mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:37:45 +00:00
WebContent+WebDriver: Move Window commands to WebContent
This moves Get Window Handle, Close Window, and Get Window Handles over to WebContent so they may be implemented closer to the spec and be used by Ladybird.
This commit is contained in:
parent
be50806a18
commit
826d5f8f9a
6 changed files with 76 additions and 98 deletions
|
@ -9,7 +9,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibCore/Promise.h>
|
||||
#include <LibWeb/WebDriver/Error.h>
|
||||
|
@ -26,19 +25,6 @@ public:
|
|||
|
||||
unsigned session_id() const { return m_id; }
|
||||
|
||||
struct Window {
|
||||
String handle;
|
||||
bool is_open;
|
||||
};
|
||||
|
||||
struct LocalElement {
|
||||
i32 id;
|
||||
};
|
||||
|
||||
ErrorOr<Window*, Web::WebDriver::Error> current_window();
|
||||
ErrorOr<void, Web::WebDriver::Error> check_for_open_top_level_browsing_context_or_return_error();
|
||||
String const& current_window_handle() { return m_current_window_handle; }
|
||||
|
||||
WebContentConnection& web_content_connection()
|
||||
{
|
||||
VERIFY(m_web_content_connection);
|
||||
|
@ -47,10 +33,6 @@ public:
|
|||
|
||||
ErrorOr<void> start();
|
||||
Web::WebDriver::Response stop();
|
||||
Web::WebDriver::Response get_window_handle();
|
||||
Web::WebDriver::Response close_window();
|
||||
Web::WebDriver::Response get_window_handles() const;
|
||||
Web::WebDriver::Response take_element_screenshot(StringView element_id);
|
||||
|
||||
private:
|
||||
using ServerPromise = Core::Promise<ErrorOr<void>>;
|
||||
|
@ -59,8 +41,6 @@ private:
|
|||
NonnullRefPtr<Client> m_client;
|
||||
bool m_started { false };
|
||||
unsigned m_id { 0 };
|
||||
HashMap<String, NonnullOwnPtr<Window>> m_windows;
|
||||
String m_current_window_handle;
|
||||
RefPtr<WebContentConnection> m_web_content_connection;
|
||||
Optional<pid_t> m_browser_pid;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue