| Index: services/ui/ws/event_dispatcher_unittest.cc
|
| diff --git a/services/ui/ws/event_dispatcher_unittest.cc b/services/ui/ws/event_dispatcher_unittest.cc
|
| index 7888872d8b86c10b911f1d55f684311812d8f598..9c213007a77d41ad7676403b151ac99818182734 100644
|
| --- a/services/ui/ws/event_dispatcher_unittest.cc
|
| +++ b/services/ui/ws/event_dispatcher_unittest.cc
|
| @@ -9,9 +9,12 @@
|
|
|
| #include <queue>
|
|
|
| +#include "base/command_line.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/memory/weak_ptr.h"
|
| +#include "base/run_loop.h"
|
| +#include "base/test/scoped_task_environment.h"
|
| #include "services/ui/common/accelerator_util.h"
|
| #include "services/ui/ws/accelerator.h"
|
| #include "services/ui/ws/event_dispatcher_delegate.h"
|
| @@ -106,7 +109,7 @@ class TestEventDispatcherDelegate : public EventDispatcherDelegate {
|
| private:
|
| // EventDispatcherDelegate:
|
| void OnAccelerator(uint32_t accelerator,
|
| - const int64_t display_id,
|
| + int64_t display_id,
|
| const ui::Event& event,
|
| AcceleratorPhase phase) override {
|
| EXPECT_EQ(0u, last_accelerator_);
|
| @@ -114,7 +117,7 @@ class TestEventDispatcherDelegate : public EventDispatcherDelegate {
|
| last_accelerator_phase_ = phase;
|
| }
|
| ServerWindow* GetFocusedWindowForEventDispatcher(
|
| - const int64_t display_id) override {
|
| + int64_t display_id) override {
|
| return focused_window_;
|
| }
|
| void SetNativeCapture(ServerWindow* window) override {}
|
| @@ -128,10 +131,10 @@ class TestEventDispatcherDelegate : public EventDispatcherDelegate {
|
| lost_capture_window_ = old_capture_window;
|
| }
|
| void OnMouseCursorLocationChanged(const gfx::Point& point,
|
| - const int64_t display_id) override {}
|
| + int64_t display_id) override {}
|
| void DispatchInputEventToWindow(ServerWindow* target,
|
| ClientSpecificId client_id,
|
| - const int64_t display_id,
|
| + int64_t display_id,
|
| const ui::Event& event,
|
| Accelerator* accelerator) override {
|
| std::unique_ptr<DispatchedEventDetails> details(new DispatchedEventDetails);
|
| @@ -141,6 +144,7 @@ class TestEventDispatcherDelegate : public EventDispatcherDelegate {
|
| details->accelerator = accelerator;
|
| dispatched_event_queue_.push(std::move(details));
|
| }
|
| + void ProcessNextAvailableEvent() override {}
|
| ClientSpecificId GetEventTargetClientId(const ServerWindow* window,
|
| bool in_nonclient_area) override {
|
| return in_nonclient_area ? kNonclientAreaId : kClientAreaId;
|
| @@ -150,7 +154,7 @@ class TestEventDispatcherDelegate : public EventDispatcherDelegate {
|
| return root_;
|
| }
|
| void OnEventTargetNotFound(const ui::Event& event,
|
| - const int64_t display_id) override {
|
| + int64_t display_id) override {
|
| last_event_target_not_found_ = ui::Event::Clone(event);
|
| }
|
|
|
| @@ -198,39 +202,12 @@ void ExpectDispatchedEventDetailsMatches(const DispatchedEventDetails* details,
|
| ASSERT_EQ(location, details->event->AsLocatedEvent()->location());
|
| }
|
|
|
| -void RunMouseEventTests(EventDispatcher* dispatcher,
|
| - TestEventDispatcherDelegate* dispatcher_delegate,
|
| - MouseEventTest* tests,
|
| - size_t test_count) {
|
| - for (size_t i = 0; i < test_count; ++i) {
|
| - const MouseEventTest& test = tests[i];
|
| - ASSERT_FALSE(dispatcher_delegate->has_queued_events())
|
| - << " unexpected queued events before running " << i;
|
| - dispatcher->ProcessEvent(ui::PointerEvent(test.input_event), 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| -
|
| - std::unique_ptr<DispatchedEventDetails> details =
|
| - dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| - ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches(
|
| - details.get(), test.expected_target_window1,
|
| - test.expected_root_location1, test.expected_location1))
|
| - << " details don't match " << i;
|
| - details = dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| - ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches(
|
| - details.get(), test.expected_target_window2,
|
| - test.expected_root_location2, test.expected_location2))
|
| - << " details2 don't match " << i;
|
| - ASSERT_FALSE(dispatcher_delegate->has_queued_events())
|
| - << " unexpected queued events after running " << i;
|
| - }
|
| -}
|
| -
|
| } // namespace
|
|
|
| // Test fixture for EventDispatcher with friend access to verify the internal
|
| // state. Setup creates a TestServerWindowDelegate, a visible root ServerWindow,
|
| // a TestEventDispatcher and the EventDispatcher for testing.
|
| -class EventDispatcherTest : public testing::Test,
|
| +class EventDispatcherTest : public testing::TestWithParam<bool>,
|
| public TestEventDispatcherDelegate::Delegate {
|
| public:
|
| EventDispatcherTest() {}
|
| @@ -242,6 +219,17 @@ class EventDispatcherTest : public testing::Test,
|
| }
|
| EventDispatcher* event_dispatcher() { return event_dispatcher_.get(); }
|
|
|
| + void DispatchEvent(EventDispatcher* dispatcher,
|
| + const ui::Event& event,
|
| + int64_t display_id,
|
| + EventDispatcher::AcceleratorMatchPhase match_phase);
|
| + void SetMousePointerDisplayLocation(EventDispatcher* dispatcher,
|
| + const gfx::Point& display_location,
|
| + int64_t display_id);
|
| + void RunMouseEventTests(EventDispatcher* dispatcher,
|
| + TestEventDispatcherDelegate* dispatcher_delegate,
|
| + MouseEventTest* tests,
|
| + size_t test_count);
|
| bool AreAnyPointersDown() const;
|
| // Deletes everything created during SetUp()
|
| void ClearSetup();
|
| @@ -256,7 +244,7 @@ class EventDispatcherTest : public testing::Test,
|
| ServerWindow* GetActiveSystemModalWindow() const;
|
|
|
| protected:
|
| - // testing::Test:
|
| + // testing::TestWithParam<bool>:
|
| void SetUp() override;
|
|
|
| private:
|
| @@ -265,14 +253,63 @@ class EventDispatcherTest : public testing::Test,
|
| event_dispatcher_->SetCaptureWindow(nullptr, kInvalidClientId);
|
| }
|
|
|
| + void RunTasks();
|
| +
|
| std::unique_ptr<TestServerWindowDelegate> window_delegate_;
|
| std::unique_ptr<ServerWindow> root_window_;
|
| std::unique_ptr<TestEventDispatcherDelegate> test_event_dispatcher_delegate_;
|
| std::unique_ptr<EventDispatcher> event_dispatcher_;
|
|
|
| + base::test::ScopedTaskEnvironment scoped_task_environment_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(EventDispatcherTest);
|
| };
|
|
|
| +void EventDispatcherTest::DispatchEvent(
|
| + EventDispatcher* dispatcher,
|
| + const ui::Event& event,
|
| + int64_t display_id,
|
| + EventDispatcher::AcceleratorMatchPhase match_phase) {
|
| + dispatcher->ProcessEvent(event, display_id, match_phase);
|
| + RunTasks();
|
| +}
|
| +
|
| +void EventDispatcherTest::SetMousePointerDisplayLocation(
|
| + EventDispatcher* dispatcher,
|
| + const gfx::Point& display_location,
|
| + int64_t display_id) {
|
| + dispatcher->SetMousePointerDisplayLocation(display_location, display_id);
|
| + RunTasks();
|
| +}
|
| +
|
| +void EventDispatcherTest::RunMouseEventTests(
|
| + EventDispatcher* dispatcher,
|
| + TestEventDispatcherDelegate* dispatcher_delegate,
|
| + MouseEventTest* tests,
|
| + size_t test_count) {
|
| + for (size_t i = 0; i < test_count; ++i) {
|
| + const MouseEventTest& test = tests[i];
|
| + ASSERT_FALSE(dispatcher_delegate->has_queued_events())
|
| + << " unexpected queued events before running " << i;
|
| + DispatchEvent(dispatcher, ui::PointerEvent(test.input_event), 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| +
|
| + std::unique_ptr<DispatchedEventDetails> details =
|
| + dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| + ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches(
|
| + details.get(), test.expected_target_window1,
|
| + test.expected_root_location1, test.expected_location1))
|
| + << " details don't match " << i;
|
| + details = dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| + ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches(
|
| + details.get(), test.expected_target_window2,
|
| + test.expected_root_location2, test.expected_location2))
|
| + << " details2 don't match " << i;
|
| + ASSERT_FALSE(dispatcher_delegate->has_queued_events())
|
| + << " unexpected queued events after running " << i;
|
| + }
|
| +}
|
| +
|
| bool EventDispatcherTest::AreAnyPointersDown() const {
|
| return EventDispatcherTestApi(event_dispatcher_.get()).AreAnyPointersDown();
|
| }
|
| @@ -321,8 +358,22 @@ ServerWindow* EventDispatcherTest::GetActiveSystemModalWindow() const {
|
| return ModalWindowControllerTestApi(mwc).GetActiveSystemModalWindow();
|
| }
|
|
|
| +void EventDispatcherTest::RunTasks() {
|
| + bool enable_async_event_targeting = GetParam();
|
| + if (!enable_async_event_targeting)
|
| + return;
|
| +
|
| + base::RunLoop runloop;
|
| + runloop.RunUntilIdle();
|
| +}
|
| +
|
| void EventDispatcherTest::SetUp() {
|
| - testing::Test::SetUp();
|
| + bool enable_async_event_targeting = GetParam();
|
| + if (enable_async_event_targeting) {
|
| + base::CommandLine::ForCurrentProcess()->AppendSwitch(
|
| + "enable-async-event-targeting");
|
| + }
|
| + testing::TestWithParam<bool>::SetUp();
|
|
|
| window_delegate_ = base::MakeUnique<TestServerWindowDelegate>();
|
| root_window_ =
|
| @@ -337,7 +388,7 @@ void EventDispatcherTest::SetUp() {
|
| test_event_dispatcher_delegate_->set_root(root_window_.get());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, ProcessEvent) {
|
| +TEST_P(EventDispatcherTest, ProcessEvent) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -347,8 +398,8 @@ TEST_F(EventDispatcherTest, ProcessEvent) {
|
| const ui::PointerEvent ui_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(ui_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), ui_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -363,11 +414,11 @@ TEST_F(EventDispatcherTest, ProcessEvent) {
|
| EXPECT_EQ(gfx::Point(10, 15), dispatched_event->location());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, ProcessEventNoTarget) {
|
| +TEST_P(EventDispatcherTest, ProcessEventNoTarget) {
|
| // Send event without a target.
|
| ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
|
| - event_dispatcher()->ProcessEvent(key, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Event wasn't dispatched to a target.
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| @@ -382,7 +433,7 @@ TEST_F(EventDispatcherTest, ProcessEventNoTarget) {
|
| EXPECT_EQ(ui::VKEY_A, event_out->AsKeyEvent()->key_code());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, AcceleratorBasic) {
|
| +TEST_P(EventDispatcherTest, AcceleratorBasic) {
|
| ClearSetup();
|
| TestEventDispatcherDelegate event_dispatcher_delegate(nullptr);
|
| EventDispatcher dispatcher(&event_dispatcher_delegate);
|
| @@ -420,7 +471,7 @@ TEST_F(EventDispatcherTest, AcceleratorBasic) {
|
| EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_3, std::move(matcher)));
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, EventMatching) {
|
| +TEST_P(EventDispatcherTest, EventMatching) {
|
| TestEventDispatcherDelegate* event_dispatcher_delegate =
|
| test_event_dispatcher_delegate();
|
| EventDispatcher* dispatcher = event_dispatcher();
|
| @@ -431,7 +482,8 @@ TEST_F(EventDispatcherTest, EventMatching) {
|
| dispatcher->AddAccelerator(accelerator_1, std::move(matcher));
|
|
|
| ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
|
| - dispatcher->ProcessEvent(key, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| EXPECT_EQ(accelerator_1,
|
| event_dispatcher_delegate->GetAndClearLastAccelerator());
|
|
|
| @@ -439,29 +491,33 @@ TEST_F(EventDispatcherTest, EventMatching) {
|
| // ignoring.
|
| key = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_W,
|
| ui::EF_CONTROL_DOWN | ui::EF_NUM_LOCK_ON);
|
| - dispatcher->ProcessEvent(key, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| EXPECT_EQ(accelerator_1,
|
| event_dispatcher_delegate->GetAndClearLastAccelerator());
|
|
|
| key = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_NONE);
|
| - dispatcher->ProcessEvent(key, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
|
|
|
| uint32_t accelerator_2 = 2;
|
| matcher = ui::CreateKeyMatcher(ui::mojom::KeyboardCode::W,
|
| ui::mojom::kEventFlagNone);
|
| dispatcher->AddAccelerator(accelerator_2, std::move(matcher));
|
| - dispatcher->ProcessEvent(key, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| EXPECT_EQ(accelerator_2,
|
| event_dispatcher_delegate->GetAndClearLastAccelerator());
|
|
|
| dispatcher->RemoveAccelerator(accelerator_2);
|
| - dispatcher->ProcessEvent(key, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
|
| }
|
|
|
| // Tests that a post-target accelerator is not triggered by ProcessEvent.
|
| -TEST_F(EventDispatcherTest, PostTargetAccelerator) {
|
| +TEST_P(EventDispatcherTest, PostTargetAccelerator) {
|
| TestEventDispatcherDelegate* event_dispatcher_delegate =
|
| test_event_dispatcher_delegate();
|
| EventDispatcher* dispatcher = event_dispatcher();
|
| @@ -474,7 +530,8 @@ TEST_F(EventDispatcherTest, PostTargetAccelerator) {
|
|
|
| ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
|
| // The post-target accelerator should be fired if there is no focused window.
|
| - dispatcher->ProcessEvent(key, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| EXPECT_EQ(accelerator_1,
|
| event_dispatcher_delegate->GetAndClearLastAccelerator());
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| @@ -486,7 +543,8 @@ TEST_F(EventDispatcherTest, PostTargetAccelerator) {
|
| event_dispatcher_delegate->SetFocusedWindowFromEventDispatcher(child.get());
|
|
|
| // With a focused window the event should be dispatched.
|
| - dispatcher->ProcessEvent(key, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_TRUE(details);
|
| @@ -498,14 +556,15 @@ TEST_F(EventDispatcherTest, PostTargetAccelerator) {
|
| EXPECT_FALSE(accelerator_weak_ptr);
|
|
|
| // Post deletion there should be no accelerator
|
| - dispatcher->ProcessEvent(key, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_TRUE(details);
|
| EXPECT_FALSE(details->accelerator);
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, ProcessPost) {
|
| +TEST_P(EventDispatcherTest, ProcessPost) {
|
| TestEventDispatcherDelegate* event_dispatcher_delegate =
|
| test_event_dispatcher_delegate();
|
| EventDispatcher* dispatcher = event_dispatcher();
|
| @@ -533,15 +592,16 @@ TEST_F(EventDispatcherTest, ProcessPost) {
|
| // Dispatch for ANY, which should trigger PRE and not call
|
| // DispatchInputEventToWindow().
|
| ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
|
| - dispatcher->ProcessEvent(key, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| EXPECT_EQ(EventDispatcherDelegate::AcceleratorPhase::PRE,
|
| event_dispatcher_delegate->last_accelerator_phase());
|
| EXPECT_EQ(pre_id, event_dispatcher_delegate->GetAndClearLastAccelerator());
|
| EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
|
|
|
| // Dispatch for POST, which should trigger POST.
|
| - dispatcher->ProcessEvent(key, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::POST_ONLY);
|
| + DispatchEvent(dispatcher, key, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::POST_ONLY);
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| ASSERT_TRUE(details);
|
| @@ -549,7 +609,7 @@ TEST_F(EventDispatcherTest, ProcessPost) {
|
| EXPECT_EQ(post_id, details->accelerator->id());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, Capture) {
|
| +TEST_P(EventDispatcherTest, Capture) {
|
| ServerWindow* root = root_window();
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| @@ -592,7 +652,7 @@ TEST_F(EventDispatcherTest, Capture) {
|
| tests, arraysize(tests));
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, CaptureMultipleMouseButtons) {
|
| +TEST_P(EventDispatcherTest, CaptureMultipleMouseButtons) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -635,7 +695,7 @@ TEST_F(EventDispatcherTest, CaptureMultipleMouseButtons) {
|
| tests, arraysize(tests));
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, ClientAreaGoesToOwner) {
|
| +TEST_P(EventDispatcherTest, ClientAreaGoesToOwner) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -651,8 +711,8 @@ TEST_F(EventDispatcherTest, ClientAreaGoesToOwner) {
|
| const ui::PointerEvent press_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(press_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, press_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Events should target child and be in the non-client area.
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| @@ -666,8 +726,8 @@ TEST_F(EventDispatcherTest, ClientAreaGoesToOwner) {
|
| const ui::PointerEvent move_event(
|
| ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(17, 18), gfx::Point(17, 18),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0));
|
| - dispatcher->ProcessEvent(move_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, move_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Still same target.
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| @@ -679,8 +739,8 @@ TEST_F(EventDispatcherTest, ClientAreaGoesToOwner) {
|
| const ui::PointerEvent release_event(ui::MouseEvent(
|
| ui::ET_MOUSE_RELEASED, gfx::Point(17, 18), gfx::Point(17, 18),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(release_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, release_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // The event should not have been dispatched to the delegate.
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| @@ -693,8 +753,8 @@ TEST_F(EventDispatcherTest, ClientAreaGoesToOwner) {
|
| const ui::PointerEvent press_event2(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(21, 22), gfx::Point(21, 22),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(press_event2, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, press_event2, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_TRUE(event_dispatcher_delegate->has_queued_events());
|
| ASSERT_EQ(child.get(), details->window);
|
| @@ -708,7 +768,7 @@ TEST_F(EventDispatcherTest, ClientAreaGoesToOwner) {
|
| EXPECT_EQ(ui::ET_POINTER_DOWN, details->event->type());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, AdditionalClientArea) {
|
| +TEST_P(EventDispatcherTest, AdditionalClientArea) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -724,8 +784,8 @@ TEST_F(EventDispatcherTest, AdditionalClientArea) {
|
| const ui::PointerEvent press_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(28, 11), gfx::Point(28, 11),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(press_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), press_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Events should target child and be in the client area.
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| @@ -735,7 +795,7 @@ TEST_F(EventDispatcherTest, AdditionalClientArea) {
|
| EXPECT_TRUE(details->IsClientArea());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, HitTestMask) {
|
| +TEST_P(EventDispatcherTest, HitTestMask) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -746,8 +806,8 @@ TEST_F(EventDispatcherTest, HitTestMask) {
|
| const ui::PointerEvent move1(ui::MouseEvent(
|
| ui::ET_MOUSE_MOVED, gfx::Point(11, 11), gfx::Point(11, 11),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0));
|
| - event_dispatcher()->ProcessEvent(move1, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), move1, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Event went through the child window and hit the root.
|
| std::unique_ptr<DispatchedEventDetails> details1 =
|
| @@ -761,8 +821,8 @@ TEST_F(EventDispatcherTest, HitTestMask) {
|
| const ui::PointerEvent move2(ui::MouseEvent(
|
| ui::ET_MOUSE_MOVED, gfx::Point(11, 12), gfx::Point(11, 12),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0));
|
| - event_dispatcher()->ProcessEvent(move2, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), move2, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Mouse exits the root.
|
| std::unique_ptr<DispatchedEventDetails> details2 =
|
| @@ -776,7 +836,7 @@ TEST_F(EventDispatcherTest, HitTestMask) {
|
| EXPECT_TRUE(details3->IsClientArea());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, DontFocusOnSecondDown) {
|
| +TEST_P(EventDispatcherTest, DontFocusOnSecondDown) {
|
| std::unique_ptr<ServerWindow> child1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> child2 = CreateChildWindow(WindowId(1, 4));
|
|
|
| @@ -792,8 +852,8 @@ TEST_F(EventDispatcherTest, DontFocusOnSecondDown) {
|
| const ui::PointerEvent press_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(press_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, press_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
|
| @@ -806,15 +866,15 @@ TEST_F(EventDispatcherTest, DontFocusOnSecondDown) {
|
| const ui::PointerEvent touch_event(ui::TouchEvent(
|
| ui::ET_TOUCH_PRESSED, gfx::Point(53, 54), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2)));
|
| - dispatcher->ProcessEvent(touch_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, touch_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
|
| EXPECT_EQ(child2.get(), details->window);
|
| EXPECT_EQ(nullptr, event_dispatcher_delegate->GetAndClearLastFocusedWindow());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, TwoPointersActive) {
|
| +TEST_P(EventDispatcherTest, TwoPointersActive) {
|
| std::unique_ptr<ServerWindow> child1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> child2 = CreateChildWindow(WindowId(1, 4));
|
|
|
| @@ -830,8 +890,8 @@ TEST_F(EventDispatcherTest, TwoPointersActive) {
|
| const ui::PointerEvent touch_event1(ui::TouchEvent(
|
| ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)));
|
| - dispatcher->ProcessEvent(touch_event1, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, touch_event1, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_EQ(child1.get(), details->window);
|
| @@ -840,8 +900,8 @@ TEST_F(EventDispatcherTest, TwoPointersActive) {
|
| const ui::PointerEvent drag_event1(ui::TouchEvent(
|
| ui::ET_TOUCH_MOVED, gfx::Point(53, 54), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)));
|
| - dispatcher->ProcessEvent(drag_event1, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, drag_event1, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_EQ(child1.get(), details->window);
|
|
|
| @@ -849,8 +909,8 @@ TEST_F(EventDispatcherTest, TwoPointersActive) {
|
| const ui::PointerEvent touch_event2(ui::TouchEvent(
|
| ui::ET_TOUCH_PRESSED, gfx::Point(54, 55), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2)));
|
| - dispatcher->ProcessEvent(touch_event2, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, touch_event2, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_EQ(child2.get(), details->window);
|
|
|
| @@ -858,14 +918,14 @@ TEST_F(EventDispatcherTest, TwoPointersActive) {
|
| const ui::PointerEvent drag_event2(ui::TouchEvent(
|
| ui::ET_TOUCH_MOVED, gfx::Point(13, 14), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2)));
|
| - dispatcher->ProcessEvent(drag_event2, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, drag_event2, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_EQ(child2.get(), details->window);
|
|
|
| // Drag again with id 1, child1 should continue to get it.
|
| - dispatcher->ProcessEvent(drag_event1, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, drag_event1, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_EQ(child1.get(), details->window);
|
|
|
| @@ -873,20 +933,20 @@ TEST_F(EventDispatcherTest, TwoPointersActive) {
|
| const ui::PointerEvent touch_release(ui::TouchEvent(
|
| ui::ET_TOUCH_RELEASED, gfx::Point(54, 55), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)));
|
| - dispatcher->ProcessEvent(touch_release, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, touch_release, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_EQ(child1.get(), details->window);
|
| const ui::PointerEvent touch_event3(ui::TouchEvent(
|
| ui::ET_TOUCH_PRESSED, gfx::Point(54, 55), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2)));
|
| - dispatcher->ProcessEvent(touch_event3, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, touch_event3, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_EQ(child2.get(), details->window);
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, DestroyWindowWhileGettingEvents) {
|
| +TEST_P(EventDispatcherTest, DestroyWindowWhileGettingEvents) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -900,8 +960,8 @@ TEST_F(EventDispatcherTest, DestroyWindowWhileGettingEvents) {
|
| const ui::PointerEvent touch_event1(ui::TouchEvent(
|
| ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)));
|
| - dispatcher->ProcessEvent(touch_event1, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, touch_event1, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
|
| @@ -913,13 +973,13 @@ TEST_F(EventDispatcherTest, DestroyWindowWhileGettingEvents) {
|
| const ui::PointerEvent drag_event1(ui::TouchEvent(
|
| ui::ET_TOUCH_MOVED, gfx::Point(53, 54), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)));
|
| - dispatcher->ProcessEvent(drag_event1, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, drag_event1, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_EQ(nullptr, details.get());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, MouseInExtendedHitTestRegion) {
|
| +TEST_P(EventDispatcherTest, MouseInExtendedHitTestRegion) {
|
| ServerWindow* root = root_window();
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| @@ -934,8 +994,8 @@ TEST_F(EventDispatcherTest, MouseInExtendedHitTestRegion) {
|
| const ui::PointerEvent ui_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(8, 9), gfx::Point(8, 9),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(ui_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, ui_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| ASSERT_EQ(root, details->window);
|
| @@ -944,8 +1004,8 @@ TEST_F(EventDispatcherTest, MouseInExtendedHitTestRegion) {
|
| const ui::PointerEvent release_event(ui::MouseEvent(
|
| ui::ET_MOUSE_RELEASED, gfx::Point(8, 9), gfx::Point(8, 9),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(release_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, release_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
|
| ASSERT_EQ(root, details->window);
|
| @@ -954,8 +1014,8 @@ TEST_F(EventDispatcherTest, MouseInExtendedHitTestRegion) {
|
| // Change the extended hit test region and send event in extended hit test
|
| // region. Should result in exit for root, followed by press for child.
|
| child->set_extended_hit_test_region(gfx::Insets(5, 5, 5, 5));
|
| - dispatcher->ProcessEvent(ui_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, ui_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_EQ(root, details->window);
|
| EXPECT_EQ(ui::ET_POINTER_EXITED, details->event->type());
|
| @@ -971,7 +1031,7 @@ TEST_F(EventDispatcherTest, MouseInExtendedHitTestRegion) {
|
| EXPECT_EQ(gfx::Point(-2, -1), details->event->AsPointerEvent()->location());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, WheelWhileDown) {
|
| +TEST_P(EventDispatcherTest, WheelWhileDown) {
|
| std::unique_ptr<ServerWindow> child1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> child2 = CreateChildWindow(WindowId(1, 4));
|
|
|
| @@ -1000,7 +1060,7 @@ TEST_F(EventDispatcherTest, WheelWhileDown) {
|
| // Tests that when explicit capture has been set that all events go to the
|
| // designated window, and that when capture is cleared, events find the
|
| // appropriate target window.
|
| -TEST_F(EventDispatcherTest, SetExplicitCapture) {
|
| +TEST_P(EventDispatcherTest, SetExplicitCapture) {
|
| ServerWindow* root = root_window();
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| @@ -1020,8 +1080,8 @@ TEST_F(EventDispatcherTest, SetExplicitCapture) {
|
| const ui::PointerEvent left_press_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(left_press_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, left_press_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Events should target child.
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| @@ -1037,8 +1097,8 @@ TEST_F(EventDispatcherTest, SetExplicitCapture) {
|
| ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON,
|
| ui::EF_RIGHT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(right_press_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, right_press_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_TRUE(IsMouseButtonDown());
|
|
|
| @@ -1047,8 +1107,8 @@ TEST_F(EventDispatcherTest, SetExplicitCapture) {
|
| ui::ET_MOUSE_RELEASED, gfx::Point(5, 5), gfx::Point(5, 5),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON,
|
| ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(left_release_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, left_release_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_TRUE(IsMouseButtonDown());
|
|
|
| @@ -1056,8 +1116,8 @@ TEST_F(EventDispatcherTest, SetExplicitCapture) {
|
| const ui::PointerEvent touch_event(ui::TouchEvent(
|
| ui::ET_TOUCH_PRESSED, gfx::Point(15, 15), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 2)));
|
| - dispatcher->ProcessEvent(touch_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, touch_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_TRUE(IsMouseButtonDown());
|
|
|
| @@ -1066,8 +1126,8 @@ TEST_F(EventDispatcherTest, SetExplicitCapture) {
|
| ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(15, 5), gfx::Point(15, 5),
|
| base::TimeTicks(), ui::EF_RIGHT_MOUSE_BUTTON,
|
| ui::EF_RIGHT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(move_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, move_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_TRUE(IsMouseButtonDown());
|
|
|
| @@ -1076,8 +1136,8 @@ TEST_F(EventDispatcherTest, SetExplicitCapture) {
|
| ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(5, 5),
|
| gfx::Point(5, 5), base::TimeTicks(),
|
| ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(right_release_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, right_release_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| EXPECT_FALSE(IsMouseButtonDown());
|
| }
|
| @@ -1088,8 +1148,8 @@ TEST_F(EventDispatcherTest, SetExplicitCapture) {
|
| const ui::PointerEvent press_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(press_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, press_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Events should target the root.
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| @@ -1102,7 +1162,7 @@ TEST_F(EventDispatcherTest, SetExplicitCapture) {
|
|
|
| // This test verifies that explicit capture overrides and resets implicit
|
| // capture.
|
| -TEST_F(EventDispatcherTest, ExplicitCaptureOverridesImplicitCapture) {
|
| +TEST_P(EventDispatcherTest, ExplicitCaptureOverridesImplicitCapture) {
|
| ServerWindow* root = root_window();
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| @@ -1148,8 +1208,8 @@ TEST_F(EventDispatcherTest, ExplicitCaptureOverridesImplicitCapture) {
|
| const ui::PointerEvent touch_event(ui::TouchEvent(
|
| ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)));
|
| - dispatcher->ProcessEvent(touch_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, touch_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| }
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| @@ -1181,8 +1241,8 @@ TEST_F(EventDispatcherTest, ExplicitCaptureOverridesImplicitCapture) {
|
| const ui::PointerEvent press_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(press_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, press_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Events should target the root.
|
| details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1193,7 +1253,7 @@ TEST_F(EventDispatcherTest, ExplicitCaptureOverridesImplicitCapture) {
|
|
|
| // Tests that setting capture does delete active pointer targets for the capture
|
| // window.
|
| -TEST_F(EventDispatcherTest, CaptureUpdatesActivePointerTargets) {
|
| +TEST_P(EventDispatcherTest, CaptureUpdatesActivePointerTargets) {
|
| ServerWindow* root = root_window();
|
| root->SetBounds(gfx::Rect(0, 0, 100, 100));
|
|
|
| @@ -1202,8 +1262,8 @@ TEST_F(EventDispatcherTest, CaptureUpdatesActivePointerTargets) {
|
| const ui::PointerEvent press_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - dispatcher->ProcessEvent(press_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, press_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1214,8 +1274,8 @@ TEST_F(EventDispatcherTest, CaptureUpdatesActivePointerTargets) {
|
| const ui::PointerEvent touch_event(ui::TouchEvent(
|
| ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 1)));
|
| - dispatcher->ProcessEvent(touch_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(dispatcher, touch_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| }
|
|
|
| ASSERT_TRUE(AreAnyPointersDown());
|
| @@ -1231,7 +1291,7 @@ TEST_F(EventDispatcherTest, CaptureUpdatesActivePointerTargets) {
|
|
|
| // Tests that when explicit capture is changed, that the previous window with
|
| // capture is no longer being observed.
|
| -TEST_F(EventDispatcherTest, UpdatingCaptureStopsObservingPreviousCapture) {
|
| +TEST_P(EventDispatcherTest, UpdatingCaptureStopsObservingPreviousCapture) {
|
| std::unique_ptr<ServerWindow> child1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> child2 = CreateChildWindow(WindowId(1, 4));
|
|
|
| @@ -1254,7 +1314,7 @@ TEST_F(EventDispatcherTest, UpdatingCaptureStopsObservingPreviousCapture) {
|
|
|
| // Tests that destroying a window with explicit capture clears the capture
|
| // state.
|
| -TEST_F(EventDispatcherTest, DestroyingCaptureWindowRemovesExplicitCapture) {
|
| +TEST_P(EventDispatcherTest, DestroyingCaptureWindowRemovesExplicitCapture) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
| child->SetBounds(gfx::Rect(10, 10, 20, 20));
|
|
|
| @@ -1271,7 +1331,7 @@ TEST_F(EventDispatcherTest, DestroyingCaptureWindowRemovesExplicitCapture) {
|
|
|
| // Tests that when |client_id| is set for a window performing capture, that this
|
| // preference is used regardless of whether an event targets the client region.
|
| -TEST_F(EventDispatcherTest, CaptureInNonClientAreaOverridesActualPoint) {
|
| +TEST_P(EventDispatcherTest, CaptureInNonClientAreaOverridesActualPoint) {
|
| ServerWindow* root = root_window();
|
| root->SetBounds(gfx::Rect(0, 0, 100, 100));
|
|
|
| @@ -1285,8 +1345,8 @@ TEST_F(EventDispatcherTest, CaptureInNonClientAreaOverridesActualPoint) {
|
| const ui::PointerEvent press_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(6, 6), gfx::Point(6, 6),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(press_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), press_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| // Events should target child and be in the client area.
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| @@ -1296,7 +1356,7 @@ TEST_F(EventDispatcherTest, CaptureInNonClientAreaOverridesActualPoint) {
|
| EXPECT_TRUE(details->IsNonclientArea());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, ProcessPointerEvents) {
|
| +TEST_P(EventDispatcherTest, ProcessPointerEvents) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -1306,8 +1366,8 @@ TEST_F(EventDispatcherTest, ProcessPointerEvents) {
|
| const ui::PointerEvent pointer_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(
|
| - pointer_event, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), pointer_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1328,8 +1388,8 @@ TEST_F(EventDispatcherTest, ProcessPointerEvents) {
|
| ui::ET_TOUCH_RELEASED, gfx::Point(25, 20), base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH,
|
| touch_id)));
|
| - event_dispatcher()->ProcessEvent(
|
| - pointer_event, 0, EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), pointer_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1346,7 +1406,7 @@ TEST_F(EventDispatcherTest, ProcessPointerEvents) {
|
| }
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, ResetClearsPointerDown) {
|
| +TEST_P(EventDispatcherTest, ResetClearsPointerDown) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -1356,8 +1416,8 @@ TEST_F(EventDispatcherTest, ResetClearsPointerDown) {
|
| const ui::PointerEvent ui_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(ui_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), ui_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1371,7 +1431,7 @@ TEST_F(EventDispatcherTest, ResetClearsPointerDown) {
|
| EXPECT_FALSE(AreAnyPointersDown());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, ResetClearsCapture) {
|
| +TEST_P(EventDispatcherTest, ResetClearsCapture) {
|
| ServerWindow* root = root_window();
|
| root->SetBounds(gfx::Rect(0, 0, 100, 100));
|
|
|
| @@ -1385,7 +1445,7 @@ TEST_F(EventDispatcherTest, ResetClearsCapture) {
|
| }
|
|
|
| // Tests that events on a modal parent target the modal child.
|
| -TEST_F(EventDispatcherTest, ModalWindowEventOnModalParent) {
|
| +TEST_P(EventDispatcherTest, ModalWindowEventOnModalParent) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
|
|
|
| @@ -1400,8 +1460,8 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnModalParent) {
|
| const ui::PointerEvent mouse_pressed(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(mouse_pressed, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), mouse_pressed, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1418,7 +1478,7 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnModalParent) {
|
| }
|
|
|
| // Tests that events on a modal child target the modal child itself.
|
| -TEST_F(EventDispatcherTest, ModalWindowEventOnModalChild) {
|
| +TEST_P(EventDispatcherTest, ModalWindowEventOnModalChild) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
|
|
|
| @@ -1433,8 +1493,8 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnModalChild) {
|
| const ui::PointerEvent mouse_pressed(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(55, 15), gfx::Point(55, 15),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(mouse_pressed, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), mouse_pressed, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1452,7 +1512,7 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnModalChild) {
|
|
|
| // Tests that events on an unrelated window are not affected by the modal
|
| // window.
|
| -TEST_F(EventDispatcherTest, ModalWindowEventOnUnrelatedWindow) {
|
| +TEST_P(EventDispatcherTest, ModalWindowEventOnUnrelatedWindow) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
|
| std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 6));
|
| @@ -1469,8 +1529,8 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnUnrelatedWindow) {
|
| const ui::PointerEvent mouse_pressed(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(75, 15), gfx::Point(75, 15),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(mouse_pressed, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), mouse_pressed, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1488,7 +1548,7 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnUnrelatedWindow) {
|
|
|
| // Tests that events events on a descendant of a modal parent target the modal
|
| // child.
|
| -TEST_F(EventDispatcherTest, ModalWindowEventOnDescendantOfModalParent) {
|
| +TEST_P(EventDispatcherTest, ModalWindowEventOnDescendantOfModalParent) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> w11 =
|
| CreateChildWindowWithParent(WindowId(1, 4), w1.get());
|
| @@ -1506,8 +1566,8 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnDescendantOfModalParent) {
|
| const ui::PointerEvent mouse_pressed(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(25, 25), gfx::Point(25, 25),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(mouse_pressed, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), mouse_pressed, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1524,7 +1584,7 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnDescendantOfModalParent) {
|
| }
|
|
|
| // Tests that events on a system modal window target the modal window itself.
|
| -TEST_F(EventDispatcherTest, ModalWindowEventOnSystemModal) {
|
| +TEST_P(EventDispatcherTest, ModalWindowEventOnSystemModal) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -1535,8 +1595,8 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnSystemModal) {
|
| const ui::PointerEvent mouse_pressed(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(mouse_pressed, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), mouse_pressed, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1553,7 +1613,7 @@ TEST_F(EventDispatcherTest, ModalWindowEventOnSystemModal) {
|
| }
|
|
|
| // Tests that events outside of system modal window target the modal window.
|
| -TEST_F(EventDispatcherTest, ModalWindowEventOutsideSystemModal) {
|
| +TEST_P(EventDispatcherTest, ModalWindowEventOutsideSystemModal) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
|
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| @@ -1565,8 +1625,8 @@ TEST_F(EventDispatcherTest, ModalWindowEventOutsideSystemModal) {
|
| const ui::PointerEvent mouse_pressed(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(45, 15), gfx::Point(45, 15),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(mouse_pressed, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), mouse_pressed, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1583,7 +1643,7 @@ TEST_F(EventDispatcherTest, ModalWindowEventOutsideSystemModal) {
|
| }
|
|
|
| // Tests events on a sub-window of system modal window target the window itself.
|
| -TEST_F(EventDispatcherTest, ModalWindowEventSubWindowSystemModal) {
|
| +TEST_P(EventDispatcherTest, ModalWindowEventSubWindowSystemModal) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| w1->SetModalType(MODAL_TYPE_SYSTEM);
|
| event_dispatcher()->AddSystemModalWindow(w1.get());
|
| @@ -1611,7 +1671,8 @@ TEST_F(EventDispatcherTest, ModalWindowEventSubWindowSystemModal) {
|
|
|
| for (size_t i = 0; i < arraysize(kTouchData); i++) {
|
| // Send touch press and check that the expected target receives it.
|
| - event_dispatcher()->ProcessEvent(
|
| + DispatchEvent(
|
| + event_dispatcher(),
|
| ui::PointerEvent(ui::TouchEvent(
|
| ui::ET_TOUCH_PRESSED, kTouchData[i].location, base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0))),
|
| @@ -1622,7 +1683,8 @@ TEST_F(EventDispatcherTest, ModalWindowEventSubWindowSystemModal) {
|
| EXPECT_EQ(kTouchData[i].expected_target, details->window) << i;
|
|
|
| // Release touch.
|
| - event_dispatcher()->ProcessEvent(
|
| + DispatchEvent(
|
| + event_dispatcher(),
|
| ui::PointerEvent(ui::TouchEvent(
|
| ui::ET_TOUCH_RELEASED, kTouchData[i].location, base::TimeTicks(),
|
| ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0))),
|
| @@ -1632,7 +1694,7 @@ TEST_F(EventDispatcherTest, ModalWindowEventSubWindowSystemModal) {
|
| }
|
|
|
| // Tests that setting capture to a descendant of a modal parent fails.
|
| -TEST_F(EventDispatcherTest, ModalWindowSetCaptureDescendantOfModalParent) {
|
| +TEST_P(EventDispatcherTest, ModalWindowSetCaptureDescendantOfModalParent) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> w11 =
|
| CreateChildWindowWithParent(WindowId(1, 4), w1.get());
|
| @@ -1651,7 +1713,7 @@ TEST_F(EventDispatcherTest, ModalWindowSetCaptureDescendantOfModalParent) {
|
| }
|
|
|
| // Tests that setting capture to a window unrelated to a modal parent works.
|
| -TEST_F(EventDispatcherTest, ModalWindowSetCaptureUnrelatedWindow) {
|
| +TEST_P(EventDispatcherTest, ModalWindowSetCaptureUnrelatedWindow) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4));
|
| std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 5));
|
| @@ -1669,7 +1731,7 @@ TEST_F(EventDispatcherTest, ModalWindowSetCaptureUnrelatedWindow) {
|
| }
|
|
|
| // Tests that setting capture fails when there is a system modal window.
|
| -TEST_F(EventDispatcherTest, ModalWindowSystemSetCapture) {
|
| +TEST_P(EventDispatcherTest, ModalWindowSystemSetCapture) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4));
|
|
|
| @@ -1684,7 +1746,7 @@ TEST_F(EventDispatcherTest, ModalWindowSystemSetCapture) {
|
| }
|
|
|
| // Tests having multiple system modal windows.
|
| -TEST_F(EventDispatcherTest, ModalWindowMultipleSystemModals) {
|
| +TEST_P(EventDispatcherTest, ModalWindowMultipleSystemModals) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4));
|
| std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 5));
|
| @@ -1726,7 +1788,7 @@ TEST_F(EventDispatcherTest, ModalWindowMultipleSystemModals) {
|
| EXPECT_EQ(nullptr, GetActiveSystemModalWindow());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, CaptureNotResetOnParentChange) {
|
| +TEST_P(EventDispatcherTest, CaptureNotResetOnParentChange) {
|
| std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
|
| w1->set_event_targeting_policy(mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
|
| std::unique_ptr<ServerWindow> w11 =
|
| @@ -1743,8 +1805,8 @@ TEST_F(EventDispatcherTest, CaptureNotResetOnParentChange) {
|
| const ui::PointerEvent mouse_pressed(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(mouse_pressed, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), mouse_pressed, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
| event_dispatcher()->SetCaptureWindow(w11.get(), kClientAreaId);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| @@ -1761,7 +1823,7 @@ TEST_F(EventDispatcherTest, CaptureNotResetOnParentChange) {
|
| EventDispatcherTestApi(event_dispatcher()).capture_window());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, ChangeCaptureFromClientToNonclient) {
|
| +TEST_P(EventDispatcherTest, ChangeCaptureFromClientToNonclient) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
| event_dispatcher()->SetCaptureWindow(child.get(), kNonclientAreaId);
|
| EXPECT_EQ(kNonclientAreaId,
|
| @@ -1776,7 +1838,7 @@ TEST_F(EventDispatcherTest, ChangeCaptureFromClientToNonclient) {
|
| EXPECT_EQ(kClientAreaId, event_dispatcher()->capture_window_client_id());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, MoveMouseFromNoTargetToValidTarget) {
|
| +TEST_P(EventDispatcherTest, MoveMouseFromNoTargetToValidTarget) {
|
| ServerWindow* root = root_window();
|
| root->set_event_targeting_policy(
|
| mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
|
| @@ -1802,7 +1864,7 @@ TEST_F(EventDispatcherTest, MoveMouseFromNoTargetToValidTarget) {
|
| tests, arraysize(tests));
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, NoTargetToTargetWithMouseDown) {
|
| +TEST_P(EventDispatcherTest, NoTargetToTargetWithMouseDown) {
|
| ServerWindow* root = root_window();
|
| root->set_event_targeting_policy(
|
| mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
|
| @@ -1835,7 +1897,7 @@ TEST_F(EventDispatcherTest, NoTargetToTargetWithMouseDown) {
|
| tests, arraysize(tests));
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, DontSendExitToSameClientWhenCaptureChanges) {
|
| +TEST_P(EventDispatcherTest, DontSendExitToSameClientWhenCaptureChanges) {
|
| ServerWindow* root = root_window();
|
| root->set_event_targeting_policy(
|
| mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
|
| @@ -1868,7 +1930,7 @@ TEST_F(EventDispatcherTest, DontSendExitToSameClientWhenCaptureChanges) {
|
| EXPECT_FALSE(test_event_dispatcher_delegate()->has_queued_events());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, MousePointerClearedOnDestroy) {
|
| +TEST_P(EventDispatcherTest, MousePointerClearedOnDestroy) {
|
| root_window()->set_event_targeting_policy(
|
| mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
|
| std::unique_ptr<ServerWindow> c1 = CreateChildWindow(WindowId(1, 3));
|
| @@ -1876,13 +1938,13 @@ TEST_F(EventDispatcherTest, MousePointerClearedOnDestroy) {
|
| root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
|
| c1->SetBounds(gfx::Rect(10, 10, 20, 20));
|
|
|
| - event_dispatcher()->SetMousePointerDisplayLocation(gfx::Point(15, 15), 0);
|
| + SetMousePointerDisplayLocation(event_dispatcher(), gfx::Point(15, 15), 0);
|
| EXPECT_EQ(c1.get(), event_dispatcher()->mouse_cursor_source_window());
|
| c1.reset();
|
| EXPECT_EQ(nullptr, event_dispatcher()->mouse_cursor_source_window());
|
| }
|
|
|
| -TEST_F(EventDispatcherTest, LocationHonorsTransform) {
|
| +TEST_P(EventDispatcherTest, LocationHonorsTransform) {
|
| std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
|
|
|
| gfx::Transform transform;
|
| @@ -1896,8 +1958,8 @@ TEST_F(EventDispatcherTest, LocationHonorsTransform) {
|
| const ui::PointerEvent ui_event(ui::MouseEvent(
|
| ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25),
|
| base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
|
| - event_dispatcher()->ProcessEvent(ui_event, 0,
|
| - EventDispatcher::AcceleratorMatchPhase::ANY);
|
| + DispatchEvent(event_dispatcher(), ui_event, 0,
|
| + EventDispatcher::AcceleratorMatchPhase::ANY);
|
|
|
| std::unique_ptr<DispatchedEventDetails> details =
|
| test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
|
| @@ -1912,6 +1974,8 @@ TEST_F(EventDispatcherTest, LocationHonorsTransform) {
|
| EXPECT_EQ(gfx::Point(5, 7), dispatched_event->location());
|
| }
|
|
|
| +INSTANTIATE_TEST_CASE_P(/* no prefix */, EventDispatcherTest, testing::Bool());
|
| +
|
| } // namespace test
|
| } // namespace ws
|
| } // namespace ui
|
|
|