Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc

Issue 359453003: Added accurate TouchToMouseMode testing to SplitTap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
12 #include "ui/aura/client/cursor_client.h"
12 #include "ui/aura/test/event_generator.h" 13 #include "ui/aura/test/event_generator.h"
13 #include "ui/aura/window_tree_host.h" 14 #include "ui/aura/window_tree_host.h"
14 #include "ui/compositor/compositor.h" 15 #include "ui/compositor/compositor.h"
15 #include "ui/compositor/test/draw_waiter_for_test.h" 16 #include "ui/compositor/test/draw_waiter_for_test.h"
16 #include "ui/events/test/test_event_handler.h" 17 #include "ui/events/test/test_event_handler.h"
17 18
18 namespace ui { 19 namespace ui {
19 20
20 class TouchExplorationTest : public InProcessBrowserTest { 21 class TouchExplorationTest : public InProcessBrowserTest {
21 public: 22 public:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 generator.set_current_location(gfx::Point(500, 600)); 78 generator.set_current_location(gfx::Point(500, 600));
78 generator.PressTouchId(2); 79 generator.PressTouchId(2);
79 generator.MoveTouchId(gfx::Point(509, 609), 2); 80 generator.MoveTouchId(gfx::Point(509, 609), 2);
80 EXPECT_GT(event_handler->num_mouse_events(), 0); 81 EXPECT_GT(event_handler->num_mouse_events(), 0);
81 EXPECT_EQ(0, event_handler->num_touch_events()); 82 EXPECT_EQ(0, event_handler->num_touch_events());
82 83
83 SwitchTouchExplorationMode(false); 84 SwitchTouchExplorationMode(false);
84 root_window->RemovePreTargetHandler(event_handler.get()); 85 root_window->RemovePreTargetHandler(event_handler.get());
85 } 86 }
86 87
88 // This test makes sure that after the user clicks with split tap,
89 // they continue to touch exploration mode if the original touch exploration
90 // finger is still on the screen.
91 IN_PROC_BROWSER_TEST_F(TouchExplorationTest, SplitTapExplore) {
mfomitchev 2014/06/27 19:15:46 One more thing: I've just realized that a change I
evy 2014/06/30 23:28:46 Done.
92 aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow();
93 scoped_ptr<ui::test::TestEventHandler>
94 event_handler(new ui::test::TestEventHandler());
95 root_window->AddPreTargetHandler(event_handler.get());
96 SwitchTouchExplorationMode(true);
97 aura::test::EventGenerator generator(root_window);
98 aura::client::CursorClient* cursor_client =
99 aura::client::GetCursorClient(root_window);
100
101 // Mouse events should show the cursor.
102 //generator.MoveMouseTo(gfx::Point(30, 31));
mfomitchev 2014/06/27 19:15:46 Why is this commented out?
evy 2014/06/30 23:28:46 whoops, fixed
103 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
104 EXPECT_TRUE(cursor_client->IsCursorVisible());
105
106 // After a press the cursor should be hidden.
mfomitchev 2014/06/27 19:15:46 Shown after immediately after press, hidden after
evy 2014/06/30 23:28:46 Done.
107 generator.set_current_location(gfx::Point(100, 200));
108 generator.PressTouchId(1);
109 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
110 EXPECT_TRUE(cursor_client->IsCursorVisible());
111 // Initiate touch explore by moving out of the slop.
112 generator.MoveTouchId(gfx::Point(109, 209), 1);
113 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
114 EXPECT_FALSE(cursor_client->IsCursorVisible());
115 event_handler->Reset();
116
117 // Press and release with a second finger for split tap. This should send
118 // touch press and release events which should send a click press and release.
119 // Once the press is passed through, mouse events should be disabled.
120 // Mouse events are reenabled after the release.
121 generator.set_current_location(gfx::Point(102, 202));
122 generator.PressTouchId(2);
123 EXPECT_FALSE(cursor_client->IsMouseEventsEnabled());
124 EXPECT_FALSE(cursor_client->IsCursorVisible());
125 generator.ReleaseTouchId(2);
126 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
127 EXPECT_FALSE(cursor_client->IsCursorVisible());
128 EXPECT_EQ(2, event_handler->num_touch_events());
129 event_handler->Reset();
130
131 // Continuing to move the touch exploration finger should send more mouse
132 // events.
133 generator.MoveTouchId(gfx::Point(509, 609), 1);
134 EXPECT_EQ(0, event_handler->num_touch_events());
135 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
136 EXPECT_FALSE(cursor_client->IsCursorVisible());
137
138 SwitchTouchExplorationMode(false);
139 root_window->RemovePreTargetHandler(event_handler.get());
140 }
141
87 } // namespace ui 142 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/chromeos/touch_exploration_controller.cc » ('j') | ui/chromeos/touch_exploration_controller_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698