Chromium Code Reviews| Index: ui/chromeos/touch_exploration_controller_unittest.cc |
| diff --git a/ui/chromeos/touch_exploration_controller_unittest.cc b/ui/chromeos/touch_exploration_controller_unittest.cc |
| index ffe4d090b8b3ce8779e8785a3c7ba77a58577ead..43e5a6ad948a1a7d42fb325baa3767a81f974dad 100644 |
| --- a/ui/chromeos/touch_exploration_controller_unittest.cc |
| +++ b/ui/chromeos/touch_exploration_controller_unittest.cc |
| @@ -81,6 +81,8 @@ class MockTouchExplorationControllerDelegate |
| virtual void SetOutputLevel(int volume) OVERRIDE { |
| volume_changes_.push_back(volume); |
| } |
| + virtual void SilenceSpokenFeedback() OVERRIDE { |
| + } |
| const std::vector<float> VolumeChanges() { return volume_changes_; } |
| const size_t NumAdjustSounds() { return num_times_adjust_sound_played_; } |
| @@ -127,6 +129,11 @@ class TouchExplorationControllerTestApi { |
| touch_exploration_controller_->SLIDE_GESTURE; |
| } |
| + bool IsInTwoFingerTapStateForTesting() const { |
| + return touch_exploration_controller_->state_ == |
| + touch_exploration_controller_->TWO_FINGER_TAP; |
| + } |
| + |
| gfx::Rect BoundsOfRootWindowInDIPForTesting() const { |
| return touch_exploration_controller_->root_window_->GetBoundsInScreen(); |
| } |
| @@ -287,6 +294,10 @@ class TouchExplorationTest : public aura::test::AuraTestBase { |
| return touch_exploration_controller_->IsInSlideGestureStateForTesting(); |
| } |
| + bool IsInTwoFingerTapState() { |
| + return touch_exploration_controller_->IsInTwoFingerTapStateForTesting(); |
| + } |
| + |
| gfx::Rect BoundsOfRootWindowInDIP() { |
| return touch_exploration_controller_->BoundsOfRootWindowInDIPForTesting(); |
| } |
| @@ -1527,4 +1538,24 @@ TEST_F(TouchExplorationTest, InBoundariesTouchExploration) { |
| EXPECT_TRUE(IsInTouchToMouseMode()); |
| } |
| +TEST_F(TouchExplorationTest, TwoFingerTap) { |
| + SwitchTouchExplorationMode(true); |
| + |
| + generator_->PressTouchId(1); |
| + EXPECT_FALSE(IsInTwoFingerTapState()); |
| + |
| + generator_->PressTouchId(2); |
| + EXPECT_TRUE(IsInTwoFingerTapState()); |
|
aboxhall
2014/07/31 16:49:26
Test for the kTwoFingerTap timeout elapsing?
|
| + |
| + const ScopedVector<ui::Event>& captured_events = GetCapturedEvents(); |
| + ASSERT_EQ(0U, captured_events.size()); |
| + |
| + generator_->ReleaseTouchId(1); |
| + generator_->ReleaseTouchId(2); |
| + |
| + // Two key events should have been sent to silence the feedback. |
| + ASSERT_EQ(2U, captured_events.size()); |
| + |
| +} |
| + |
| } // namespace ui |