haikuwebkit/Tools/WebKitTestRunner/Options.h

82 lines
2.8 KiB
C
Raw Permalink Normal View History

/*
* Copyright (C) 2013 University of Szeged. All rights reserved.
* Copyright (C) 2013 Samsung Electronics. All rights reserved.
* Copyright (C) 2015-2018 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED OR
* 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.
*/
#pragma once
Remove support for experimental: and internal: prefixes from WebKitTestRunner and DumpRenderTree https://bugs.webkit.org/show_bug.cgi?id=218569 Reviewed by Tim Horton. The prefixes were removed from use in tests in r269360. * DumpRenderTree/TestOptions.cpp: (WTR::TestOptions::webViewIsCompatibleWithOptions const): Replace duplicated comparison code with call to operator==. * TestRunnerShared/TestFeatures.cpp: (WTR::merge): Remove special maps for internal and experimental features. (WTR::operator==): (WTR::operator!=): Add operator== support for use by TestOptions in determining compatibility. (WTR::parseTestHeaderFeature): (WTR::parseTestHeader): Split out feature parsing for future use in command line parsing. * TestRunnerShared/TestFeatures.h: Remove special maps for internal and experimental features. * WebKitTestRunner/Options.cpp: (WTR::handleOptionAcceleratedDrawing): (WTR::handleOptionRemoteLayerTree): (WTR::handleOptionShowWebView): (WTR::handleOptionShowTouches): (WTR::parseFeature): (WTR::handleOptionExperimentalFeature): (WTR::handleOptionInternalFeature): * WebKitTestRunner/Options.h: Rather than parsing into bools / extra maps, parse the command line options directly into a TestFeatures. * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Initialize global features from the new Options' TestFeatures. (WTR::TestController::resetPreferencesToConsistentValues): Remove special casing for experimental and internal features, they are now just generic bool WebPreferences. Move special cases for internal features into TestOptions. (WTR::TestController::testOptionsForTest const): Now that global features is not seeded with the default features, construct the full merge chain starting with the default features instead. * WebKitTestRunner/TestOptions.cpp: (WTR::TestOptions::defaults): Add some additional defaults moved from TestController::resetPreferencesToConsistentValues. (WTR::TestOptions::hasSameInitializationOptions const): Use operator== to reduce duplicated code. * WebKitTestRunner/TestOptions.h: (WTR::TestOptions::experimentalFeatures const): Deleted. (WTR::TestOptions::internalDebugFeatures const): Deleted. Remove now unused extra maps for external and internal features. Canonical link: https://commits.webkit.org/231228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269390 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-04 22:22:03 +00:00
#include "TestFeatures.h"
#include <functional>
Add infrastructure to relax SSL for allowed hosts in DumpRenderTree and WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=184239 Reviewed by Alexey Proskuryakov. Adds a new optional command line option --allow-any-certificate-for-allowed-hosts (defaults to disabled) to allow the allowed hosts to accept any HTTPS certificate. You can specify an allowed host by using the existing command line option --allowed-host. Currently both DumpRenderTree and WebKitTestRunner relax SSL certificate validation for 127.0.0.1 and localhost so that we can run HTTPS tests from these hosts using a self-signed certificate. They do not relax these restrictions for any allowed host, specified using the optional command line option --allowed-host. For testing purposes it is useful to be able to run a local HTTPS server with a self-signed certificate and mimic a non-localhost hostname (by adding an alias(es) for 127.0.0.1 to /etc/hosts). We should support relaxing SSL restrictions for such testing purposes. For example, to allow host example.test to present any HTTPS certificate when running tests you would invoke: run-webkit-tests --allowed-host example.test --additional-drt-flag '--allow-any-certificate-for-allowed-hosts' * DumpRenderTree/mac/DumpRenderTree.mm: (initializeGlobalsFromCommandLineOptions): Parse the command line option --allow-any-certificate-for-allowed-hosts. (dumpRenderTree): Allow any HTTPS certificate from each allowed host. * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::didReceiveMessageToPage): Clear out the existing list of allowed hosts before appending entries to it to avoid growing the list of allowed hosts without bound. Call platformAllowAnyHTTPSCertificateForAllowedHosts() to apply SSL relaxation for each allowed host. * WebKitTestRunner/Options.cpp: (WTR::handleOptionAllowAnyHTTPSCertificateForAllowedHosts): Added. (WTR::handleOptionAllowedHost): Update code as needed now that Options::allowedHosts is a std::set. (WTR::OptionsHandler::OptionsHandler): * WebKitTestRunner/Options.h: Change the data type of allowedHosts from a std::vector to a std::set so that we can make use of the convenience functon std::set::find() in TestController::canAuthenticateAgainstProtectionSpace(). * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): (WTR::TestController::canAuthenticateAgainstProtectionSpace): Allow any HTTPS certificate from each allowed host. * WebKitTestRunner/TestController.h: Canonical link: https://commits.webkit.org/199802@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-02 23:12:12 +00:00
#include <set>
#include <stdio.h>
#include <string>
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
#include <unordered_map>
#include <vector>
#include <wtf/Vector.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace WTR {
struct Options {
bool useWaitToDumpWatchdogTimer { true };
bool forceNoTimeout { false };
bool verbose { false };
bool gcBetweenTests { false };
bool shouldDumpPixelsForAllTests { false };
bool forceComplexText { false };
Teach WebKitTestRunner and DumpRenderTree about detecting world leaks https://bugs.webkit.org/show_bug.cgi?id=188994 Reviewed by Tim Horton. Source/WebCore: Export Document::postTask() for use by WTR's injected bundle. * dom/Document.h: Source/WebKit: This patch adds the notion of a "control command" in the protocol between webkitpy and WebKitTestRunner/DumpRenderTree. A command is simply an input string starting with a # that is checked for before trying to parse the input as test URL. For now, just one commmand is supported, which is "#CHECK FOR WORLD LEAKS". In response to the command, the tool dumps an output block in the usual pseudo-MIME-style, with a trailing "#EOF". Future patches will add support to webkitpy to parse this output. DumpRenderTree stubs out the command, returning an empty block. WebKitTestRunner responds to the command by dumping the list of live documents, if it was run with the --check-for-world-leaks option. When run with --check-for-world-leaks, WebKitTestRunner gets the list of live documents via WKBundleGetLiveDocumentURLs() after every test (this allows it to detect the first test that leaked a document), and keeps them in a map of document identifier to test and live document URL. Then when it receives the "#CHECK FOR WORLD LEAKS" command, it calls into the bundle to clear the page and memory caches, runs a GC, then posts a task (in the Document::postTaks() sense) after which it requests the list of live documents for a final time, excluding any that are loaded in live Frames (thus omitting the about:blank that will be loaded at this point). Documents in this list are therefore leaked (or abandoned). Future patches will hook up webkitpy reporting for leaked documents. * WebProcess/InjectedBundle/API/c/WKBundle.cpp: (WKBundleGetLiveDocumentURLs): (WKBundleClearPageCache): (WKBundleClearMemoryCache): * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKBundlePagePostTask): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: * WebProcess/InjectedBundle/InjectedBundle.cpp: (WebKit::InjectedBundle::liveDocumentURLs): * WebProcess/InjectedBundle/InjectedBundle.h: Tools: This patch adds the notion of a "control command" in the protocol between webkitpy and WebKitTestRunner/DumpRenderTree. A command is simply an input string starting with a # that is checked for before trying to parse the input as test URL. For now, just one commmand is supported, which is "#CHECK FOR WORLD LEAKS". In response to the command, the tool dumps an output block in the usual pseudo-MIME-style, with a trailing "#EOF". Future patches will add support to webkitpy to parse this output. DumpRenderTree stubs out the command, returning an empty block. WebKitTestRunner responds to the command by dumping the list of live documents, if it was run with the --check-for-world-leaks option. When run with --check-for-world-leaks, WebKitTestRunner gets the list of live documents via WKBundleGetLiveDocumentURLs() after every test (this allows it to detect the first test that leaked a document), and keeps them in a map of document identifier to test and live document URL. Then when it receives the "#CHECK FOR WORLD LEAKS" command, it calls into the bundle to clear the page and memory caches, runs a GC, then posts a task (in the Document::postTaks() sense) after which it requests the list of live documents for a final time, excluding any that are loaded in live Frames (thus omitting the about:blank that will be loaded at this point). Documents in this list are therefore leaked (or abandoned). Future patches will hook up webkitpy reporting for leaked documents. * DumpRenderTree/mac/DumpRenderTree.mm: (initializeGlobalsFromCommandLineOptions): (handleControlCommand): (runTestingServerLoop): * DumpRenderTree/win/DumpRenderTree.cpp: (handleControlCommand): (main): * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::postGCTask): (WTR::InjectedBundle::reportLiveDocuments): (WTR::InjectedBundle::didReceiveMessageToPage): * WebKitTestRunner/InjectedBundle/InjectedBundle.h: * WebKitTestRunner/Options.cpp: (WTR::handleOptionCheckForWorldLeaks): (WTR::OptionsHandler::OptionsHandler): * WebKitTestRunner/Options.h: * WebKitTestRunner/TestController.cpp: (WTR::AsyncTask::run): (WTR::AsyncTask::currentTask): (WTR::TestController::initialize): (WTR::TestController::ensureViewSupportsOptionsForTest): (WTR::TestController::resetStateToConsistentValues): (WTR::TestController::updateLiveDocumentsAfterTest): (WTR::TestController::checkForWorldLeaks): (WTR::TestController::findAndDumpWorldLeaks): (WTR::TestController::willDestroyWebView): (WTR::parseInputLine): (WTR::TestController::waitForCompletion): (WTR::TestController::handleControlCommand): (WTR::TestController::runTestingServerLoop): (WTR::TestController::run): (WTR::TestController::didReceiveLiveDocumentsList): (WTR::TestController::didReceiveMessageFromInjectedBundle): * WebKitTestRunner/TestController.h: (WTR::AsyncTask::AsyncTask): (WTR::AsyncTask::taskComplete): (WTR::TestController::AbandonedDocumentInfo::AbandonedDocumentInfo): * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::invoke): * WebKitTestRunner/TestOptions.h: (WTR::TestOptions::hasSameInitializationOptions const): Canonical link: https://commits.webkit.org/204062@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235408 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-08-27 23:31:15 +00:00
bool checkForWorldLeaks { false };
Add infrastructure to relax SSL for allowed hosts in DumpRenderTree and WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=184239 Reviewed by Alexey Proskuryakov. Adds a new optional command line option --allow-any-certificate-for-allowed-hosts (defaults to disabled) to allow the allowed hosts to accept any HTTPS certificate. You can specify an allowed host by using the existing command line option --allowed-host. Currently both DumpRenderTree and WebKitTestRunner relax SSL certificate validation for 127.0.0.1 and localhost so that we can run HTTPS tests from these hosts using a self-signed certificate. They do not relax these restrictions for any allowed host, specified using the optional command line option --allowed-host. For testing purposes it is useful to be able to run a local HTTPS server with a self-signed certificate and mimic a non-localhost hostname (by adding an alias(es) for 127.0.0.1 to /etc/hosts). We should support relaxing SSL restrictions for such testing purposes. For example, to allow host example.test to present any HTTPS certificate when running tests you would invoke: run-webkit-tests --allowed-host example.test --additional-drt-flag '--allow-any-certificate-for-allowed-hosts' * DumpRenderTree/mac/DumpRenderTree.mm: (initializeGlobalsFromCommandLineOptions): Parse the command line option --allow-any-certificate-for-allowed-hosts. (dumpRenderTree): Allow any HTTPS certificate from each allowed host. * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::didReceiveMessageToPage): Clear out the existing list of allowed hosts before appending entries to it to avoid growing the list of allowed hosts without bound. Call platformAllowAnyHTTPSCertificateForAllowedHosts() to apply SSL relaxation for each allowed host. * WebKitTestRunner/Options.cpp: (WTR::handleOptionAllowAnyHTTPSCertificateForAllowedHosts): Added. (WTR::handleOptionAllowedHost): Update code as needed now that Options::allowedHosts is a std::set. (WTR::OptionsHandler::OptionsHandler): * WebKitTestRunner/Options.h: Change the data type of allowedHosts from a std::vector to a std::set so that we can make use of the convenience functon std::set::find() in TestController::canAuthenticateAgainstProtectionSpace(). * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): (WTR::TestController::canAuthenticateAgainstProtectionSpace): Allow any HTTPS certificate from each allowed host. * WebKitTestRunner/TestController.h: Canonical link: https://commits.webkit.org/199802@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-02 23:12:12 +00:00
bool allowAnyHTTPSCertificateForAllowedHosts { false };
bool enableAllExperimentalFeatures { true };
std::vector<std::string> paths;
Add infrastructure to relax SSL for allowed hosts in DumpRenderTree and WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=184239 Reviewed by Alexey Proskuryakov. Adds a new optional command line option --allow-any-certificate-for-allowed-hosts (defaults to disabled) to allow the allowed hosts to accept any HTTPS certificate. You can specify an allowed host by using the existing command line option --allowed-host. Currently both DumpRenderTree and WebKitTestRunner relax SSL certificate validation for 127.0.0.1 and localhost so that we can run HTTPS tests from these hosts using a self-signed certificate. They do not relax these restrictions for any allowed host, specified using the optional command line option --allowed-host. For testing purposes it is useful to be able to run a local HTTPS server with a self-signed certificate and mimic a non-localhost hostname (by adding an alias(es) for 127.0.0.1 to /etc/hosts). We should support relaxing SSL restrictions for such testing purposes. For example, to allow host example.test to present any HTTPS certificate when running tests you would invoke: run-webkit-tests --allowed-host example.test --additional-drt-flag '--allow-any-certificate-for-allowed-hosts' * DumpRenderTree/mac/DumpRenderTree.mm: (initializeGlobalsFromCommandLineOptions): Parse the command line option --allow-any-certificate-for-allowed-hosts. (dumpRenderTree): Allow any HTTPS certificate from each allowed host. * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::didReceiveMessageToPage): Clear out the existing list of allowed hosts before appending entries to it to avoid growing the list of allowed hosts without bound. Call platformAllowAnyHTTPSCertificateForAllowedHosts() to apply SSL relaxation for each allowed host. * WebKitTestRunner/Options.cpp: (WTR::handleOptionAllowAnyHTTPSCertificateForAllowedHosts): Added. (WTR::handleOptionAllowedHost): Update code as needed now that Options::allowedHosts is a std::set. (WTR::OptionsHandler::OptionsHandler): * WebKitTestRunner/Options.h: Change the data type of allowedHosts from a std::vector to a std::set so that we can make use of the convenience functon std::set::find() in TestController::canAuthenticateAgainstProtectionSpace(). * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): (WTR::TestController::canAuthenticateAgainstProtectionSpace): Allow any HTTPS certificate from each allowed host. * WebKitTestRunner/TestController.h: Canonical link: https://commits.webkit.org/199802@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-02 23:12:12 +00:00
std::set<std::string> allowedHosts;
Remove support for experimental: and internal: prefixes from WebKitTestRunner and DumpRenderTree https://bugs.webkit.org/show_bug.cgi?id=218569 Reviewed by Tim Horton. The prefixes were removed from use in tests in r269360. * DumpRenderTree/TestOptions.cpp: (WTR::TestOptions::webViewIsCompatibleWithOptions const): Replace duplicated comparison code with call to operator==. * TestRunnerShared/TestFeatures.cpp: (WTR::merge): Remove special maps for internal and experimental features. (WTR::operator==): (WTR::operator!=): Add operator== support for use by TestOptions in determining compatibility. (WTR::parseTestHeaderFeature): (WTR::parseTestHeader): Split out feature parsing for future use in command line parsing. * TestRunnerShared/TestFeatures.h: Remove special maps for internal and experimental features. * WebKitTestRunner/Options.cpp: (WTR::handleOptionAcceleratedDrawing): (WTR::handleOptionRemoteLayerTree): (WTR::handleOptionShowWebView): (WTR::handleOptionShowTouches): (WTR::parseFeature): (WTR::handleOptionExperimentalFeature): (WTR::handleOptionInternalFeature): * WebKitTestRunner/Options.h: Rather than parsing into bools / extra maps, parse the command line options directly into a TestFeatures. * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize): Initialize global features from the new Options' TestFeatures. (WTR::TestController::resetPreferencesToConsistentValues): Remove special casing for experimental and internal features, they are now just generic bool WebPreferences. Move special cases for internal features into TestOptions. (WTR::TestController::testOptionsForTest const): Now that global features is not seeded with the default features, construct the full merge chain starting with the default features instead. * WebKitTestRunner/TestOptions.cpp: (WTR::TestOptions::defaults): Add some additional defaults moved from TestController::resetPreferencesToConsistentValues. (WTR::TestOptions::hasSameInitializationOptions const): Use operator== to reduce duplicated code. * WebKitTestRunner/TestOptions.h: (WTR::TestOptions::experimentalFeatures const): Deleted. (WTR::TestOptions::internalDebugFeatures const): Deleted. Remove now unused extra maps for external and internal features. Canonical link: https://commits.webkit.org/231228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269390 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-04 22:22:03 +00:00
TestFeatures features;
};
class Option {
public:
Option(const char* name, const char* description, std::function<bool(Options&, const char*, const char*)> parameterHandler, bool hasArgument = false);
bool matches(const char*);
const char* name;
const char* description;
std::function<bool(Options&, const char*, const char*)> parameterHandler;
bool hasArgument;
};
class OptionsHandler {
public:
explicit OptionsHandler(Options&);
bool parse(int argc, const char* argv[]);
void printHelp(FILE* channel = stderr);
private:
Vector<Option> optionList;
Options& options;
static const char* usage;
static const char* help;
};
} // namespace WTR