haikuwebkit/Source/WebDriver/HTTPServer.h

113 lines
3.4 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
#include <wtf/Forward.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
#if USE(SOUP)
#include <wtf/glib/GRefPtr.h>
typedef struct _SoupServer SoupServer;
[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
#elif USE(INSPECTOR_SOCKET_SERVER)
#include "HTTPParser.h"
#include <JavaScriptCore/RemoteInspectorSocketEndpoint.h>
using Inspector::ConnectionID;
using Inspector::PlatformSocketType;
using Inspector::RemoteInspectorSocketEndpoint;
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
namespace WebDriver {
[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
class HTTPRequestHandler
#if USE(INSPECTOR_SOCKET_SERVER)
: public RemoteInspectorSocketEndpoint::Client
#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
public:
struct Request {
String method;
String path;
const char* data { nullptr };
size_t dataLength { 0 };
};
struct Response {
unsigned statusCode { 0 };
CString data;
String contentType;
};
virtual void handleRequest(Request&&, Function<void (Response&&)>&& replyHandler) = 0;
[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)
void connect(ConnectionID);
#endif
private:
#if USE(INSPECTOR_SOCKET_SERVER)
void sendResponse(Response&&);
void reset();
String packHTTPMessage(Response&&) const;
void didReceive(RemoteInspectorSocketEndpoint&, ConnectionID, Vector<uint8_t>&&) final;
void didClose(RemoteInspectorSocketEndpoint&, ConnectionID) final;
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<ConnectionID> m_client;
[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
HTTPParser m_parser;
#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
};
[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
class HTTPServer
#if USE(INSPECTOR_SOCKET_SERVER)
: public RemoteInspectorSocketEndpoint::Listener
#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
public:
explicit HTTPServer(HTTPRequestHandler&);
~HTTPServer() = default;
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
bool listen(const std::optional<String>& host, unsigned port);
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
void disconnect();
private:
[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<ConnectionID> doAccept(RemoteInspectorSocketEndpoint&, PlatformSocketType) final;
[WinCairo][PlayStation] Add handling for accept failure case https://bugs.webkit.org/show_bug.cgi?id=217353 Reviewed by Alex Christensen. Source/JavaScriptCore: It is rare to happen, but listening socket can be invalid state (i.e. cable disconnection, interface error), and accept() will be called because of the poll's false report. In that situation, it is required to rebuild the listening socket from the scratch. The failure of accept is the good place to capture this situation. This patch moves listening duty into Listener internal calss and it is possible to make the invalid state while maintained by SocketEndpoint. Also in case of failure continues, the retry will be gradually increasing the intervals. * inspector/remote/socket/RemoteInspectorServer.h: * inspector/remote/socket/RemoteInspectorSocketEndpoint.cpp: (Inspector::RemoteInspectorSocketEndpoint::listenInet): (Inspector::RemoteInspectorSocketEndpoint::pollingTimeout): (Inspector::RemoteInspectorSocketEndpoint::workerThread): (Inspector::RemoteInspectorSocketEndpoint::createClient): (Inspector::RemoteInspectorSocketEndpoint::disconnect): (Inspector::RemoteInspectorSocketEndpoint::acceptInetSocketIfEnabled): * inspector/remote/socket/RemoteInspectorSocketEndpoint.h: Source/WebDriver: Following the interface change. * HTTPServer.h: * socket/HTTPServerSocket.cpp: (WebDriver::HTTPServer::didStatusChanged): Canonical link: https://commits.webkit.org/231006@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-28 23:51:45 +00:00
void didChangeStatus(RemoteInspectorSocketEndpoint&, ConnectionID, RemoteInspectorSocketEndpoint::Listener::Status) final;
[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
HTTPRequestHandler& m_requestHandler;
#if USE(SOUP)
GRefPtr<SoupServer> m_soupServer;
#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<ConnectionID> m_server;
[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