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

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: removed extra browser test 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/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
13 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
14 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
15 #include "ui/aura/client/cursor_client.h"
15 #include "ui/aura/test/event_generator.h" 16 #include "ui/aura/test/event_generator.h"
16 #include "ui/aura/window_tree_host.h" 17 #include "ui/aura/window_tree_host.h"
17 #include "ui/compositor/compositor.h" 18 #include "ui/compositor/compositor.h"
18 #include "ui/compositor/test/draw_waiter_for_test.h" 19 #include "ui/compositor/test/draw_waiter_for_test.h"
19 #include "ui/events/test/test_event_handler.h" 20 #include "ui/events/test/test_event_handler.h"
20 21
21 namespace ui { 22 namespace ui {
22 23
23 class TouchExplorationTest : public InProcessBrowserTest { 24 class TouchExplorationTest : public InProcessBrowserTest {
24 public: 25 public:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 generator.set_current_location(gfx::Point(500, 600)); 80 generator.set_current_location(gfx::Point(500, 600));
80 generator.PressTouchId(2); 81 generator.PressTouchId(2);
81 generator.MoveTouchId(gfx::Point(509, 609), 2); 82 generator.MoveTouchId(gfx::Point(509, 609), 2);
82 EXPECT_GT(event_handler->num_mouse_events(), 0); 83 EXPECT_GT(event_handler->num_mouse_events(), 0);
83 EXPECT_EQ(0, event_handler->num_touch_events()); 84 EXPECT_EQ(0, event_handler->num_touch_events());
84 85
85 SwitchTouchExplorationMode(false); 86 SwitchTouchExplorationMode(false);
86 root_window->RemovePreTargetHandler(event_handler.get()); 87 root_window->RemovePreTargetHandler(event_handler.get());
87 } 88 }
88 89
90 // This test makes sure that after the user clicks with split tap,
91 // they continue to touch exploration mode if the original touch exploration
92 // finger is still on the screen.
93 IN_PROC_BROWSER_TEST_F(TouchExplorationTest, SplitTapExplore) {
94 aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow();
mfomitchev 2014/07/03 17:31:55 I think you need to call WaitForResizeComplete(),
evy 2014/07/07 18:53:42 Done.
95 scoped_ptr<ui::test::TestEventHandler>
96 event_handler(new ui::test::TestEventHandler());
97 root_window->AddPreTargetHandler(event_handler.get());
98 SwitchTouchExplorationMode(true);
99 aura::test::EventGenerator generator(root_window);
100 aura::client::CursorClient* cursor_client =
101 aura::client::GetCursorClient(root_window);
102
103 // Mouse events should show the cursor.
104 generator.MoveMouseTo(gfx::Point(30, 31));
105 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
106 EXPECT_TRUE(cursor_client->IsCursorVisible());
107
108 // After a press the cursor should be shown after immediately after press,
109 // hidden after move.
110 generator.set_current_location(gfx::Point(100, 200));
111 generator.PressTouchId(1);
112 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
113 EXPECT_TRUE(cursor_client->IsCursorVisible());
114 // Initiate touch explore by moving out of the slop.
115 generator.MoveTouchId(gfx::Point(109, 209), 1);
116 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
117 EXPECT_FALSE(cursor_client->IsCursorVisible());
118 event_handler->Reset();
119
120 // Press and release with a second finger for split tap. This should send
121 // touch press and release events which should send a click press and release.
122 // Once the press is passed through, mouse events should be disabled.
123 // Mouse events are reenabled after the release.
124 generator.set_current_location(gfx::Point(102, 202));
125 generator.PressTouchId(2);
126 EXPECT_FALSE(cursor_client->IsMouseEventsEnabled());
127 EXPECT_FALSE(cursor_client->IsCursorVisible());
128 generator.ReleaseTouchId(2);
129 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
130 EXPECT_FALSE(cursor_client->IsCursorVisible());
131 EXPECT_EQ(2, event_handler->num_touch_events());
132 event_handler->Reset();
133
134 // Continuing to move the touch exploration finger should send more mouse
135 // events.
136 generator.MoveTouchId(gfx::Point(509, 609), 1);
137 EXPECT_EQ(0, event_handler->num_touch_events());
138 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
139 EXPECT_FALSE(cursor_client->IsCursorVisible());
140
141 SwitchTouchExplorationMode(false);
142 root_window->RemovePreTargetHandler(event_handler.get());
143 }
144
89 } // namespace ui 145 } // 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