⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 268795 in webkit


Ignore:
Timestamp:
Oct 21, 2020, 8:04:20 AM (6 years ago)
Author:
weinig@apple.com
Message:

Cleanup DumpRenderTree in preparation for supporting arbitrary test header commands
https://bugs.webkit.org/show_bug.cgi?id=217962

Reviewed by Darin Adler.

  • Moves DumpRenderTree's TestOptions to be fully backed by TestFeatures like WebKitTestRunnner, allowing future changes to utilize any WebPreference once SPI is available from WebKitLegacy.
  • Removes use of using namespace std; from DumpRenderTree.mm, which is not something we normally do and made the code a bit confusing.
  • Move some random setting of preferences to centralized reset functions.
  • DumpRenderTree/TestOptions.cpp:
  • DumpRenderTree/TestOptions.h:
  • DumpRenderTree/mac/DumpRenderTree.mm:
  • DumpRenderTree/mac/TestRunnerMac.mm:
  • DumpRenderTree/mac/UIDelegate.mm:
  • DumpRenderTree/win/DumpRenderTree.cpp:
Location:
trunk/Tools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r268793 r268795  
     12020-10-20  Sam Weinig  <weinig@apple.com>
     2
     3        Cleanup DumpRenderTree in preparation for supporting arbitrary test header commands
     4        https://bugs.webkit.org/show_bug.cgi?id=217962
     5
     6        Reviewed by Darin Adler.
     7
     8        - Moves DumpRenderTree's TestOptions to be fully backed by TestFeatures like WebKitTestRunnner,
     9          allowing future changes to utilize any WebPreference once SPI is available from WebKitLegacy.
     10
     11        - Removes use of using namespace std; from DumpRenderTree.mm, which is not something we normally
     12          do and made the code a bit confusing.
     13
     14        - Move some random setting of preferences to centralized reset functions.
     15
     16        * DumpRenderTree/TestOptions.cpp:
     17        * DumpRenderTree/TestOptions.h:
     18        * DumpRenderTree/mac/DumpRenderTree.mm:
     19        * DumpRenderTree/mac/TestRunnerMac.mm:
     20        * DumpRenderTree/mac/UIDelegate.mm:
     21        * DumpRenderTree/win/DumpRenderTree.cpp:
     22
    1232020-10-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    224
  • trunk/Tools/DumpRenderTree/TestOptions.cpp

    r268705 r268795  
    3131namespace WTR {
    3232
     33const TestFeatures& TestOptions::defaults()
     34{
     35    static TestFeatures features;
     36    if (features.boolWebPreferenceFeatures.empty()) {
     37        features.boolWebPreferenceFeatures = {
     38            // These are WebPreference values that must always be set as they may
     39            // differ from the default set in the WebPreferences*.yaml configuration.
     40            { "AllowCrossOriginSubresourcesToAskForCredentials", false },
     41            { "AllowTopNavigationToDataURLs", true },
     42            { "AcceleratedDrawingEnabled", false },
     43            { "AttachmentElementEnabled", false },
     44            { "UsesBackForwardCache", false },
     45            { "ColorFilterEnabled", false },
     46            { "InspectorAdditionsEnabled", false },
     47            { "IntersectionObserverEnabled", false },
     48            { "KeygenElementEnabled", false },
     49            { "MenuItemElementEnabled", false },
     50            { "ModernMediaControlsEnabled", true },
     51
     52            { "CSSLogicalEnabled", false },
     53            { "LineHeightUnitsEnabled", false },
     54            { "SelectionAcrossShadowBoundariesEnabled", true },
     55            { "LayoutFormattingContextIntegrationEnabled", true },
     56
     57            { "AdClickAttributionEnabled", false },
     58            { "AspectRatioOfImgFromWidthAndHeightEnabled", false },
     59            { "AsyncClipboardAPIEnabled", false },
     60            { "CSSOMViewSmoothScrollingEnabled", false },
     61            { "ContactPickerAPIEnabled", false },
     62            { "CoreMathMLEnabled", false },
     63            { "RequestIdleCallbackEnabled", false },
     64            { "ResizeObserverEnabled", false },
     65            { "WebGPUEnabled", false },
     66        };
     67    }
     68    return features;
     69}
     70
    3371const std::unordered_map<std::string, TestHeaderKeyType>& TestOptions::keyTypeMapping()
    3472{
     
    4886}
    4987
    50 template<typename T> static void setValueIfSetInMap(T& valueToSet, std::string key, const std::unordered_map<std::string, T>& map)
     88bool TestOptions::webViewIsCompatibleWithOptions(const TestOptions& options) const
     89{
     90    if (m_features.experimentalFeatures != options.m_features.experimentalFeatures)
     91        return false;
     92    if (m_features.internalDebugFeatures != options.m_features.internalDebugFeatures)
     93        return false;
     94    if (m_features.boolWebPreferenceFeatures != options.m_features.boolWebPreferenceFeatures)
     95        return false;
     96    if (m_features.doubleWebPreferenceFeatures != options.m_features.doubleWebPreferenceFeatures)
     97        return false;
     98    if (m_features.uint32WebPreferenceFeatures != options.m_features.uint32WebPreferenceFeatures)
     99        return false;
     100    if (m_features.stringWebPreferenceFeatures != options.m_features.stringWebPreferenceFeatures)
     101        return false;
     102    if (m_features.boolTestRunnerFeatures != options.m_features.boolTestRunnerFeatures)
     103        return false;
     104    if (m_features.doubleTestRunnerFeatures != options.m_features.doubleTestRunnerFeatures)
     105        return false;
     106    if (m_features.stringTestRunnerFeatures != options.m_features.stringTestRunnerFeatures)
     107        return false;
     108    if (m_features.stringVectorTestRunnerFeatures != options.m_features.stringVectorTestRunnerFeatures)
     109        return false;
     110    return true;
     111}
     112
     113template<typename T> T featureValue(std::string key, T defaultValue, const std::unordered_map<std::string, T>& map)
    51114{
    52115    auto it = map.find(key);
    53     if (it == map.end())
    54         return;
    55     valueToSet = it->second;
     116    if (it != map.end())
     117        return it->second;
     118    return defaultValue;
    56119}
    57120
    58 TestOptions::TestOptions(TestFeatures testFeatures)
     121bool TestOptions::boolTestRunnerFeatureValue(std::string key, bool defaultValue) const
    59122{
    60     setValueIfSetInMap(allowCrossOriginSubresourcesToAskForCredentials, "AllowCrossOriginSubresourcesToAskForCredentials", testFeatures.boolWebPreferenceFeatures);
    61     setValueIfSetInMap(allowTopNavigationToDataURLs, "AllowTopNavigationToDataURLs", testFeatures.boolWebPreferenceFeatures);
    62     setValueIfSetInMap(enableAcceleratedDrawing, "AcceleratedDrawingEnabled", testFeatures.boolWebPreferenceFeatures);
    63     setValueIfSetInMap(enableAttachmentElement, "AttachmentElementEnabled", testFeatures.boolWebPreferenceFeatures);
    64     setValueIfSetInMap(enableBackForwardCache, "UsesBackForwardCache", testFeatures.boolWebPreferenceFeatures);
    65     setValueIfSetInMap(enableColorFilter, "ColorFilterEnabled", testFeatures.boolWebPreferenceFeatures);
    66     setValueIfSetInMap(enableInspectorAdditions, "InspectorAdditionsEnabled", testFeatures.boolWebPreferenceFeatures);
    67     setValueIfSetInMap(enableIntersectionObserver, "IntersectionObserverEnabled", testFeatures.boolWebPreferenceFeatures);
    68     setValueIfSetInMap(enableKeygenElement, "KeygenElementEnabled", testFeatures.boolWebPreferenceFeatures);
    69     setValueIfSetInMap(enableMenuItemElement, "MenuItemElementEnabled", testFeatures.boolWebPreferenceFeatures);
    70     setValueIfSetInMap(enableModernMediaControls, "ModernMediaControlsEnabled", testFeatures.boolWebPreferenceFeatures);
    71 
    72     setValueIfSetInMap(enableDragDestinationActionLoad, "enableDragDestinationActionLoad", testFeatures.boolTestRunnerFeatures);
    73     setValueIfSetInMap(dumpJSConsoleLogInStdErr, "dumpJSConsoleLogInStdErr", testFeatures.boolTestRunnerFeatures);
    74     setValueIfSetInMap(layerBackedWebView, "layerBackedWebView", testFeatures.boolTestRunnerFeatures);
    75     setValueIfSetInMap(useEphemeralSession, "useEphemeralSession", testFeatures.boolTestRunnerFeatures);
    76 
    77     setValueIfSetInMap(additionalSupportedImageTypes, "additionalSupportedImageTypes", testFeatures.stringTestRunnerFeatures);
    78     setValueIfSetInMap(jscOptions, "jscOptions", testFeatures.stringTestRunnerFeatures);
    79 
    80     setValueIfSetInMap(enableCSSLogical, "CSSLogicalEnabled", testFeatures.internalDebugFeatures);
    81     setValueIfSetInMap(enableLineHeightUnits, "LineHeightUnitsEnabled", testFeatures.internalDebugFeatures);
    82     setValueIfSetInMap(enableSelectionAcrossShadowBoundaries, "selectionAcrossShadowBoundariesEnabled", testFeatures.internalDebugFeatures);
    83     setValueIfSetInMap(layoutFormattingContextIntegrationEnabled, "LayoutFormattingContextIntegrationEnabled", testFeatures.internalDebugFeatures);
    84 
    85     setValueIfSetInMap(adClickAttributionEnabled, "AdClickAttributionEnabled", testFeatures.experimentalFeatures);
    86     setValueIfSetInMap(enableAspectRatioOfImgFromWidthAndHeight, "AspectRatioOfImgFromWidthAndHeightEnabled", testFeatures.experimentalFeatures);
    87     setValueIfSetInMap(enableAsyncClipboardAPI, "AsyncClipboardAPIEnabled", testFeatures.experimentalFeatures);
    88     setValueIfSetInMap(enableCSSOMViewSmoothScrolling, "CSSOMViewSmoothScrollingEnabled", testFeatures.experimentalFeatures);
    89     setValueIfSetInMap(enableContactPickerAPI, "ContactPickerAPIEnabled", testFeatures.experimentalFeatures);
    90     setValueIfSetInMap(enableCoreMathML, "CoreMathMLEnabled", testFeatures.experimentalFeatures);
    91     setValueIfSetInMap(enableRequestIdleCallback, "RequestIdleCallbackEnabled", testFeatures.experimentalFeatures);
    92     setValueIfSetInMap(enableResizeObserver, "ResizeObserverEnabled", testFeatures.experimentalFeatures);
    93     setValueIfSetInMap(enableWebGPU, "WebGPUEnabled", testFeatures.experimentalFeatures);
     123    return featureValue(key, defaultValue, m_features.boolTestRunnerFeatures);
    94124}
    95125
    96 bool TestOptions::webViewIsCompatibleWithOptions(const TestOptions& other) const
     126std::string TestOptions::stringTestRunnerFeatureValue(std::string key, std::string defaultValue) const
    97127{
    98     return other.layerBackedWebView == layerBackedWebView
    99         && other.jscOptions == jscOptions;
     128    return featureValue(key, defaultValue, m_features.stringTestRunnerFeatures);
    100129}
    101130
  • trunk/Tools/DumpRenderTree/TestOptions.h

    r268705 r268795  
    3232namespace WTR {
    3333
    34 struct TestOptions {
    35     // FIXME: Remove these and replace with access to TestFeatures set.
    36     // Web Preferences
    37     bool allowCrossOriginSubresourcesToAskForCredentials { false };
    38     bool allowTopNavigationToDataURLs { true };
    39     bool enableAcceleratedDrawing { false };
    40     bool enableAttachmentElement { false };
    41     bool enableBackForwardCache { false };
    42     bool enableColorFilter { false };
    43     bool enableInspectorAdditions { false };
    44     bool enableIntersectionObserver { false };
    45     bool enableKeygenElement { false };
    46     bool enableMenuItemElement { false };
    47     bool enableModernMediaControls { true };
     34class TestOptions {
     35public:
     36    static const TestFeatures& defaults();
     37    static const std::unordered_map<std::string, TestHeaderKeyType>& keyTypeMapping();
    4838
    49     // FIXME: Remove these and replace with access to TestFeatures set.
    50     // Internal Features
    51     bool enableCSSLogical { false };
    52     bool enableLineHeightUnits { false };
    53     bool enableSelectionAcrossShadowBoundaries { true };
    54     bool layoutFormattingContextIntegrationEnabled { true };
     39    explicit TestOptions(TestFeatures features)
     40        : m_features(std::move(features))
     41    {
     42    }
    5543
    56     // FIXME: Remove these and replace with access to TestFeatures set.
    57     // Experimental Features
    58     bool adClickAttributionEnabled { false };
    59     bool enableAspectRatioOfImgFromWidthAndHeight { false };
    60     bool enableAsyncClipboardAPI { false };
    61     bool enableCSSOMViewSmoothScrolling { false };
    62     bool enableContactPickerAPI { false };
    63     bool enableCoreMathML { false };
    64     bool enableRequestIdleCallback { false };
    65     bool enableResizeObserver { false };
    66     bool enableWebGPU { false };
     44    bool webViewIsCompatibleWithOptions(const TestOptions&) const;
    6745
    68     // Test Runner Specific Features
    69     bool dumpJSConsoleLogInStdErr { false };
    70     bool enableDragDestinationActionLoad { false };
    71     bool enableWebSQL { true };
    72     bool layerBackedWebView { false };
    73     bool useEphemeralSession { false };
    74     std::string additionalSupportedImageTypes;
    75     std::string jscOptions;
     46    // Test-Runner-Specific Features
     47    bool dumpJSConsoleLogInStdErr() const { return boolTestRunnerFeatureValue("dumpJSConsoleLogInStdErr", false); }
     48    bool enableDragDestinationActionLoad() const { return boolTestRunnerFeatureValue("enableDragDestinationActionLoad", false); }
     49    bool layerBackedWebView() const { return boolTestRunnerFeatureValue("layerBackedWebView", false); }
     50    bool useEphemeralSession() const { return boolTestRunnerFeatureValue("useEphemeralSession", false); }
     51    std::string additionalSupportedImageTypes() const { return stringTestRunnerFeatureValue("additionalSupportedImageTypes", { }); }
     52    std::string jscOptions() const { return stringTestRunnerFeatureValue("jscOptions", { }); }
    7653
    77     explicit TestOptions(TestFeatures);
    78     bool webViewIsCompatibleWithOptions(const TestOptions&) const;
    79    
    80     static const std::unordered_map<std::string, TestHeaderKeyType>& keyTypeMapping();
     54    const auto& boolWebPreferenceFeatures() const { return m_features.boolWebPreferenceFeatures; }
     55    const auto& doubleWebPreferenceFeatures() const { return m_features.doubleWebPreferenceFeatures; }
     56    const auto& uint32WebPreferenceFeatures() const { return m_features.uint32WebPreferenceFeatures; }
     57    const auto& stringWebPreferenceFeatures() const { return m_features.stringWebPreferenceFeatures; }
     58
     59    static std::string toWebKitLegacyPreferenceKey(const std::string&);
     60
     61private:
     62    bool boolTestRunnerFeatureValue(std::string key, bool defaultValue) const;
     63    std::string stringTestRunnerFeatureValue(std::string key, std::string defaultValue) const;
     64
     65    TestFeatures m_features;
    8166};
    8267
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r268762 r268795  
    131131}
    132132
    133 using namespace std;
    134 
    135133#if !PLATFORM(IOS_FAMILY)
    136134@interface DumpRenderTreeApplication : NSApplication
     
    153151    const CGSize scrollViewSize = [scrollView bounds].size;
    154152    CGSize contentSize = newFrame.size;
    155     contentSize.height = CGRound(max(CGRectGetMaxY(newFrame), scrollViewSize.height));
     153    contentSize.height = CGRound(std::max(CGRectGetMaxY(newFrame), scrollViewSize.height));
    156154    [(UIWebScrollView *)scrollView setContentSize:contentSize];
    157155}
     
    179177#endif
    180178
    181 static void runTest(const string& testURL);
     179static void runTest(const std::string& testURL);
    182180
    183181// Deciding when it's OK to dump out the state is a bit tricky.  All these must be true:
     
    250248}
    251249
    252 static bool shouldIgnoreWebCoreNodeLeaks(const string& urlString)
     250static bool shouldIgnoreWebCoreNodeLeaks(const std::string& urlString)
    253251{
    254252    static char* const ignoreSet[] = {
     
    259257    for (int i = 0; i < ignoreSetCount; i++) {
    260258        // FIXME: ignore case
    261         string curIgnore(ignoreSet[i]);
     259        std::string curIgnore(ignoreSet[i]);
    262260        // Match at the end of the urlString.
    263261        if (!urlString.compare(urlString.length() - curIgnore.length(), curIgnore.length(), curIgnore))
     
    617615    CGFloat trackLength = isHorizontal ? bounds.size.width : bounds.size.height;
    618616    CGFloat minKnobSize = isHorizontal ? bounds.size.height : bounds.size.width;
    619     CGFloat knobLength = max(minKnobSize, static_cast<CGFloat>(round(trackLength * [self knobProportion])));
    620     CGFloat knobPosition = static_cast<CGFloat>((round([self doubleValue] * (trackLength - knobLength))));
     617    CGFloat knobLength = std::max(minKnobSize, static_cast<CGFloat>(std::round(trackLength * [self knobProportion])));
     618    CGFloat knobPosition = static_cast<CGFloat>((std::round([self doubleValue] * (trackLength - knobLength))));
    621619
    622620    if (isHorizontal)
     
    686684    [WebView registerURLSchemeAsLocal:@"feeds"];
    687685    [WebView registerURLSchemeAsLocal:@"feedsearch"];
    688 
    689     [[webView preferences] _setMediaRecorderEnabled:YES];
    690686
    691687#if PLATFORM(MAC)
     
    758754    [webView cacheDisplayInRect:[webView bounds] toBitmapImageRep:imageRep];
    759755#else
    760     [[webView preferences] _setTelephoneNumberParsingEnabled:NO];
    761 
    762756    // Initialize the global UIViews, and set the key UIWindow to be painted.
    763757    if (!gWebBrowserView) {
     
    828822    [preferences setWritableStreamAPIEnabled:YES];
    829823    [preferences setTransformStreamAPIEnabled:YES];
    830     preferences.encryptedMediaAPIEnabled = YES;
     824    [preferences setEncryptedMediaAPIEnabled:YES];
    831825    [preferences setAccessibilityObjectModelEnabled:YES];
    832826    [preferences setAriaReflectionEnabled:YES];
     
    835829    [preferences setServerTimingEnabled:YES];
    836830    [preferences setIntersectionObserverEnabled:YES];
    837     preferences.sourceBufferChangeTypeEnabled = YES;
     831    [preferences setSourceBufferChangeTypeEnabled:YES];
    838832    [preferences setCSSOMViewScrollingAPIEnabled:YES];
    839833    [preferences setMediaRecorderEnabled:YES];
     
    852846
    853847// Called before each test.
    854 static void resetWebPreferencesToConsistentValues()
    855 {
    856     WebPreferences *preferences = [WebPreferences standardPreferences];
     848static void resetWebPreferencesToConsistentValues(WebPreferences *preferences)
     849{
    857850    enableExperimentalFeatures(preferences);
    858851
     
    922915    // cause initialization to use the correct database paths.
    923916    [preferences setStorageTrackerEnabled:YES];
     917    [preferences _setTelephoneNumberParsingEnabled:NO];
    924918#endif
    925919
     
    937931    [preferences setAsynchronousSpellCheckingEnabled:NO];
    938932#if !PLATFORM(IOS_FAMILY)
    939     ASSERT([preferences mockScrollbarsEnabled]);
     933    [preferences setMockScrollbarsEnabled:YES];
    940934#endif
    941935
     
    965959
    966960    [preferences setCacheAPIEnabled:NO];
    967     preferences.mediaCapabilitiesEnabled = YES;
    968 
    969     preferences.selectionAcrossShadowBoundariesEnabled = YES;
     961    [preferences setMediaCapabilitiesEnabled:YES];
     962
     963    [preferences setSelectionAcrossShadowBoundariesEnabled:YES];
    970964
    971965    [preferences setWebSQLEnabled:YES];
     966    [preferences _setMediaRecorderEnabled:YES];
    972967
    973968    [WebPreferences _clearNetworkLoaderSession];
     
    975970}
    976971
    977 static void setWebPreferencesForTestOptions(const WTR::TestOptions& options)
    978 {
    979     WebPreferences *preferences = [WebPreferences standardPreferences];
    980 
    981     preferences.attachmentElementEnabled = options.enableAttachmentElement;
    982     preferences.acceleratedDrawingEnabled = options.enableAcceleratedDrawing;
    983     preferences.menuItemElementEnabled = options.enableMenuItemElement;
    984     preferences.keygenElementEnabled = options.enableKeygenElement;
    985     preferences.modernMediaControlsEnabled = options.enableModernMediaControls;
    986     preferences.inspectorAdditionsEnabled = options.enableInspectorAdditions;
    987     preferences.allowCrossOriginSubresourcesToAskForCredentials = options.allowCrossOriginSubresourcesToAskForCredentials;
    988     preferences.colorFilterEnabled = options.enableColorFilter;
    989     preferences.selectionAcrossShadowBoundariesEnabled = options.enableSelectionAcrossShadowBoundaries;
    990     preferences.webGPUEnabled = options.enableWebGPU;
    991     preferences.CSSLogicalEnabled = options.enableCSSLogical;
    992     preferences.lineHeightUnitsEnabled = options.enableLineHeightUnits;
    993     preferences.adClickAttributionEnabled = options.adClickAttributionEnabled;
    994     preferences.resizeObserverEnabled = options.enableResizeObserver;
    995     preferences.CSSOMViewSmoothScrollingEnabled = options.enableCSSOMViewSmoothScrolling;
    996     preferences.coreMathMLEnabled = options.enableCoreMathML;
    997     preferences.requestIdleCallbackEnabled = options.enableRequestIdleCallback;
    998     preferences.asyncClipboardAPIEnabled = options.enableAsyncClipboardAPI;
    999     preferences.privateBrowsingEnabled = options.useEphemeralSession;
    1000     preferences.usesPageCache = options.enableBackForwardCache;
    1001     preferences.layoutFormattingContextIntegrationEnabled = options.layoutFormattingContextIntegrationEnabled;
    1002     preferences.aspectRatioOfImgFromWidthAndHeightEnabled = options.enableAspectRatioOfImgFromWidthAndHeight;
    1003     preferences.allowTopNavigationToDataURLs = options.allowTopNavigationToDataURLs;
    1004     preferences.contactPickerAPIEnabled = options.enableContactPickerAPI;
     972static bool boolWebPreferenceFeatureValue(std::string key, bool defaultValue, const WTR::TestOptions& options)
     973{
     974    auto it = options.boolWebPreferenceFeatures().find(key);
     975    if (it != options.boolWebPreferenceFeatures().end())
     976        return it->second;
     977    return defaultValue;
     978}
     979
     980static void setWebPreferencesForTestOptions(WebPreferences *preferences, const WTR::TestOptions& options)
     981{
     982    preferences.privateBrowsingEnabled = options.useEphemeralSession();
     983
     984    preferences.attachmentElementEnabled = boolWebPreferenceFeatureValue("AttachmentElementEnabled", false, options);
     985    preferences.acceleratedDrawingEnabled = boolWebPreferenceFeatureValue("AcceleratedDrawingEnabled", false, options);
     986    preferences.menuItemElementEnabled = boolWebPreferenceFeatureValue("MenuItemElementEnabled", false, options);
     987    preferences.keygenElementEnabled = boolWebPreferenceFeatureValue("KeygenElementEnabled", false, options);
     988    preferences.modernMediaControlsEnabled = boolWebPreferenceFeatureValue("ModernMediaControlsEnabled", true, options);
     989    preferences.inspectorAdditionsEnabled = boolWebPreferenceFeatureValue("InspectorAdditionsEnabled", false, options);
     990    preferences.allowCrossOriginSubresourcesToAskForCredentials = boolWebPreferenceFeatureValue("AllowCrossOriginSubresourcesToAskForCredentials", false, options);
     991    preferences.colorFilterEnabled = boolWebPreferenceFeatureValue("ColorFilterEnabled", false, options);
     992    preferences.selectionAcrossShadowBoundariesEnabled = boolWebPreferenceFeatureValue("SelectionAcrossShadowBoundariesEnabled", true, options);
     993    preferences.webGPUEnabled = boolWebPreferenceFeatureValue("WebGPUEnabled", false, options);
     994    preferences.CSSLogicalEnabled = boolWebPreferenceFeatureValue("CSSLogicalEnabled", false, options);
     995    preferences.lineHeightUnitsEnabled = boolWebPreferenceFeatureValue("LineHeightUnitsEnabled", false, options);
     996    preferences.adClickAttributionEnabled = boolWebPreferenceFeatureValue("AdClickAttributionEnabled", false, options);
     997    preferences.resizeObserverEnabled = boolWebPreferenceFeatureValue("ResizeObserverEnabled", false, options);
     998    preferences.CSSOMViewSmoothScrollingEnabled = boolWebPreferenceFeatureValue("CSSOMViewSmoothScrollingEnabled", false, options);
     999    preferences.coreMathMLEnabled = boolWebPreferenceFeatureValue("CoreMathMLEnabled", false, options);
     1000    preferences.requestIdleCallbackEnabled = boolWebPreferenceFeatureValue("RequestIdleCallbackEnabled", false, options);
     1001    preferences.asyncClipboardAPIEnabled = boolWebPreferenceFeatureValue("AsyncClipboardAPIEnabled", false, options);
     1002    preferences.usesPageCache = boolWebPreferenceFeatureValue("UsesBackForwardCache", false, options);
     1003    preferences.layoutFormattingContextIntegrationEnabled = boolWebPreferenceFeatureValue("LayoutFormattingContextIntegrationEnabled", true, options);
     1004    preferences.aspectRatioOfImgFromWidthAndHeightEnabled = boolWebPreferenceFeatureValue("AspectRatioOfImgFromWidthAndHeightEnabled", false, options);
     1005    preferences.allowTopNavigationToDataURLs = boolWebPreferenceFeatureValue("AllowTopNavigationToDataURLs", true, options);
     1006    preferences.contactPickerAPIEnabled = boolWebPreferenceFeatureValue("ContactPickerAPIEnabled", false, options);
    10051007}
    10061008
     
    14391441static NSData *dumpAudio()
    14401442{
    1441     const vector<char>& dataVector = gTestRunner->audioResult();
     1443    const auto& dataVector = gTestRunner->audioResult();
    14421444
    14431445    NSData *data = [NSData dataWithBytes:dataVector.data() length:dataVector.size()];
     
    16351637
    16361638    // W3C SVG tests expect to be 480x360
    1637     bool isSVGW3CTest = (gTestRunner->testURL().find("svg/W3C-SVG-1.1") != string::npos);
     1639    bool isSVGW3CTest = (gTestRunner->testURL().find("svg/W3C-SVG-1.1") != std::string::npos);
    16381640    NSSize frameSize = isSVGW3CTest ? NSMakeSize(TestRunner::w3cSVGViewWidth, TestRunner::w3cSVGViewHeight) : NSMakeSize(TestRunner::viewWidth, TestRunner::viewHeight);
    16391641    [[mainFrame webView] setFrameSize:frameSize];
     
    18341836    }
    18351837
    1836     if (options.jscOptions.length()) {
     1838    if (options.jscOptions().length()) {
    18371839        JSC::Options::dumpAllOptionsInALine(savedOptions);
    1838         JSC::Options::setOptions(options.jscOptions.c_str());
     1840        JSC::Options::setOptions(options.jscOptions().c_str());
    18391841    }
    18401842}
     
    18751877    [WebCache clearCachedCredentials];
    18761878
    1877     resetWebPreferencesToConsistentValues();
    1878     setWebPreferencesForTestOptions(options);
     1879    resetWebPreferencesToConsistentValues(webView.preferences);
     1880    setWebPreferencesForTestOptions(webView.preferences, options);
    18791881#if PLATFORM(MAC)
    1880     [webView setWantsLayer:options.layerBackedWebView];
     1882    [webView setWantsLayer:options.layerBackedWebView()];
    18811883#endif
    18821884
     
    19221924#endif
    19231925
    1924     WebCoreTestSupport::setAdditionalSupportedImageTypesForTesting(options.additionalSupportedImageTypes.c_str());
     1926    WebCoreTestSupport::setAdditionalSupportedImageTypesForTesting(options.additionalSupportedImageTypes().c_str());
    19251927
    19261928    [mainFrame _clearOpener];
     
    19781980static WTR::TestOptions testOptionsForTest(const WTR::TestCommand& command)
    19791981{
    1980     WTR::TestFeatures features;
     1982    WTR::TestFeatures features = WTR::TestOptions::defaults();
    19811983    WTR::merge(features, WTR::hardcodedFeaturesBasedOnPathForTest(command));
    19821984    WTR::merge(features, WTR::featureDefaultsFromTestHeaderForTest(command, WTR::TestOptions::keyTypeMapping()));
     
    19851987}
    19861988
    1987 static void runTest(const string& inputLine)
     1989static void runTest(const std::string& inputLine)
    19881990{
    19891991    ASSERT(!inputLine.empty());
    19901992
    19911993    auto command = WTR::parseInputLine(inputLine);
    1992     const string& pathOrURL = command.pathOrURL;
     1994    auto pathOrURL = command.pathOrURL;
    19931995    dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests;
    19941996
     
    20252027    gTestRunner->setAllowedHosts(allowedHosts);
    20262028    gTestRunner->setCustomTimeout(command.timeout.milliseconds());
    2027     gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr);
     2029    gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr());
    20282030
    20292031    resetWebViewToConsistentState(options, ResetTime::BeforeTest);
  • trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm

    r267761 r268795  
    577577void TestRunner::setUserStyleSheetEnabled(bool flag)
    578578{
    579     [[WebPreferences standardPreferences] setUserStyleSheetEnabled:flag];
     579    [[[mainFrame webView] preferences] setUserStyleSheetEnabled:flag];
    580580}
    581581
     
    584584    RetainPtr<CFStringRef> pathCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, path));
    585585    NSURL *url = [NSURL URLWithString:(__bridge NSString *)pathCF.get()];
    586     [[WebPreferences standardPreferences] setUserStyleSheetLocation:url];
     586    [[[mainFrame webView] preferences] setUserStyleSheetLocation:url];
    587587}
    588588
     
    610610    NSString *valueNS = (__bridge NSString *)valueCF.get();
    611611
    612     [[WebPreferences standardPreferences] _setPreferenceForTestWithValue:valueNS forKey:keyNS];
     612    [[[mainFrame webView] preferences] _setPreferenceForTestWithValue:valueNS forKey:keyNS];
    613613}
    614614
     
    701701void TestRunner::setCacheModel(int cacheModel)
    702702{
    703     [[WebPreferences standardPreferences] setCacheModel:(WebCacheModel)cacheModel];
     703    [[[mainFrame webView] preferences] setCacheModel:(WebCacheModel)cacheModel];
    704704}
    705705
  • trunk/Tools/DumpRenderTree/mac/UIDelegate.mm

    r268370 r268795  
    6161- (void)resetToConsistentStateBeforeTesting:(const WTR::TestOptions&)options
    6262{
    63     m_enableDragDestinationActionLoad = options.enableDragDestinationActionLoad;
     63    m_enableDragDestinationActionLoad = options.enableDragDestinationActionLoad();
    6464}
    6565
     
    180180
    181181    WebView *webView = createWebViewAndOffscreenWindow();
    182    
     182    [webView setPreferences:[sender preferences]];
     183
    183184    if (gTestRunner->newWindowsCopyBackForwardList())
    184185        [webView _loadBackForwardListFromOtherView:sender];
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r268616 r268795  
    907907    preferences->setFontSmoothing(FontSmoothingTypeStandard);
    908908
     909    prefsPrivate->setWebSQLEnabled(true);
     910
    909911    prefsPrivate->setDataTransferItemsEnabled(TRUE);
    910912    prefsPrivate->clearNetworkLoaderSession();
     
    913915}
    914916
     917static bool boolWebPreferenceFeatureValue(std::string key, bool defaultValue, const WTR::TestOptions& options)
     918{
     919    auto it = options.boolWebPreferenceFeatures().find(key);
     920    if (it != options.boolWebPreferenceFeatures().end())
     921        return it->second;
     922    return defaultValue;
     923}
     924
    915925static void setWebPreferencesForTestOptions(IWebPreferences* preferences, const WTR::TestOptions& options)
    916926{
    917927    COMPtr<IWebPreferencesPrivate8> prefsPrivate { Query, preferences };
    918928
    919     prefsPrivate->setMenuItemElementEnabled(options.enableMenuItemElement);
    920     prefsPrivate->setKeygenElementEnabled(options.enableKeygenElement);
    921     prefsPrivate->setModernMediaControlsEnabled(options.enableModernMediaControls);
    922     prefsPrivate->setInspectorAdditionsEnabled(options.enableInspectorAdditions);
    923     prefsPrivate->setRequestIdleCallbackEnabled(options.enableRequestIdleCallback);
    924     prefsPrivate->setAsyncClipboardAPIEnabled(options.enableAsyncClipboardAPI);
    925     prefsPrivate->setContactPickerAPIEnabled(options.enableContactPickerAPI);
    926     prefsPrivate->setWebSQLEnabled(options.enableWebSQL);
    927     prefsPrivate->setAllowTopNavigationToDataURLs(options.allowTopNavigationToDataURLs);
    928     preferences->setPrivateBrowsingEnabled(options.useEphemeralSession);
    929     preferences->setUsesPageCache(options.enableBackForwardCache);
    930     prefsPrivate->setCSSOMViewSmoothScrollingEnabled(options.enableCSSOMViewSmoothScrolling);
     929    preferences->setPrivateBrowsingEnabled(options.useEphemeralSession());
     930    preferences->setUsesPageCache(boolWebPreferenceFeatureValue("UsesBackForwardCache", false, options));
     931    prefsPrivate->setMenuItemElementEnabled(boolWebPreferenceFeatureValue("MenuItemElementEnabled", false, options));
     932    prefsPrivate->setKeygenElementEnabled(boolWebPreferenceFeatureValue("KeygenElementEnabled", false, options));
     933    prefsPrivate->setModernMediaControlsEnabled(boolWebPreferenceFeatureValue("ModernMediaControlsEnabled", true, options));
     934    prefsPrivate->setInspectorAdditionsEnabled(boolWebPreferenceFeatureValue("InspectorAdditionsEnabled", false, options));
     935    prefsPrivate->setRequestIdleCallbackEnabled(boolWebPreferenceFeatureValue("RequestIdleCallbackEnabled", false, options));
     936    prefsPrivate->setAsyncClipboardAPIEnabled(boolWebPreferenceFeatureValue("AsyncClipboardAPIEnabled", false, options));
     937    prefsPrivate->setContactPickerAPIEnabled(boolWebPreferenceFeatureValue("ContactPickerAPIEnabled", false, options));
     938    prefsPrivate->setAllowTopNavigationToDataURLs(boolWebPreferenceFeatureValue("AllowTopNavigationToDataURLs", true, options));
     939    prefsPrivate->setCSSOMViewSmoothScrollingEnabled(boolWebPreferenceFeatureValue("CSSOMViewSmoothScrollingEnabled", false, options));
    931940}
    932941
     
    974983    }
    975984
    976     if (options.jscOptions.length()) {
     985    if (!options.jscOptions().empty()) {
    977986        JSC::Options::dumpAllOptionsInALine(savedOptions);
    978         JSC::Options::setOptions(options.jscOptions.c_str());
     987        JSC::Options::setOptions(options.jscOptions().c_str());
    979988    }
    980989}
     
    11691178static WTR::TestOptions testOptionsForTest(const WTR::TestCommand& command)
    11701179{
    1171     WTR::TestFeatures features;
     1180    WTR::TestFeatures features = WTR::TestOptions::defaults();
    11721181    WTR::merge(features, WTR::hardcodedFeaturesBasedOnPathForTest(command));
    11731182    WTR::merge(features, WTR::featureDefaultsFromTestHeaderForTest(command, WTR::TestOptions::keyTypeMapping()));
     
    12301239    ::gTestRunner = TestRunner::create(testURL.data(), command.expectedPixelHash);
    12311240    ::gTestRunner->setCustomTimeout(command.timeout.milliseconds());
    1232     ::gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr);
     1241    ::gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr());
    12331242
    12341243    topLoadingFrame = nullptr;
Note: See TracChangeset for help on using the changeset viewer.