OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } | 388 } |
389 | 389 |
390 // Tests that touch-events that are beyond the bounds of the root-window do get | 390 // Tests that touch-events that are beyond the bounds of the root-window do get |
391 // propagated to the event filters correctly with the root as the target. | 391 // propagated to the event filters correctly with the root as the target. |
392 TEST_F(WindowEventDispatcherTest, TouchEventsOutsideBounds) { | 392 TEST_F(WindowEventDispatcherTest, TouchEventsOutsideBounds) { |
393 ui::test::TestEventHandler handler; | 393 ui::test::TestEventHandler handler; |
394 root_window()->AddPreTargetHandler(&handler); | 394 root_window()->AddPreTargetHandler(&handler); |
395 | 395 |
396 gfx::Point position = root_window()->bounds().origin(); | 396 gfx::Point position = root_window()->bounds().origin(); |
397 position.Offset(-10, -10); | 397 position.Offset(-10, -10); |
398 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position, 0, base::TimeDelta()); | 398 ui::TouchEvent press( |
| 399 ui::ET_TOUCH_PRESSED, position, 0, ui::EventTimeForNow()); |
399 DispatchEventUsingWindowDispatcher(&press); | 400 DispatchEventUsingWindowDispatcher(&press); |
400 EXPECT_EQ(1, handler.num_touch_events()); | 401 EXPECT_EQ(1, handler.num_touch_events()); |
401 | 402 |
402 position = root_window()->bounds().origin(); | 403 position = root_window()->bounds().origin(); |
403 position.Offset(root_window()->bounds().width() + 10, | 404 position.Offset(root_window()->bounds().width() + 10, |
404 root_window()->bounds().height() + 10); | 405 root_window()->bounds().height() + 10); |
405 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, position, 0, base::TimeDelta()); | 406 ui::TouchEvent release( |
| 407 ui::ET_TOUCH_RELEASED, position, 0, ui::EventTimeForNow()); |
406 DispatchEventUsingWindowDispatcher(&release); | 408 DispatchEventUsingWindowDispatcher(&release); |
407 EXPECT_EQ(2, handler.num_touch_events()); | 409 EXPECT_EQ(2, handler.num_touch_events()); |
408 } | 410 } |
409 | 411 |
410 // Tests that scroll events are dispatched correctly. | 412 // Tests that scroll events are dispatched correctly. |
411 TEST_F(WindowEventDispatcherTest, ScrollEventDispatch) { | 413 TEST_F(WindowEventDispatcherTest, ScrollEventDispatch) { |
412 base::TimeDelta now = ui::EventTimeForNow(); | 414 base::TimeDelta now = ui::EventTimeForNow(); |
413 ui::test::TestEventHandler handler; | 415 ui::test::TestEventHandler handler; |
414 root_window()->AddPreTargetHandler(&handler); | 416 root_window()->AddPreTargetHandler(&handler); |
415 | 417 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 494 |
493 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 495 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
494 mouse_locations_.push_back(event->location()); | 496 mouse_locations_.push_back(event->location()); |
495 mouse_event_flags_.push_back(event->flags()); | 497 mouse_event_flags_.push_back(event->flags()); |
496 } | 498 } |
497 | 499 |
498 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { | 500 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { |
499 touch_locations_.push_back(event->location()); | 501 touch_locations_.push_back(event->location()); |
500 } | 502 } |
501 | 503 |
| 504 bool HasReceivedEvent(ui::EventType type) { |
| 505 return std::find(events_.begin(), events_.end(), type) != events_.end(); |
| 506 } |
| 507 |
502 private: | 508 private: |
503 scoped_ptr<base::RunLoop> run_loop_; | 509 scoped_ptr<base::RunLoop> run_loop_; |
504 ui::EventType wait_until_event_; | 510 ui::EventType wait_until_event_; |
505 | 511 |
506 Events events_; | 512 Events events_; |
507 EventLocations mouse_locations_; | 513 EventLocations mouse_locations_; |
508 EventLocations touch_locations_; | 514 EventLocations touch_locations_; |
509 EventFlags mouse_event_flags_; | 515 EventFlags mouse_event_flags_; |
510 | 516 |
511 DISALLOW_COPY_AND_ASSIGN(EventFilterRecorder); | 517 DISALLOW_COPY_AND_ASSIGN(EventFilterRecorder); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 root_window()->AddPreTargetHandler(&recorder); | 726 root_window()->AddPreTargetHandler(&recorder); |
721 | 727 |
722 test::TestWindowDelegate delegate; | 728 test::TestWindowDelegate delegate; |
723 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 729 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
724 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); | 730 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); |
725 | 731 |
726 const gfx::Point touch_location(60, 60); | 732 const gfx::Point touch_location(60, 60); |
727 // Starting the touch and throwing out the first few events, since the system | 733 // Starting the touch and throwing out the first few events, since the system |
728 // is going to generate synthetic mouse events that are not relevant to the | 734 // is going to generate synthetic mouse events that are not relevant to the |
729 // test. | 735 // test. |
730 ui::TouchEvent touch_pressed_event(ui::ET_TOUCH_PRESSED, touch_location, | 736 ui::TouchEvent touch_pressed_event( |
731 0, base::TimeDelta()); | 737 ui::ET_TOUCH_PRESSED, touch_location, 0, ui::EventTimeForNow()); |
732 DispatchEventUsingWindowDispatcher(&touch_pressed_event); | 738 DispatchEventUsingWindowDispatcher(&touch_pressed_event); |
733 recorder.WaitUntilReceivedEvent(ui::ET_GESTURE_SHOW_PRESS); | 739 recorder.WaitUntilReceivedEvent(ui::ET_GESTURE_SHOW_PRESS); |
734 recorder.Reset(); | 740 recorder.Reset(); |
735 | 741 |
736 host()->dispatcher()->HoldPointerMoves(); | 742 host()->dispatcher()->HoldPointerMoves(); |
737 | 743 |
738 // Check that we don't immediately dispatch the TOUCH_MOVED event. | 744 // Check that we don't immediately dispatch the TOUCH_MOVED event. |
739 ui::TouchEvent touch_moved_event(ui::ET_TOUCH_MOVED, touch_location, | 745 ui::TouchEvent touch_moved_event( |
740 0, base::TimeDelta()); | 746 ui::ET_TOUCH_MOVED, touch_location, 0, ui::EventTimeForNow()); |
741 DispatchEventUsingWindowDispatcher(&touch_moved_event); | 747 DispatchEventUsingWindowDispatcher(&touch_moved_event); |
742 EXPECT_TRUE(recorder.events().empty()); | 748 EXPECT_TRUE(recorder.events().empty()); |
743 | 749 |
744 // Check that on ReleasePointerMoves, held events are not dispatched | 750 // Check that on ReleasePointerMoves, held events are not dispatched |
745 // immediately, but posted instead. | 751 // immediately, but posted instead. |
746 DispatchEventUsingWindowDispatcher(&touch_moved_event); | 752 DispatchEventUsingWindowDispatcher(&touch_moved_event); |
747 host()->dispatcher()->ReleasePointerMoves(); | 753 host()->dispatcher()->ReleasePointerMoves(); |
748 EXPECT_TRUE(recorder.events().empty()); | 754 EXPECT_TRUE(recorder.events().empty()); |
749 | 755 |
750 RunAllPendingInMessageLoop(); | 756 RunAllPendingInMessageLoop(); |
751 EXPECT_EQ("TOUCH_MOVED", EventTypesToString(recorder.events())); | 757 EXPECT_EQ("TOUCH_MOVED", EventTypesToString(recorder.events())); |
752 recorder.Reset(); | 758 recorder.Reset(); |
753 | 759 |
754 // If another touch event occurs then the held touch should be dispatched | 760 // If another touch event occurs then the held touch should be dispatched |
755 // immediately before it. | 761 // immediately before it. |
756 ui::TouchEvent touch_released_event(ui::ET_TOUCH_RELEASED, touch_location, | 762 ui::TouchEvent touch_released_event( |
757 0, base::TimeDelta()); | 763 ui::ET_TOUCH_RELEASED, touch_location, 0, ui::EventTimeForNow()); |
758 recorder.Reset(); | 764 recorder.Reset(); |
759 host()->dispatcher()->HoldPointerMoves(); | 765 host()->dispatcher()->HoldPointerMoves(); |
760 DispatchEventUsingWindowDispatcher(&touch_moved_event); | 766 DispatchEventUsingWindowDispatcher(&touch_moved_event); |
761 DispatchEventUsingWindowDispatcher(&touch_released_event); | 767 DispatchEventUsingWindowDispatcher(&touch_released_event); |
762 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_TAP_CANCEL GESTURE_END", | 768 EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_TAP GESTURE_END", |
763 EventTypesToString(recorder.events())); | 769 EventTypesToString(recorder.events())); |
764 recorder.Reset(); | 770 recorder.Reset(); |
765 host()->dispatcher()->ReleasePointerMoves(); | 771 host()->dispatcher()->ReleasePointerMoves(); |
766 RunAllPendingInMessageLoop(); | 772 RunAllPendingInMessageLoop(); |
767 EXPECT_TRUE(recorder.events().empty()); | 773 EXPECT_TRUE(recorder.events().empty()); |
768 } | 774 } |
769 | 775 |
770 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { | 776 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { |
771 public: | 777 public: |
772 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, | 778 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 TEST_F(WindowEventDispatcherTest, RepostTapdownGestureTest) { | 1212 TEST_F(WindowEventDispatcherTest, RepostTapdownGestureTest) { |
1207 EventFilterRecorder recorder; | 1213 EventFilterRecorder recorder; |
1208 root_window()->AddPreTargetHandler(&recorder); | 1214 root_window()->AddPreTargetHandler(&recorder); |
1209 | 1215 |
1210 test::TestWindowDelegate delegate; | 1216 test::TestWindowDelegate delegate; |
1211 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1217 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1212 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); | 1218 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); |
1213 | 1219 |
1214 ui::GestureEventDetails details(ui::ET_GESTURE_TAP_DOWN, 0.0f, 0.0f); | 1220 ui::GestureEventDetails details(ui::ET_GESTURE_TAP_DOWN, 0.0f, 0.0f); |
1215 gfx::Point point(10, 10); | 1221 gfx::Point point(10, 10); |
1216 ui::GestureEvent event( | 1222 ui::GestureEvent event(ui::ET_GESTURE_TAP_DOWN, |
1217 ui::ET_GESTURE_TAP_DOWN, | 1223 point.x(), |
1218 point.x(), | 1224 point.y(), |
1219 point.y(), | 1225 0, |
1220 0, | 1226 ui::EventTimeForNow(), |
1221 ui::EventTimeForNow(), | 1227 details, |
1222 details, | 1228 0); |
1223 0); | |
1224 host()->dispatcher()->RepostEvent(event); | 1229 host()->dispatcher()->RepostEvent(event); |
1225 RunAllPendingInMessageLoop(); | 1230 RunAllPendingInMessageLoop(); |
1226 // TODO(rbyers): Currently disabled - crbug.com/170987 | 1231 // TODO(rbyers): Currently disabled - crbug.com/170987 |
1227 EXPECT_FALSE(EventTypesToString(recorder.events()).find("GESTURE_TAP_DOWN") != | 1232 EXPECT_FALSE(EventTypesToString(recorder.events()).find("GESTURE_TAP_DOWN") != |
1228 std::string::npos); | 1233 std::string::npos); |
1229 recorder.Reset(); | 1234 recorder.Reset(); |
1230 root_window()->RemovePreTargetHandler(&recorder); | 1235 root_window()->RemovePreTargetHandler(&recorder); |
1231 } | 1236 } |
1232 | 1237 |
1233 // This class inherits from the EventFilterRecorder class which provides a | 1238 // This class inherits from the EventFilterRecorder class which provides a |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 | 1572 |
1568 TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveTouches) { | 1573 TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveTouches) { |
1569 EventFilterRecorder recorder; | 1574 EventFilterRecorder recorder; |
1570 root_window()->AddPreTargetHandler(&recorder); | 1575 root_window()->AddPreTargetHandler(&recorder); |
1571 | 1576 |
1572 test::TestWindowDelegate delegate; | 1577 test::TestWindowDelegate delegate; |
1573 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1578 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1574 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); | 1579 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); |
1575 | 1580 |
1576 gfx::Point position1 = root_window()->bounds().origin(); | 1581 gfx::Point position1 = root_window()->bounds().origin(); |
1577 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position1, 0, base::TimeDelta()); | 1582 ui::TouchEvent press( |
| 1583 ui::ET_TOUCH_PRESSED, position1, 0, ui::EventTimeForNow()); |
1578 DispatchEventUsingWindowDispatcher(&press); | 1584 DispatchEventUsingWindowDispatcher(&press); |
1579 | 1585 |
1580 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN", | 1586 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN", |
1581 EventTypesToString(recorder.GetAndResetEvents())); | 1587 EventTypesToString(recorder.GetAndResetEvents())); |
1582 | 1588 |
1583 window->Hide(); | 1589 window->Hide(); |
1584 | 1590 |
1585 EXPECT_EQ("TOUCH_CANCELLED GESTURE_TAP_CANCEL GESTURE_END", | 1591 EXPECT_EQ(ui::ET_TOUCH_CANCELLED, recorder.events()[0]); |
1586 EventTypesToString(recorder.events())); | 1592 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_GESTURE_TAP_CANCEL)); |
| 1593 EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_GESTURE_END)); |
| 1594 EXPECT_EQ(3U, recorder.events().size()); |
1587 root_window()->RemovePreTargetHandler(&recorder); | 1595 root_window()->RemovePreTargetHandler(&recorder); |
1588 } | 1596 } |
1589 | 1597 |
1590 TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveGestures) { | 1598 TEST_F(WindowEventDispatcherTest, WindowHideCancelsActiveGestures) { |
1591 EventFilterRecorder recorder; | 1599 EventFilterRecorder recorder; |
1592 root_window()->AddPreTargetHandler(&recorder); | 1600 root_window()->AddPreTargetHandler(&recorder); |
1593 | 1601 |
1594 test::TestWindowDelegate delegate; | 1602 test::TestWindowDelegate delegate; |
1595 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 1603 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
1596 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); | 1604 &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); |
1597 | 1605 |
1598 gfx::Point position1 = root_window()->bounds().origin(); | 1606 gfx::Point position1 = root_window()->bounds().origin(); |
1599 gfx::Point position2 = root_window()->bounds().CenterPoint(); | 1607 gfx::Point position2 = root_window()->bounds().CenterPoint(); |
1600 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position1, 0, base::TimeDelta()); | 1608 ui::TouchEvent press( |
| 1609 ui::ET_TOUCH_PRESSED, position1, 0, ui::EventTimeForNow()); |
1601 DispatchEventUsingWindowDispatcher(&press); | 1610 DispatchEventUsingWindowDispatcher(&press); |
1602 | 1611 |
1603 ui::TouchEvent move(ui::ET_TOUCH_MOVED, position2, 0, base::TimeDelta()); | 1612 ui::TouchEvent move( |
| 1613 ui::ET_TOUCH_MOVED, position2, 0, ui::EventTimeForNow()); |
1604 DispatchEventUsingWindowDispatcher(&move); | 1614 DispatchEventUsingWindowDispatcher(&move); |
1605 | 1615 |
1606 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, position1, 1, base::TimeDelta()); | 1616 ui::TouchEvent press2( |
| 1617 ui::ET_TOUCH_PRESSED, position1, 1, ui::EventTimeForNow()); |
1607 DispatchEventUsingWindowDispatcher(&press2); | 1618 DispatchEventUsingWindowDispatcher(&press2); |
1608 | 1619 |
1609 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED " | 1620 // TODO(tdresser): once the unified Gesture Recognizer has stuck, remove the |
1610 "GESTURE_TAP_CANCEL GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE " | 1621 // special casing here. See crbug.com/332418 for details. |
1611 "TOUCH_PRESSED GESTURE_BEGIN GESTURE_PINCH_BEGIN", | 1622 std::string expected = |
1612 EventTypesToString(recorder.GetAndResetEvents())); | 1623 "TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED " |
| 1624 "GESTURE_TAP_CANCEL GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE " |
| 1625 "TOUCH_PRESSED GESTURE_BEGIN GESTURE_PINCH_BEGIN"; |
| 1626 |
| 1627 std::string expected_ugr = |
| 1628 "TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED " |
| 1629 "GESTURE_TAP_CANCEL GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE " |
| 1630 "TOUCH_PRESSED GESTURE_BEGIN"; |
| 1631 |
| 1632 std::string events_string = EventTypesToString(recorder.GetAndResetEvents()); |
| 1633 EXPECT_TRUE((expected == events_string) || (expected_ugr == events_string)); |
1613 | 1634 |
1614 window->Hide(); | 1635 window->Hide(); |
1615 | 1636 |
1616 EXPECT_EQ("TOUCH_CANCELLED GESTURE_PINCH_END GESTURE_END TOUCH_CANCELLED " | 1637 expected = |
1617 "GESTURE_SCROLL_END GESTURE_END", | 1638 "TOUCH_CANCELLED GESTURE_PINCH_END GESTURE_END TOUCH_CANCELLED " |
1618 EventTypesToString(recorder.events())); | 1639 "GESTURE_SCROLL_END GESTURE_END"; |
| 1640 expected_ugr = |
| 1641 "TOUCH_CANCELLED GESTURE_SCROLL_END GESTURE_END GESTURE_END " |
| 1642 "TOUCH_CANCELLED"; |
| 1643 |
| 1644 events_string = EventTypesToString(recorder.GetAndResetEvents()); |
| 1645 EXPECT_TRUE((expected == events_string) || (expected_ugr == events_string)); |
| 1646 |
1619 root_window()->RemovePreTargetHandler(&recorder); | 1647 root_window()->RemovePreTargetHandler(&recorder); |
1620 } | 1648 } |
1621 | 1649 |
1622 // Places two windows side by side. Presses down on one window, and starts a | 1650 // Places two windows side by side. Presses down on one window, and starts a |
1623 // scroll. Sets capture on the other window and ensures that the "ending" events | 1651 // scroll. Sets capture on the other window and ensures that the "ending" events |
1624 // aren't sent to the window which gained capture. | 1652 // aren't sent to the window which gained capture. |
1625 TEST_F(WindowEventDispatcherTest, EndingEventDoesntRetarget) { | 1653 TEST_F(WindowEventDispatcherTest, EndingEventDoesntRetarget) { |
1626 EventFilterRecorder recorder1; | 1654 EventFilterRecorder recorder1; |
1627 EventFilterRecorder recorder2; | 1655 EventFilterRecorder recorder2; |
1628 scoped_ptr<Window> window1(CreateNormalWindow(1, root_window(), NULL)); | 1656 scoped_ptr<Window> window1(CreateNormalWindow(1, root_window(), NULL)); |
1629 window1->SetBounds(gfx::Rect(0, 0, 40, 40)); | 1657 window1->SetBounds(gfx::Rect(0, 0, 40, 40)); |
1630 | 1658 |
1631 scoped_ptr<Window> window2(CreateNormalWindow(2, root_window(), NULL)); | 1659 scoped_ptr<Window> window2(CreateNormalWindow(2, root_window(), NULL)); |
1632 window2->SetBounds(gfx::Rect(40, 0, 40, 40)); | 1660 window2->SetBounds(gfx::Rect(40, 0, 40, 40)); |
1633 | 1661 |
1634 window1->AddPreTargetHandler(&recorder1); | 1662 window1->AddPreTargetHandler(&recorder1); |
1635 window2->AddPreTargetHandler(&recorder2); | 1663 window2->AddPreTargetHandler(&recorder2); |
1636 | 1664 |
1637 gfx::Point position = window1->bounds().origin(); | 1665 gfx::Point position = window1->bounds().origin(); |
1638 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position, 0, base::TimeDelta()); | 1666 ui::TouchEvent press( |
| 1667 ui::ET_TOUCH_PRESSED, position, 0, ui::EventTimeForNow()); |
1639 DispatchEventUsingWindowDispatcher(&press); | 1668 DispatchEventUsingWindowDispatcher(&press); |
1640 | 1669 |
1641 gfx::Point position2 = window1->bounds().CenterPoint(); | 1670 gfx::Point position2 = window1->bounds().CenterPoint(); |
1642 ui::TouchEvent move(ui::ET_TOUCH_MOVED, position2, 0, base::TimeDelta()); | 1671 ui::TouchEvent move( |
| 1672 ui::ET_TOUCH_MOVED, position2, 0, ui::EventTimeForNow()); |
1643 DispatchEventUsingWindowDispatcher(&move); | 1673 DispatchEventUsingWindowDispatcher(&move); |
1644 | 1674 |
1645 window2->SetCapture(); | 1675 window2->SetCapture(); |
1646 | 1676 |
1647 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED " | 1677 EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED " |
1648 "GESTURE_TAP_CANCEL GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE " | 1678 "GESTURE_TAP_CANCEL GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE " |
1649 "TOUCH_CANCELLED GESTURE_SCROLL_END GESTURE_END", | 1679 "TOUCH_CANCELLED GESTURE_SCROLL_END GESTURE_END", |
1650 EventTypesToString(recorder1.events())); | 1680 EventTypesToString(recorder1.events())); |
1651 | 1681 |
1652 EXPECT_TRUE(recorder2.events().empty()); | 1682 EXPECT_TRUE(recorder2.events().empty()); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 delegate.GetMouseMotionCountsAndReset(); | 2140 delegate.GetMouseMotionCountsAndReset(); |
2111 | 2141 |
2112 // Notify both hosts that the cursor is now hidden. This should send a single | 2142 // Notify both hosts that the cursor is now hidden. This should send a single |
2113 // mouse-exit event to |window|. | 2143 // mouse-exit event to |window|. |
2114 host()->OnCursorVisibilityChanged(false); | 2144 host()->OnCursorVisibilityChanged(false); |
2115 second_host->OnCursorVisibilityChanged(false); | 2145 second_host->OnCursorVisibilityChanged(false); |
2116 EXPECT_EQ("0 0 1", delegate.GetMouseMotionCountsAndReset()); | 2146 EXPECT_EQ("0 0 1", delegate.GetMouseMotionCountsAndReset()); |
2117 } | 2147 } |
2118 | 2148 |
2119 } // namespace aura | 2149 } // namespace aura |
OLD | NEW |