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 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 | 1301 |
1302 ASSERT_TRUE(details->event); | 1302 ASSERT_TRUE(details->event); |
1303 ASSERT_TRUE(details->event->IsPointerEvent()); | 1303 ASSERT_TRUE(details->event->IsPointerEvent()); |
1304 | 1304 |
1305 ui::PointerEvent* dispatched_event = details->event->AsPointerEvent(); | 1305 ui::PointerEvent* dispatched_event = details->event->AsPointerEvent(); |
1306 EXPECT_EQ(gfx::Point(20, 25), dispatched_event->root_location()); | 1306 EXPECT_EQ(gfx::Point(20, 25), dispatched_event->root_location()); |
1307 EXPECT_EQ(gfx::Point(10, 15), dispatched_event->location()); | 1307 EXPECT_EQ(gfx::Point(10, 15), dispatched_event->location()); |
1308 } | 1308 } |
1309 | 1309 |
1310 { | 1310 { |
1311 const int touch_id = 3; | 1311 const uint32_t touch_id = 3U; |
1312 const ui::PointerEvent pointer_event( | 1312 const ui::PointerEvent pointer_event( |
1313 ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(25, 20), touch_id, | 1313 ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(25, 20), touch_id, |
1314 base::TimeTicks())); | 1314 base::TimeTicks())); |
1315 event_dispatcher()->ProcessEvent( | 1315 event_dispatcher()->ProcessEvent( |
1316 pointer_event, EventDispatcher::AcceleratorMatchPhase::ANY); | 1316 pointer_event, EventDispatcher::AcceleratorMatchPhase::ANY); |
1317 | 1317 |
1318 std::unique_ptr<DispatchedEventDetails> details = | 1318 std::unique_ptr<DispatchedEventDetails> details = |
1319 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); | 1319 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); |
1320 ASSERT_TRUE(details); | 1320 ASSERT_TRUE(details); |
1321 ASSERT_EQ(child.get(), details->window); | 1321 ASSERT_EQ(child.get(), details->window); |
1322 | 1322 |
1323 ASSERT_TRUE(details->event); | 1323 ASSERT_TRUE(details->event); |
1324 ASSERT_TRUE(details->event->IsPointerEvent()); | 1324 ASSERT_TRUE(details->event->IsPointerEvent()); |
1325 | 1325 |
1326 ui::PointerEvent* dispatched_event = details->event->AsPointerEvent(); | 1326 ui::PointerEvent* dispatched_event = details->event->AsPointerEvent(); |
1327 EXPECT_EQ(gfx::Point(25, 20), dispatched_event->root_location()); | 1327 EXPECT_EQ(gfx::Point(25, 20), dispatched_event->root_location()); |
1328 EXPECT_EQ(gfx::Point(15, 10), dispatched_event->location()); | 1328 EXPECT_EQ(gfx::Point(15, 10), dispatched_event->location()); |
1329 EXPECT_EQ(touch_id, dispatched_event->pointer_id()); | 1329 EXPECT_EQ(touch_id, dispatched_event->pointer_details().id); |
1330 } | 1330 } |
1331 } | 1331 } |
1332 | 1332 |
1333 TEST_F(EventDispatcherTest, ResetClearsPointerDown) { | 1333 TEST_F(EventDispatcherTest, ResetClearsPointerDown) { |
1334 std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3)); | 1334 std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3)); |
1335 | 1335 |
1336 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1336 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
1337 child->SetBounds(gfx::Rect(10, 10, 20, 20)); | 1337 child->SetBounds(gfx::Rect(10, 10, 20, 20)); |
1338 | 1338 |
1339 // Send event that is over child. | 1339 // Send event that is over child. |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 | 1796 |
1797 // Set capture on |c1|. No events should be sent as |c1| is in the same | 1797 // Set capture on |c1|. No events should be sent as |c1| is in the same |
1798 // client. | 1798 // client. |
1799 event_dispatcher()->SetCaptureWindow(c1.get(), kClientAreaId); | 1799 event_dispatcher()->SetCaptureWindow(c1.get(), kClientAreaId); |
1800 EXPECT_FALSE(test_event_dispatcher_delegate()->has_queued_events()); | 1800 EXPECT_FALSE(test_event_dispatcher_delegate()->has_queued_events()); |
1801 } | 1801 } |
1802 | 1802 |
1803 } // namespace test | 1803 } // namespace test |
1804 } // namespace ws | 1804 } // namespace ws |
1805 } // namespace ui | 1805 } // namespace ui |
OLD | NEW |