mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:37:34 +00:00
WebDriver: Implement POST /session/{id}/window/fullscreen
endpoint
This commit is contained in:
parent
6805cf00ad
commit
1aa16b4dd4
12 changed files with 57 additions and 0 deletions
|
@ -50,6 +50,7 @@ endpoint WebContentClient
|
|||
did_request_resize_window(Gfx::IntSize size) => (Gfx::IntSize window_size)
|
||||
did_request_maximize_window() => (Gfx::IntRect window_rect)
|
||||
did_request_minimize_window() => (Gfx::IntRect window_rect)
|
||||
did_request_fullscreen_window() => (Gfx::IntRect window_rect)
|
||||
did_request_file(String path, i32 request_id) =|
|
||||
|
||||
did_output_js_console_message(i32 message_index) =|
|
||||
|
|
|
@ -15,6 +15,7 @@ endpoint WebDriverClient {
|
|||
set_window_rect(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
maximize_window() => (Web::WebDriver::Response response)
|
||||
minimize_window() => (Web::WebDriver::Response response)
|
||||
fullscreen_window() => (Web::WebDriver::Response response)
|
||||
find_element(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
find_elements(JsonValue payload) => (Web::WebDriver::Response response)
|
||||
find_element_from_element(JsonValue payload, String element_id) => (Web::WebDriver::Response response)
|
||||
|
|
|
@ -515,6 +515,28 @@ Messages::WebDriverClient::MinimizeWindowResponse WebDriverConnection::minimize_
|
|||
return serialize_rect(window_rect);
|
||||
}
|
||||
|
||||
// 11.8.5 Fullscreen Window, https://w3c.github.io/webdriver/#dfn-fullscreen-window
|
||||
Messages::WebDriverClient::FullscreenWindowResponse WebDriverConnection::fullscreen_window()
|
||||
{
|
||||
// 1. If the remote end does not support fullscreen return error with error code unsupported operation.
|
||||
|
||||
// 2. If the current top-level browsing context is no longer open, return error with error code no such window.
|
||||
TRY(ensure_open_top_level_browsing_context());
|
||||
|
||||
// FIXME: 3. Handle any user prompts and return its value if it is an error.
|
||||
|
||||
// 4. Restore the window.
|
||||
restore_the_window();
|
||||
|
||||
// 5. FIXME: Call fullscreen an element with the current top-level browsing context’s active document’s document element.
|
||||
// As described in https://fullscreen.spec.whatwg.org/#fullscreen-an-element
|
||||
// NOTE: What we do here is basically `requestFullscreen(options)` with options["navigationUI"]="show"
|
||||
auto rect = m_web_content_client.did_request_fullscreen_window();
|
||||
|
||||
// 6. Return success with data set to the WindowRect object for the current top-level browsing context.
|
||||
return serialize_rect(rect);
|
||||
}
|
||||
|
||||
// 12.3.2 Find Element, https://w3c.github.io/webdriver/#dfn-find-element
|
||||
Messages::WebDriverClient::FindElementResponse WebDriverConnection::find_element(JsonValue const& payload)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@ private:
|
|||
virtual Messages::WebDriverClient::SetWindowRectResponse set_window_rect(JsonValue const& payload) override;
|
||||
virtual Messages::WebDriverClient::MaximizeWindowResponse maximize_window() override;
|
||||
virtual Messages::WebDriverClient::MinimizeWindowResponse minimize_window() override;
|
||||
virtual Messages::WebDriverClient::FullscreenWindowResponse fullscreen_window() override;
|
||||
virtual Messages::WebDriverClient::FindElementResponse find_element(JsonValue const& payload) override;
|
||||
virtual Messages::WebDriverClient::FindElementsResponse find_elements(JsonValue const& payload) override;
|
||||
virtual Messages::WebDriverClient::FindElementFromElementResponse find_element_from_element(JsonValue const& payload, String const& element_id) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue