OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
6 | 6 |
7 #include "ash/magnifier/magnification_controller.h" | 7 #include "ash/magnifier/magnification_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 13 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
14 #include "chrome/browser/chromeos/login/helper.h" | 14 #include "chrome/browser/chromeos/login/helper.h" |
15 #include "chrome/browser/chromeos/login/login_utils.h" | 15 #include "chrome/browser/chromeos/login/login_utils.h" |
16 #include "chrome/browser/chromeos/login/user_manager.h" | 16 #include "chrome/browser/chromeos/login/user_manager.h" |
17 #include "chrome/browser/chromeos/login/user_manager_impl.h" | 17 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
18 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
19 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con
troller.h" | 19 #include "chrome/browser/extensions/api/braille_display_private/mock_braille_con
troller.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "chrome/test/base/in_process_browser_test.h" | 23 #include "chrome/test/base/in_process_browser_test.h" |
24 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
25 #include "chromeos/chromeos_switches.h" | 25 #include "chromeos/chromeos_switches.h" |
26 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
28 | 28 |
29 using extensions::api::braille_display_private::BrailleObserver; | 29 using extensions::api::braille_display_private::BrailleObserver; |
30 using extensions::api::braille_display_private::DisplayState; | 30 using extensions::api::braille_display_private::DisplayState; |
31 using extensions::api::braille_display_private::StubBrailleController; | 31 using extensions::api::braille_display_private::MockBrailleController; |
32 | 32 |
33 namespace chromeos { | 33 namespace chromeos { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 const char kTestUserName[] = "owner@invalid.domain"; | 37 const char kTestUserName[] = "owner@invalid.domain"; |
38 | 38 |
39 const int kTestAutoclickDelayMs = 2000; | 39 const int kTestAutoclickDelayMs = 2000; |
40 | 40 |
41 // Test user name for locally managed user. The domain part must be matched | 41 // Test user name for locally managed user. The domain part must be matched |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 bool observed_; | 76 bool observed_; |
77 bool observed_enabled_; | 77 bool observed_enabled_; |
78 int observed_type_; | 78 int observed_type_; |
79 | 79 |
80 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; | 80 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(MockAccessibilityObserver); | 82 DISALLOW_COPY_AND_ASSIGN(MockAccessibilityObserver); |
83 }; | 83 }; |
84 | 84 |
85 class MockBrailleController : public StubBrailleController { | |
86 public: | |
87 | |
88 MockBrailleController() : available_(false), observer_(NULL) {} | |
89 | |
90 virtual scoped_ptr<DisplayState> GetDisplayState() OVERRIDE { | |
91 scoped_ptr<DisplayState> state(new DisplayState()); | |
92 state->available = available_; | |
93 return state.Pass(); | |
94 } | |
95 | |
96 virtual void AddObserver(BrailleObserver* observer) OVERRIDE { | |
97 ASSERT_EQ(NULL, observer_); | |
98 observer_ = observer; | |
99 } | |
100 | |
101 virtual void RemoveObserver(BrailleObserver* observer) OVERRIDE { | |
102 ASSERT_EQ(observer_, observer); | |
103 } | |
104 | |
105 void SetAvailable(bool available) { | |
106 available_ = available; | |
107 } | |
108 | |
109 BrailleObserver* GetObserver() { | |
110 return observer_; | |
111 } | |
112 | |
113 private: | |
114 bool available_; | |
115 BrailleObserver* observer_; | |
116 }; | |
117 | |
118 void SetLargeCursorEnabled(bool enabled) { | 85 void SetLargeCursorEnabled(bool enabled) { |
119 return AccessibilityManager::Get()->EnableLargeCursor(enabled); | 86 return AccessibilityManager::Get()->EnableLargeCursor(enabled); |
120 } | 87 } |
121 | 88 |
122 bool IsLargeCursorEnabled() { | 89 bool IsLargeCursorEnabled() { |
123 return AccessibilityManager::Get()->IsLargeCursorEnabled(); | 90 return AccessibilityManager::Get()->IsLargeCursorEnabled(); |
124 } | 91 } |
125 | 92 |
126 bool ShouldShowAccessibilityMenu() { | 93 bool ShouldShowAccessibilityMenu() { |
127 return AccessibilityManager::Get()->ShouldShowAccessibilityMenu(); | 94 return AccessibilityManager::Get()->ShouldShowAccessibilityMenu(); |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 EXPECT_FALSE(ShouldShowAccessibilityMenu()); | 620 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
654 | 621 |
655 // Check on-screen keyboard. | 622 // Check on-screen keyboard. |
656 SetVirtualKeyboardEnabled(true); | 623 SetVirtualKeyboardEnabled(true); |
657 EXPECT_TRUE(ShouldShowAccessibilityMenu()); | 624 EXPECT_TRUE(ShouldShowAccessibilityMenu()); |
658 SetVirtualKeyboardEnabled(false); | 625 SetVirtualKeyboardEnabled(false); |
659 EXPECT_FALSE(ShouldShowAccessibilityMenu()); | 626 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
660 } | 627 } |
661 | 628 |
662 } // namespace chromeos | 629 } // namespace chromeos |
OLD | NEW |