Title: [268498] trunk/Tools
Revision
268498
Author
hector_i_lo...@apple.com
Date
2020-10-14 16:21:10 -0700 (Wed, 14 Oct 2020)

Log Message

Unreviewed, reverting r268474.

Revision is causing a number of test failures across iOS and
macOS

Reverted changeset:

"[Testing] Support configuring any preference from test
headers for WebKitTestRunner"
https://bugs.webkit.org/show_bug.cgi?id=217645
https://trac.webkit.org/changeset/268474

Modified Paths

Removed Paths

  • trunk/Tools/WebKitTestRunner/Scripts/PreferencesTemplates/

Diff

Modified: trunk/Tools/ChangeLog (268497 => 268498)


--- trunk/Tools/ChangeLog	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/ChangeLog	2020-10-14 23:21:10 UTC (rev 268498)
@@ -1,3 +1,17 @@
+2020-10-14  Hector Lopez  <hector_i_lo...@apple.com>
+
+        Unreviewed, reverting r268474.
+
+        Revision is causing a number of test failures across iOS and
+        macOS
+
+        Reverted changeset:
+
+        "[Testing] Support configuring any preference from test
+        headers for WebKitTestRunner"
+        https://bugs.webkit.org/show_bug.cgi?id=217645
+        https://trac.webkit.org/changeset/268474
+
 2020-10-14  Ryosuke Niwa  <rn...@webkit.org>
 
         Enabling IPC testing API should prevent the termination of WebContent process which sends an invalid IPC

Modified: trunk/Tools/WebKitTestRunner/CMakeLists.txt (268497 => 268498)


--- trunk/Tools/WebKitTestRunner/CMakeLists.txt	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/WebKitTestRunner/CMakeLists.txt	2020-10-14 23:21:10 UTC (rev 268498)
@@ -30,7 +30,6 @@
     ${CMAKE_BINARY_DIR}
     ${WebKitTestRunner_SHARED_DIR}
     ${WebKitTestRunner_BINDINGS_DIR}
-    ${WebKitTestRunner_DERIVED_SOURCES_DIR}
     ${WebKitTestRunner_DERIVED_SOURCES_DIR}/UIScriptContext
     ${WebKitTestRunner_DIR}
     ${WebKitTestRunner_UISCRIPTCONTEXT_DIR}
@@ -44,29 +43,6 @@
     ${WebCore_PRIVATE_FRAMEWORK_HEADERS_DIR}
 )
 
-set(WebKitTestRunner_WEB_PREFERENCES_TEMPLATES
-    ${WebKitTestRunner_DIR}/Scripts/PreferencesTemplates/TestOptionsGeneratedKeys.h.erb
-)
-
-set(WebKitTestRunner_WEB_PREFERENCES
-    ${WTF_SCRIPTS_DIR}/Preferences/WebPreferences.yaml
-    ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesDebug.yaml
-    ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesExperimental.yaml
-    ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesInternal.yaml
-)
-
-set_source_files_properties(${WebKitTestRunner_WEB_PREFERENCES} PROPERTIES GENERATED TRUE)
-
-add_custom_command(
-    OUTPUT ${WebKitTestRunner_DERIVED_SOURCES_DIR}/TestOptionsGeneratedKeys.h
-    DEPENDS ${WebKitTestRunner_WEB_PREFERENCES_TEMPLATES} ${WebKitTestRunner_WEB_PREFERENCES} WTF_CopyPreferences
-    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
-    VERBATIM)
-
-list(APPEND WebKitTestRunner_SOURCES
-    ${WebKitTestRunner_DERIVED_SOURCES_DIR}/TestOptionsGeneratedKeys.h
-)
-
 set(WebKitTestRunnerInjectedBundle_SOURCES
     InjectedBundle/AccessibilityController.cpp
     InjectedBundle/AccessibilityTextMarker.cpp

Modified: trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig (268497 => 268498)


--- trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/WebKitTestRunner/Configurations/Base.xcconfig	2020-10-14 23:21:10 UTC (rev 268498)
@@ -100,14 +100,6 @@
 PRODUCTION_FRAMEWORKS_DIR[sdk=embedded*] = $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
 PRODUCTION_FRAMEWORKS_DIR[sdk=macosx*] = $(SDKROOT)$(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks;
 
-WTF_BUILD_SCRIPTS_DIR = $(WTF_BUILD_SCRIPTS_DIR_$(CONFIGURATION));
-WTF_BUILD_SCRIPTS_DIR_Release = $(WTF_BUILD_SCRIPTS_DIR_engineering);
-WTF_BUILD_SCRIPTS_DIR_Debug = $(WTF_BUILD_SCRIPTS_DIR_engineering);
-WTF_BUILD_SCRIPTS_DIR_Production = $(WTF_BUILD_SCRIPTS_DIR_Production_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH));
-WTF_BUILD_SCRIPTS_DIR_Production_COCOA_TOUCH_YES = $(SDKROOT)$(WK_ALTERNATE_WEBKIT_SDK_PATH)/usr/local/include/wtf/Scripts;
-WTF_BUILD_SCRIPTS_DIR_Production_COCOA_TOUCH_NO = $(SDKROOT)/usr/local/include/wtf/Scripts;
-WTF_BUILD_SCRIPTS_DIR_engineering = $(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts;
-
 WEBCORE_PRIVATE_HEADERS_DIR = $(WEBCORE_PRIVATE_HEADERS_DIR_$(CONFIGURATION));
 WEBCORE_PRIVATE_HEADERS_DIR_Release = $(WEBCORE_PRIVATE_HEADERS_DIR_engineering);
 WEBCORE_PRIVATE_HEADERS_DIR_Debug = $(WEBCORE_PRIVATE_HEADERS_DIR_engineering);
@@ -131,7 +123,6 @@
 WK_COCOA_TOUCH_watchsimulator = cocoatouch;
 WK_COCOA_TOUCH_appletvos = cocoatouch;
 WK_COCOA_TOUCH_appletvsimulator = cocoatouch;
-WK_IS_COCOA_TOUCH = $(WK_NOT_$(WK_EMPTY_$(WK_COCOA_TOUCH)));
 
 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));
 HEADER_SEARCH_PATHS_ = ;

Modified: trunk/Tools/WebKitTestRunner/DerivedSources-input.xcfilelist (268497 => 268498)


--- trunk/Tools/WebKitTestRunner/DerivedSources-input.xcfilelist	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/WebKitTestRunner/DerivedSources-input.xcfilelist	2020-10-14 23:21:10 UTC (rev 268498)
@@ -1,9 +1,4 @@
 # This file is generated by the generate-xcfilelists script.
-$(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/GeneratePreferences.rb
-$(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/Preferences/WebPreferences.yaml
-$(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/Preferences/WebPreferencesDebug.yaml
-$(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/Preferences/WebPreferencesExperimental.yaml
-$(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts/Preferences/WebPreferencesInternal.yaml
 $(PROJECT_DIR)/../TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
 $(PROJECT_DIR)/InjectedBundle/Bindings/AccessibilityController.idl
 $(PROJECT_DIR)/InjectedBundle/Bindings/AccessibilityTextMarker.idl
@@ -14,7 +9,6 @@
 $(PROJECT_DIR)/InjectedBundle/Bindings/GCController.idl
 $(PROJECT_DIR)/InjectedBundle/Bindings/TestRunner.idl
 $(PROJECT_DIR)/InjectedBundle/Bindings/TextInputController.idl
-$(PROJECT_DIR)/Scripts/PreferencesTemplates/TestOptionsGeneratedKeys.h.erb
 $(WEBCORE_PRIVATE_HEADERS_DIR)/CodeGenerator.pm
 $(WEBCORE_PRIVATE_HEADERS_DIR)/IDLAttributes.json
 $(WEBCORE_PRIVATE_HEADERS_DIR)/IDLParser.pm

Modified: trunk/Tools/WebKitTestRunner/DerivedSources-output.xcfilelist (268497 => 268498)


--- trunk/Tools/WebKitTestRunner/DerivedSources-output.xcfilelist	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/WebKitTestRunner/DerivedSources-output.xcfilelist	2020-10-14 23:21:10 UTC (rev 268498)
@@ -17,4 +17,3 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitTestRunner/JSTextInputController.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitTestRunner/JSUIScriptController.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitTestRunner/JSUIScriptController.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitTestRunner/TestOptionsGeneratedKeys.h

Modified: trunk/Tools/WebKitTestRunner/DerivedSources.make (268497 => 268498)


--- trunk/Tools/WebKitTestRunner/DerivedSources.make	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/WebKitTestRunner/DerivedSources.make	2020-10-14 23:21:10 UTC (rev 268498)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2020 Apple Inc. All rights reserved.
+# Copyright (C) 2010 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -26,27 +26,6 @@
     $(WebKitTestRunner)/../TestRunnerShared/UIScriptContext/Bindings \
 #
 
-RUBY = ruby
-
-WEB_PREFERENCES = \
-    ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferences.yaml \
-    ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferencesDebug.yaml \
-    ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferencesExperimental.yaml \
-    ${WTF_BUILD_SCRIPTS_DIR}/Preferences/WebPreferencesInternal.yaml \
-#
-
-WEB_PREFERENCES_TEMPLATES = \
-    $(WebKitTestRunner)/Scripts/PreferencesTemplates/TestOptionsGeneratedKeys.h.erb \
-#
-WEB_PREFERENCES_FILES = $(basename $(notdir $(WEB_PREFERENCES_TEMPLATES)))
-WEB_PREFERENCES_PATTERNS = $(subst .,%,$(WEB_PREFERENCES_FILES))
-
-all : $(WEB_PREFERENCES_FILES)
-
-$(WEB_PREFERENCES_PATTERNS) : $(WTF_BUILD_SCRIPTS_DIR)/GeneratePreferences.rb $(WEB_PREFERENCES_TEMPLATES) $(WEB_PREFERENCES)
-	$(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))
-
-
 INJECTED_BUNDLE_INTERFACES = \
     AccessibilityController \
     AccessibilityTextMarker \

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (268497 => 268498)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2020-10-14 23:21:10 UTC (rev 268498)
@@ -469,7 +469,6 @@
     m_checkForWorldLeaks = options.checkForWorldLeaks;
     m_allowAnyHTTPSCertificateForAllowedHosts = options.allowAnyHTTPSCertificateForAllowedHosts;
 
-    m_globalFeatures = TestOptions::defaults();
     m_globalFeatures.internalDebugFeatures = options.internalFeatures;
     m_globalFeatures.experimentalFeatures = options.experimentalFeatures;
     m_globalFeatures.boolWebPreferenceFeatures.insert({ "AcceleratedDrawingEnabled", options.shouldUseAcceleratedDrawing });
@@ -857,6 +856,9 @@
     for (const auto& [key, value]  : options.internalDebugFeatures())
         WKPreferencesSetInternalDebugFeatureForKey(preferences, value, toWK(key).get());
 
+    for (const auto& [key, value] : options.boolWKPreferences())
+        WKPreferencesSetBoolValueForKey(preferences, value, toWK(key).get());
+
     // FIXME: Convert these to default values for TestOptions.
     WKPreferencesSetProcessSwapOnNavigationEnabled(preferences, options.contextOptions().shouldEnableProcessSwapOnNavigation());
     WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
@@ -922,19 +924,6 @@
 #endif
 
     platformResetPreferencesToConsistentValues();
-
-    for (const auto& [key, value] : options.boolWebPreferenceFeatures())
-        WKPreferencesSetBoolValueForKey(preferences, value, toWK(key).get());
-
-    for (const auto& [key, value] : options.doubleWebPreferenceFeatures())
-        WKPreferencesSetDoubleValueForKey(preferences, value, toWK(key).get());
-
-    for (const auto& [key, value] : options.uint32WebPreferenceFeatures())
-        WKPreferencesSetUInt32ValueForKey(preferences, value, toWK(key).get());
-
-    for (const auto& [key, value] : options.stringWebPreferenceFeatures())
-        WKPreferencesSetStringValueForKey(preferences, toWK(value).get(), toWK(key).get());
-
 }
 
 bool TestController::resetStateToConsistentValues(const TestOptions& options, ResetStage resetStage)

Modified: trunk/Tools/WebKitTestRunner/TestOptions.cpp (268497 => 268498)


--- trunk/Tools/WebKitTestRunner/TestOptions.cpp	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/WebKitTestRunner/TestOptions.cpp	2020-10-14 23:21:10 UTC (rev 268498)
@@ -26,81 +26,131 @@
 #include "config.h"
 #include "TestOptions.h"
 
-#include "TestOptionsGeneratedKeys.h"
+#include <fstream>
+#include <string>
 #include <wtf/Assertions.h>
+#include <wtf/StdFilesystem.h>
 
 namespace WTR {
 
-const TestFeatures& TestOptions::defaults()
+static const std::unordered_map<std::string, bool>& boolWebPreferencesDefaultsMap()
 {
-    static TestFeatures features;
-    if (features.boolWebPreferenceFeatures.empty()) {
-        features.boolWebPreferenceFeatures = {
-            // These are WebPreference values that must always be set as they may
-            // differ from the default set in the WebPreferences*.yaml configuration.
-            { "AllowTopNavigationToDataURLs", true },
-            { "CaptureAudioInGPUProcessEnabled", false },
-            { "CaptureAudioInUIProcessEnabled", false },
-            { "CaptureVideoInGPUProcessEnabled", false },
-            { "CaptureVideoInUIProcessEnabled", false },
-            { "DOMPasteAllowed", true },
-            { "MockScrollbarsEnabled", true },
-            { "ModernMediaControlsEnabled", true },
-            { "NeedsSiteSpecificQuirks", false },
-            { "PageVisibilityBasedProcessSuppressionEnabled", false },
-            { "UsesBackForwardCache", false },
-            { "WebAuthenticationEnabled", true },
-            { "WebAuthenticationLocalAuthenticatorEnabled", true },
-        };
-        features.boolTestRunnerFeatures = {
-            { "allowsLinkPreview", true },
-            { "dumpJSConsoleLogInStdErr", false },
-            { "editable", false },
-            { "enableInAppBrowserPrivacy", false },
-            { "enableProcessSwapOnNavigation", true },
-            { "enableProcessSwapOnWindowOpen", false },
-            { "ignoreSynchronousMessagingTimeouts", false },
-            { "ignoresViewportScaleLimits", false },
-            { "isAppBoundWebView", false },
-            { "runSingly", false },
-            { "shouldHandleRunOpenPanel", true },
-            { "shouldPresentPopovers", true },
-            { "shouldShowTouches", false },
-            { "shouldShowWebView", false },
-            { "spellCheckingDots", false },
-            { "useCharacterSelectionGranularity", false },
-            { "useDataDetection", false },
-            { "useEphemeralSession", false },
-            { "useFlexibleViewport", false },
-            { "useRemoteLayerTree", false },
-            { "useThreadedScrolling", false },
-        };
-        features.doubleTestRunnerFeatures = {
-            { "contentInset.top", 0 },
-            { "deviceScaleFactor", 1 },
-            { "viewHeight", 600 },
-            { "viewWidth", 800 },
-        };
-        features.stringTestRunnerFeatures = {
-            { "additionalSupportedImageTypes", { } },
-            { "applicationBundleIdentifier", { } },
-            { "applicationManifest", { } },
-            { "contentMode", { } },
-            { "jscOptions", { } },
-            { "standaloneWebApplicationURL", { } },
-        };
-        features.stringVectorTestRunnerFeatures = {
-            { "language", { } },
-        };
-    }
-    
-    return features;
+    static std::unordered_map<std::string, bool> map {
+        { "AcceleratedDrawingEnabled", false },
+        { "AllowCrossOriginSubresourcesToAskForCredentials", false },
+        { "AllowTopNavigationToDataURLs", true },
+        { "AttachmentElementEnabled", false },
+        { "CaptureAudioInGPUProcessEnabled", false },
+        { "CaptureAudioInUIProcessEnabled", false },
+        { "CaptureVideoInGPUProcessEnabled", false },
+        { "CaptureVideoInUIProcessEnabled", false },
+        { "ColorFilterEnabled", false },
+        { "DOMPasteAllowed", true },
+        { "InspectorAdditionsEnabled", false },
+        { "KeygenElementEnabled", false },
+        { "MenuItemElementEnabled", false },
+        { "MockScrollbarsEnabled", true },
+        { "ModernMediaControlsEnabled", true },
+        { "NeedsSiteSpecificQuirks", false },
+        { "PageVisibilityBasedProcessSuppressionEnabled", false },
+        { "PunchOutWhiteBackgroundsInDarkMode", false },
+        { "ServiceControlsEnabled", false },
+        { "ShouldIgnoreMetaViewport", false },
+        { "ShouldUseServiceWorkerShortTimeout", false },
+        { "UsesBackForwardCache", false },
+        { "WebAuthenticationEnabled", true },
+        { "WebAuthenticationLocalAuthenticatorEnabled", true },
+    };
+    return map;
 }
 
+static const std::unordered_map<std::string, bool>& boolTestRunnerDefaultsMap()
+{
+    static std::unordered_map<std::string, bool> map {
+        { "allowsLinkPreview", true },
+        { "dumpJSConsoleLogInStdErr", false },
+        { "editable", false },
+        { "enableInAppBrowserPrivacy", false },
+        { "enableProcessSwapOnNavigation", true },
+        { "enableProcessSwapOnWindowOpen", false },
+        { "ignoreSynchronousMessagingTimeouts", false },
+        { "ignoresViewportScaleLimits", false },
+        { "isAppBoundWebView", false },
+        { "runSingly", false },
+        { "shouldHandleRunOpenPanel", true },
+        { "shouldPresentPopovers", true },
+        { "shouldShowTouches", false },
+        { "shouldShowWebView", false },
+        { "spellCheckingDots", false },
+        { "useCharacterSelectionGranularity", false },
+        { "useDataDetection", false },
+        { "useEphemeralSession", false },
+        { "useFlexibleViewport", false },
+        { "useRemoteLayerTree", false },
+        { "useThreadedScrolling", false },
+    };
+    return map;
+}
+
+static const std::unordered_map<std::string, double>& doubleTestRunnerDefaultsMap()
+{
+    static std::unordered_map<std::string, double> map {
+        { "contentInset.top", 0 },
+        { "deviceScaleFactor", 1 },
+        { "viewHeight", 600 },
+        { "viewWidth", 800 },
+    };
+    return map;
+}
+
+static const std::unordered_map<std::string, std::string>& stringTestRunnerDefaultsMap()
+{
+    static std::unordered_map<std::string, std::string> map {
+        { "additionalSupportedImageTypes", { } },
+        { "applicationBundleIdentifier", { } },
+        { "applicationManifest", { } },
+        { "contentMode", { } },
+        { "jscOptions", { } },
+        { "standaloneWebApplicationURL", { } },
+    };
+    return map;
+}
+
+static const std::unordered_map<std::string, std::vector<std::string>>& stringVectorTestRunnerDefaultsMap()
+{
+    static std::unordered_map<std::string, std::vector<std::string>> map {
+        { "language", { } },
+    };
+    return map;
+}
+
 const std::unordered_map<std::string, TestHeaderKeyType>& TestOptions::keyTypeMapping()
 {
-    static const std::unordered_map<std::string, TestHeaderKeyType> map {
-        GENERATED_WEB_PREFERENCE_KEY_TYPE_MAPPINGS
+    static std::unordered_map<std::string, TestHeaderKeyType> map {
+        { "AcceleratedDrawingEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "AllowCrossOriginSubresourcesToAskForCredentials", TestHeaderKeyType::BoolWebPreference },
+        { "AllowTopNavigationToDataURLs", TestHeaderKeyType::BoolWebPreference },
+        { "AttachmentElementEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "CaptureAudioInGPUProcessEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "CaptureAudioInUIProcessEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "CaptureVideoInGPUProcessEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "CaptureVideoInUIProcessEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "ColorFilterEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "DOMPasteAllowed", TestHeaderKeyType::BoolWebPreference },
+        { "InspectorAdditionsEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "KeygenElementEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "MenuItemElementEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "MockScrollbarsEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "ModernMediaControlsEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "NeedsSiteSpecificQuirks", TestHeaderKeyType::BoolWebPreference },
+        { "PageVisibilityBasedProcessSuppressionEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "PunchOutWhiteBackgroundsInDarkMode", TestHeaderKeyType::BoolWebPreference },
+        { "ServiceControlsEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "ShouldIgnoreMetaViewport", TestHeaderKeyType::BoolWebPreference },
+        { "ShouldUseServiceWorkerShortTimeout", TestHeaderKeyType::BoolWebPreference },
+        { "UsesBackForwardCache", TestHeaderKeyType::BoolWebPreference },
+        { "WebAuthenticationEnabled", TestHeaderKeyType::BoolWebPreference },
+        { "WebAuthenticationLocalAuthenticatorEnabled", TestHeaderKeyType::BoolWebPreference },
 
         { "allowsLinkPreview", TestHeaderKeyType::BoolTestRunner },
         { "dumpJSConsoleLogInStdErr", TestHeaderKeyType::BoolTestRunner },
@@ -142,6 +192,11 @@
     return map;
 }
 
+TestOptions::TestOptions(TestFeatures features)
+    : m_features { features }
+{
+}
+
 bool TestOptions::hasSameInitializationOptions(const TestOptions& options) const
 {
     if (m_features.experimentalFeatures != options.m_features.experimentalFeatures)
@@ -167,42 +222,46 @@
     return true;
 }
 
-bool TestOptions::boolWebPreferenceFeatureValue(std::string key, bool defaultValue) const
+std::vector<std::pair<std::string, bool>> TestOptions::boolWKPreferences() const
 {
-    auto it = m_features.boolWebPreferenceFeatures.find(key);
-    if (it != m_features.boolWebPreferenceFeatures.end())
-        return it->second;
-    return defaultValue;
+    std::vector<std::pair<std::string, bool>> result;
+
+    for (auto [key, defaultValue] : boolWebPreferencesDefaultsMap())
+        result.push_back({ key, boolWebPreferenceFeatureValue(key) });
+
+    return result;
 }
 
-template<typename T> T testRunnerFeatureValue(std::string key, const std::unordered_map<std::string, T>& map)
+template<typename T> T featureValue(std::string key, const std::unordered_map<std::string, T>& map, const std::unordered_map<std::string, T>& defaultsMap)
 {
-    // All test runner features should always exist in their corresponding map since the base/global defaults
-    // contains default values for all of them.
-
     auto it = map.find(key);
-    ASSERT(it != map.end());
-    return it->second;
+    if (it != map.end())
+        return it->second;
+    
+    auto defaultsMapIt = defaultsMap.find(key);
+    ASSERT(defaultsMapIt != defaultsMap.end());
+    return defaultsMapIt->second;
 }
 
+bool TestOptions::boolWebPreferenceFeatureValue(std::string key) const
+{
+    return featureValue(key, m_features.boolWebPreferenceFeatures, boolWebPreferencesDefaultsMap());
+}
 bool TestOptions::boolTestRunnerFeatureValue(std::string key) const
 {
-    return testRunnerFeatureValue(key, m_features.boolTestRunnerFeatures);
+    return featureValue(key, m_features.boolTestRunnerFeatures, boolTestRunnerDefaultsMap());
 }
-
 double TestOptions::doubleTestRunnerFeatureValue(std::string key) const
 {
-    return testRunnerFeatureValue(key, m_features.doubleTestRunnerFeatures);
+    return featureValue(key, m_features.doubleTestRunnerFeatures, doubleTestRunnerDefaultsMap());
 }
-
 std::string TestOptions::stringTestRunnerFeatureValue(std::string key) const
 {
-    return testRunnerFeatureValue(key, m_features.stringTestRunnerFeatures);
+    return featureValue(key, m_features.stringTestRunnerFeatures, stringTestRunnerDefaultsMap());
 }
-
 std::vector<std::string> TestOptions::stringVectorTestRunnerFeatureValue(std::string key) const
 {
-    return testRunnerFeatureValue(key, m_features.stringVectorTestRunnerFeatures);
+    return featureValue(key, m_features.stringVectorTestRunnerFeatures, stringVectorTestRunnerDefaultsMap());
 }
 
 }

Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (268497 => 268498)


--- trunk/Tools/WebKitTestRunner/TestOptions.h	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h	2020-10-14 23:21:10 UTC (rev 268498)
@@ -59,13 +59,9 @@
 
 class TestOptions {
 public:
-    static const TestFeatures& defaults();
     static const std::unordered_map<std::string, TestHeaderKeyType>& keyTypeMapping();
 
-    explicit TestOptions(TestFeatures features)
-        : m_features { std::move(features) }
-    {
-    }
+    explicit TestOptions(TestFeatures);
 
     ContextOptions contextOptions() const
     {
@@ -78,10 +74,10 @@
         };
     }
 
-    bool allowTopNavigationToDataURLs() const { return boolWebPreferenceFeatureValue("AllowTopNavigationToDataURLs", true); }
-    bool enableAttachmentElement() const { return boolWebPreferenceFeatureValue("AttachmentElementEnabled", false); }
-    bool punchOutWhiteBackgroundsInDarkMode() const { return boolWebPreferenceFeatureValue("PunchOutWhiteBackgroundsInDarkMode", false); }
-    bool useServiceWorkerShortTimeout() const { return boolWebPreferenceFeatureValue("ShouldUseServiceWorkerShortTimeout", false); }
+    bool allowTopNavigationToDataURLs() const { return boolWebPreferenceFeatureValue("AllowTopNavigationToDataURLs"); }
+    bool enableAttachmentElement() const { return boolWebPreferenceFeatureValue("AttachmentElementEnabled"); }
+    bool punchOutWhiteBackgroundsInDarkMode() const { return boolWebPreferenceFeatureValue("PunchOutWhiteBackgroundsInDarkMode"); }
+    bool useServiceWorkerShortTimeout() const { return boolWebPreferenceFeatureValue("ShouldUseServiceWorkerShortTimeout"); }
 
     bool allowsLinkPreview() const { return boolTestRunnerFeatureValue("allowsLinkPreview"); }
     bool dumpJSConsoleLogInStdErr() const { return boolTestRunnerFeatureValue("dumpJSConsoleLogInStdErr"); }
@@ -119,15 +115,12 @@
     const std::unordered_map<std::string, bool>& experimentalFeatures() const { return m_features.experimentalFeatures; }
     const std::unordered_map<std::string, bool>& internalDebugFeatures() const { return m_features.internalDebugFeatures; }
 
-    const std::unordered_map<std::string, bool>& boolWebPreferenceFeatures() const { return m_features.boolWebPreferenceFeatures; }
-    const std::unordered_map<std::string, double>& doubleWebPreferenceFeatures() const { return m_features.doubleWebPreferenceFeatures; }
-    const std::unordered_map<std::string, uint32_t>& uint32WebPreferenceFeatures() const { return m_features.uint32WebPreferenceFeatures; }
-    const std::unordered_map<std::string, std::string>& stringWebPreferenceFeatures() const { return m_features.stringWebPreferenceFeatures; }
+    std::vector<std::pair<std::string, bool>> boolWKPreferences() const;
 
     bool hasSameInitializationOptions(const TestOptions&) const;
 
 private:
-    bool boolWebPreferenceFeatureValue(std::string key, bool defaultValue) const;
+    bool boolWebPreferenceFeatureValue(std::string key) const;
     bool boolTestRunnerFeatureValue(std::string key) const;
     double doubleTestRunnerFeatureValue(std::string key) const;
     std::string stringTestRunnerFeatureValue(std::string key) const;

Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (268497 => 268498)


--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj	2020-10-14 23:14:55 UTC (rev 268497)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj	2020-10-14 23:21:10 UTC (rev 268498)
@@ -351,10 +351,6 @@
 		6510A78111EC643800410867 /* WebKitWeightWatcher900.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher900.ttf; path = fonts/WebKitWeightWatcher900.ttf; sourceTree = "<group>"; };
 		65EB859D11EC67CC0034D300 /* ActivateFonts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActivateFonts.h; sourceTree = "<group>"; };
 		65EB859F11EC67CC0034D300 /* ActivateFontsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ActivateFontsCocoa.mm; sourceTree = "<group>"; };
-		7C8A1F5625351EC600C5291E /* TestOptionsGeneratedKeys.h.erb */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestOptionsGeneratedKeys.h.erb; sourceTree = "<group>"; };
-		7C8A1F5725351EC600C5291E /* check-xcfilelists.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "check-xcfilelists.sh"; sourceTree = "<group>"; };
-		7C8A1F5825351EC600C5291E /* generate-derived-sources.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "generate-derived-sources.sh"; sourceTree = "<group>"; };
-		7CAA0E7625353BF500C519E5 /* TestOptionsGeneratedKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestOptionsGeneratedKeys.h; sourceTree = "<group>"; };
 		7CFF9BC52534AF1D0008009F /* TestFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestFeatures.h; path = ../TestRunnerShared/TestFeatures.h; sourceTree = "<group>"; };
 		7CFF9BC62534AF1D0008009F /* TestFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestFeatures.cpp; path = ../TestRunnerShared/TestFeatures.cpp; sourceTree = "<group>"; };
 		7CFF9BC72534AF1D0008009F /* TestCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestCommand.cpp; path = ../TestRunnerShared/TestCommand.cpp; sourceTree = "<group>"; };
@@ -484,17 +480,16 @@
 			isa = PBXGroup;
 			children = (
 				49AEEF692407278200C87E4C /* Info.plist */,
+				0F18E71A1D6BC4BC0027E547 /* TestRunnerShared */,
 				BC952EC511F3C10F003398B4 /* DerivedSources.make */,
 				2EE52CEA1890A9A80010ED21 /* WebKitTestRunnerApp-Info.plist */,
 				BC99CBF11207642D00FDEE76 /* Shared */,
 				08FB7795FE84155DC02AAC07 /* TestRunner */,
-				0F18E71A1D6BC4BC0027E547 /* TestRunnerShared */,
 				BC25183511D1571D002EBC01 /* InjectedBundle */,
 				BC793401118F7C8A005EA8E2 /* Configurations */,
 				08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
 				BC25194411D15DBE002EBC01 /* Resources */,
 				2EE52CE81890A9A80010ED21 /* WebKitTestRunnerApp */,
-				7C8A1F5425351EC600C5291E /* Scripts */,
 				2EE52CE11890A9A80010ED21 /* Frameworks */,
 				1AB674ADFE9D54B511CA2CBB /* Products */,
 			);
@@ -504,7 +499,6 @@
 		08FB7795FE84155DC02AAC07 /* TestRunner */ = {
 			isa = PBXGroup;
 			children = (
-				7CAA0E7525353BC500C519E5 /* Derived Sources */,
 				BC9192021333E4CD003011DC /* cg */,
 				0FEB90A11905BC4A000FDBF3 /* cocoa */,
 				2EE52D121890A9FB0010ED21 /* ios */,
@@ -756,33 +750,6 @@
 			path = mac;
 			sourceTree = "<group>";
 		};
-		7C8A1F5425351EC600C5291E /* Scripts */ = {
-			isa = PBXGroup;
-			children = (
-				7C8A1F5525351EC600C5291E /* PreferencesTemplates */,
-				7C8A1F5725351EC600C5291E /* check-xcfilelists.sh */,
-				7C8A1F5825351EC600C5291E /* generate-derived-sources.sh */,
-			);
-			path = Scripts;
-			sourceTree = "<group>";
-		};
-		7C8A1F5525351EC600C5291E /* PreferencesTemplates */ = {
-			isa = PBXGroup;
-			children = (
-				7C8A1F5625351EC600C5291E /* TestOptionsGeneratedKeys.h.erb */,
-			);
-			path = PreferencesTemplates;
-			sourceTree = "<group>";
-		};
-		7CAA0E7525353BC500C519E5 /* Derived Sources */ = {
-			isa = PBXGroup;
-			children = (
-				7CAA0E7625353BF500C519E5 /* TestOptionsGeneratedKeys.h */,
-			);
-			name = "Derived Sources";
-			path = DerivedSources/WebKitTestRunner;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
 		BC14E4E0120E02F900826C0C /* Controllers */ = {
 			isa = PBXGroup;
 			children = (
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to