Changeset 29822 in webkit


Ignore:
Timestamp:
Jan 27, 2008 12:00:29 PM (16 years ago)
Author:
mitz@apple.com
Message:

WebKitTools:

Reviewed by Darin Adler.

  • add support for directory prologues and epilogues to run-webkit-tests
  • allow setting a persistent user style sheet in DumpRenderTree
  • activate the WebKit Layout Tests font in Windows DumpRenderTree
  • DumpRenderTree/LayoutTestController.cpp: (clearPersistentUserStyleSheetCallback): Added. (setPersistentUserStyleSheetLocationCallback): Added. (LayoutTestController::staticFunctions): Added. clearPersistentUserStyleSheet and setPersistentUserStyleSheet.
  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/mac/DumpRenderTree.mm: (setPersistentUserStyleSheetLocation): Added. (resetWebViewToConsistentStateBeforeTesting): Added the user style sheet to the set of things this function resets. Now it either disables the user style sheet or sets it to the persistent user style sheet and enables it.
  • DumpRenderTree/mac/DumpRenderTreeMac.h:
  • DumpRenderTree/mac/LayoutTestControllerMac.mm: (LayoutTestController::setPersistentUserStyleSheetLocation): Added. (LayoutTestController::clearPersistentUserStyleSheet): Added.
  • DumpRenderTree/win/DumpRenderTree.cpp: (setPersistentUserStyleSheetLocation): Added. (initialize): Added the WebKit Layout Tests font to the set of fonts to install. (resetWebViewToConsistentStateBeforeTesting): See DumpRenderTree.mm.
  • DumpRenderTree/win/DumpRenderTreeWin.h:
  • DumpRenderTree/win/LayoutTestControllerWin.cpp: (LayoutTestController::setPersistentUserStyleSheetLocation): Added. (LayoutTestController::clearPersistentUserStyleSheet): Added.
  • Scripts/run-webkit-tests: Changed to look for, and if found process in DumpRenderTree, files named run-webkit-tests-prologue.html and run-webkit-tests-epilogue.html in the resources subdirectory of any test directory and platform test results directory. The prologues are processed before the first test from the directory (and its subdirectories) is run, and the epilogues are processed after the last test from the directory is run. Platform-specific prologues and epilogues are processed in order of specificity.

LayoutTests:

Reviewed by Darin Adler.

  • make some CSS2.1 tests pass on Windows by using @font-face to force font fallback to match Mac OS X.
  • platform/win/Skipped:
  • platform/win/css2.1: Added.
  • platform/win/css2.1/resources: Added.
  • platform/win/css2.1/resources/Mac-compatible-font-fallback.css: Added.
  • platform/win/css2.1/resources/run-webkit-tests-epilogue.html: Added.
  • platform/win/css2.1/resources/run-webkit-tests-prologue.html: Added.
Location:
trunk
Files:
5 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r29820 r29822  
     12008-01-27  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        - make some CSS2.1 tests pass on Windows by using @font-face to force
     6          font fallback to match Mac OS X.
     7
     8        * platform/win/Skipped:
     9        * platform/win/css2.1: Added.
     10        * platform/win/css2.1/resources: Added.
     11        * platform/win/css2.1/resources/Mac-compatible-font-fallback.css: Added.
     12        * platform/win/css2.1/resources/run-webkit-tests-epilogue.html: Added.
     13        * platform/win/css2.1/resources/run-webkit-tests-prologue.html: Added.
     14
    1152008-01-27  Darin Adler  <darin@apple.com>
    216
  • trunk/LayoutTests/platform/win/Skipped

    r29796 r29822  
    4747
    4848# Layout tests that depend on certain fonts don't match Mac results <rdar://problem/5075790>
    49 css2.1/t0905-c5525-fltblck-00-d-ag.html
    5049css2.1/t1202-counter-09-b.html
    5150css2.1/t1202-counters-09-b.html
     
    7675
    7776# No advanced text <rdar://problems/4516194>
    78 css2.1/t0805-c5518-brdr-t-01-e.html
    79 css2.1/t0805-c5519-brdr-r-00-a.html
    80 css2.1/t0805-c5519-brdr-r-01-e.html
    81 css2.1/t0805-c5520-brdr-b-01-e.html
    82 css2.1/t0805-c5521-brdr-l-00-a.html
    83 css2.1/t0805-c5521-brdr-l-01-e.html
    84 css2.1/t0805-c5521-ibrdr-l-00-a.html
    85 css2.1/t0905-c414-flt-02-c.html
    86 css2.1/t0905-c414-flt-03-c.html
    87 css2.1/t0905-c414-flt-04-c.html
    88 css2.1/t0905-c414-flt-fit-01-d-g.html
    89 css2.1/t0905-c5525-fltblck-01-d.html
    90 css2.1/t0905-c5525-fltcont-00-d-g.html
    91 css2.1/t0905-c5525-fltwidth-00-c-g.html
    92 css2.1/t0905-c5525-fltwidth-02-c-g.html
    93 css2.1/t0905-c5525-fltwidth-03-c-g.html
    94 css2.1/t0905-c5525-fltwrap-00-b.html
    95 css2.1/t1202-counter-03-b.html
    96 css2.1/t1202-counter-04-b.html
    97 css2.1/t1202-counters-03-b.html
    98 css2.1/t1202-counters-04-b.html
    99 css2.1/t1205-c566-list-stl-01-c-g.html
    100 css2.1/t090501-c414-flt-01-b.html
    101 css2.1/t090501-c414-flt-03-b-g.html
    102 css2.1/t090501-c414-flt-ln-01-d-g.html
    103 css2.1/t090501-c5525-flt-l-00-b-g.html
    104 css2.1/t090501-c5525-flt-r-00-b-g.html
    105 css2.1/t100304-c43-rpl-bbx-01-d-g.html
    10677fast/text/atsui-multiple-renderers.html
    10778fast/text/atsui-pointtooffset-calls-cg.html
  • trunk/WebKitTools/ChangeLog

    r29790 r29822  
     12008-01-27  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        - add support for directory prologues and epilogues to run-webkit-tests
     6        - allow setting a persistent user style sheet in DumpRenderTree
     7        - activate the WebKit Layout Tests font in Windows DumpRenderTree
     8
     9        * DumpRenderTree/LayoutTestController.cpp:
     10        (clearPersistentUserStyleSheetCallback): Added.
     11        (setPersistentUserStyleSheetLocationCallback): Added.
     12        (LayoutTestController::staticFunctions): Added.
     13        clearPersistentUserStyleSheet and setPersistentUserStyleSheet.
     14        * DumpRenderTree/LayoutTestController.h:
     15        * DumpRenderTree/mac/DumpRenderTree.mm:
     16        (setPersistentUserStyleSheetLocation): Added.
     17        (resetWebViewToConsistentStateBeforeTesting): Added the user style sheet
     18        to the set of things this function resets. Now it either disables the
     19        user style sheet or sets it to the persistent user style sheet and
     20        enables it.
     21        * DumpRenderTree/mac/DumpRenderTreeMac.h:
     22        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     23        (LayoutTestController::setPersistentUserStyleSheetLocation): Added.
     24        (LayoutTestController::clearPersistentUserStyleSheet): Added.
     25        * DumpRenderTree/win/DumpRenderTree.cpp:
     26        (setPersistentUserStyleSheetLocation): Added.
     27        (initialize): Added the WebKit Layout Tests font to the set of fonts to
     28        install.
     29        (resetWebViewToConsistentStateBeforeTesting): See DumpRenderTree.mm.
     30        * DumpRenderTree/win/DumpRenderTreeWin.h:
     31        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     32        (LayoutTestController::setPersistentUserStyleSheetLocation): Added.
     33        (LayoutTestController::clearPersistentUserStyleSheet): Added.
     34        * Scripts/run-webkit-tests: Changed to look for, and if found process in
     35        DumpRenderTree, files named run-webkit-tests-prologue.html and
     36        run-webkit-tests-epilogue.html in the resources subdirectory of any
     37        test directory and platform test results directory. The prologues are
     38        processed before the first test from the directory (and its
     39        subdirectories) is run, and the epilogues are processed after the last
     40        test from the directory is run. Platform-specific prologues and
     41        epilogues are processed in order of specificity.
     42
    1432008-01-25  Alexey Proskuryakov  <ap@webkit.org>
    244
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r29663 r29822  
    225225}
    226226
     227static JSValueRef clearPersistentUserStyleSheetCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     228{
     229    // Has mac & windows implementation
     230    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     231    controller->clearPersistentUserStyleSheet();
     232
     233    return JSValueMakeUndefined(context);
     234}
     235
    227236static JSValueRef decodeHostNameCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    228237{
     
    432441    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
    433442    controller->setMainFrameIsFirstResponder(JSValueToBoolean(context, arguments[0]));
     443
     444    return JSValueMakeUndefined(context);
     445}
     446
     447static JSValueRef setPersistentUserStyleSheetLocationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     448{
     449    // Has mac implementation
     450    if (argumentCount < 1)
     451        return JSValueMakeUndefined(context);
     452
     453    JSRetainPtr<JSStringRef> path(Adopt, JSValueToStringCopy(context, arguments[0], exception));
     454    ASSERT(!*exception);
     455
     456    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     457    controller->setPersistentUserStyleSheetLocation(path.get());
    434458
    435459    return JSValueMakeUndefined(context);
     
    599623        { "addFileToPasteboardOnDrag", addFileToPasteboardOnDragCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    600624        { "clearBackForwardList", clearBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     625        { "clearPersistentUserStyleSheet", clearPersistentUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    601626        { "decodeHostName", decodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    602627        { "display", displayCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     
    630655        { "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    631656        { "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     657        { "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    632658        { "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    633659        { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r29663 r29822  
    6464    void setUserStyleSheetEnabled(bool flag);
    6565    void setUserStyleSheetLocation(JSStringRef path);
     66    void setPersistentUserStyleSheetLocation(JSStringRef path);
     67    void clearPersistentUserStyleSheet();
    6668    int windowCount();
    6769
  • trunk/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm

    r29380 r29822  
    6969#import <objc/objc-runtime.h>
    7070#import <wtf/Assertions.h>
     71#import <wtf/RetainPtr.h>
    7172
    7273@interface DumpRenderTreeEvent : NSEvent
     
    113114static BOOL printSeparators;
    114115static NSString *currentTest = nil;
     116static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
    115117
    116118static WebHistoryItem *prevTestBFItem = nil;  // current b/f item at the end of the previous test
     
    119121const unsigned maxViewWidth = 800;
    120122
     123void setPersistentUserStyleSheetLocation(CFStringRef url)
     124{
     125    persistentUserStyleSheetLocation = url;
     126}
    121127
    122128static BOOL shouldIgnoreWebCoreNodeLeaks(CFStringRef URLString)
     
    804810    [preferences setJavaScriptCanOpenWindowsAutomatically:YES];
    805811
     812    if (persistentUserStyleSheetLocation) {
     813        [preferences setUserStyleSheetLocation:[NSURL URLWithString:(NSString *)(persistentUserStyleSheetLocation.get())]];
     814        [preferences setUserStyleSheetEnabled:YES];
     815    } else
     816        [preferences setUserStyleSheetEnabled:NO];
     817
    806818    [WebView _setUsesTestModeFocusRingColor:YES];
    807819}
  • trunk/WebKitTools/DumpRenderTree/mac/DumpRenderTreeMac.h

    r29663 r29822  
    3939@class WebView;
    4040
     41typedef const struct __CFString* CFStringRef;
     42
    4143extern CFMutableArrayRef openWindowsRef;
    4244extern CFMutableSetRef disallowedURLs;
     
    5153
    5254WebView* createWebViewAndOffscreenWindow();
     55void setPersistentUserStyleSheetLocation(CFStringRef);
    5356
    5457#endif // DumpRenderTreeMac_h
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r29663 r29822  
    214214}
    215215
     216void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL)
     217{
     218    RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL));
     219    ::setPersistentUserStyleSheetLocation(urlString.get());
     220}
     221
     222void LayoutTestController::clearPersistentUserStyleSheet()
     223{
     224    ::setPersistentUserStyleSheetLocation(0);
     225}
     226
    216227void LayoutTestController::setWindowIsKey(bool windowIsKey)
    217228{
  • trunk/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp

    r29790 r29822  
    3838#include "WorkQueueItem.h"
    3939#include "WorkQueue.h"
     40#include <wtf/RetainPtr.h>
    4041#include <wtf/Vector.h>
    4142#include <WebCore/COMPtr.h>
     
    8182static bool timedOut = false;
    8283static bool threaded = false;
     84static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
    8385
    8486static const char* currentTest;
     
    108110const unsigned maxViewWidth = 800;
    109111const unsigned maxViewHeight = 600;
     112
     113void setPersistentUserStyleSheetLocation(CFStringRef url)
     114{
     115    persistentUserStyleSheetLocation = url;
     116}
    110117
    111118wstring urlSuitableForTestResult(const wstring& url)
     
    223230        TEXT("Times Bold.ttf"),
    224231        TEXT("Times Italic.ttf"),
    225         TEXT("Times Roman.ttf")
     232        TEXT("Times Roman.ttf"),
     233        TEXT("WebKit Layout Tests.ttf")
    226234    };
    227235
     
    635643        preferences->setPrivateBrowsingEnabled(FALSE);
    636644        preferences->setJavaScriptCanOpenWindowsAutomatically(TRUE);
     645
     646        if (persistentUserStyleSheetLocation) {
     647            Vector<wchar_t> urlCharacters(CFStringGetLength(persistentUserStyleSheetLocation.get()));
     648            CFStringGetCharacters(persistentUserStyleSheetLocation.get(), CFRangeMake(0, CFStringGetLength(persistentUserStyleSheetLocation.get())), (UniChar *)urlCharacters.data());
     649            BSTR url = SysAllocStringLen(urlCharacters.data(), urlCharacters.size());
     650            preferences->setUserStyleSheetLocation(url);
     651            SysFreeString(url);
     652            preferences->setUserStyleSheetEnabled(TRUE);
     653        } else
     654            preferences->setUserStyleSheetEnabled(FALSE);
     655
    637656        COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
    638657        if (prefsPrivate)
  • trunk/WebKitTools/DumpRenderTree/win/DumpRenderTreeWin.h

    r29450 r29822  
    5252struct IWebPolicyDelegate;
    5353struct IWebView;
     54typedef const struct __CFString* CFStringRef;
    5455typedef struct HWND__* HWND;
    5556
     
    6970HashMap<HWND, IWebView*>& windowToWebViewMap();
    7071
     72void setPersistentUserStyleSheetLocation(CFStringRef);
     73
    7174#endif // DumpRenderTreeWin_h
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r29495 r29822  
    482482}
    483483
     484void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL)
     485{
     486    RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL));
     487    ::setPersistentUserStyleSheetLocation(urlString.get());
     488}
     489
     490void LayoutTestController::clearPersistentUserStyleSheet()
     491{
     492    ::setPersistentUserStyleSheetLocation(0);
     493}
     494
    484495void LayoutTestController::setWindowIsKey(bool flag)
    485496{
  • trunk/WebKitTools/Scripts/run-webkit-tests

    r29674 r29822  
    9191sub recordActualResultsAndDiff($$);
    9292sub buildPlatformHierarchy();
     93sub epiloguesAndPrologues($$);
    9394
    9495# Argument handling
     
    467468    next if $test eq 'results.html';
    468469
     470    my $newDumpTool = not $isDumpToolOpen;
    469471    openDumpTool();
    470472
    471473    my $base = stripExtension($test);
    472474   
     475    my $dir = $base;
     476    $dir =~ s|/[^/]+$||;
     477
     478    if ($newDumpTool || $dir ne $lastDirectory) {
     479        foreach my $logue (epiloguesAndPrologues($newDumpTool ? "" : $lastDirectory, $dir)) {
     480            if (isCygwin()) {
     481                $logue = toWindowsPath($logue);
     482            } else {
     483                $logue = canonpath($logue);
     484            }
     485            if ($verbose) {
     486                print "running epilogue or prologue $logue\n";
     487            }
     488            print OUT "$logue\n";
     489            # Discard the output.
     490            while (<IN>) {
     491                last if /#EOF/;
     492            }
     493        }
     494    }
     495
    473496    if ($verbose) {
    474497        print "running $test -> ";
    475498        $atLineStart = 0;
    476499    } elsif (!$quiet) {
    477         my $dir = $base;
    478         $dir =~ s|/[^/]+$||;
    479500        if ($dir ne $lastDirectory) {
    480501            print "\n" unless $atLineStart;
    481502            print "$dir ";
    482             $lastDirectory = $dir;
    483503        }
    484504        print ".";
    485505        $atLineStart = 0;
    486506    }
     507
     508    $lastDirectory = $dir;
    487509
    488510    my $result;
     
    15261548    return @hierarchy;
    15271549}
     1550
     1551sub epiloguesAndPrologues($$) {
     1552    my ($lastDirectory, $directory) = @_;
     1553    my @lastComponents = split('/', $lastDirectory);
     1554    my @components = split('/', $directory);
     1555
     1556    while (@lastComponents) {
     1557        if ($lastComponents[0] ne $components[0]) {
     1558            last;
     1559        }
     1560        shift @components;
     1561        shift @lastComponents;
     1562    }
     1563
     1564    my @result;
     1565    my $leaving = $lastDirectory;
     1566    foreach (@lastComponents) {
     1567        my $epilogue = $leaving . "/resources/run-webkit-tests-epilogue.html";
     1568        foreach (@platformHierarchy) {
     1569            push @result, catdir($_, $epilogue) if (stat(catdir($_, $epilogue)));
     1570        }
     1571        push @result, catdir($testDirectory, $epilogue) if (stat(catdir($testDirectory, $epilogue)));
     1572        $leaving =~ s|(^\|/)[^/]+$||;
     1573    }
     1574
     1575    my $entering = $leaving;
     1576    foreach (@components) {
     1577        $entering .= '/' . $_;
     1578        my $prologue = $entering . "/resources/run-webkit-tests-prologue.html";
     1579        push @result, catdir($testDirectory, $prologue) if (stat(catdir($testDirectory, $prologue)));
     1580        foreach (reverse @platformHierarchy) {
     1581            push @result, catdir($_, $prologue) if (stat(catdir($_, $prologue)));
     1582        }
     1583    }
     1584    return @result;
     1585}
Note: See TracChangeset for help on using the changeset viewer.