haikuwebkit/Source/WebDriver/Capabilities.h

93 lines
2.9 KiB
C
Raw Permalink Normal View History

Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
/*
* Copyright (C) 2017 Igalia S.L.
*
* 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.
*/
#pragma once
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
#include <utility>
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
#include <wtf/Forward.h>
WebDriver: implement proxy support https://bugs.webkit.org/show_bug.cgi?id=180408 Reviewed by Carlos Alberto Lopez Perez. Source/JavaScriptCore: Add optional Proxy struct to session capabilities. * inspector/remote/RemoteInspector.h: * inspector/remote/glib/RemoteInspectorServer.cpp: (Inspector::processSessionCapabilities): Source/WebDriver: Handle proxy object in capabilities. * Capabilities.h: Add Proxy struct. * WebDriverService.cpp: (WebDriver::deserializeProxy): Deserialize the proxy from capabilities. (WebDriver::WebDriverService::parseCapabilities const): Get the deserialized proxy. (WebDriver::WebDriverService::validatedCapabilities const): Ensure proxy object is valid. (WebDriver::WebDriverService::matchCapabilities const): Check proxy type is supported by the platform. (WebDriver::WebDriverService::createSession): Only set an empty proxy object in capabilities if we don't have a deserialized proxy. * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::buildSessionCapabilities const): Send the proxy settings to the browser. * glib/WebDriverServiceGLib.cpp: (WebDriver::WebDriverService::platformSupportProxyType const): Return false if proxy type is "pac". Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (parseProxyCapabilities): Parse the proxy settings from capabilities. (webkitAutomationSessionCreate): Set the proxy settings received from capabilities. WebDriverTests: Unskip the tests that are now passing. * TestExpectations.json: Canonical link: https://commits.webkit.org/217382@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-11 15:16:16 +00:00
#include <wtf/URL.h>
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace WebDriver {
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
struct Timeouts {
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<double> script;
std::optional<double> pageLoad;
std::optional<double> implicit;
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
};
WebDriver: Implement page load strategy https://bugs.webkit.org/show_bug.cgi?id=175183 Reviewed by Brian Burg. Source/WebDriver: Validate and parse page load strategy when processing capabilities. * Capabilities.h: * Session.cpp: (WebDriver::Session::pageLoadStrategyString const): Helper to get the page load strategy as a String to be passed to Automation. (WebDriver::Session::go): Pass page load strategy if present. (WebDriver::Session::back): Ditto. (WebDriver::Session::forward): Ditto. (WebDriver::Session::refresh): Ditto. (WebDriver::Session::waitForNavigationToComplete): Ditto. * Session.h: * WebDriverService.cpp: (WebDriver::deserializePageLoadStrategy): (WebDriver::WebDriverService::parseCapabilities const): (WebDriver::WebDriverService::validatedCapabilities const): (WebDriver::WebDriverService::newSession): Source/WebKit: Split pending navigation maps into normal and eager, and use one or the other depending on the received page load strategy. We need to keep different maps for every page load strategy because every command could use a different strategy. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::waitForNavigationToComplete): Extract page load strategy from parameter and pass it to waitForNavigationToCompleteOnPage() and waitForNavigationToCompleteOnFrame(). (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): Return early if page load strategy is none. Otherwise at the pening callback to the normal or eager map depeding on the page load straegy. (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame): Ditto. (WebKit::respondToPendingNavigationCallbacksWithTimeout): Helper to send pening navigation callback in case of timeout failure. (WebKit::WebAutomationSession::loadTimerFired): Call finishPendingNavigationsWithTimeoutFailure() with all the maps. (WebKit::WebAutomationSession::navigateBrowsingContext): Extract page load strategy from parameter and pass it to waitForNavigationToCompleteOnPage(). (WebKit::WebAutomationSession::goBackInBrowsingContext): Ditto. (WebKit::WebAutomationSession::goForwardInBrowsingContext): Ditto. (WebKit::WebAutomationSession::reloadBrowsingContext): Ditto. (WebKit::WebAutomationSession::navigationOccurredForFrame): Use the normal maps. (WebKit::WebAutomationSession::documentLoadedForFrame): Stop timeout timer and dispatch eager pending navigations. * UIProcess/Automation/WebAutomationSession.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::didFinishDocumentLoadForFrame): Notify the automation session. Canonical link: https://commits.webkit.org/191973@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220317 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 11:14:34 +00:00
enum class PageLoadStrategy {
None,
Normal,
Eager
};
WebDriver: implement unhandled prompt behavior https://bugs.webkit.org/show_bug.cgi?id=175184 Reviewed by Brian Burg. Handle user prompts before running some of the commands according to the specification. * Capabilities.h: Add UnhandledPromptBehavior capability. * CommandResult.cpp: (WebDriver::CommandResult::httpStatusCode const): Add UnexpectedAlertOpen error. (WebDriver::CommandResult::errorString const): Ditto. * CommandResult.h: (WebDriver::CommandResult::setAdditonalErrorData): New method to set an additional data object that will be sent as part of the result error message. (WebDriver::CommandResult::additionalErrorData const): Return the additional data object. * Session.cpp: (WebDriver::Session::handleUserPrompts): Check if there's an active JavaScript dialog and deal with it depeding on the unhandled prompt behavior. (WebDriver::Session::reportUnexpectedAlertOpen): Generate an error message with UnexpectedAlertOpen error and including the alert text as additional error data. (WebDriver::Session::go): Handle user prompts before running the command. (WebDriver::Session::getCurrentURL): Ditto. (WebDriver::Session::back): Ditto. (WebDriver::Session::forward): Ditto. (WebDriver::Session::refresh): Ditto. (WebDriver::Session::getTitle): Ditto. (WebDriver::Session::closeWindow): Ditto. (WebDriver::Session::switchToFrame): Ditto. (WebDriver::Session::switchToParentFrame): Ditto. (WebDriver::Session::isElementSelected): Ditto. (WebDriver::Session::getElementText): Ditto. (WebDriver::Session::getElementTagName): Ditto. (WebDriver::Session::getElementRect): Ditto. (WebDriver::Session::isElementEnabled): Ditto. (WebDriver::Session::isElementDisplayed): Ditto. (WebDriver::Session::getElementAttribute): Ditto. (WebDriver::Session::elementSendKeys): Ditto. (WebDriver::Session::elementSubmit): Ditto. (WebDriver::Session::executeScript): Ditto. * Session.h: * WebDriverService.cpp: (WebDriver::WebDriverService::sendResponse const): Send data object as part of the result error message if present. (WebDriver::deserializeUnhandledPromptBehavior): (WebDriver::WebDriverService::parseCapabilities const): (WebDriver::WebDriverService::validatedCapabilities const): (WebDriver::WebDriverService::newSession): Canonical link: https://commits.webkit.org/192027@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220388 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-08 06:43:25 +00:00
enum class UnhandledPromptBehavior {
Dismiss,
Accept,
DismissAndNotify,
AcceptAndNotify,
WebDriver: implement unhandled prompt behavior https://bugs.webkit.org/show_bug.cgi?id=175184 Reviewed by Brian Burg. Handle user prompts before running some of the commands according to the specification. * Capabilities.h: Add UnhandledPromptBehavior capability. * CommandResult.cpp: (WebDriver::CommandResult::httpStatusCode const): Add UnexpectedAlertOpen error. (WebDriver::CommandResult::errorString const): Ditto. * CommandResult.h: (WebDriver::CommandResult::setAdditonalErrorData): New method to set an additional data object that will be sent as part of the result error message. (WebDriver::CommandResult::additionalErrorData const): Return the additional data object. * Session.cpp: (WebDriver::Session::handleUserPrompts): Check if there's an active JavaScript dialog and deal with it depeding on the unhandled prompt behavior. (WebDriver::Session::reportUnexpectedAlertOpen): Generate an error message with UnexpectedAlertOpen error and including the alert text as additional error data. (WebDriver::Session::go): Handle user prompts before running the command. (WebDriver::Session::getCurrentURL): Ditto. (WebDriver::Session::back): Ditto. (WebDriver::Session::forward): Ditto. (WebDriver::Session::refresh): Ditto. (WebDriver::Session::getTitle): Ditto. (WebDriver::Session::closeWindow): Ditto. (WebDriver::Session::switchToFrame): Ditto. (WebDriver::Session::switchToParentFrame): Ditto. (WebDriver::Session::isElementSelected): Ditto. (WebDriver::Session::getElementText): Ditto. (WebDriver::Session::getElementTagName): Ditto. (WebDriver::Session::getElementRect): Ditto. (WebDriver::Session::isElementEnabled): Ditto. (WebDriver::Session::isElementDisplayed): Ditto. (WebDriver::Session::getElementAttribute): Ditto. (WebDriver::Session::elementSendKeys): Ditto. (WebDriver::Session::elementSubmit): Ditto. (WebDriver::Session::executeScript): Ditto. * Session.h: * WebDriverService.cpp: (WebDriver::WebDriverService::sendResponse const): Send data object as part of the result error message if present. (WebDriver::deserializeUnhandledPromptBehavior): (WebDriver::WebDriverService::parseCapabilities const): (WebDriver::WebDriverService::validatedCapabilities const): (WebDriver::WebDriverService::newSession): Canonical link: https://commits.webkit.org/192027@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220388 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-08 06:43:25 +00:00
Ignore
};
WebDriver: implement proxy support https://bugs.webkit.org/show_bug.cgi?id=180408 Reviewed by Carlos Alberto Lopez Perez. Source/JavaScriptCore: Add optional Proxy struct to session capabilities. * inspector/remote/RemoteInspector.h: * inspector/remote/glib/RemoteInspectorServer.cpp: (Inspector::processSessionCapabilities): Source/WebDriver: Handle proxy object in capabilities. * Capabilities.h: Add Proxy struct. * WebDriverService.cpp: (WebDriver::deserializeProxy): Deserialize the proxy from capabilities. (WebDriver::WebDriverService::parseCapabilities const): Get the deserialized proxy. (WebDriver::WebDriverService::validatedCapabilities const): Ensure proxy object is valid. (WebDriver::WebDriverService::matchCapabilities const): Check proxy type is supported by the platform. (WebDriver::WebDriverService::createSession): Only set an empty proxy object in capabilities if we don't have a deserialized proxy. * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::buildSessionCapabilities const): Send the proxy settings to the browser. * glib/WebDriverServiceGLib.cpp: (WebDriver::WebDriverService::platformSupportProxyType const): Return false if proxy type is "pac". Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (parseProxyCapabilities): Parse the proxy settings from capabilities. (webkitAutomationSessionCreate): Set the proxy settings received from capabilities. WebDriverTests: Unskip the tests that are now passing. * TestExpectations.json: Canonical link: https://commits.webkit.org/217382@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-11 15:16:16 +00:00
struct Proxy {
String type;
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<String> autoconfigURL;
std::optional<URL> ftpURL;
std::optional<URL> httpURL;
std::optional<URL> httpsURL;
std::optional<URL> socksURL;
std::optional<uint8_t> socksVersion;
WebDriver: implement proxy support https://bugs.webkit.org/show_bug.cgi?id=180408 Reviewed by Carlos Alberto Lopez Perez. Source/JavaScriptCore: Add optional Proxy struct to session capabilities. * inspector/remote/RemoteInspector.h: * inspector/remote/glib/RemoteInspectorServer.cpp: (Inspector::processSessionCapabilities): Source/WebDriver: Handle proxy object in capabilities. * Capabilities.h: Add Proxy struct. * WebDriverService.cpp: (WebDriver::deserializeProxy): Deserialize the proxy from capabilities. (WebDriver::WebDriverService::parseCapabilities const): Get the deserialized proxy. (WebDriver::WebDriverService::validatedCapabilities const): Ensure proxy object is valid. (WebDriver::WebDriverService::matchCapabilities const): Check proxy type is supported by the platform. (WebDriver::WebDriverService::createSession): Only set an empty proxy object in capabilities if we don't have a deserialized proxy. * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::buildSessionCapabilities const): Send the proxy settings to the browser. * glib/WebDriverServiceGLib.cpp: (WebDriver::WebDriverService::platformSupportProxyType const): Return false if proxy type is "pac". Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (parseProxyCapabilities): Parse the proxy settings from capabilities. (webkitAutomationSessionCreate): Set the proxy settings received from capabilities. WebDriverTests: Unskip the tests that are now passing. * TestExpectations.json: Canonical link: https://commits.webkit.org/217382@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-11 15:16:16 +00:00
Vector<String> ignoreAddressList;
};
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
struct Capabilities {
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<String> browserName;
std::optional<String> browserVersion;
std::optional<String> platformName;
std::optional<bool> acceptInsecureCerts;
std::optional<bool> strictFileInteractability;
std::optional<bool> setWindowRect;
std::optional<Timeouts> timeouts;
std::optional<PageLoadStrategy> pageLoadStrategy;
std::optional<UnhandledPromptBehavior> unhandledPromptBehavior;
std::optional<Proxy> proxy;
[WPE] Add initial support for WebDriver https://bugs.webkit.org/show_bug.cgi?id=179727 Reviewed by Michael Catanzaro. .: Enable WebDriver by default in WPE. * Source/cmake/OptionsWPE.cmake: Source/WebDriver: Add WPE implementation for platform-specific methods. Move the version handling to a common file WebDriverServiceGLib.cpp. * Capabilities.h: * PlatformGTK.cmake: * PlatformWPE.cmake: * glib/WebDriverServiceGLib.cpp: Added. (WebDriver::parseVersion): (WebDriver::WebDriverService::platformCompareBrowserVersions): * gtk/WebDriverServiceGtk.cpp: * wpe/WebDriverServiceWPE.cpp: Copied from Source/WebDriver/gtk/WebDriverServiceGtk.cpp. (WebDriver::WebDriverService::platformCapabilities): (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): Tools: Make it possible to run WebDriver tests with WPE. * Scripts/run-webdriver-tests: Add --wpe alias for --platform=wpe. * Scripts/webkitpy/port/wpe.py: (WPEPort.__init__): Initialize _display_server from options. (WPEPort._driver_class): Use WaylandDriver when wayland is passed as display server option. * Scripts/webkitpy/webdriver_tests/webdriver_driver.py: (WebDriver.browser_env): Add virtual method to get the environment that should be used. * Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py: Copied from Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver.py. (WebDriverWPE): (WebDriverWPE.__init__): (WebDriverWPE.binary_path): (WebDriverWPE.browser_name): (WebDriverWPE.capabilities): (WebDriverWPE.browser_env): * Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py: (WebDriverW3CExecutor.__init__): Update the environment with the one provided by the driver. * wpe/jhbuild.modules: Upgrade dyz to newer version that supports automation. Canonical link: https://commits.webkit.org/195790@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-16 12:48:22 +00:00
#if PLATFORM(GTK) || PLATFORM(WPE)
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<String> browserBinary;
std::optional<Vector<String>> browserArguments;
std::optional<Vector<std::pair<String, String>>> certificates;
[WPE] Add initial support for WebDriver https://bugs.webkit.org/show_bug.cgi?id=179727 Reviewed by Michael Catanzaro. .: Enable WebDriver by default in WPE. * Source/cmake/OptionsWPE.cmake: Source/WebDriver: Add WPE implementation for platform-specific methods. Move the version handling to a common file WebDriverServiceGLib.cpp. * Capabilities.h: * PlatformGTK.cmake: * PlatformWPE.cmake: * glib/WebDriverServiceGLib.cpp: Added. (WebDriver::parseVersion): (WebDriver::WebDriverService::platformCompareBrowserVersions): * gtk/WebDriverServiceGtk.cpp: * wpe/WebDriverServiceWPE.cpp: Copied from Source/WebDriver/gtk/WebDriverServiceGtk.cpp. (WebDriver::WebDriverService::platformCapabilities): (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): Tools: Make it possible to run WebDriver tests with WPE. * Scripts/run-webdriver-tests: Add --wpe alias for --platform=wpe. * Scripts/webkitpy/port/wpe.py: (WPEPort.__init__): Initialize _display_server from options. (WPEPort._driver_class): Use WaylandDriver when wayland is passed as display server option. * Scripts/webkitpy/webdriver_tests/webdriver_driver.py: (WebDriver.browser_env): Add virtual method to get the environment that should be used. * Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py: Copied from Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver.py. (WebDriverWPE): (WebDriverWPE.__init__): (WebDriverWPE.binary_path): (WebDriverWPE.browser_name): (WebDriverWPE.capabilities): (WebDriverWPE.browser_env): * Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py: (WebDriverW3CExecutor.__init__): Update the environment with the one provided by the driver. * wpe/jhbuild.modules: Upgrade dyz to newer version that supports automation. Canonical link: https://commits.webkit.org/195790@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-16 12:48:22 +00:00
#endif
#if PLATFORM(GTK)
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<bool> useOverlayScrollbars;
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
#endif
[PlayStation][WinCairo] Enable WebDriver target on PlayStation and client for WinCairo https://bugs.webkit.org/show_bug.cgi?id=216908 Reviewed by Don Olmstead. Source/JavaScriptCore: Implement automation session correctly for PlayStation and WinCairo. * inspector/remote/RemoteInspector.h: * inspector/remote/socket/RemoteInspectorConnectionClient.cpp: (Inspector::RemoteInspectorConnectionClient::parseTargetListJSON): * inspector/remote/socket/RemoteInspectorConnectionClient.h: * inspector/remote/socket/RemoteInspectorSocket.cpp: (Inspector::RemoteInspector::stopInternal): (Inspector::RemoteInspector::requestAutomationSession): (Inspector::RemoteInspector::startAutomationSession): Source/WebDriver: Extend WebDriver client binary to support connection to remote device for both PlayStation and WinCairo. We've implemented a simple web server to accept WebDriver request natively and bypass them to RemoteInspector. * Capabilities.h: * HTTPServer.h: * PlatformPlayStation.cmake: Added. * PlatformWin.cmake: * SessionHost.h: (WebDriver::SessionHost::setHostAddress): * WebDriverMain.cpp: (main): (dllLauncherEntryPoint): * WebDriverService.cpp: (WebDriver::printUsageStatement): (WebDriver::WebDriverService::run): (WebDriver::WebDriverService::connectToBrowser): * WebDriverService.h: * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformInit): * playstation/WebDriverServicePlayStation.cpp: Copied from Source\WebDriver\win\WebDriverServiceWin.cpp. (WebDriver::WebDriverService::platformInit): (WebDriver::WebDriverService::platformCapabilities): (WebDriver::WebDriverService::platformCompareBrowserVersions): (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): (WebDriver::WebDriverService::platformSupportProxyType const): * socket/CapabilitiesSocket.cpp: Copied from Source\WebDriver\socket\SessionHostSocket.cpp. (WebDriver::CapabilitiesSocket::parseCapabilities): * socket/CapabilitiesSocket.h: Copied from Source\WebDriver\socket\HTTPServerSocket.cpp. * socket/HTTPParser.cpp: Added. (WebDriver::HTTPParser::parse): (WebDriver::HTTPParser::handlePhase): (WebDriver::HTTPParser::abortProcess): (WebDriver::HTTPParser::parseFirstLine): (WebDriver::HTTPParser::readLine): (WebDriver::HTTPParser::expectedBodyLength const): * socket/HTTPParser.h: Copied from Source\WebDriver\HTTPServer.h. (WebDriver::HTTPParser::pullMessage): * socket/HTTPServerSocket.cpp: (WebDriver::HTTPServer::listen): (WebDriver::HTTPServer::disconnect): (WebDriver::HTTPServer::doAccept): (WebDriver::HTTPServer::didClose): (WebDriver::HTTPRequestHandler::connect): (WebDriver::HTTPRequestHandler::reset): (WebDriver::HTTPRequestHandler::didReceive): (WebDriver::HTTPRequestHandler::sendResponse): (WebDriver::HTTPRequestHandler::packHTTPMessage const): (WebDriver::HTTPRequestHandler::didClose): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::dispatchMap): (WebDriver::SessionHost::sendWebInspectorEvent): (WebDriver::SessionHost::connectToBrowser): (WebDriver::SessionHost::isConnected const): (WebDriver::SessionHost::didClose): (WebDriver::SessionHost::parseTargetList): (WebDriver::SessionHost::receivedSetTargetList): (WebDriver::SessionHost::receivedSendMessageToFrontend): (WebDriver::SessionHost::startAutomationSession): (WebDriver::SessionHost::setTargetList): (WebDriver::SessionHost::sendMessageToBackend): * win/WebDriverServiceWin.cpp: (WebDriver::WebDriverService::platformInit): (WebDriver::WebDriverService::platformParseCapabilities const): * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformInit): Canonical link: https://commits.webkit.org/229926@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267807 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-30 21:22:57 +00:00
#if USE(INSPECTOR_SOCKET_SERVER)
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<String> targetAddr;
std::optional<int> targetPort;
[PlayStation][WinCairo] Enable WebDriver target on PlayStation and client for WinCairo https://bugs.webkit.org/show_bug.cgi?id=216908 Reviewed by Don Olmstead. Source/JavaScriptCore: Implement automation session correctly for PlayStation and WinCairo. * inspector/remote/RemoteInspector.h: * inspector/remote/socket/RemoteInspectorConnectionClient.cpp: (Inspector::RemoteInspectorConnectionClient::parseTargetListJSON): * inspector/remote/socket/RemoteInspectorConnectionClient.h: * inspector/remote/socket/RemoteInspectorSocket.cpp: (Inspector::RemoteInspector::stopInternal): (Inspector::RemoteInspector::requestAutomationSession): (Inspector::RemoteInspector::startAutomationSession): Source/WebDriver: Extend WebDriver client binary to support connection to remote device for both PlayStation and WinCairo. We've implemented a simple web server to accept WebDriver request natively and bypass them to RemoteInspector. * Capabilities.h: * HTTPServer.h: * PlatformPlayStation.cmake: Added. * PlatformWin.cmake: * SessionHost.h: (WebDriver::SessionHost::setHostAddress): * WebDriverMain.cpp: (main): (dllLauncherEntryPoint): * WebDriverService.cpp: (WebDriver::printUsageStatement): (WebDriver::WebDriverService::run): (WebDriver::WebDriverService::connectToBrowser): * WebDriverService.h: * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformInit): * playstation/WebDriverServicePlayStation.cpp: Copied from Source\WebDriver\win\WebDriverServiceWin.cpp. (WebDriver::WebDriverService::platformInit): (WebDriver::WebDriverService::platformCapabilities): (WebDriver::WebDriverService::platformCompareBrowserVersions): (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): (WebDriver::WebDriverService::platformSupportProxyType const): * socket/CapabilitiesSocket.cpp: Copied from Source\WebDriver\socket\SessionHostSocket.cpp. (WebDriver::CapabilitiesSocket::parseCapabilities): * socket/CapabilitiesSocket.h: Copied from Source\WebDriver\socket\HTTPServerSocket.cpp. * socket/HTTPParser.cpp: Added. (WebDriver::HTTPParser::parse): (WebDriver::HTTPParser::handlePhase): (WebDriver::HTTPParser::abortProcess): (WebDriver::HTTPParser::parseFirstLine): (WebDriver::HTTPParser::readLine): (WebDriver::HTTPParser::expectedBodyLength const): * socket/HTTPParser.h: Copied from Source\WebDriver\HTTPServer.h. (WebDriver::HTTPParser::pullMessage): * socket/HTTPServerSocket.cpp: (WebDriver::HTTPServer::listen): (WebDriver::HTTPServer::disconnect): (WebDriver::HTTPServer::doAccept): (WebDriver::HTTPServer::didClose): (WebDriver::HTTPRequestHandler::connect): (WebDriver::HTTPRequestHandler::reset): (WebDriver::HTTPRequestHandler::didReceive): (WebDriver::HTTPRequestHandler::sendResponse): (WebDriver::HTTPRequestHandler::packHTTPMessage const): (WebDriver::HTTPRequestHandler::didClose): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::dispatchMap): (WebDriver::SessionHost::sendWebInspectorEvent): (WebDriver::SessionHost::connectToBrowser): (WebDriver::SessionHost::isConnected const): (WebDriver::SessionHost::didClose): (WebDriver::SessionHost::parseTargetList): (WebDriver::SessionHost::receivedSetTargetList): (WebDriver::SessionHost::receivedSendMessageToFrontend): (WebDriver::SessionHost::startAutomationSession): (WebDriver::SessionHost::setTargetList): (WebDriver::SessionHost::sendMessageToBackend): * win/WebDriverServiceWin.cpp: (WebDriver::WebDriverService::platformInit): (WebDriver::WebDriverService::platformParseCapabilities const): * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformInit): Canonical link: https://commits.webkit.org/229926@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267807 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-30 21:22:57 +00:00
#endif
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
};
} // namespace WebDriver