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 "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 ash::AccessibilityDelegate* ad = | 27 ash::AccessibilityDelegate* ad = |
28 ash::Shell::GetInstance()->accessibility_delegate(); | 28 ash::Shell::GetInstance()->accessibility_delegate(); |
29 if (on != ad->IsSpokenFeedbackEnabled()) | 29 if (on != ad->IsSpokenFeedbackEnabled()) |
30 ad->ToggleSpokenFeedback(ash::A11Y_NOTIFICATION_NONE); | 30 ad->ToggleSpokenFeedback(ash::A11Y_NOTIFICATION_NONE); |
31 } | 31 } |
32 | 32 |
33 private: | 33 private: |
34 DISALLOW_COPY_AND_ASSIGN(TouchExplorationTest); | 34 DISALLOW_COPY_AND_ASSIGN(TouchExplorationTest); |
35 }; | 35 }; |
36 | 36 |
37 IN_PROC_BROWSER_TEST_F(TouchExplorationTest, PRE_ToggleOnOff) { | |
38 // TODO (mfomitchev): If the test is run by itself, there is a resize at the | |
39 // very beginning. An in-progress resize creates a "resize lock" in | |
40 // RenderWidgetHostViewAura, which calls | |
41 // WindowEventDispatcher::HoldPointerMoves(), which prevents mouse events from | |
42 // coming through. Adding a PRE_ test ensures the resize completes before the | |
43 // actual test is executed. sadrul@ says the resize shouldn't be even | |
44 // happening, so this needs to be looked at further. | |
45 } | |
46 | |
47 // This test turns the touch exploration mode on/off and confirms that events | 37 // This test turns the touch exploration mode on/off and confirms that events |
48 // get rewritten when the touch exploration mode is on, and aren't affected | 38 // get rewritten when the touch exploration mode is on, and aren't affected |
49 // after the touch exploration mode is turned off. | 39 // after the touch exploration mode is turned off. |
50 IN_PROC_BROWSER_TEST_F(TouchExplorationTest, ToggleOnOff) { | 40 IN_PROC_BROWSER_TEST_F(TouchExplorationTest, ToggleOnOff) { |
51 aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow(); | 41 aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow(); |
52 scoped_ptr<ui::test::TestEventHandler> | 42 scoped_ptr<ui::test::TestEventHandler> |
53 event_handler(new ui::test::TestEventHandler()); | 43 event_handler(new ui::test::TestEventHandler()); |
54 root_window->AddPreTargetHandler(event_handler.get()); | 44 root_window->AddPreTargetHandler(event_handler.get()); |
55 SwitchTouchExplorationMode(true); | 45 SwitchTouchExplorationMode(true); |
56 aura::test::EventGenerator generator(root_window); | 46 aura::test::EventGenerator generator(root_window); |
(...skipping 13 matching lines...) Expand all Loading... |
70 SwitchTouchExplorationMode(true); | 60 SwitchTouchExplorationMode(true); |
71 generator.PressTouchId(2); | 61 generator.PressTouchId(2); |
72 EXPECT_GT(event_handler->num_mouse_events(), 0); | 62 EXPECT_GT(event_handler->num_mouse_events(), 0); |
73 EXPECT_EQ(0, event_handler->num_touch_events()); | 63 EXPECT_EQ(0, event_handler->num_touch_events()); |
74 | 64 |
75 SwitchTouchExplorationMode(false); | 65 SwitchTouchExplorationMode(false); |
76 root_window->RemovePreTargetHandler(event_handler.get()); | 66 root_window->RemovePreTargetHandler(event_handler.get()); |
77 } | 67 } |
78 | 68 |
79 } // namespace ui | 69 } // namespace ui |
OLD | NEW |