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