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

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

Issue 2101263004: mash: Migrate AccessibilityDelegate access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 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/common/accessibility_delegate.h" 7 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/accessibility_types.h" 8 #include "ash/common/accessibility_types.h"
9 #include "ash/common/wm_shell.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 11 #include "ash/test/ash_test_base.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/test/simple_test_tick_clock.h" 13 #include "base/test/simple_test_tick_clock.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
17 #include "chrome/test/base/in_process_browser_test.h" 18 #include "chrome/test/base/in_process_browser_test.h"
18 #include "content/public/test/browser_test_utils.h" 19 #include "content/public/test/browser_test_utils.h"
19 #include "ui/aura/client/cursor_client.h" 20 #include "ui/aura/client/cursor_client.h"
20 #include "ui/aura/window_tree_host.h" 21 #include "ui/aura/window_tree_host.h"
21 #include "ui/compositor/compositor.h" 22 #include "ui/compositor/compositor.h"
22 #include "ui/compositor/test/draw_waiter_for_test.h" 23 #include "ui/compositor/test/draw_waiter_for_test.h"
23 #include "ui/events/event.h" 24 #include "ui/events/event.h"
24 #include "ui/events/event_utils.h" 25 #include "ui/events/event_utils.h"
25 #include "ui/events/test/event_generator.h" 26 #include "ui/events/test/event_generator.h"
26 #include "ui/events/test/test_event_handler.h" 27 #include "ui/events/test/test_event_handler.h"
27 28
28 namespace ui { 29 namespace ui {
James Cook 2016/06/28 22:34:25 optional: kinda weird that this file is in namespa
msw 2016/06/28 22:49:50 Done.
29 30
30 class TouchExplorationTest : public InProcessBrowserTest { 31 class TouchExplorationTest : public InProcessBrowserTest {
31 public: 32 public:
32 TouchExplorationTest() : simulated_clock_(new base::SimpleTestTickClock()) { 33 TouchExplorationTest() : simulated_clock_(new base::SimpleTestTickClock()) {
33 // Tests fail if time is ever 0. 34 // Tests fail if time is ever 0.
34 simulated_clock_->Advance(base::TimeDelta::FromMilliseconds(10)); 35 simulated_clock_->Advance(base::TimeDelta::FromMilliseconds(10));
35 } 36 }
36 ~TouchExplorationTest() override {} 37 ~TouchExplorationTest() override {}
37 38
38 protected: 39 protected:
(...skipping 12 matching lines...) Expand all
51 event_handler_.reset(new ui::test::TestEventHandler()); 52 event_handler_.reset(new ui::test::TestEventHandler());
52 root_window_->AddPreTargetHandler(event_handler_.get()); 53 root_window_->AddPreTargetHandler(event_handler_.get());
53 } 54 }
54 55
55 void TearDownOnMainThread() override { 56 void TearDownOnMainThread() override {
56 SwitchTouchExplorationMode(false); 57 SwitchTouchExplorationMode(false);
57 root_window_->RemovePreTargetHandler(event_handler_.get()); 58 root_window_->RemovePreTargetHandler(event_handler_.get());
58 } 59 }
59 60
60 void SwitchTouchExplorationMode(bool on) { 61 void SwitchTouchExplorationMode(bool on) {
61 ash::AccessibilityDelegate* ad = 62 ash::AccessibilityDelegate* delegate =
62 ash::Shell::GetInstance()->accessibility_delegate(); 63 ash::WmShell::Get()->GetAccessibilityDelegate();
63 if (on != ad->IsSpokenFeedbackEnabled()) 64 if (on != delegate->IsSpokenFeedbackEnabled())
64 ad->ToggleSpokenFeedback(ash::A11Y_NOTIFICATION_NONE); 65 delegate->ToggleSpokenFeedback(ash::A11Y_NOTIFICATION_NONE);
65 } 66 }
66 67
67 base::TimeTicks Now() { return simulated_clock_->NowTicks(); } 68 base::TimeTicks Now() { return simulated_clock_->NowTicks(); }
68 69
69 ui::GestureDetector::Config gesture_detector_config_; 70 ui::GestureDetector::Config gesture_detector_config_;
70 base::SimpleTestTickClock* simulated_clock_; 71 base::SimpleTestTickClock* simulated_clock_;
71 aura::Window* root_window_; 72 aura::Window* root_window_;
72 std::unique_ptr<ui::test::TestEventHandler> event_handler_; 73 std::unique_ptr<ui::test::TestEventHandler> event_handler_;
73 74
74 private: 75 private:
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 244
244 // Continuing to move the touch exploration finger should send more mouse 245 // Continuing to move the touch exploration finger should send more mouse
245 // events. 246 // events.
246 generator.MoveTouchId(gfx::Point(509, 609), 1); 247 generator.MoveTouchId(gfx::Point(509, 609), 1);
247 EXPECT_EQ(0, event_handler_->num_touch_events()); 248 EXPECT_EQ(0, event_handler_->num_touch_events());
248 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled()); 249 EXPECT_TRUE(cursor_client->IsMouseEventsEnabled());
249 EXPECT_FALSE(cursor_client->IsCursorVisible()); 250 EXPECT_FALSE(cursor_client->IsCursorVisible());
250 } 251 }
251 252
252 } // namespace ui 253 } // namespace ui
OLDNEW
« ash/wm/overview/window_selector_unittest.cc ('K') | « ash/wm/overview/window_selector_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698