Changeset 268795 in webkit
- Timestamp:
- Oct 21, 2020, 8:04:20 AM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
DumpRenderTree/TestOptions.cpp (modified) (2 diffs)
-
DumpRenderTree/TestOptions.h (modified) (1 diff)
-
DumpRenderTree/mac/DumpRenderTree.mm (modified) (23 diffs)
-
DumpRenderTree/mac/TestRunnerMac.mm (modified) (4 diffs)
-
DumpRenderTree/mac/UIDelegate.mm (modified) (2 diffs)
-
DumpRenderTree/win/DumpRenderTree.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r268793 r268795 1 2020-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 1 23 2020-10-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 24 -
trunk/Tools/DumpRenderTree/TestOptions.cpp
r268705 r268795 31 31 namespace WTR { 32 32 33 const 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 33 71 const std::unordered_map<std::string, TestHeaderKeyType>& TestOptions::keyTypeMapping() 34 72 { … … 48 86 } 49 87 50 template<typename T> static void setValueIfSetInMap(T& valueToSet, std::string key, const std::unordered_map<std::string, T>& map) 88 bool 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 113 template<typename T> T featureValue(std::string key, T defaultValue, const std::unordered_map<std::string, T>& map) 51 114 { 52 115 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; 56 119 } 57 120 58 TestOptions::TestOptions(TestFeatures testFeatures) 121 bool TestOptions::boolTestRunnerFeatureValue(std::string key, bool defaultValue) const 59 122 { 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); 94 124 } 95 125 96 bool TestOptions::webViewIsCompatibleWithOptions(const TestOptions& other) const126 std::string TestOptions::stringTestRunnerFeatureValue(std::string key, std::string defaultValue) const 97 127 { 98 return other.layerBackedWebView == layerBackedWebView 99 && other.jscOptions == jscOptions; 128 return featureValue(key, defaultValue, m_features.stringTestRunnerFeatures); 100 129 } 101 130 -
trunk/Tools/DumpRenderTree/TestOptions.h
r268705 r268795 32 32 namespace WTR { 33 33 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 }; 34 class TestOptions { 35 public: 36 static const TestFeatures& defaults(); 37 static const std::unordered_map<std::string, TestHeaderKeyType>& keyTypeMapping(); 48 38 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 } 55 43 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; 67 45 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", { }); } 76 53 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 61 private: 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; 81 66 }; 82 67 -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r268762 r268795 131 131 } 132 132 133 using namespace std;134 135 133 #if !PLATFORM(IOS_FAMILY) 136 134 @interface DumpRenderTreeApplication : NSApplication … … 153 151 const CGSize scrollViewSize = [scrollView bounds].size; 154 152 CGSize contentSize = newFrame.size; 155 contentSize.height = CGRound( max(CGRectGetMaxY(newFrame), scrollViewSize.height));153 contentSize.height = CGRound(std::max(CGRectGetMaxY(newFrame), scrollViewSize.height)); 156 154 [(UIWebScrollView *)scrollView setContentSize:contentSize]; 157 155 } … … 179 177 #endif 180 178 181 static void runTest(const st ring& testURL);179 static void runTest(const std::string& testURL); 182 180 183 181 // Deciding when it's OK to dump out the state is a bit tricky. All these must be true: … … 250 248 } 251 249 252 static bool shouldIgnoreWebCoreNodeLeaks(const st ring& urlString)250 static bool shouldIgnoreWebCoreNodeLeaks(const std::string& urlString) 253 251 { 254 252 static char* const ignoreSet[] = { … … 259 257 for (int i = 0; i < ignoreSetCount; i++) { 260 258 // FIXME: ignore case 261 st ring curIgnore(ignoreSet[i]);259 std::string curIgnore(ignoreSet[i]); 262 260 // Match at the end of the urlString. 263 261 if (!urlString.compare(urlString.length() - curIgnore.length(), curIgnore.length(), curIgnore)) … … 617 615 CGFloat trackLength = isHorizontal ? bounds.size.width : bounds.size.height; 618 616 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)))); 621 619 622 620 if (isHorizontal) … … 686 684 [WebView registerURLSchemeAsLocal:@"feeds"]; 687 685 [WebView registerURLSchemeAsLocal:@"feedsearch"]; 688 689 [[webView preferences] _setMediaRecorderEnabled:YES];690 686 691 687 #if PLATFORM(MAC) … … 758 754 [webView cacheDisplayInRect:[webView bounds] toBitmapImageRep:imageRep]; 759 755 #else 760 [[webView preferences] _setTelephoneNumberParsingEnabled:NO];761 762 756 // Initialize the global UIViews, and set the key UIWindow to be painted. 763 757 if (!gWebBrowserView) { … … 828 822 [preferences setWritableStreamAPIEnabled:YES]; 829 823 [preferences setTransformStreamAPIEnabled:YES]; 830 preferences.encryptedMediaAPIEnabled = YES;824 [preferences setEncryptedMediaAPIEnabled:YES]; 831 825 [preferences setAccessibilityObjectModelEnabled:YES]; 832 826 [preferences setAriaReflectionEnabled:YES]; … … 835 829 [preferences setServerTimingEnabled:YES]; 836 830 [preferences setIntersectionObserverEnabled:YES]; 837 preferences.sourceBufferChangeTypeEnabled = YES;831 [preferences setSourceBufferChangeTypeEnabled:YES]; 838 832 [preferences setCSSOMViewScrollingAPIEnabled:YES]; 839 833 [preferences setMediaRecorderEnabled:YES]; … … 852 846 853 847 // Called before each test. 854 static void resetWebPreferencesToConsistentValues() 855 { 856 WebPreferences *preferences = [WebPreferences standardPreferences]; 848 static void resetWebPreferencesToConsistentValues(WebPreferences *preferences) 849 { 857 850 enableExperimentalFeatures(preferences); 858 851 … … 922 915 // cause initialization to use the correct database paths. 923 916 [preferences setStorageTrackerEnabled:YES]; 917 [preferences _setTelephoneNumberParsingEnabled:NO]; 924 918 #endif 925 919 … … 937 931 [preferences setAsynchronousSpellCheckingEnabled:NO]; 938 932 #if !PLATFORM(IOS_FAMILY) 939 ASSERT([preferences mockScrollbarsEnabled]);933 [preferences setMockScrollbarsEnabled:YES]; 940 934 #endif 941 935 … … 965 959 966 960 [preferences setCacheAPIEnabled:NO]; 967 preferences.mediaCapabilitiesEnabled = YES;968 969 preferences.selectionAcrossShadowBoundariesEnabled = YES;961 [preferences setMediaCapabilitiesEnabled:YES]; 962 963 [preferences setSelectionAcrossShadowBoundariesEnabled:YES]; 970 964 971 965 [preferences setWebSQLEnabled:YES]; 966 [preferences _setMediaRecorderEnabled:YES]; 972 967 973 968 [WebPreferences _clearNetworkLoaderSession]; … … 975 970 } 976 971 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; 972 static 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 980 static 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); 1005 1007 } 1006 1008 … … 1439 1441 static NSData *dumpAudio() 1440 1442 { 1441 const vector<char>& dataVector = gTestRunner->audioResult();1443 const auto& dataVector = gTestRunner->audioResult(); 1442 1444 1443 1445 NSData *data = [NSData dataWithBytes:dataVector.data() length:dataVector.size()]; … … 1635 1637 1636 1638 // W3C SVG tests expect to be 480x360 1637 bool isSVGW3CTest = (gTestRunner->testURL().find("svg/W3C-SVG-1.1") != st ring::npos);1639 bool isSVGW3CTest = (gTestRunner->testURL().find("svg/W3C-SVG-1.1") != std::string::npos); 1638 1640 NSSize frameSize = isSVGW3CTest ? NSMakeSize(TestRunner::w3cSVGViewWidth, TestRunner::w3cSVGViewHeight) : NSMakeSize(TestRunner::viewWidth, TestRunner::viewHeight); 1639 1641 [[mainFrame webView] setFrameSize:frameSize]; … … 1834 1836 } 1835 1837 1836 if (options.jscOptions .length()) {1838 if (options.jscOptions().length()) { 1837 1839 JSC::Options::dumpAllOptionsInALine(savedOptions); 1838 JSC::Options::setOptions(options.jscOptions .c_str());1840 JSC::Options::setOptions(options.jscOptions().c_str()); 1839 1841 } 1840 1842 } … … 1875 1877 [WebCache clearCachedCredentials]; 1876 1878 1877 resetWebPreferencesToConsistentValues( );1878 setWebPreferencesForTestOptions( options);1879 resetWebPreferencesToConsistentValues(webView.preferences); 1880 setWebPreferencesForTestOptions(webView.preferences, options); 1879 1881 #if PLATFORM(MAC) 1880 [webView setWantsLayer:options.layerBackedWebView ];1882 [webView setWantsLayer:options.layerBackedWebView()]; 1881 1883 #endif 1882 1884 … … 1922 1924 #endif 1923 1925 1924 WebCoreTestSupport::setAdditionalSupportedImageTypesForTesting(options.additionalSupportedImageTypes .c_str());1926 WebCoreTestSupport::setAdditionalSupportedImageTypesForTesting(options.additionalSupportedImageTypes().c_str()); 1925 1927 1926 1928 [mainFrame _clearOpener]; … … 1978 1980 static WTR::TestOptions testOptionsForTest(const WTR::TestCommand& command) 1979 1981 { 1980 WTR::TestFeatures features ;1982 WTR::TestFeatures features = WTR::TestOptions::defaults(); 1981 1983 WTR::merge(features, WTR::hardcodedFeaturesBasedOnPathForTest(command)); 1982 1984 WTR::merge(features, WTR::featureDefaultsFromTestHeaderForTest(command, WTR::TestOptions::keyTypeMapping())); … … 1985 1987 } 1986 1988 1987 static void runTest(const st ring& inputLine)1989 static void runTest(const std::string& inputLine) 1988 1990 { 1989 1991 ASSERT(!inputLine.empty()); 1990 1992 1991 1993 auto command = WTR::parseInputLine(inputLine); 1992 const string&pathOrURL = command.pathOrURL;1994 auto pathOrURL = command.pathOrURL; 1993 1995 dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests; 1994 1996 … … 2025 2027 gTestRunner->setAllowedHosts(allowedHosts); 2026 2028 gTestRunner->setCustomTimeout(command.timeout.milliseconds()); 2027 gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr );2029 gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr()); 2028 2030 2029 2031 resetWebViewToConsistentState(options, ResetTime::BeforeTest); -
trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm
r267761 r268795 577 577 void TestRunner::setUserStyleSheetEnabled(bool flag) 578 578 { 579 [[ WebPreferences standardPreferences] setUserStyleSheetEnabled:flag];579 [[[mainFrame webView] preferences] setUserStyleSheetEnabled:flag]; 580 580 } 581 581 … … 584 584 RetainPtr<CFStringRef> pathCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, path)); 585 585 NSURL *url = [NSURL URLWithString:(__bridge NSString *)pathCF.get()]; 586 [[ WebPreferences standardPreferences] setUserStyleSheetLocation:url];586 [[[mainFrame webView] preferences] setUserStyleSheetLocation:url]; 587 587 } 588 588 … … 610 610 NSString *valueNS = (__bridge NSString *)valueCF.get(); 611 611 612 [[ WebPreferences standardPreferences] _setPreferenceForTestWithValue:valueNS forKey:keyNS];612 [[[mainFrame webView] preferences] _setPreferenceForTestWithValue:valueNS forKey:keyNS]; 613 613 } 614 614 … … 701 701 void TestRunner::setCacheModel(int cacheModel) 702 702 { 703 [[ WebPreferences standardPreferences] setCacheModel:(WebCacheModel)cacheModel];703 [[[mainFrame webView] preferences] setCacheModel:(WebCacheModel)cacheModel]; 704 704 } 705 705 -
trunk/Tools/DumpRenderTree/mac/UIDelegate.mm
r268370 r268795 61 61 - (void)resetToConsistentStateBeforeTesting:(const WTR::TestOptions&)options 62 62 { 63 m_enableDragDestinationActionLoad = options.enableDragDestinationActionLoad ;63 m_enableDragDestinationActionLoad = options.enableDragDestinationActionLoad(); 64 64 } 65 65 … … 180 180 181 181 WebView *webView = createWebViewAndOffscreenWindow(); 182 182 [webView setPreferences:[sender preferences]]; 183 183 184 if (gTestRunner->newWindowsCopyBackForwardList()) 184 185 [webView _loadBackForwardListFromOtherView:sender]; -
trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp
r268616 r268795 907 907 preferences->setFontSmoothing(FontSmoothingTypeStandard); 908 908 909 prefsPrivate->setWebSQLEnabled(true); 910 909 911 prefsPrivate->setDataTransferItemsEnabled(TRUE); 910 912 prefsPrivate->clearNetworkLoaderSession(); … … 913 915 } 914 916 917 static 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 915 925 static void setWebPreferencesForTestOptions(IWebPreferences* preferences, const WTR::TestOptions& options) 916 926 { 917 927 COMPtr<IWebPreferencesPrivate8> prefsPrivate { Query, preferences }; 918 928 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)); 931 940 } 932 941 … … 974 983 } 975 984 976 if ( options.jscOptions.length()) {985 if (!options.jscOptions().empty()) { 977 986 JSC::Options::dumpAllOptionsInALine(savedOptions); 978 JSC::Options::setOptions(options.jscOptions .c_str());987 JSC::Options::setOptions(options.jscOptions().c_str()); 979 988 } 980 989 } … … 1169 1178 static WTR::TestOptions testOptionsForTest(const WTR::TestCommand& command) 1170 1179 { 1171 WTR::TestFeatures features ;1180 WTR::TestFeatures features = WTR::TestOptions::defaults(); 1172 1181 WTR::merge(features, WTR::hardcodedFeaturesBasedOnPathForTest(command)); 1173 1182 WTR::merge(features, WTR::featureDefaultsFromTestHeaderForTest(command, WTR::TestOptions::keyTypeMapping())); … … 1230 1239 ::gTestRunner = TestRunner::create(testURL.data(), command.expectedPixelHash); 1231 1240 ::gTestRunner->setCustomTimeout(command.timeout.milliseconds()); 1232 ::gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr );1241 ::gTestRunner->setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr || options.dumpJSConsoleLogInStdErr()); 1233 1242 1234 1243 topLoadingFrame = nullptr;
Note:
See TracChangeset
for help on using the changeset viewer.