OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/touch_exploration_controller.h" | 5 #include "ui/chromeos/touch_exploration_controller.h" |
6 | 6 |
7 #include "base/test/simple_test_tick_clock.h" | 7 #include "base/test/simple_test_tick_clock.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "ui/aura/client/cursor_client.h" | 9 #include "ui/aura/client/cursor_client.h" |
10 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 | 745 |
746 // Double-tap without any previous touch. | 746 // Double-tap without any previous touch. |
747 // Touch exploration mode has not been entered, so there is no previous | 747 // Touch exploration mode has not been entered, so there is no previous |
748 // touch exploration event. The double-tap should be discarded, and no events | 748 // touch exploration event. The double-tap should be discarded, and no events |
749 // should be generated at all. | 749 // should be generated at all. |
750 gfx::Point double_tap_location(33, 34); | 750 gfx::Point double_tap_location(33, 34); |
751 generator_->set_current_location(double_tap_location); | 751 generator_->set_current_location(double_tap_location); |
752 generator_->PressTouch(); | 752 generator_->PressTouch(); |
753 generator_->ReleaseTouch(); | 753 generator_->ReleaseTouch(); |
754 generator_->PressTouch(); | 754 generator_->PressTouch(); |
| 755 // Since the state stays in single_tap_released, we need to make sure the |
| 756 // tap timer doesn't fire and set the state to no fingers down (since there |
| 757 // is still a finger down). |
| 758 AdvanceSimulatedTimePastPotentialTapDelay(); |
| 759 EXPECT_FALSE(IsInNoFingersDownState()); |
755 generator_->ReleaseTouch(); | 760 generator_->ReleaseTouch(); |
| 761 EXPECT_TRUE(IsInNoFingersDownState()); |
756 | 762 |
757 std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents(); | 763 std::vector<ui::LocatedEvent*> captured_events = GetCapturedLocatedEvents(); |
758 ASSERT_EQ(0U, captured_events.size()); | 764 ASSERT_EQ(0U, captured_events.size()); |
759 } | 765 } |
760 | 766 |
761 // Tapping and releasing with a second finger when in touch exploration mode | 767 // Tapping and releasing with a second finger when in touch exploration mode |
762 // should send a touch press and released to the location of the last | 768 // should send a touch press and released to the location of the last |
763 // successful touch exploration and return to touch explore. | 769 // successful touch exploration and return to touch explore. |
764 TEST_F(TouchExplorationTest, SplitTap) { | 770 TEST_F(TouchExplorationTest, SplitTap) { |
765 SwitchTouchExplorationMode(true); | 771 SwitchTouchExplorationMode(true); |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 EXPECT_FALSE(IsInSlideGestureState()); | 1634 EXPECT_FALSE(IsInSlideGestureState()); |
1629 EXPECT_FALSE(IsInTouchToMouseMode()); | 1635 EXPECT_FALSE(IsInTouchToMouseMode()); |
1630 | 1636 |
1631 AdvanceSimulatedTimePastTapDelay(); | 1637 AdvanceSimulatedTimePastTapDelay(); |
1632 EXPECT_FALSE(IsInGestureInProgressState()); | 1638 EXPECT_FALSE(IsInGestureInProgressState()); |
1633 EXPECT_FALSE(IsInSlideGestureState()); | 1639 EXPECT_FALSE(IsInSlideGestureState()); |
1634 EXPECT_TRUE(IsInTouchToMouseMode()); | 1640 EXPECT_TRUE(IsInTouchToMouseMode()); |
1635 } | 1641 } |
1636 | 1642 |
1637 } // namespace ui | 1643 } // namespace ui |
OLD | NEW |