/* * Copyright (c) 2022, Florent Castelli * Copyright (c) 2022, Linus Groh * Copyright (c) 2022, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include namespace WebDriver { class Session { public: Session(unsigned session_id, NonnullRefPtr client, Web::WebDriver::LadybirdOptions options); ~Session(); unsigned session_id() const { return m_id; } WebContentConnection& web_content_connection() { VERIFY(m_web_content_connection); return *m_web_content_connection; } ErrorOr start(); Web::WebDriver::Response stop(); private: using ServerPromise = Core::Promise>; ErrorOr> create_server(DeprecatedString const& socket_path, NonnullRefPtr promise); NonnullRefPtr m_client; Web::WebDriver::LadybirdOptions m_options; bool m_started { false }; unsigned m_id { 0 }; RefPtr m_web_content_connection; Optional m_browser_pid; }; }