Changeset 268604 in webkit
- Timestamp:
- Oct 16, 2020 12:37:06 PM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r268601 r268604 1 2020-10-16 Sam Weinig <weinig@apple.com> 2 3 [Testing] Support configuring any preference from test headers for WebKitTestRunner 4 https://bugs.webkit.org/show_bug.cgi?id=217645 5 6 Reviewed by Tim Horton. 7 8 Support using any preference defined in any of the WebPreference*.yaml configuration files 9 as a test header command rather than limiting it to a hard coded subset by generating the 10 list of supported commands and their types from the yaml files themselves. 11 12 This currently only works for WebKitTestRunner, but will be made to work with DumpRenderTree 13 in subsequent changes. 14 15 * WebKitTestRunner/CMakeLists.txt: 16 * WebKitTestRunner/Configurations/Base.xcconfig: 17 * WebKitTestRunner/DerivedSources-input.xcfilelist: 18 * WebKitTestRunner/DerivedSources-output.xcfilelist: 19 * WebKitTestRunner/DerivedSources.make: 20 * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: 21 * WebKitTestRunner/Scripts/PreferencesTemplates: Added. 22 * WebKitTestRunner/Scripts/PreferencesTemplates/TestOptionsGeneratedKeys.h.erb: Added. 23 Add generation of TestOptionsGeneratedKeys.h from the WebPreference*.yaml using 24 the shared GeneratePreferences.rb script in WTF. 25 26 * WebKitTestRunner/TestController.cpp: 27 (WTR::TestController::resetPreferencesToConsistentValues): 28 Move preference setting to the bottom of the file to allow any preference 29 to be overriden. Also adds in support for double, uint32_t, and string preferences 30 though none of those are currently being used. 31 32 * WebKitTestRunner/TestOptions.cpp: 33 (WTR::TestOptions::keyTypeMapping): 34 Use generated macro GENERATED_WEB_PREFERENCE_KEY_TYPE_MAPPINGS rather than hardcoding 35 all the preferences types. 36 37 * WebKitTestRunner/TestOptions.h: 38 (WTR::TestOptions::boolWebPreferenceFeatures const): 39 (WTR::TestOptions::doubleWebPreferenceFeatures const): 40 (WTR::TestOptions::uint32WebPreferenceFeatures const): 41 (WTR::TestOptions::stringWebPreferenceFeatures const): 42 Expose accessors for preferences values for use in setting the actual preference 43 values. Rather than setting all preferences, we now only set preferences that have 44 been explicitly requested, using the default value for any that have not. 45 1 46 2020-10-16 Aakash Jain <aakash_jain@apple.com> 2 47 -
trunk/Tools/WebKitTestRunner/CMakeLists.txt
r268498 r268604 31 31 ${WebKitTestRunner_SHARED_DIR} 32 32 ${WebKitTestRunner_BINDINGS_DIR} 33 ${WebKitTestRunner_DERIVED_SOURCES_DIR} 33 34 ${WebKitTestRunner_DERIVED_SOURCES_DIR}/UIScriptContext 34 35 ${WebKitTestRunner_DIR} … … 42 43 list(APPEND WebKitTestRunner_INCLUDE_DIRECTORIES 43 44 ${WebCore_PRIVATE_FRAMEWORK_HEADERS_DIR} 45 ) 46 47 set(WebKitTestRunner_WEB_PREFERENCES_TEMPLATES 48 ${WebKitTestRunner_DIR}/Scripts/PreferencesTemplates/TestOptionsGeneratedKeys.h.erb 49 ) 50 51 set(WebKitTestRunner_WEB_PREFERENCES 52 ${WTF_SCRIPTS_DIR}/Preferences/WebPreferences.yaml 53 ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesDebug.yaml 54 ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesExperimental.yaml 55 ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesInternal.yaml 56 ) 57 58 set_source_files_properties(${WebKitTestRunner_WEB_PREFERENCES} PROPERTIES GENERATED TRUE) 59 60 add_custom_command( 61 OUTPUT ${WebKitTestRunner_DERIVED_SOURCES_DIR}/TestOptionsGeneratedKeys.h 62 DEPENDS ${WebKitTestRunner_WEB_PREFERENCES_TEMPLATES} ${WebKitTestRunner_WEB_PREFERENCES} WTF_CopyPreferences 63 COMMAND ${RUBY_EXECUTABLE} ${WTF_SCRIPTS_DIR}/GeneratePreferences.rb --frontend WebKit --base ${WTF_SCRIPTS_DIR}/Preferences/WebPreferences.yaml --debug ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesDebug.yaml --experimental ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesExperimental.yaml --internal ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesInternal.yaml --outputDir "${WebKitTestRunner_DERIVED_SOURCES_DIR}" --template ${WebKitTestRunner_DIR}/Scripts/PreferencesTemplates/TestOptionsGeneratedKeys.h.erb 64 VERBATIM) 65 66 list(APPEND WebKitTestRunner_SOURCES 67 ${WebKitTestRunner_DERIVED_SOURCES_DIR}/TestOptionsGeneratedKeys.h 44 68 ) 45 69 -
trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig
r268498 r268604 101 101 PRODUCTION_FRAMEWORKS_DIR[sdk=macosx*] = $(SDKROOT)$(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; 102 102 103 WTF_BUILD_SCRIPTS_DIR = $(WTF_BUILD_SCRIPTS_DIR_$(CONFIGURATION)); 104 WTF_BUILD_SCRIPTS_DIR_Release = $(WTF_BUILD_SCRIPTS_DIR_engineering); 105 WTF_BUILD_SCRIPTS_DIR_Debug = $(WTF_BUILD_SCRIPTS_DIR_engineering); 106 WTF_BUILD_SCRIPTS_DIR_Production = $(WTF_BUILD_SCRIPTS_DIR_Production_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH)); 107 WTF_BUILD_SCRIPTS_DIR_Production_COCOA_TOUCH_YES = $(SDKROOT)$(WK_ALTERNATE_WEBKIT_SDK_PATH)/usr/local/include/wtf/Scripts; 108 WTF_BUILD_SCRIPTS_DIR_Production_COCOA_TOUCH_NO = $(SDKROOT)/usr/local/include/wtf/Scripts; 109 WTF_BUILD_SCRIPTS_DIR_engineering = $(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts; 110 103 111 WEBCORE_PRIVATE_HEADERS_DIR = $(WEBCORE_PRIVATE_HEADERS_DIR_$(CONFIGURATION)); 104 112 WEBCORE_PRIVATE_HEADERS_DIR_Release = $(WEBCORE_PRIVATE_HEADERS_DIR_engineering); … … 124 132 WK_COCOA_TOUCH_appletvos = cocoatouch; 125 133 WK_COCOA_TOUCH_appletvsimulator = cocoatouch; 134 WK_IS_COCOA_TOUCH = $(WK_NOT_$(WK_EMPTY_$(WK_COCOA_TOUCH))); 126 135 127 136 HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include $(BUILT_PRODUCTS_DIR)/WebCoreTestSupport $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(NEXT_ROOT)/usr/local/include/WebCoreTestSupport $(HEADER_SEARCH_PATHS_$(WK_COCOA_TOUCH)); -
trunk/Tools/WebKitTestRunner/DerivedSources-input.xcfilelist
r268498 r268604 1 1 # This file is generated by the generate-xcfilelists script. 2 $(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/GeneratePreferences.rb 3 $(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/Preferences/WebPreferences.yaml 4 $(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/Preferences/WebPreferencesDebug.yaml 5 $(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/Preferences/WebPreferencesExperimental.yaml 6 $(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/Preferences/WebPreferencesInternal.yaml 2 7 $(PROJECT_DIR)/../TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 3 8 $(PROJECT_DIR)/InjectedBundle/Bindings/AccessibilityController.idl … … 10 15 $(PROJECT_DIR)/InjectedBundle/Bindings/TestRunner.idl 11 16 $(PROJECT_DIR)/InjectedBundle/Bindings/TextInputController.idl 17 $(PROJECT_DIR)/Scripts/PreferencesTemplates/TestOptionsGeneratedKeys.h.erb 12 18 $(WEBCORE_PRIVATE_HEADERS_DIR)/CodeGenerator.pm 13 19 $(WEBCORE_PRIVATE_HEADERS_DIR)/IDLAttributes.json -
trunk/Tools/WebKitTestRunner/DerivedSources-output.xcfilelist
r268498 r268604 18 18 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitTestRunner/JSUIScriptController.cpp 19 19 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitTestRunner/JSUIScriptController.h 20 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitTestRunner/TestOptionsGeneratedKeys.h -
trunk/Tools/WebKitTestRunner/DerivedSources.make
r268498 r268604 1 # Copyright (C) 2010 Apple Inc. All rights reserved.1 # Copyright (C) 2010-2020 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 26 26 $(WebKitTestRunner)/../TestRunnerShared/UIScriptContext/Bindings \ 27 27 # 28 29 RUBY = ruby 30 31 WEB_PREFERENCES = \ 32 ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferences.yaml \ 33 ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferencesDebug.yaml \ 34 ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferencesExperimental.yaml \ 35 ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferencesInternal.yaml \ 36 # 37 38 WEB_PREFERENCES_TEMPLATES = \ 39 $(WebKitTestRunner)/Scripts/PreferencesTemplates/TestOptionsGeneratedKeys.h.erb \ 40 # 41 WEB_PREFERENCES_FILES = $(basename $(notdir $(WEB_PREFERENCES_TEMPLATES))) 42 WEB_PREFERENCES_PATTERNS = $(subst .erb,,$(WEB_PREFERENCES_FILES)) 43 44 all : $(WEB_PREFERENCES_FILES) 45 46 $(WEB_PREFERENCES_PATTERNS) : $(WTF_BUILD_SCRIPTS_DIR)/GeneratePreferences.rb $(WEB_PREFERENCES_TEMPLATES) $(WEB_PREFERENCES) 47 $(RUBY) $< --frontend WebKit --base ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferences.yaml --debug ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferencesDebug.yaml --experimental ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferencesExperimental.yaml --internal ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferencesInternal.yaml $(addprefix --template , $(WEB_PREFERENCES_TEMPLATES)) 48 28 49 29 50 INJECTED_BUNDLE_INTERFACES = \ -
trunk/Tools/WebKitTestRunner/TestController.cpp
r268498 r268604 470 470 m_allowAnyHTTPSCertificateForAllowedHosts = options.allowAnyHTTPSCertificateForAllowedHosts; 471 471 472 m_globalFeatures = TestOptions::defaults(); 472 473 m_globalFeatures.internalDebugFeatures = options.internalFeatures; 473 474 m_globalFeatures.experimentalFeatures = options.experimentalFeatures; … … 498 499 } 499 500 500 WKRetainPtr<WKContextConfigurationRef> TestController::generateContextConfiguration(const ContextOptions& options) const501 WKRetainPtr<WKContextConfigurationRef> TestController::generateContextConfiguration(const TestOptions& options) const 501 502 { 502 503 auto configuration = adoptWK(WKContextConfigurationCreate()); 503 504 WKContextConfigurationSetInjectedBundlePath(configuration.get(), injectedBundlePath()); 504 505 WKContextConfigurationSetFullySynchronousModeIsAllowedForTesting(configuration.get(), true); 505 WKContextConfigurationSetIgnoreSynchronousMessagingTimeoutsForTesting(configuration.get(), options.ignoreSynchronousMessagingTimeouts );506 WKContextConfigurationSetIgnoreSynchronousMessagingTimeoutsForTesting(configuration.get(), options.ignoreSynchronousMessagingTimeouts()); 506 507 507 508 auto overrideLanguages = adoptWK(WKMutableArrayCreate()); 508 for (auto& language : options.overrideLanguages )509 for (auto& language : options.overrideLanguages()) 509 510 WKArrayAppendItem(overrideLanguages.get(), toWK(language).get()); 510 511 WKContextConfigurationSetOverrideLanguages(configuration.get(), overrideLanguages.get()); … … 512 513 if (options.shouldEnableProcessSwapOnNavigation()) { 513 514 WKContextConfigurationSetProcessSwapsOnNavigation(configuration.get(), true); 514 if (options.enableProcessSwapOnWindowOpen )515 if (options.enableProcessSwapOnWindowOpen()) 515 516 WKContextConfigurationSetProcessSwapsOnWindowOpenWithOpener(configuration.get(), true); 516 517 } … … 561 562 WKRetainPtr<WKPageConfigurationRef> TestController::generatePageConfiguration(const TestOptions& options) 562 563 { 563 auto contextOptions = options.contextOptions(); 564 if (!m_context || !m_contextOptions->hasSameInitializationOptions(contextOptions)) { 565 auto contextConfiguration = generateContextConfiguration(contextOptions); 564 if (!m_context || !m_mainWebView || !m_mainWebView->viewSupportsOptions(options)) { 565 auto contextConfiguration = generateContextConfiguration(options); 566 566 m_context = platformAdjustContext(adoptWK(WKContextCreateWithConfiguration(contextConfiguration.get())).get(), contextConfiguration.get()); 567 m_contextOptions = contextOptions;568 567 569 568 m_geolocationProvider = makeUnique<GeolocationProviderMock>(m_context.get()); … … 825 824 } 826 825 827 828 826 createWebViewWithOptions(options); 829 827 … … 857 855 WKPreferencesSetInternalDebugFeatureForKey(preferences, value, toWK(key).get()); 858 856 859 for (const auto& [key, value] : options.boolWKPreferences())860 WKPreferencesSetBoolValueForKey(preferences, value, toWK(key).get());861 862 857 // FIXME: Convert these to default values for TestOptions. 863 WKPreferencesSetProcessSwapOnNavigationEnabled(preferences, options. contextOptions().shouldEnableProcessSwapOnNavigation());858 WKPreferencesSetProcessSwapOnNavigationEnabled(preferences, options.shouldEnableProcessSwapOnNavigation()); 864 859 WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true); 865 860 WKPreferencesSetSubpixelAntialiasedLayerTextEnabled(preferences, false); … … 925 920 926 921 platformResetPreferencesToConsistentValues(); 922 923 for (const auto& [key, value] : options.boolWebPreferenceFeatures()) 924 WKPreferencesSetBoolValueForKey(preferences, value, toWK(key).get()); 925 926 for (const auto& [key, value] : options.doubleWebPreferenceFeatures()) 927 WKPreferencesSetDoubleValueForKey(preferences, value, toWK(key).get()); 928 929 for (const auto& [key, value] : options.uint32WebPreferenceFeatures()) 930 WKPreferencesSetUInt32ValueForKey(preferences, value, toWK(key).get()); 931 932 for (const auto& [key, value] : options.stringWebPreferenceFeatures()) 933 WKPreferencesSetStringValueForKey(preferences, toWK(value).get(), toWK(key).get()); 934 927 935 } 928 936 -
trunk/Tools/WebKitTestRunner/TestController.h
r268458 r268604 354 354 private: 355 355 WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(const TestOptions&); 356 WKRetainPtr<WKContextConfigurationRef> generateContextConfiguration(const ContextOptions&) const;356 WKRetainPtr<WKContextConfigurationRef> generateContextConfiguration(const TestOptions&) const; 357 357 void initialize(int argc, const char* argv[]); 358 358 void createWebViewWithOptions(const TestOptions&); … … 539 539 std::unique_ptr<PlatformWebView> m_mainWebView; 540 540 WKRetainPtr<WKContextRef> m_context; 541 Optional<ContextOptions> m_contextOptions;542 541 WKRetainPtr<WKPageGroupRef> m_pageGroup; 543 542 WKRetainPtr<WKUserContentControllerRef> m_userContentController; -
trunk/Tools/WebKitTestRunner/TestOptions.cpp
r268498 r268604 27 27 #include "TestOptions.h" 28 28 29 #include <fstream> 30 #include <string> 29 #include "TestOptionsGeneratedKeys.h" 31 30 #include <wtf/Assertions.h> 32 #include <wtf/StdFilesystem.h>33 31 34 32 namespace WTR { 35 33 36 static const std::unordered_map<std::string, bool>& boolWebPreferencesDefaultsMap() 37 { 38 static std::unordered_map<std::string, bool> map { 39 { "AcceleratedDrawingEnabled", false }, 40 { "AllowCrossOriginSubresourcesToAskForCredentials", false }, 41 { "AllowTopNavigationToDataURLs", true }, 42 { "AttachmentElementEnabled", false }, 43 { "CaptureAudioInGPUProcessEnabled", false }, 44 { "CaptureAudioInUIProcessEnabled", false }, 45 { "CaptureVideoInGPUProcessEnabled", false }, 46 { "CaptureVideoInUIProcessEnabled", false }, 47 { "ColorFilterEnabled", false }, 48 { "DOMPasteAllowed", true }, 49 { "InspectorAdditionsEnabled", false }, 50 { "KeygenElementEnabled", false }, 51 { "MenuItemElementEnabled", false }, 52 { "MockScrollbarsEnabled", true }, 53 { "ModernMediaControlsEnabled", true }, 54 { "NeedsSiteSpecificQuirks", false }, 55 { "PageVisibilityBasedProcessSuppressionEnabled", false }, 56 { "PunchOutWhiteBackgroundsInDarkMode", false }, 57 { "ServiceControlsEnabled", false }, 58 { "ShouldIgnoreMetaViewport", false }, 59 { "ShouldUseServiceWorkerShortTimeout", false }, 60 { "UsesBackForwardCache", false }, 61 { "WebAuthenticationEnabled", true }, 62 { "WebAuthenticationLocalAuthenticatorEnabled", true }, 63 }; 64 return map; 65 } 66 67 static const std::unordered_map<std::string, bool>& boolTestRunnerDefaultsMap() 68 { 69 static std::unordered_map<std::string, bool> map { 70 { "allowsLinkPreview", true }, 71 { "dumpJSConsoleLogInStdErr", false }, 72 { "editable", false }, 73 { "enableInAppBrowserPrivacy", false }, 74 { "enableProcessSwapOnNavigation", true }, 75 { "enableProcessSwapOnWindowOpen", false }, 76 { "ignoreSynchronousMessagingTimeouts", false }, 77 { "ignoresViewportScaleLimits", false }, 78 { "isAppBoundWebView", false }, 79 { "runSingly", false }, 80 { "shouldHandleRunOpenPanel", true }, 81 { "shouldPresentPopovers", true }, 82 { "shouldShowTouches", false }, 83 { "shouldShowWebView", false }, 84 { "spellCheckingDots", false }, 85 { "useCharacterSelectionGranularity", false }, 86 { "useDataDetection", false }, 87 { "useEphemeralSession", false }, 88 { "useFlexibleViewport", false }, 89 { "useRemoteLayerTree", false }, 90 { "useThreadedScrolling", false }, 91 }; 92 return map; 93 } 94 95 static const std::unordered_map<std::string, double>& doubleTestRunnerDefaultsMap() 96 { 97 static std::unordered_map<std::string, double> map { 98 { "contentInset.top", 0 }, 99 { "deviceScaleFactor", 1 }, 100 { "viewHeight", 600 }, 101 { "viewWidth", 800 }, 102 }; 103 return map; 104 } 105 106 static const std::unordered_map<std::string, std::string>& stringTestRunnerDefaultsMap() 107 { 108 static std::unordered_map<std::string, std::string> map { 109 { "additionalSupportedImageTypes", { } }, 110 { "applicationBundleIdentifier", { } }, 111 { "applicationManifest", { } }, 112 { "contentMode", { } }, 113 { "jscOptions", { } }, 114 { "standaloneWebApplicationURL", { } }, 115 }; 116 return map; 117 } 118 119 static const std::unordered_map<std::string, std::vector<std::string>>& stringVectorTestRunnerDefaultsMap() 120 { 121 static std::unordered_map<std::string, std::vector<std::string>> map { 122 { "language", { } }, 123 }; 124 return map; 34 const TestFeatures& TestOptions::defaults() 35 { 36 static TestFeatures features; 37 if (features.boolWebPreferenceFeatures.empty()) { 38 features.boolWebPreferenceFeatures = { 39 // These are WebPreference values that must always be set as they may 40 // differ from the default set in the WebPreferences*.yaml configuration. 41 { "AllowTopNavigationToDataURLs", true }, 42 { "CaptureAudioInGPUProcessEnabled", false }, 43 { "CaptureAudioInUIProcessEnabled", false }, 44 { "CaptureVideoInGPUProcessEnabled", false }, 45 { "CaptureVideoInUIProcessEnabled", false }, 46 { "DOMPasteAllowed", true }, 47 { "MockScrollbarsEnabled", true }, 48 { "ModernMediaControlsEnabled", true }, 49 { "NeedsSiteSpecificQuirks", false }, 50 { "PageVisibilityBasedProcessSuppressionEnabled", false }, 51 { "UsesBackForwardCache", false }, 52 { "WebAuthenticationEnabled", true }, 53 { "WebAuthenticationLocalAuthenticatorEnabled", true }, 54 }; 55 features.boolTestRunnerFeatures = { 56 { "allowsLinkPreview", true }, 57 { "dumpJSConsoleLogInStdErr", false }, 58 { "editable", false }, 59 { "enableInAppBrowserPrivacy", false }, 60 { "enableProcessSwapOnNavigation", true }, 61 { "enableProcessSwapOnWindowOpen", false }, 62 { "ignoreSynchronousMessagingTimeouts", false }, 63 { "ignoresViewportScaleLimits", false }, 64 { "isAppBoundWebView", false }, 65 { "runSingly", false }, 66 { "shouldHandleRunOpenPanel", true }, 67 { "shouldPresentPopovers", true }, 68 { "shouldShowTouches", false }, 69 { "shouldShowWebView", false }, 70 { "spellCheckingDots", false }, 71 { "useCharacterSelectionGranularity", false }, 72 { "useDataDetection", false }, 73 { "useEphemeralSession", false }, 74 { "useFlexibleViewport", false }, 75 { "useRemoteLayerTree", false }, 76 { "useThreadedScrolling", false }, 77 }; 78 features.doubleTestRunnerFeatures = { 79 { "contentInset.top", 0 }, 80 { "deviceScaleFactor", 1 }, 81 { "viewHeight", 600 }, 82 { "viewWidth", 800 }, 83 }; 84 features.stringTestRunnerFeatures = { 85 { "additionalSupportedImageTypes", { } }, 86 { "applicationBundleIdentifier", { } }, 87 { "applicationManifest", { } }, 88 { "contentMode", { } }, 89 { "jscOptions", { } }, 90 { "standaloneWebApplicationURL", { } }, 91 }; 92 features.stringVectorTestRunnerFeatures = { 93 { "language", { } }, 94 }; 95 } 96 97 return features; 125 98 } 126 99 127 100 const std::unordered_map<std::string, TestHeaderKeyType>& TestOptions::keyTypeMapping() 128 101 { 129 static std::unordered_map<std::string, TestHeaderKeyType> map { 130 { "AcceleratedDrawingEnabled", TestHeaderKeyType::BoolWebPreference }, 131 { "AllowCrossOriginSubresourcesToAskForCredentials", TestHeaderKeyType::BoolWebPreference }, 132 { "AllowTopNavigationToDataURLs", TestHeaderKeyType::BoolWebPreference }, 133 { "AttachmentElementEnabled", TestHeaderKeyType::BoolWebPreference }, 134 { "CaptureAudioInGPUProcessEnabled", TestHeaderKeyType::BoolWebPreference }, 135 { "CaptureAudioInUIProcessEnabled", TestHeaderKeyType::BoolWebPreference }, 136 { "CaptureVideoInGPUProcessEnabled", TestHeaderKeyType::BoolWebPreference }, 137 { "CaptureVideoInUIProcessEnabled", TestHeaderKeyType::BoolWebPreference }, 138 { "ColorFilterEnabled", TestHeaderKeyType::BoolWebPreference }, 139 { "DOMPasteAllowed", TestHeaderKeyType::BoolWebPreference }, 140 { "InspectorAdditionsEnabled", TestHeaderKeyType::BoolWebPreference }, 141 { "KeygenElementEnabled", TestHeaderKeyType::BoolWebPreference }, 142 { "MenuItemElementEnabled", TestHeaderKeyType::BoolWebPreference }, 143 { "MockScrollbarsEnabled", TestHeaderKeyType::BoolWebPreference }, 144 { "ModernMediaControlsEnabled", TestHeaderKeyType::BoolWebPreference }, 145 { "NeedsSiteSpecificQuirks", TestHeaderKeyType::BoolWebPreference }, 146 { "PageVisibilityBasedProcessSuppressionEnabled", TestHeaderKeyType::BoolWebPreference }, 147 { "PunchOutWhiteBackgroundsInDarkMode", TestHeaderKeyType::BoolWebPreference }, 148 { "ServiceControlsEnabled", TestHeaderKeyType::BoolWebPreference }, 149 { "ShouldIgnoreMetaViewport", TestHeaderKeyType::BoolWebPreference }, 150 { "ShouldUseServiceWorkerShortTimeout", TestHeaderKeyType::BoolWebPreference }, 151 { "UsesBackForwardCache", TestHeaderKeyType::BoolWebPreference }, 152 { "WebAuthenticationEnabled", TestHeaderKeyType::BoolWebPreference }, 153 { "WebAuthenticationLocalAuthenticatorEnabled", TestHeaderKeyType::BoolWebPreference }, 102 static const std::unordered_map<std::string, TestHeaderKeyType> map { 103 GENERATED_WEB_PREFERENCE_KEY_TYPE_MAPPINGS 154 104 155 105 { "allowsLinkPreview", TestHeaderKeyType::BoolTestRunner }, … … 193 143 } 194 144 195 TestOptions::TestOptions(TestFeatures features)196 : m_features { features }197 {198 }199 200 145 bool TestOptions::hasSameInitializationOptions(const TestOptions& options) const 201 146 { … … 223 168 } 224 169 225 std::vector<std::pair<std::string, bool>> TestOptions::boolWKPreferences() const 226 { 227 std::vector<std::pair<std::string, bool>> result; 228 229 for (auto [key, defaultValue] : boolWebPreferencesDefaultsMap()) 230 result.push_back({ key, boolWebPreferenceFeatureValue(key) }); 231 232 return result; 233 } 234 235 template<typename T> T featureValue(std::string key, const std::unordered_map<std::string, T>& map, const std::unordered_map<std::string, T>& defaultsMap) 236 { 170 bool TestOptions::boolWebPreferenceFeatureValue(std::string key, bool defaultValue) const 171 { 172 auto it = m_features.boolWebPreferenceFeatures.find(key); 173 if (it != m_features.boolWebPreferenceFeatures.end()) 174 return it->second; 175 return defaultValue; 176 } 177 178 template<typename T> T testRunnerFeatureValue(std::string key, const std::unordered_map<std::string, T>& map) 179 { 180 // All test runner features should always exist in their corresponding map since the base/global defaults 181 // contains default values for all of them. 182 237 183 auto it = map.find(key); 238 if (it != map.end()) 239 return it->second; 240 241 auto defaultsMapIt = defaultsMap.find(key); 242 ASSERT(defaultsMapIt != defaultsMap.end()); 243 return defaultsMapIt->second; 244 } 245 246 bool TestOptions::boolWebPreferenceFeatureValue(std::string key) const 247 { 248 return featureValue(key, m_features.boolWebPreferenceFeatures, boolWebPreferencesDefaultsMap()); 249 } 184 ASSERT(it != map.end()); 185 return it->second; 186 } 187 250 188 bool TestOptions::boolTestRunnerFeatureValue(std::string key) const 251 189 { 252 return featureValue(key, m_features.boolTestRunnerFeatures, boolTestRunnerDefaultsMap()); 253 } 190 return testRunnerFeatureValue(key, m_features.boolTestRunnerFeatures); 191 } 192 254 193 double TestOptions::doubleTestRunnerFeatureValue(std::string key) const 255 194 { 256 return featureValue(key, m_features.doubleTestRunnerFeatures, doubleTestRunnerDefaultsMap()); 257 } 195 return testRunnerFeatureValue(key, m_features.doubleTestRunnerFeatures); 196 } 197 258 198 std::string TestOptions::stringTestRunnerFeatureValue(std::string key) const 259 199 { 260 return featureValue(key, m_features.stringTestRunnerFeatures, stringTestRunnerDefaultsMap()); 261 } 200 return testRunnerFeatureValue(key, m_features.stringTestRunnerFeatures); 201 } 202 262 203 std::vector<std::string> TestOptions::stringVectorTestRunnerFeatureValue(std::string key) const 263 204 { 264 return featureValue(key, m_features.stringVectorTestRunnerFeatures, stringVectorTestRunnerDefaultsMap());265 } 266 267 } 205 return testRunnerFeatureValue(key, m_features.stringVectorTestRunnerFeatures); 206 } 207 208 } -
trunk/Tools/WebKitTestRunner/TestOptions.h
r268498 r268604 34 34 namespace WTR { 35 35 36 struct ContextOptions { 37 std::vector<std::string> overrideLanguages; 38 bool ignoreSynchronousMessagingTimeouts; 39 bool enableProcessSwapOnNavigation; 40 bool enableProcessSwapOnWindowOpen; 41 bool useServiceWorkerShortTimeout; 36 class TestOptions { 37 public: 38 static const TestFeatures& defaults(); 39 static const std::unordered_map<std::string, TestHeaderKeyType>& keyTypeMapping(); 42 40 43 bool hasSameInitializationOptions(const ContextOptions& options) const 41 explicit TestOptions(TestFeatures features) 42 : m_features { std::move(features) } 44 43 { 45 if (ignoreSynchronousMessagingTimeouts != options.ignoreSynchronousMessagingTimeouts46 || overrideLanguages != options.overrideLanguages47 || enableProcessSwapOnNavigation != options.enableProcessSwapOnNavigation48 || enableProcessSwapOnWindowOpen != options.enableProcessSwapOnWindowOpen49 || useServiceWorkerShortTimeout != options.useServiceWorkerShortTimeout)50 return false;51 return true;52 44 } 53 45 54 bool shouldEnableProcessSwapOnNavigation() const 55 { 56 return enableProcessSwapOnNavigation || enableProcessSwapOnWindowOpen; 57 } 58 }; 59 60 class TestOptions { 61 public: 62 static const std::unordered_map<std::string, TestHeaderKeyType>& keyTypeMapping(); 63 64 explicit TestOptions(TestFeatures); 65 66 ContextOptions contextOptions() const 67 { 68 return { 69 overrideLanguages(), 70 ignoreSynchronousMessagingTimeouts(), 71 enableProcessSwapOnNavigation(), 72 enableProcessSwapOnWindowOpen(), 73 useServiceWorkerShortTimeout() 74 }; 75 } 76 77 bool allowTopNavigationToDataURLs() const { return boolWebPreferenceFeatureValue("AllowTopNavigationToDataURLs"); } 78 bool enableAttachmentElement() const { return boolWebPreferenceFeatureValue("AttachmentElementEnabled"); } 79 bool punchOutWhiteBackgroundsInDarkMode() const { return boolWebPreferenceFeatureValue("PunchOutWhiteBackgroundsInDarkMode"); } 80 bool useServiceWorkerShortTimeout() const { return boolWebPreferenceFeatureValue("ShouldUseServiceWorkerShortTimeout"); } 46 bool allowTopNavigationToDataURLs() const { return boolWebPreferenceFeatureValue("AllowTopNavigationToDataURLs", true); } 47 bool enableAttachmentElement() const { return boolWebPreferenceFeatureValue("AttachmentElementEnabled", false); } 48 bool punchOutWhiteBackgroundsInDarkMode() const { return boolWebPreferenceFeatureValue("PunchOutWhiteBackgroundsInDarkMode", false); } 49 bool useServiceWorkerShortTimeout() const { return boolWebPreferenceFeatureValue("ShouldUseServiceWorkerShortTimeout", false); } 81 50 82 51 bool allowsLinkPreview() const { return boolTestRunnerFeatureValue("allowsLinkPreview"); } … … 113 82 std::vector<std::string> overrideLanguages() const { return stringVectorTestRunnerFeatureValue("language"); } 114 83 84 bool shouldEnableProcessSwapOnNavigation() const 85 { 86 return enableProcessSwapOnNavigation() || enableProcessSwapOnWindowOpen(); 87 } 88 115 89 const std::unordered_map<std::string, bool>& experimentalFeatures() const { return m_features.experimentalFeatures; } 116 90 const std::unordered_map<std::string, bool>& internalDebugFeatures() const { return m_features.internalDebugFeatures; } 117 91 118 std::vector<std::pair<std::string, bool>> boolWKPreferences() const; 92 const std::unordered_map<std::string, bool>& boolWebPreferenceFeatures() const { return m_features.boolWebPreferenceFeatures; } 93 const std::unordered_map<std::string, double>& doubleWebPreferenceFeatures() const { return m_features.doubleWebPreferenceFeatures; } 94 const std::unordered_map<std::string, uint32_t>& uint32WebPreferenceFeatures() const { return m_features.uint32WebPreferenceFeatures; } 95 const std::unordered_map<std::string, std::string>& stringWebPreferenceFeatures() const { return m_features.stringWebPreferenceFeatures; } 119 96 120 97 bool hasSameInitializationOptions(const TestOptions&) const; 121 98 122 99 private: 123 bool boolWebPreferenceFeatureValue(std::string key ) const;100 bool boolWebPreferenceFeatureValue(std::string key, bool defaultValue) const; 124 101 bool boolTestRunnerFeatureValue(std::string key) const; 125 102 double doubleTestRunnerFeatureValue(std::string key) const; -
trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
r268498 r268604 352 352 65EB859D11EC67CC0034D300 /* ActivateFonts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActivateFonts.h; sourceTree = "<group>"; }; 353 353 65EB859F11EC67CC0034D300 /* ActivateFontsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ActivateFontsCocoa.mm; sourceTree = "<group>"; }; 354 7C8A1F5625351EC600C5291E /* TestOptionsGeneratedKeys.h.erb */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestOptionsGeneratedKeys.h.erb; sourceTree = "<group>"; }; 355 7C8A1F5725351EC600C5291E /* check-xcfilelists.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "check-xcfilelists.sh"; sourceTree = "<group>"; }; 356 7C8A1F5825351EC600C5291E /* generate-derived-sources.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "generate-derived-sources.sh"; sourceTree = "<group>"; }; 357 7CAA0E7625353BF500C519E5 /* TestOptionsGeneratedKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestOptionsGeneratedKeys.h; sourceTree = "<group>"; }; 354 358 7CFF9BC52534AF1D0008009F /* TestFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestFeatures.h; path = ../TestRunnerShared/TestFeatures.h; sourceTree = "<group>"; }; 355 359 7CFF9BC62534AF1D0008009F /* TestFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestFeatures.cpp; path = ../TestRunnerShared/TestFeatures.cpp; sourceTree = "<group>"; }; … … 481 485 children = ( 482 486 49AEEF692407278200C87E4C /* Info.plist */, 483 0F18E71A1D6BC4BC0027E547 /* TestRunnerShared */,484 487 BC952EC511F3C10F003398B4 /* DerivedSources.make */, 485 488 2EE52CEA1890A9A80010ED21 /* WebKitTestRunnerApp-Info.plist */, 486 489 BC99CBF11207642D00FDEE76 /* Shared */, 487 490 08FB7795FE84155DC02AAC07 /* TestRunner */, 491 0F18E71A1D6BC4BC0027E547 /* TestRunnerShared */, 488 492 BC25183511D1571D002EBC01 /* InjectedBundle */, 489 493 BC793401118F7C8A005EA8E2 /* Configurations */, … … 491 495 BC25194411D15DBE002EBC01 /* Resources */, 492 496 2EE52CE81890A9A80010ED21 /* WebKitTestRunnerApp */, 497 7C8A1F5425351EC600C5291E /* Scripts */, 493 498 2EE52CE11890A9A80010ED21 /* Frameworks */, 494 499 1AB674ADFE9D54B511CA2CBB /* Products */, … … 500 505 isa = PBXGroup; 501 506 children = ( 507 7CAA0E7525353BC500C519E5 /* Derived Sources */, 502 508 BC9192021333E4CD003011DC /* cg */, 503 509 0FEB90A11905BC4A000FDBF3 /* cocoa */, … … 750 756 path = mac; 751 757 sourceTree = "<group>"; 758 }; 759 7C8A1F5425351EC600C5291E /* Scripts */ = { 760 isa = PBXGroup; 761 children = ( 762 7C8A1F5525351EC600C5291E /* PreferencesTemplates */, 763 7C8A1F5725351EC600C5291E /* check-xcfilelists.sh */, 764 7C8A1F5825351EC600C5291E /* generate-derived-sources.sh */, 765 ); 766 path = Scripts; 767 sourceTree = "<group>"; 768 }; 769 7C8A1F5525351EC600C5291E /* PreferencesTemplates */ = { 770 isa = PBXGroup; 771 children = ( 772 7C8A1F5625351EC600C5291E /* TestOptionsGeneratedKeys.h.erb */, 773 ); 774 path = PreferencesTemplates; 775 sourceTree = "<group>"; 776 }; 777 7CAA0E7525353BC500C519E5 /* Derived Sources */ = { 778 isa = PBXGroup; 779 children = ( 780 7CAA0E7625353BF500C519E5 /* TestOptionsGeneratedKeys.h */, 781 ); 782 name = "Derived Sources"; 783 path = DerivedSources/WebKitTestRunner; 784 sourceTree = BUILT_PRODUCTS_DIR; 752 785 }; 753 786 BC14E4E0120E02F900826C0C /* Controllers */ = {
Note: See TracChangeset
for help on using the changeset viewer.