2015-09-30 01:20:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Apple Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "TestOptions.h"
|
|
|
|
|
2020-10-16 19:37:06 +00:00
|
|
|
#include "TestOptionsGeneratedKeys.h"
|
2020-10-12 21:54:50 +00:00
|
|
|
#include <wtf/Assertions.h>
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
|
2015-09-30 01:20:23 +00:00
|
|
|
namespace WTR {
|
|
|
|
|
2021-02-03 10:34:39 +00:00
|
|
|
#if PLATFORM(COCOA)
|
2021-01-29 09:01:22 +00:00
|
|
|
static constexpr bool captureAudioInGPUProcessEnabledValue = true;
|
|
|
|
static constexpr bool captureVideoInGPUProcessEnabledValue = true;
|
|
|
|
#else
|
|
|
|
static constexpr bool captureAudioInGPUProcessEnabledValue = false;
|
|
|
|
static constexpr bool captureVideoInGPUProcessEnabledValue = false;
|
|
|
|
#endif
|
|
|
|
|
2021-04-11 20:11:34 +00:00
|
|
|
#if PLATFORM(IOS_FAMILY_SIMULATOR)
|
|
|
|
static constexpr bool mediaSourceEnabledValue = false;
|
|
|
|
#else
|
|
|
|
static constexpr bool mediaSourceEnabledValue = true;
|
|
|
|
#endif
|
|
|
|
|
2020-10-16 19:37:06 +00:00
|
|
|
const TestFeatures& TestOptions::defaults()
|
2020-10-13 17:16:15 +00:00
|
|
|
{
|
2020-10-16 19:37:06 +00:00
|
|
|
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.
|
2021-04-11 20:11:34 +00:00
|
|
|
|
|
|
|
// Please do not add new options here if they are not necessary (e.g.
|
|
|
|
// an experimental feature which gets enabled by default automatically)
|
|
|
|
// as it adds a small amount of unnecessary work per-test.
|
|
|
|
|
2020-11-04 22:22:03 +00:00
|
|
|
{ "AcceleratedDrawingEnabled", false },
|
2020-11-01 20:09:38 +00:00
|
|
|
{ "AllowFileAccessFromFileURLs", true },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "AllowTopNavigationToDataURLs", true },
|
2020-11-01 20:09:38 +00:00
|
|
|
{ "AllowUniversalAccessFromFileURLs", true },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "AllowsInlineMediaPlayback", true },
|
2020-11-04 22:22:03 +00:00
|
|
|
{ "AsyncFrameScrollingEnabled", false },
|
|
|
|
{ "AsyncOverflowScrollingEnabled", false },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "CSSOMViewScrollingAPIEnabled", true },
|
2021-01-29 09:01:22 +00:00
|
|
|
{ "CaptureAudioInGPUProcessEnabled", captureAudioInGPUProcessEnabledValue },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "CaptureAudioInUIProcessEnabled", false },
|
2021-01-29 09:01:22 +00:00
|
|
|
{ "CaptureVideoInGPUProcessEnabled", captureVideoInGPUProcessEnabledValue },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "CaptureVideoInUIProcessEnabled", false },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "ContentChangeObserverEnabled", false },
|
|
|
|
{ "CustomPasteboardDataEnabled", true },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "DOMPasteAllowed", true },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "DataTransferItemsEnabled", true },
|
|
|
|
{ "DeveloperExtrasEnabled", true },
|
|
|
|
{ "DirectoryUploadEnabled", true },
|
|
|
|
{ "ExposeSpeakersEnabled", true },
|
2020-11-01 20:09:38 +00:00
|
|
|
{ "FrameFlatteningEnabled", false },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "FullScreenEnabled", true },
|
2020-11-01 20:09:38 +00:00
|
|
|
{ "GenericCueAPIEnabled", false },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "HiddenPageCSSAnimationSuspensionEnabled", false },
|
|
|
|
{ "HiddenPageDOMTimerThrottlingEnabled", false },
|
|
|
|
{ "InlineMediaPlaybackRequiresPlaysInlineAttribute", false },
|
2020-11-04 22:22:03 +00:00
|
|
|
{ "InputTypeDateEnabled", true },
|
|
|
|
{ "InputTypeDateTimeLocalEnabled", true },
|
|
|
|
{ "InputTypeMonthEnabled", true },
|
|
|
|
{ "InputTypeTimeEnabled", true },
|
|
|
|
{ "InputTypeWeekEnabled", true },
|
2020-11-01 20:09:38 +00:00
|
|
|
{ "JavaScriptCanAccessClipboard", true },
|
|
|
|
{ "JavaScriptCanOpenWindowsAutomatically", true },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "LargeImageAsyncDecodingEnabled", false },
|
|
|
|
{ "MediaDevicesEnabled", true },
|
|
|
|
{ "MediaPreloadingEnabled", true },
|
|
|
|
{ "MediaSourceEnabled", mediaSourceEnabledValue },
|
|
|
|
{ "MockCaptureDevicesEnabled", true },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "MockScrollbarsEnabled", true },
|
|
|
|
{ "ModernMediaControlsEnabled", true },
|
|
|
|
{ "NeedsSiteSpecificQuirks", false },
|
2020-11-01 20:09:38 +00:00
|
|
|
{ "NeedsStorageAccessFromFileURLsQuirk", false },
|
2021-04-16 20:41:08 +00:00
|
|
|
{ "OfflineWebApplicationCacheEnabled", true },
|
2020-11-01 20:09:38 +00:00
|
|
|
{ "OffscreenCanvasEnabled", true },
|
2021-05-16 03:14:57 +00:00
|
|
|
{ "OffscreenCanvasInWorkersEnabled", true },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "PageVisibilityBasedProcessSuppressionEnabled", false },
|
2020-11-01 20:09:38 +00:00
|
|
|
{ "PluginsEnabled", true },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "RequiresUserGestureForAudioPlayback", false },
|
|
|
|
{ "RequiresUserGestureForMediaPlayback", false },
|
|
|
|
{ "RequiresUserGestureForVideoPlayback", false },
|
2020-11-04 22:22:03 +00:00
|
|
|
{ "SpeakerSelectionRequiresUserGesture", false },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "SubpixelAntialiasedLayerTextEnabled", false },
|
|
|
|
{ "TabsToLinks", false },
|
|
|
|
{ "TextAutosizingEnabled", false },
|
|
|
|
{ "TextAutosizingUsesIdempotentMode", false },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "UsesBackForwardCache", false },
|
|
|
|
{ "WebAuthenticationEnabled", true },
|
2021-04-11 20:11:34 +00:00
|
|
|
{ "WebRTCMDNSICECandidatesEnabled", false },
|
2020-11-01 20:09:38 +00:00
|
|
|
{ "XSSAuditorEnabled", false },
|
2021-04-11 20:11:34 +00:00
|
|
|
#if PLATFORM(IOS_FAMILY_SIMULATOR)
|
|
|
|
{ "VP9DecoderEnabled", false },
|
2021-05-04 06:33:52 +00:00
|
|
|
#endif
|
|
|
|
#if ENABLE(GPU_PROCESS) && ENABLE(WEBGL)
|
|
|
|
{ "UseGPUProcessForWebGLEnabled", false },
|
2021-04-11 20:11:34 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
features.stringWebPreferenceFeatures = {
|
|
|
|
{ "CursiveFontFamily", "Apple Chancery" },
|
|
|
|
{ "DefaultTextEncodingName", "ISO-8859-1" },
|
|
|
|
{ "FantasyFontFamily", "Papyrus" },
|
|
|
|
{ "FixedFontFamily", "Courier" },
|
|
|
|
{ "PictographFontFamily", "Apple Color Emoji" },
|
|
|
|
{ "SansSerifFontFamily", "Helvetica" },
|
|
|
|
{ "SerifFontFamily", "Times" },
|
|
|
|
{ "StandardFontFamily", "Times" },
|
2020-10-16 19:37:06 +00:00
|
|
|
};
|
|
|
|
features.boolTestRunnerFeatures = {
|
|
|
|
{ "allowsLinkPreview", true },
|
|
|
|
{ "dumpJSConsoleLogInStdErr", false },
|
|
|
|
{ "editable", false },
|
|
|
|
{ "enableInAppBrowserPrivacy", false },
|
|
|
|
{ "enableProcessSwapOnNavigation", true },
|
|
|
|
{ "enableProcessSwapOnWindowOpen", false },
|
2021-05-01 03:26:53 +00:00
|
|
|
{ "appHighlightsEnabled", false },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "ignoreSynchronousMessagingTimeouts", false },
|
|
|
|
{ "ignoresViewportScaleLimits", false },
|
|
|
|
{ "isAppBoundWebView", false },
|
2021-07-13 16:40:12 +00:00
|
|
|
{ "isAppInitiated", true },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "runSingly", false },
|
|
|
|
{ "shouldHandleRunOpenPanel", true },
|
|
|
|
{ "shouldPresentPopovers", true },
|
|
|
|
{ "shouldShowTouches", false },
|
|
|
|
{ "shouldShowWebView", false },
|
|
|
|
{ "spellCheckingDots", false },
|
2020-12-04 19:53:50 +00:00
|
|
|
{ "textInteractionEnabled", true },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "useCharacterSelectionGranularity", false },
|
|
|
|
{ "useDataDetection", false },
|
|
|
|
{ "useEphemeralSession", false },
|
|
|
|
{ "useFlexibleViewport", false },
|
|
|
|
{ "useRemoteLayerTree", false },
|
|
|
|
{ "useThreadedScrolling", false },
|
|
|
|
};
|
|
|
|
features.doubleTestRunnerFeatures = {
|
|
|
|
{ "contentInset.top", 0 },
|
2021-07-12 16:15:13 +00:00
|
|
|
{ "horizontalSystemMinimumLayoutMargin", 0 },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "deviceScaleFactor", 1 },
|
|
|
|
{ "viewHeight", 600 },
|
|
|
|
{ "viewWidth", 800 },
|
|
|
|
};
|
|
|
|
features.stringTestRunnerFeatures = {
|
|
|
|
{ "additionalSupportedImageTypes", { } },
|
|
|
|
{ "applicationBundleIdentifier", { } },
|
|
|
|
{ "applicationManifest", { } },
|
|
|
|
{ "contentMode", { } },
|
REGRESSION (r274610): Unable to drag images when image extraction is enabled
https://bugs.webkit.org/show_bug.cgi?id=224211
<rdar://problem/76229563>
Reviewed by Tim Horton.
Source/WebKit:
r274610 introduced a new deferring gesture recognizer intended to prevent several text interaction gestures from
recognizing during pending image extraction. However, this also causes dragging on iOS to fail, since the
gesture used to initiate dragging is excluded by the new deferring gesture recognizer. To fix this, allow the
new deferring gesture to recognize simultaneously alongside all gestures with the exception of only the gestures
it is intended to defer (i.e. text interaction gestures).
Test: fast/events/ios/dragstart-on-image-by-long-pressing.html
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _isAnimatingDragCancel]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[UIGestureRecognizer _wk_isTapAndAHalf]):
Add a WebKit category method that returns whether or not a gesture recognizer is a tap-and-a-half gesture.
(-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
Allow the image extraction deferring gesture to recognize alongside all other gestures, with the exception of
the text interaction gestures determined by `-shouldDeferGestureDueToImageExtraction:`. This limits the impact
of this new deferring gesture, such that it only affects the text interaction gestures it is intended to defer.
(-[WKContentView shouldDeferGestureDueToImageExtraction:]):
Add a helper method to determine whether or not a gesture recognizer should be deferred, due to pending image
extraction. We pull this logic behind a helper method because it's now consulted from two call sites.
(-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]):
(-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
(-[WKContentView isAnimatingDragCancel]):
Add a testing hook to return whether or not the drag cancel animation is running. See Tools/ChangeLog and the
new layout test for more detail.
(tapAndAHalfRecognizerClass): Deleted.
Tools:
Add support for some new testing infrastructure; see below for more details.
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::isAnimatingDragCancel const):
Add a new testing hook to return whether or not the web view's drag interaction is currently animating a drag
cancel (i.e., the drag preview is animating back to its original frame).
* WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):
(WTR::TestOptions::keyTypeMapping):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::dragInteractionPolicy const):
Add a test option that allows tests to override the drag interaction policy to "always-allow",
"always-disallow", and the default value. This option allows us to force drag and drop to be enabled when
testing on iPhone simulator.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::dragInteractionPolicy):
(WTR::TestController::platformResetStateToConsistentValues):
* WebKitTestRunner/ios/UIScriptControllerIOS.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::isAnimatingDragCancel const):
LayoutTests:
Add a new layout test that initiates dragging on an image using a synthesized event stream, and verifies that
"dragstart" and "dragend" events are dispatched on the image.
* fast/events/ios/dragstart-on-image-by-long-pressing-expected.txt: Added.
* fast/events/ios/dragstart-on-image-by-long-pressing.html: Added.
* resources/ui-helper.js:
(window.UIHelper.isAnimatingDragCancel):
Add a `UIHelper` method that returns whether or not the dragging animation is being cancelled. The new test uses
this hook to wait for the drag cancel animation to end before proceeding to the next test.
Canonical link: https://commits.webkit.org/236202@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-06 20:39:10 +00:00
|
|
|
{ "dragInteractionPolicy", { } },
|
2020-10-16 19:37:06 +00:00
|
|
|
{ "jscOptions", { } },
|
|
|
|
{ "standaloneWebApplicationURL", { } },
|
|
|
|
};
|
|
|
|
features.stringVectorTestRunnerFeatures = {
|
|
|
|
{ "language", { } },
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return features;
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
}
|
|
|
|
|
2020-10-12 21:54:50 +00:00
|
|
|
const std::unordered_map<std::string, TestHeaderKeyType>& TestOptions::keyTypeMapping()
|
|
|
|
{
|
2020-10-16 19:37:06 +00:00
|
|
|
static const std::unordered_map<std::string, TestHeaderKeyType> map {
|
|
|
|
GENERATED_WEB_PREFERENCE_KEY_TYPE_MAPPINGS
|
2020-10-13 17:16:15 +00:00
|
|
|
|
|
|
|
{ "allowsLinkPreview", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "dumpJSConsoleLogInStdErr", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "editable", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "enableInAppBrowserPrivacy", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "enableProcessSwapOnNavigation", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "enableProcessSwapOnWindowOpen", TestHeaderKeyType::BoolTestRunner },
|
2021-05-01 03:26:53 +00:00
|
|
|
{ "appHighlightsEnabled", TestHeaderKeyType::BoolTestRunner },
|
2020-10-13 17:16:15 +00:00
|
|
|
{ "ignoreSynchronousMessagingTimeouts", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "ignoresViewportScaleLimits", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "isAppBoundWebView", TestHeaderKeyType::BoolTestRunner },
|
2021-07-13 16:40:12 +00:00
|
|
|
{ "isAppInitiated", TestHeaderKeyType::BoolTestRunner },
|
2020-10-13 17:16:15 +00:00
|
|
|
{ "runSingly", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "shouldHandleRunOpenPanel", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "shouldPresentPopovers", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "shouldShowTouches", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "shouldShowWebView", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "spellCheckingDots", TestHeaderKeyType::BoolTestRunner },
|
2020-12-04 19:53:50 +00:00
|
|
|
{ "textInteractionEnabled", TestHeaderKeyType::BoolTestRunner },
|
2020-10-13 17:16:15 +00:00
|
|
|
{ "useCharacterSelectionGranularity", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "useDataDetection", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "useEphemeralSession", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "useFlexibleViewport", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "useRemoteLayerTree", TestHeaderKeyType::BoolTestRunner },
|
|
|
|
{ "useThreadedScrolling", TestHeaderKeyType::BoolTestRunner },
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
|
2020-10-13 17:16:15 +00:00
|
|
|
{ "contentInset.top", TestHeaderKeyType::DoubleTestRunner },
|
2021-07-12 16:15:13 +00:00
|
|
|
{ "horizontalSystemMinimumLayoutMargin", TestHeaderKeyType::DoubleTestRunner },
|
2020-10-13 17:16:15 +00:00
|
|
|
{ "deviceScaleFactor", TestHeaderKeyType::DoubleTestRunner },
|
|
|
|
{ "viewHeight", TestHeaderKeyType::DoubleTestRunner },
|
|
|
|
{ "viewWidth", TestHeaderKeyType::DoubleTestRunner },
|
2020-10-12 21:54:50 +00:00
|
|
|
|
2020-10-13 17:16:15 +00:00
|
|
|
{ "additionalSupportedImageTypes", TestHeaderKeyType::StringTestRunner },
|
|
|
|
{ "applicationBundleIdentifier", TestHeaderKeyType::StringTestRunner },
|
|
|
|
{ "applicationManifest", TestHeaderKeyType::StringRelativePathTestRunner },
|
|
|
|
{ "contentMode", TestHeaderKeyType::StringTestRunner },
|
REGRESSION (r274610): Unable to drag images when image extraction is enabled
https://bugs.webkit.org/show_bug.cgi?id=224211
<rdar://problem/76229563>
Reviewed by Tim Horton.
Source/WebKit:
r274610 introduced a new deferring gesture recognizer intended to prevent several text interaction gestures from
recognizing during pending image extraction. However, this also causes dragging on iOS to fail, since the
gesture used to initiate dragging is excluded by the new deferring gesture recognizer. To fix this, allow the
new deferring gesture to recognize simultaneously alongside all gestures with the exception of only the gestures
it is intended to defer (i.e. text interaction gestures).
Test: fast/events/ios/dragstart-on-image-by-long-pressing.html
* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _isAnimatingDragCancel]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[UIGestureRecognizer _wk_isTapAndAHalf]):
Add a WebKit category method that returns whether or not a gesture recognizer is a tap-and-a-half gesture.
(-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
Allow the image extraction deferring gesture to recognize alongside all other gestures, with the exception of
the text interaction gestures determined by `-shouldDeferGestureDueToImageExtraction:`. This limits the impact
of this new deferring gesture, such that it only affects the text interaction gestures it is intended to defer.
(-[WKContentView shouldDeferGestureDueToImageExtraction:]):
Add a helper method to determine whether or not a gesture recognizer should be deferred, due to pending image
extraction. We pull this logic behind a helper method because it's now consulted from two call sites.
(-[WKContentView deferringGestureRecognizer:shouldDeferOtherGestureRecognizer:]):
(-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
(-[WKContentView isAnimatingDragCancel]):
Add a testing hook to return whether or not the drag cancel animation is running. See Tools/ChangeLog and the
new layout test for more detail.
(tapAndAHalfRecognizerClass): Deleted.
Tools:
Add support for some new testing infrastructure; see below for more details.
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::isAnimatingDragCancel const):
Add a new testing hook to return whether or not the web view's drag interaction is currently animating a drag
cancel (i.e., the drag preview is animating back to its original frame).
* WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):
(WTR::TestOptions::keyTypeMapping):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::dragInteractionPolicy const):
Add a test option that allows tests to override the drag interaction policy to "always-allow",
"always-disallow", and the default value. This option allows us to force drag and drop to be enabled when
testing on iPhone simulator.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::dragInteractionPolicy):
(WTR::TestController::platformResetStateToConsistentValues):
* WebKitTestRunner/ios/UIScriptControllerIOS.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::isAnimatingDragCancel const):
LayoutTests:
Add a new layout test that initiates dragging on an image using a synthesized event stream, and verifies that
"dragstart" and "dragend" events are dispatched on the image.
* fast/events/ios/dragstart-on-image-by-long-pressing-expected.txt: Added.
* fast/events/ios/dragstart-on-image-by-long-pressing.html: Added.
* resources/ui-helper.js:
(window.UIHelper.isAnimatingDragCancel):
Add a `UIHelper` method that returns whether or not the dragging animation is being cancelled. The new test uses
this hook to wait for the drag cancel animation to end before proceeding to the next test.
Canonical link: https://commits.webkit.org/236202@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-06 20:39:10 +00:00
|
|
|
{ "dragInteractionPolicy", TestHeaderKeyType::StringTestRunner },
|
2020-10-13 17:16:15 +00:00
|
|
|
{ "jscOptions", TestHeaderKeyType::StringTestRunner },
|
|
|
|
{ "standaloneWebApplicationURL", TestHeaderKeyType::StringURLTestRunner },
|
2020-10-12 21:54:50 +00:00
|
|
|
|
2020-10-13 17:16:15 +00:00
|
|
|
{ "language", TestHeaderKeyType::StringVectorTestRunner },
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return map;
|
2015-09-30 01:20:23 +00:00
|
|
|
}
|
|
|
|
|
2020-11-04 22:22:03 +00:00
|
|
|
bool TestOptions::hasSameInitializationOptions(const TestOptions& other) const
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
{
|
2020-11-04 22:22:03 +00:00
|
|
|
return m_features == other.m_features;
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
}
|
|
|
|
|
2020-10-16 19:37:06 +00:00
|
|
|
bool TestOptions::boolWebPreferenceFeatureValue(std::string key, bool defaultValue) const
|
2020-10-12 06:29:53 +00:00
|
|
|
{
|
2020-10-16 19:37:06 +00:00
|
|
|
auto it = m_features.boolWebPreferenceFeatures.find(key);
|
|
|
|
if (it != m_features.boolWebPreferenceFeatures.end())
|
|
|
|
return it->second;
|
|
|
|
return defaultValue;
|
2020-10-12 06:29:53 +00:00
|
|
|
}
|
|
|
|
|
2020-10-16 19:37:06 +00:00
|
|
|
template<typename T> T testRunnerFeatureValue(std::string key, const std::unordered_map<std::string, T>& map)
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
{
|
2020-10-16 19:37:06 +00:00
|
|
|
// All test runner features should always exist in their corresponding map since the base/global defaults
|
|
|
|
// contains default values for all of them.
|
|
|
|
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
auto it = map.find(key);
|
2020-10-16 19:37:06 +00:00
|
|
|
ASSERT(it != map.end());
|
|
|
|
return it->second;
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
}
|
|
|
|
|
2020-10-13 17:16:15 +00:00
|
|
|
bool TestOptions::boolTestRunnerFeatureValue(std::string key) const
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
{
|
2020-10-16 19:37:06 +00:00
|
|
|
return testRunnerFeatureValue(key, m_features.boolTestRunnerFeatures);
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
}
|
2020-10-16 19:37:06 +00:00
|
|
|
|
2020-10-13 17:16:15 +00:00
|
|
|
double TestOptions::doubleTestRunnerFeatureValue(std::string key) const
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
{
|
2020-10-16 19:37:06 +00:00
|
|
|
return testRunnerFeatureValue(key, m_features.doubleTestRunnerFeatures);
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
}
|
2020-10-16 19:37:06 +00:00
|
|
|
|
2020-10-13 17:16:15 +00:00
|
|
|
std::string TestOptions::stringTestRunnerFeatureValue(std::string key) const
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
{
|
2020-10-16 19:37:06 +00:00
|
|
|
return testRunnerFeatureValue(key, m_features.stringTestRunnerFeatures);
|
Refactor TestOptions code in WebKitTestRunner to make it easier to rationalize and extend
https://bugs.webkit.org/show_bug.cgi?id=217390
Reviewed by Darin Adler.
Refactors TestOptions code in WebKitTestRunner to make it clear how options coming in at
different levels are treated and what precedence each has. The order is (from least to most):
- Global features passed to WebKitTestRunner via the command line (e.g. --show-touches)
- Hardcoded features based on the path of the test being run (hopefully we can remove all soon)
- Hardcoded platform specific defaults (currently only used by macOS for useThreadedScrolling).
- Features from the test headers within the test itself.
- Finally, a second chance for more platform specific defaults (currenly only used the Cocoa ports
for setting enableProcessSwapOnNavigation and enableProcessSwapOnWindowOpen based on NSUserDefaults.)
To make this change work, and pave the way for future autogeneration of some of these test options,
the TestOptions struct (now class) was overhauled. Instead of storing the state itself, TestOptions
is now an immutable owner of a TestFeatures object. TestFeatures is a simple struct that contains maps
of option keys to values and can be merged with other TestFeatures objects. TestOptions takes a
TestFeatures at construction, and exposes getters for all keys, as well as defaults for when they are
not in the maps. In future changes, I would like to remove many of these (the ones that correspond
with WebKit preferences anyway) and have the keys and values automatically dealt with by WKPreferences.
* WebKitTestRunner/Options.cpp:
* WebKitTestRunner/Options.h:
Switch to std::unordered_map for consistency and ease of conversion.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
Update to call new TestOptions functions.
* WebKitTestRunner/StringFunctions.h:
(WTR::toWK):
(WTR::toWTFString):
Add conversions for std::string.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
Replace some bools with a new global TestFeatures instance that forms the base of
all TestFeatures merges.
(WTR::TestController::generateContextConfiguration const):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::TestController::resetStateToConsistentValues):
Update to call new TestOptions functions.
(WTR::TestController::createTestURL):
Expose as a static member function on TestController for use in other files.
(WTR::TestController::testOptionsForTest const):
Rework to be a sequence of TestFeatures merges.
(WTR::TestController::updateWebViewSizeForTest):
(WTR::TestController::updateWindowScaleForTest):
Update to call new TestOptions functions.
(WTR::createTestURL): Deleted.
(WTR::parseBooleanTestHeaderValue): Deleted.
(WTR::parseStringTestHeaderValueAsRelativePath): Deleted.
(WTR::parseStringTestHeaderValueAsURL): Deleted.
(WTR::updateTestOptionsFromTestHeader): Deleted.
(WTR::TestController::platformAddTestOptions const): Deleted.
Moved TestOptions parsing to TestOptions.cpp
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::createTestSettingsDictionary):
Update to call new TestOptions functions.
* WebKitTestRunner/TestOptions.h:
Reworks TestOptions to be an immutable owner of a TestFeatures struct, which is a set
of maps that map feature string keys, to values of type bool, double, string or string vector.
* WebKitTestRunner/TestOptions.cpp:
(WTR::merge):
Merges two TestFeatures objects. If both contain the same key, the 'additional'
TestFeatures overrides the 'base' TestFeatures.
(WTR::dumpFeatures):
Helper to dump features to stderr, useful for debugging.
(WTR::keyType):
Helper for parser to know which value parser to use.
(WTR::parseBooleanTestHeaderValue):
(WTR::parseStringTestHeaderValueAsRelativePath):
(WTR::parseStringTestHeaderValueAsURL):
Value parsers moved from TestController.cpp
(WTR::parseTestHeader):
Header parser moved from TestController.cpp. Update to now return
a TestFeatures object and use keyType to pick value parser rather
than inlining the if statements.
(WTR::hardcodedFeaturesBasedOnPathForTest):
Moved from the TestOptions contructor and reworked to return a TestFeatures
object to be merged by the caller.
(WTR::featureDefaultsFromTestHeaderForTest):
Creates a TestFeatures for the test headers of the current test.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformSpecificFeatureOverridesDefaultsForTest const):
Reworked to now return a TestFeatures object that will be merged, rather than updating
a TestOptions. Moves enableInAppBrowserPrivacy work to TestController::platformWillRunTest
where it is more appropriate.
(WTR::TestController::platformInitializeDataStore):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::finishCreatingPlatformWebView):
(WTR::TestController::setApplicationBundleIdentifier):
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::contentMode):
Update to call new TestOptions functions.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::TestController::platformConfigureViewForTest):
Update to call new TestOptions functions.
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Moved GeneratedTouchesDebugWindow work to TestController::platformConfigureViewForTest
where it is more appropriate and removed shouldShowTouches setting as that is done
globally now.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
Update to call new TestOptions functions.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Remove shouldUseRemoteLayerTree and shouldShowWebView, as those are now done globally,
and re-implemented useThreadedScrolling to use boolFeatures.
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/wpe/TestControllerWPE.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
* WebKitTestRunner/gtk/TestControllerGTK.cpp:
(WTR::TestController::platformSpecificFeatureDefaultsForTest const):
(WTR::TestController::updatePlatformSpecificTestOptionsForTest const): Deleted.
Updated for new signature.
Canonical link: https://commits.webkit.org/230271@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:45:29 +00:00
|
|
|
}
|
2020-10-16 19:37:06 +00:00
|
|
|
|
2020-10-13 17:16:15 +00:00
|
|
|
std::vector<std::string> TestOptions::stringVectorTestRunnerFeatureValue(std::string key) const
|
2015-09-30 01:20:23 +00:00
|
|
|
{
|
2020-10-16 19:37:06 +00:00
|
|
|
return testRunnerFeatureValue(key, m_features.stringVectorTestRunnerFeatures);
|
2015-09-30 01:20:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|