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/ash_switches.h" | |
9 #include "ash/shell.h" | 8 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
11 #include "base/command_line.h" | |
12 #include "base/test/simple_test_tick_clock.h" | 10 #include "base/test/simple_test_tick_clock.h" |
13 #include "base/time/time.h" | 11 #include "base/time/time.h" |
14 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" |
19 #include "ui/aura/client/cursor_client.h" | 17 #include "ui/aura/client/cursor_client.h" |
20 #include "ui/aura/window_tree_host.h" | 18 #include "ui/aura/window_tree_host.h" |
21 #include "ui/compositor/compositor.h" | 19 #include "ui/compositor/compositor.h" |
22 #include "ui/compositor/test/draw_waiter_for_test.h" | 20 #include "ui/compositor/test/draw_waiter_for_test.h" |
23 #include "ui/events/event.h" | 21 #include "ui/events/event.h" |
24 #include "ui/events/event_utils.h" | 22 #include "ui/events/event_utils.h" |
25 #include "ui/events/test/event_generator.h" | 23 #include "ui/events/test/event_generator.h" |
26 #include "ui/events/test/test_event_handler.h" | 24 #include "ui/events/test/test_event_handler.h" |
27 | 25 |
28 namespace ui { | 26 namespace ui { |
29 | 27 |
30 class TouchExplorationTest : public InProcessBrowserTest { | 28 class TouchExplorationTest : public InProcessBrowserTest { |
31 public: | 29 public: |
32 TouchExplorationTest() : simulated_clock_(new base::SimpleTestTickClock()) { | 30 TouchExplorationTest() : simulated_clock_(new base::SimpleTestTickClock()) { |
33 // Tests fail if time is ever 0. | 31 // Tests fail if time is ever 0. |
34 simulated_clock_->Advance(base::TimeDelta::FromMilliseconds(10)); | 32 simulated_clock_->Advance(base::TimeDelta::FromMilliseconds(10)); |
35 } | 33 } |
36 virtual ~TouchExplorationTest() {} | 34 virtual ~TouchExplorationTest() {} |
37 | 35 |
38 protected: | 36 protected: |
39 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { | |
40 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
41 ash::switches::kAshEnableTouchExplorationMode); | |
42 } | |
43 | |
44 virtual void SetUpOnMainThread() OVERRIDE { | 37 virtual void SetUpOnMainThread() OVERRIDE { |
45 // The RenderView for WebContents is created as a result of the | 38 // The RenderView for WebContents is created as a result of the |
46 // navigation to the New Tab page which is done as part of the test | 39 // navigation to the New Tab page which is done as part of the test |
47 // SetUp. The creation involves sending a resize message to the renderer | 40 // SetUp. The creation involves sending a resize message to the renderer |
48 // process. Here we wait for the resize ack to be received, because | 41 // process. Here we wait for the resize ack to be received, because |
49 // currently WindowEventDispatcher has code to hold touch and mouse | 42 // currently WindowEventDispatcher has code to hold touch and mouse |
50 // move events until resize is complete (crbug.com/384342) which | 43 // move events until resize is complete (crbug.com/384342) which |
51 // interferes with this test. | 44 // interferes with this test. |
52 content::WebContents* web_contents = | 45 content::WebContents* web_contents = |
53 browser()->tab_strip_model()->GetActiveWebContents(); | 46 browser()->tab_strip_model()->GetActiveWebContents(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 180 |
188 // Continuing to move the touch exploration finger should send more mouse | 181 // Continuing to move the touch exploration finger should send more mouse |
189 // events. | 182 // events. |
190 generator.MoveTouchId(gfx::Point(509, 609), 1); | 183 generator.MoveTouchId(gfx::Point(509, 609), 1); |
191 EXPECT_EQ(0, event_handler_->num_touch_events()); | 184 EXPECT_EQ(0, event_handler_->num_touch_events()); |
192 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled()); | 185 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled()); |
193 EXPECT_FALSE(cursor_client->IsCursorVisible()); | 186 EXPECT_FALSE(cursor_client->IsCursorVisible()); |
194 } | 187 } |
195 | 188 |
196 } // namespace ui | 189 } // namespace ui |
OLD | NEW |