OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/ui/ws/event_dispatcher.h" | 5 #include "services/ui/ws/event_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 192 } |
193 | 193 |
194 void RunMouseEventTests(EventDispatcher* dispatcher, | 194 void RunMouseEventTests(EventDispatcher* dispatcher, |
195 TestEventDispatcherDelegate* dispatcher_delegate, | 195 TestEventDispatcherDelegate* dispatcher_delegate, |
196 MouseEventTest* tests, | 196 MouseEventTest* tests, |
197 size_t test_count) { | 197 size_t test_count) { |
198 for (size_t i = 0; i < test_count; ++i) { | 198 for (size_t i = 0; i < test_count; ++i) { |
199 const MouseEventTest& test = tests[i]; | 199 const MouseEventTest& test = tests[i]; |
200 ASSERT_FALSE(dispatcher_delegate->has_queued_events()) | 200 ASSERT_FALSE(dispatcher_delegate->has_queued_events()) |
201 << " unexpected queued events before running " << i; | 201 << " unexpected queued events before running " << i; |
202 if (test.input_event.IsMouseWheelEvent()) | 202 dispatcher->ProcessEvent(ui::PointerEvent(test.input_event), |
203 dispatcher->ProcessEvent(test.input_event, | 203 EventDispatcher::AcceleratorMatchPhase::ANY); |
204 EventDispatcher::AcceleratorMatchPhase::ANY); | |
205 else | |
206 dispatcher->ProcessEvent(ui::PointerEvent(test.input_event), | |
207 EventDispatcher::AcceleratorMatchPhase::ANY); | |
208 | 204 |
209 std::unique_ptr<DispatchedEventDetails> details = | 205 std::unique_ptr<DispatchedEventDetails> details = |
210 dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); | 206 dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); |
211 ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches( | 207 ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches( |
212 details.get(), test.expected_target_window1, | 208 details.get(), test.expected_target_window1, |
213 test.expected_root_location1, test.expected_location1)) | 209 test.expected_root_location1, test.expected_location1)) |
214 << " details don't match " << i; | 210 << " details don't match " << i; |
215 details = dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); | 211 details = dispatcher_delegate->GetAndAdvanceDispatchedEventDetails(); |
216 ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches( | 212 ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches( |
217 details.get(), test.expected_target_window2, | 213 details.get(), test.expected_target_window2, |
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 // The delegate can decide if it really wants to forward the event or not. | 1702 // The delegate can decide if it really wants to forward the event or not. |
1707 EXPECT_EQ(child.get(), | 1703 EXPECT_EQ(child.get(), |
1708 test_event_dispatcher_delegate()->lost_capture_window()); | 1704 test_event_dispatcher_delegate()->lost_capture_window()); |
1709 EXPECT_EQ(child.get(), event_dispatcher()->capture_window()); | 1705 EXPECT_EQ(child.get(), event_dispatcher()->capture_window()); |
1710 EXPECT_EQ(kClientAreaId, event_dispatcher()->capture_window_client_id()); | 1706 EXPECT_EQ(kClientAreaId, event_dispatcher()->capture_window_client_id()); |
1711 } | 1707 } |
1712 | 1708 |
1713 } // namespace test | 1709 } // namespace test |
1714 } // namespace ws | 1710 } // namespace ws |
1715 } // namespace ui | 1711 } // namespace ui |
OLD | NEW |