#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/widget/input/main_thread_event_queue.h"
#include <stddef.h>
#include <new>
#include <tuple>
#include <utility>
#include "base/auto_reset.h"
#include "base/containers/adapters.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ref.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/string_util.h"
#include "base/test/test_simple_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "cc/metrics/event_metrics.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event_attribution.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#include "third_party/blink/public/platform/scheduler/test/web_mock_thread_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/test/fake_widget_scheduler.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
namespace {
const base::TimeDelta kFrameInterval = …;
bool Equal(const WebTouchEvent& lhs, const WebTouchEvent& rhs) { … }
bool Equal(const WebMouseWheelEvent& lhs, const WebMouseWheelEvent& rhs) { … }
}
class HandledTask { … };
class HandledEvent : public HandledTask { … };
class HandledClosure : public HandledTask { … };
enum class CallbackReceivedState { … };
void PrintTo(CallbackReceivedState state, std::ostream* os) { … }
class ReceivedCallback { … };
class HandledEventCallbackTracker { … };
MATCHER_P3(IsHandledTouchEvent, event_type, touch_id, dispatch_type, "") { … }
class MockWidgetScheduler : public scheduler::FakeWidgetScheduler { … };
class MainThreadEventQueueTest : public testing::Test,
public testing::WithParamInterface<bool>,
public MainThreadEventQueueClient,
private ScopedUnblockTouchMoveEarlierForTest { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MainThreadEventQueueTest, ClientDoesntHandleInputEvent) { … }
TEST_P(MainThreadEventQueueTest, NonBlockingWheel) { … }
TEST_P(MainThreadEventQueueTest, NonBlockingTouch) { … }
TEST_P(MainThreadEventQueueTest, BlockingTouch) { … }
TEST_P(MainThreadEventQueueTest, InterleavedEvents) { … }
TEST_P(MainThreadEventQueueTest, RafAlignedMouseInput) { … }
TEST_P(MainThreadEventQueueTest, RafAlignedTouchInput) { … }
TEST_P(MainThreadEventQueueTest, RafAlignedTouchInputCoalescedMoves) { … }
TEST_P(MainThreadEventQueueTest, RafAlignedTouchInputThrottlingMoves) { … }
TEST_P(MainThreadEventQueueTest, LowLatency) { … }
TEST_P(MainThreadEventQueueTest, BlockingTouchesDuringFling) { … }
TEST_P(MainThreadEventQueueTest, BlockingTouchesOutsideFling) { … }
TEST_P(MainThreadEventQueueTest, QueueingEventTimestampRecorded) { … }
TEST_P(MainThreadEventQueueTest, QueuingTwoClosures) { … }
TEST_P(MainThreadEventQueueTest, QueuingClosureWithRafEvent) { … }
TEST_P(MainThreadEventQueueTest, QueuingClosuresBetweenEvents) { … }
TEST_P(MainThreadEventQueueTest, BlockingTouchMoveBecomesNonBlocking) { … }
TEST_P(MainThreadEventQueueTest, BlockingTouchMoveWithTouchEnd) { … }
TEST_P(MainThreadEventQueueTest,
UnblockTouchMoveAfterTouchStartAndFirstTouchMoveNotConsumed) { … }
TEST_P(MainThreadEventQueueTest, UnbufferedDispatchTouchEvent) { … }
TEST_P(MainThreadEventQueueTest, PointerEventsCoalescing) { … }
TEST_P(MainThreadEventQueueTest, PointerRawUpdateEvents) { … }
TEST_P(MainThreadEventQueueTest, UnbufferedDispatchMouseEvent) { … }
TEST_P(MainThreadEventQueueTest, PointerEventsWithRelativeMotionCoalescing) { … }
TEST_P(MainThreadEventQueueTest, InputEventsDispatchedNotified) { … }
}