mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:17:45 +00:00
WebContent+WebDriver: Move Get/Set Timeouts to WebContent
This commit is contained in:
parent
cb4b9108d1
commit
04f41bda52
6 changed files with 33 additions and 33 deletions
|
@ -476,8 +476,7 @@ Web::WebDriver::Response Client::handle_get_timeouts(Vector<StringView> const& p
|
|||
{
|
||||
dbgln_if(WEBDRIVER_DEBUG, "Handling GET /session/<session id>/timeouts");
|
||||
auto* session = TRY(find_session_with_id(parameters[0]));
|
||||
auto result = session->get_timeouts();
|
||||
return make_json_value(result);
|
||||
return session->web_content_connection().get_timeouts();
|
||||
}
|
||||
|
||||
// 9.2 Set Timeouts, https://w3c.github.io/webdriver/#dfn-set-timeouts
|
||||
|
@ -486,8 +485,7 @@ Web::WebDriver::Response Client::handle_set_timeouts(Vector<StringView> const& p
|
|||
{
|
||||
dbgln_if(WEBDRIVER_DEBUG, "Handling POST /session/<session id>/timeouts");
|
||||
auto* session = TRY(find_session_with_id(parameters[0]));
|
||||
auto result = TRY(session->set_timeouts(payload));
|
||||
return make_json_value(result);
|
||||
return session->web_content_connection().set_timeouts(payload);
|
||||
}
|
||||
|
||||
// 10.1 Navigate To, https://w3c.github.io/webdriver/#dfn-navigate-to
|
||||
|
|
|
@ -131,29 +131,6 @@ Web::WebDriver::Response Session::stop()
|
|||
return JsonValue {};
|
||||
}
|
||||
|
||||
// 9.1 Get Timeouts, https://w3c.github.io/webdriver/#dfn-get-timeouts
|
||||
JsonObject Session::get_timeouts()
|
||||
{
|
||||
// 1. Let timeouts be the timeouts object for session’s timeouts configuration
|
||||
auto timeouts = Web::WebDriver::timeouts_object(m_timeouts_configuration);
|
||||
|
||||
// 2. Return success with data timeouts.
|
||||
return timeouts;
|
||||
}
|
||||
|
||||
// 9.2 Set Timeouts, https://w3c.github.io/webdriver/#dfn-set-timeouts
|
||||
Web::WebDriver::Response Session::set_timeouts(JsonValue const& payload)
|
||||
{
|
||||
// 1. Let timeouts be the result of trying to JSON deserialize as a timeouts configuration the request’s parameters.
|
||||
auto timeouts = TRY(Web::WebDriver::json_deserialize_as_a_timeouts_configuration(payload));
|
||||
|
||||
// 2. Make the session timeouts the new timeouts.
|
||||
m_timeouts_configuration = move(timeouts);
|
||||
|
||||
// 3. Return success with data null.
|
||||
return JsonValue {};
|
||||
}
|
||||
|
||||
// 11.1 Get Window Handle, https://w3c.github.io/webdriver/#get-window-handle
|
||||
Web::WebDriver::Response Session::get_window_handle()
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <LibCore/Promise.h>
|
||||
#include <LibWeb/WebDriver/Error.h>
|
||||
#include <LibWeb/WebDriver/Response.h>
|
||||
#include <LibWeb/WebDriver/TimeoutsConfiguration.h>
|
||||
#include <WebDriver/WebContentConnection.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -48,8 +47,6 @@ public:
|
|||
|
||||
ErrorOr<void> start();
|
||||
Web::WebDriver::Response stop();
|
||||
JsonObject get_timeouts();
|
||||
Web::WebDriver::Response set_timeouts(JsonValue const& payload);
|
||||
Web::WebDriver::Response get_window_handle();
|
||||
ErrorOr<void, Variant<Web::WebDriver::Error, Error>> close_window();
|
||||
Web::WebDriver::Response get_window_handles() const;
|
||||
|
@ -66,9 +63,6 @@ private:
|
|||
String m_current_window_handle;
|
||||
RefPtr<WebContentConnection> m_web_content_connection;
|
||||
Optional<pid_t> m_browser_pid;
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-session-script-timeout
|
||||
Web::WebDriver::TimeoutsConfiguration m_timeouts_configuration;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue