mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-20 10:02:51 +00:00
Cookies have a minimum expiry resolution of 1 second. So to test cookie expiration, the test had to idle for at least a second, which is quite a noticeable delay now that LibWeb tests are parallelized. Instead, we can add an internal API to expire cookies with a time offset to avoid this idle delay.
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
/*
|
|
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
#include <LibWeb/Internals/InternalAnimationTimeline.h>
|
|
#include <LibWeb/UIEvents/MouseButton.h>
|
|
#include <LibWeb/WebIDL/Types.h>
|
|
|
|
namespace Web::Internals {
|
|
|
|
class Internals final : public Bindings::PlatformObject {
|
|
WEB_PLATFORM_OBJECT(Internals, Bindings::PlatformObject);
|
|
JS_DECLARE_ALLOCATOR(Internals);
|
|
|
|
public:
|
|
virtual ~Internals() override;
|
|
|
|
void signal_text_test_is_done(String const& text);
|
|
|
|
void gc();
|
|
JS::Object* hit_test(double x, double y);
|
|
|
|
void send_text(HTML::HTMLElement&, String const&, WebIDL::UnsignedShort modifiers);
|
|
void send_key(HTML::HTMLElement&, String const&, WebIDL::UnsignedShort modifiers);
|
|
void commit_text();
|
|
|
|
void click(double x, double y);
|
|
void middle_click(double x, double y);
|
|
void move_pointer_to(double x, double y);
|
|
void wheel(double x, double y, double delta_x, double delta_y);
|
|
|
|
WebIDL::ExceptionOr<bool> dispatch_user_activated_event(DOM::EventTarget&, DOM::Event& event);
|
|
|
|
void spoof_current_url(String const& url);
|
|
|
|
JS::NonnullGCPtr<InternalAnimationTimeline> create_internal_animation_timeline();
|
|
|
|
void simulate_drag_start(double x, double y, String const& name, String const& contents);
|
|
void simulate_drag_move(double x, double y);
|
|
void simulate_drop(double x, double y);
|
|
|
|
void expire_cookies_with_time_offset(WebIDL::LongLong seconds);
|
|
|
|
private:
|
|
explicit Internals(JS::Realm&);
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
void click(double x, double y, UIEvents::MouseButton);
|
|
|
|
HTML::Window& internals_window() const;
|
|
Page& internals_page() const;
|
|
};
|
|
|
|
}
|