OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/magnifier/magnification_controller.h" | 5 #include "ash/magnifier/magnification_controller.h" |
6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
7 #include "ash/system/tray/system_tray.h" | 7 #include "ash/system/tray/system_tray.h" |
8 #include "ash/system/tray_accessibility.h" | 8 #include "ash/system/tray_accessibility.h" |
9 #include "ash/system/user/login_status.h" | 9 #include "ash/system/user/login_status.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
15 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 15 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
16 #include "chrome/browser/chromeos/login/helper.h" | 16 #include "chrome/browser/chromeos/login/helper.h" |
17 #include "chrome/browser/chromeos/login/login_utils.h" | 17 #include "chrome/browser/chromeos/login/login_utils.h" |
18 #include "chrome/browser/chromeos/login/startup_utils.h" | 18 #include "chrome/browser/chromeos/login/startup_utils.h" |
19 #include "chrome/browser/chromeos/login/user_manager.h" | 19 #include "chrome/browser/chromeos/login/user_manager.h" |
20 #include "chrome/browser/chromeos/login/user_manager_impl.h" | 20 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
| 21 #include "chrome/browser/policy/browser_policy_connector.h" |
| 22 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
| 23 #include "chrome/browser/policy/policy_map.h" |
| 24 #include "chrome/browser/policy/policy_types.h" |
21 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
23 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
26 #include "chrome/test/base/testing_profile.h" | 30 #include "chrome/test/base/testing_profile.h" |
27 #include "chromeos/chromeos_switches.h" | 31 #include "chromeos/chromeos_switches.h" |
28 #include "content/public/test/test_utils.h" | 32 #include "content/public/test/test_utils.h" |
| 33 #include "policy/policy_constants.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
30 #include "ui/views/widget/widget.h" | 35 #include "ui/views/widget/widget.h" |
31 | 36 |
| 37 using testing::AnyNumber; |
| 38 using testing::Return; |
| 39 using testing::_; |
| 40 using testing::WithParamInterface; |
| 41 |
32 namespace chromeos { | 42 namespace chromeos { |
33 | 43 |
| 44 enum PrefSettingMechanism { |
| 45 PREF_SERVICE, |
| 46 POLICY, |
| 47 }; |
| 48 |
34 void SetMagnifierEnabled(bool enabled) { | 49 void SetMagnifierEnabled(bool enabled) { |
35 MagnificationManager::Get()->SetMagnifierEnabled(enabled); | 50 MagnificationManager::Get()->SetMagnifierEnabled(enabled); |
36 } | 51 } |
37 | 52 |
38 class TrayAccessibilityTest : public CrosInProcessBrowserTest { | 53 class TrayAccessibilityTest |
| 54 : public CrosInProcessBrowserTest, |
| 55 public WithParamInterface<PrefSettingMechanism> { |
39 protected: | 56 protected: |
40 TrayAccessibilityTest() {} | 57 TrayAccessibilityTest() {} |
41 virtual ~TrayAccessibilityTest() {} | 58 virtual ~TrayAccessibilityTest() {} |
42 | 59 |
| 60 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 61 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 62 .WillRepeatedly(Return(true)); |
| 63 EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber()); |
| 64 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
| 65 } |
| 66 |
43 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 67 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
44 command_line->AppendSwitch(switches::kLoginManager); | 68 command_line->AppendSwitch(switches::kLoginManager); |
45 command_line->AppendSwitchASCII(switches::kLoginProfile, | 69 command_line->AppendSwitchASCII(switches::kLoginProfile, |
46 TestingProfile::kTestUserProfileDir); | 70 TestingProfile::kTestUserProfileDir); |
47 } | 71 } |
48 | 72 |
49 virtual void RunTestOnMainThreadLoop() OVERRIDE { | 73 virtual void RunTestOnMainThreadLoop() OVERRIDE { |
50 // Need to mark oobe completed to show detailed views. | 74 // Need to mark oobe completed to show detailed views. |
51 StartupUtils::MarkOobeCompleted(); | 75 StartupUtils::MarkOobeCompleted(); |
52 CrosInProcessBrowserTest::RunTestOnMainThreadLoop(); | 76 CrosInProcessBrowserTest::RunTestOnMainThreadLoop(); |
53 } | 77 } |
54 | 78 |
| 79 void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) { |
| 80 if (GetParam() == PREF_SERVICE) { |
| 81 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 82 PrefService* prefs = profile->GetPrefs(); |
| 83 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, value); |
| 84 } else if (GetParam() == POLICY) { |
| 85 policy::PolicyMap policy_map; |
| 86 policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu, |
| 87 policy::POLICY_LEVEL_MANDATORY, |
| 88 policy::POLICY_SCOPE_USER, |
| 89 base::Value::CreateBooleanValue(value)); |
| 90 provider_.UpdateChromePolicy(policy_map); |
| 91 base::RunLoop().RunUntilIdle(); |
| 92 } else { |
| 93 FAIL() << "Unknown test parameterization"; |
| 94 } |
| 95 } |
| 96 |
55 ash::internal::TrayAccessibility* tray() { | 97 ash::internal::TrayAccessibility* tray() { |
56 return ash::Shell::GetInstance()->GetPrimarySystemTray()-> | 98 return ash::Shell::GetInstance()->GetPrimarySystemTray()-> |
57 GetTrayAccessibilityForTest(); | 99 GetTrayAccessibilityForTest(); |
58 } | 100 } |
59 | 101 |
60 bool IsTrayIconVisible() { | 102 bool IsTrayIconVisible() { |
61 return tray()->tray_icon_visible_; | 103 return tray()->tray_icon_visible_; |
62 } | 104 } |
63 | 105 |
64 views::View* CreateMenuItem() { | 106 views::View* CreateMenuItem() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return tray()->detailed_menu_->spoken_feedback_enabled_; | 157 return tray()->detailed_menu_->spoken_feedback_enabled_; |
116 } | 158 } |
117 | 159 |
118 bool IsHighContrastEnabledOnDetailMenu() { | 160 bool IsHighContrastEnabledOnDetailMenu() { |
119 return tray()->detailed_menu_->high_contrast_enabled_; | 161 return tray()->detailed_menu_->high_contrast_enabled_; |
120 } | 162 } |
121 | 163 |
122 bool IsScreenMagnifierEnabledOnDetailMenu() { | 164 bool IsScreenMagnifierEnabledOnDetailMenu() { |
123 return tray()->detailed_menu_->screen_magnifier_enabled_; | 165 return tray()->detailed_menu_->screen_magnifier_enabled_; |
124 } | 166 } |
| 167 |
| 168 policy::MockConfigurationPolicyProvider provider_; |
125 }; | 169 }; |
126 | 170 |
127 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, LoginStatus) { | 171 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) { |
128 EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus()); | 172 EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus()); |
129 | 173 |
130 UserManager::Get()->UserLoggedIn( | 174 UserManager::Get()->UserLoggedIn( |
131 "owner@invalid.domain", "owner@invalid.domain", true); | 175 "owner@invalid.domain", "owner@invalid.domain", true); |
132 UserManager::Get()->SessionStarted(); | 176 UserManager::Get()->SessionStarted(); |
133 | 177 |
134 EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus()); | 178 EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus()); |
135 } | 179 } |
136 | 180 |
137 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) { | 181 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) { |
138 SetLoginStatus(ash::user::LOGGED_IN_NONE); | 182 SetLoginStatus(ash::user::LOGGED_IN_NONE); |
139 | 183 |
140 // Confirms that the icon is invisible before login. | 184 // Confirms that the icon is invisible before login. |
141 EXPECT_FALSE(IsTrayIconVisible()); | 185 EXPECT_FALSE(IsTrayIconVisible()); |
142 | 186 |
143 UserManager::Get()->UserLoggedIn( | 187 UserManager::Get()->UserLoggedIn( |
144 "owner@invalid.domain", "owner@invalid.domain", true); | 188 "owner@invalid.domain", "owner@invalid.domain", true); |
145 UserManager::Get()->SessionStarted(); | 189 UserManager::Get()->SessionStarted(); |
146 | 190 |
147 // Confirms that the icon is invisible just after login. | 191 // Confirms that the icon is invisible just after login. |
148 EXPECT_FALSE(IsTrayIconVisible()); | 192 EXPECT_FALSE(IsTrayIconVisible()); |
149 | 193 |
150 // Toggling spoken feedback changes the visibillity of the icon. | 194 // Toggling spoken feedback changes the visibility of the icon. |
151 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 195 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
152 EXPECT_TRUE(IsTrayIconVisible()); | 196 EXPECT_TRUE(IsTrayIconVisible()); |
153 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 197 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
154 EXPECT_FALSE(IsTrayIconVisible()); | 198 EXPECT_FALSE(IsTrayIconVisible()); |
155 | 199 |
156 // Toggling high contrast the visibillity of the icon. | 200 // Toggling high contrast the visibility of the icon. |
157 accessibility::EnableHighContrast(true); | 201 accessibility::EnableHighContrast(true); |
158 EXPECT_TRUE(IsTrayIconVisible()); | 202 EXPECT_TRUE(IsTrayIconVisible()); |
159 accessibility::EnableHighContrast(false); | 203 accessibility::EnableHighContrast(false); |
160 EXPECT_FALSE(IsTrayIconVisible()); | 204 EXPECT_FALSE(IsTrayIconVisible()); |
161 | 205 |
162 // Toggling magnifier the visibillity of the icon. | 206 // Toggling magnifier the visibility of the icon. |
163 SetMagnifierEnabled(true); | 207 SetMagnifierEnabled(true); |
164 EXPECT_TRUE(IsTrayIconVisible()); | 208 EXPECT_TRUE(IsTrayIconVisible()); |
165 SetMagnifierEnabled(false); | 209 SetMagnifierEnabled(false); |
166 EXPECT_FALSE(IsTrayIconVisible()); | 210 EXPECT_FALSE(IsTrayIconVisible()); |
167 | 211 |
168 // Enabling all accessibility features. | 212 // Enabling all accessibility features. |
169 SetMagnifierEnabled(true); | 213 SetMagnifierEnabled(true); |
170 EXPECT_TRUE(IsTrayIconVisible()); | 214 EXPECT_TRUE(IsTrayIconVisible()); |
171 accessibility::EnableHighContrast(true); | 215 accessibility::EnableHighContrast(true); |
172 EXPECT_TRUE(IsTrayIconVisible()); | 216 EXPECT_TRUE(IsTrayIconVisible()); |
173 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 217 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
174 EXPECT_TRUE(IsTrayIconVisible()); | 218 EXPECT_TRUE(IsTrayIconVisible()); |
175 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 219 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
176 EXPECT_TRUE(IsTrayIconVisible()); | 220 EXPECT_TRUE(IsTrayIconVisible()); |
177 accessibility::EnableHighContrast(false); | 221 accessibility::EnableHighContrast(false); |
178 EXPECT_TRUE(IsTrayIconVisible()); | 222 EXPECT_TRUE(IsTrayIconVisible()); |
179 SetMagnifierEnabled(false); | 223 SetMagnifierEnabled(false); |
180 EXPECT_FALSE(IsTrayIconVisible()); | 224 EXPECT_FALSE(IsTrayIconVisible()); |
181 | 225 |
182 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect | 226 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect |
183 // the icon on the tray. | 227 // the icon on the tray. |
184 Profile* profile = ProfileManager::GetDefaultProfile(); | 228 SetShowAccessibilityOptionsInSystemTrayMenu(true); |
185 PrefService* prefs = profile->GetPrefs(); | |
186 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); | |
187 prefs->CommitPendingWrite(); | |
188 accessibility::EnableHighContrast(true); | 229 accessibility::EnableHighContrast(true); |
189 EXPECT_TRUE(IsTrayIconVisible()); | 230 EXPECT_TRUE(IsTrayIconVisible()); |
190 accessibility::EnableHighContrast(false); | 231 accessibility::EnableHighContrast(false); |
191 EXPECT_FALSE(IsTrayIconVisible()); | 232 EXPECT_FALSE(IsTrayIconVisible()); |
192 } | 233 } |
193 | 234 |
194 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) { | 235 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { |
195 // Login | 236 // Login |
196 UserManager::Get()->UserLoggedIn( | 237 UserManager::Get()->UserLoggedIn( |
197 "owner@invalid.domain", "owner@invalid.domain", true); | 238 "owner@invalid.domain", "owner@invalid.domain", true); |
198 UserManager::Get()->SessionStarted(); | 239 UserManager::Get()->SessionStarted(); |
199 | 240 |
200 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. | 241 SetShowAccessibilityOptionsInSystemTrayMenu(false); |
201 Profile* profile = ProfileManager::GetDefaultProfile(); | |
202 PrefService* prefs = profile->GetPrefs(); | |
203 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); | |
204 prefs->CommitPendingWrite(); | |
205 | 242 |
206 // Confirms that the menu is hidden. | 243 // Confirms that the menu is hidden. |
207 EXPECT_FALSE(CanCreateMenuItem()); | 244 EXPECT_FALSE(CanCreateMenuItem()); |
208 | 245 |
209 // Toggling spoken feedback changes the visibillity of the menu. | 246 // Toggling spoken feedback changes the visibility of the menu. |
210 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 247 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
211 EXPECT_TRUE(CanCreateMenuItem()); | 248 EXPECT_TRUE(CanCreateMenuItem()); |
212 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 249 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
213 EXPECT_FALSE(CanCreateMenuItem()); | 250 EXPECT_FALSE(CanCreateMenuItem()); |
214 | 251 |
215 // Toggling high contrast changes the visibillity of the menu. | 252 // Toggling high contrast changes the visibility of the menu. |
216 accessibility::EnableHighContrast(true); | 253 accessibility::EnableHighContrast(true); |
217 EXPECT_TRUE(CanCreateMenuItem()); | 254 EXPECT_TRUE(CanCreateMenuItem()); |
218 accessibility::EnableHighContrast(false); | 255 accessibility::EnableHighContrast(false); |
219 EXPECT_FALSE(CanCreateMenuItem()); | 256 EXPECT_FALSE(CanCreateMenuItem()); |
220 | 257 |
221 // Toggling screen magnifier changes the visibillity of the menu. | 258 // Toggling screen magnifier changes the visibility of the menu. |
222 SetMagnifierEnabled(true); | 259 SetMagnifierEnabled(true); |
223 EXPECT_TRUE(CanCreateMenuItem()); | 260 EXPECT_TRUE(CanCreateMenuItem()); |
224 SetMagnifierEnabled(false); | 261 SetMagnifierEnabled(false); |
225 EXPECT_FALSE(CanCreateMenuItem()); | 262 EXPECT_FALSE(CanCreateMenuItem()); |
226 | 263 |
227 // Enabling all accessibility features. | 264 // Enabling all accessibility features. |
228 SetMagnifierEnabled(true); | 265 SetMagnifierEnabled(true); |
229 EXPECT_TRUE(CanCreateMenuItem()); | 266 EXPECT_TRUE(CanCreateMenuItem()); |
230 accessibility::EnableHighContrast(true); | 267 accessibility::EnableHighContrast(true); |
231 EXPECT_TRUE(CanCreateMenuItem()); | 268 EXPECT_TRUE(CanCreateMenuItem()); |
232 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 269 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
233 EXPECT_TRUE(CanCreateMenuItem()); | 270 EXPECT_TRUE(CanCreateMenuItem()); |
234 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 271 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
235 EXPECT_TRUE(CanCreateMenuItem()); | 272 EXPECT_TRUE(CanCreateMenuItem()); |
236 accessibility::EnableHighContrast(false); | 273 accessibility::EnableHighContrast(false); |
237 EXPECT_TRUE(CanCreateMenuItem()); | 274 EXPECT_TRUE(CanCreateMenuItem()); |
238 SetMagnifierEnabled(false); | 275 SetMagnifierEnabled(false); |
239 EXPECT_FALSE(CanCreateMenuItem()); | 276 EXPECT_FALSE(CanCreateMenuItem()); |
240 } | 277 } |
241 | 278 |
242 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { | 279 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
243 // Login | 280 // Login |
244 UserManager::Get()->UserLoggedIn( | 281 UserManager::Get()->UserLoggedIn( |
245 "owner@invalid.domain", "owner@invalid.domain", true); | 282 "owner@invalid.domain", "owner@invalid.domain", true); |
246 UserManager::Get()->SessionStarted(); | 283 UserManager::Get()->SessionStarted(); |
247 | 284 |
248 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. | 285 SetShowAccessibilityOptionsInSystemTrayMenu(true); |
249 Profile* profile = ProfileManager::GetDefaultProfile(); | |
250 PrefService* prefs = profile->GetPrefs(); | |
251 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); | |
252 prefs->CommitPendingWrite(); | |
253 | 286 |
254 // Confirms that the menu is visible. | 287 // Confirms that the menu is visible. |
255 EXPECT_TRUE(CanCreateMenuItem()); | 288 EXPECT_TRUE(CanCreateMenuItem()); |
256 | 289 |
257 // The menu is keeping visible regardless of toggling spoken feedback. | 290 // The menu is keeping visible regardless of toggling spoken feedback. |
258 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 291 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
259 EXPECT_TRUE(CanCreateMenuItem()); | 292 EXPECT_TRUE(CanCreateMenuItem()); |
260 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 293 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
261 EXPECT_TRUE(CanCreateMenuItem()); | 294 EXPECT_TRUE(CanCreateMenuItem()); |
262 | 295 |
(...skipping 16 matching lines...) Expand all Loading... |
279 EXPECT_TRUE(CanCreateMenuItem()); | 312 EXPECT_TRUE(CanCreateMenuItem()); |
280 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 313 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
281 EXPECT_TRUE(CanCreateMenuItem()); | 314 EXPECT_TRUE(CanCreateMenuItem()); |
282 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 315 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
283 EXPECT_TRUE(CanCreateMenuItem()); | 316 EXPECT_TRUE(CanCreateMenuItem()); |
284 accessibility::EnableHighContrast(false); | 317 accessibility::EnableHighContrast(false); |
285 EXPECT_TRUE(CanCreateMenuItem()); | 318 EXPECT_TRUE(CanCreateMenuItem()); |
286 SetMagnifierEnabled(false); | 319 SetMagnifierEnabled(false); |
287 EXPECT_TRUE(CanCreateMenuItem()); | 320 EXPECT_TRUE(CanCreateMenuItem()); |
288 | 321 |
289 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. | 322 SetShowAccessibilityOptionsInSystemTrayMenu(false); |
290 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); | |
291 | 323 |
292 // Confirms that the menu is invisible. | 324 // Confirms that the menu is invisible. |
293 EXPECT_FALSE(CanCreateMenuItem()); | 325 EXPECT_FALSE(CanCreateMenuItem()); |
294 } | 326 } |
295 | 327 |
296 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { | 328 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { |
297 SetLoginStatus(ash::user::LOGGED_IN_NONE); | 329 SetLoginStatus(ash::user::LOGGED_IN_NONE); |
298 | 330 |
299 // Confirms that the menu is visible. | 331 // Confirms that the menu is visible. |
300 EXPECT_TRUE(CanCreateMenuItem()); | 332 EXPECT_TRUE(CanCreateMenuItem()); |
301 | 333 |
302 // The menu is keeping visible regardless of toggling spoken feedback. | 334 // The menu is keeping visible regardless of toggling spoken feedback. |
303 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 335 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
304 EXPECT_TRUE(CanCreateMenuItem()); | 336 EXPECT_TRUE(CanCreateMenuItem()); |
305 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 337 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
306 EXPECT_TRUE(CanCreateMenuItem()); | 338 EXPECT_TRUE(CanCreateMenuItem()); |
(...skipping 17 matching lines...) Expand all Loading... |
324 EXPECT_TRUE(CanCreateMenuItem()); | 356 EXPECT_TRUE(CanCreateMenuItem()); |
325 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 357 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
326 EXPECT_TRUE(CanCreateMenuItem()); | 358 EXPECT_TRUE(CanCreateMenuItem()); |
327 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 359 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
328 EXPECT_TRUE(CanCreateMenuItem()); | 360 EXPECT_TRUE(CanCreateMenuItem()); |
329 accessibility::EnableHighContrast(false); | 361 accessibility::EnableHighContrast(false); |
330 EXPECT_TRUE(CanCreateMenuItem()); | 362 EXPECT_TRUE(CanCreateMenuItem()); |
331 SetMagnifierEnabled(false); | 363 SetMagnifierEnabled(false); |
332 EXPECT_TRUE(CanCreateMenuItem()); | 364 EXPECT_TRUE(CanCreateMenuItem()); |
333 | 365 |
334 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. | 366 SetShowAccessibilityOptionsInSystemTrayMenu(true); |
335 Profile* profile = ProfileManager::GetDefaultProfile(); | |
336 PrefService* prefs = profile->GetPrefs(); | |
337 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); | |
338 prefs->CommitPendingWrite(); | |
339 | 367 |
340 // Confirms that the menu is keeping visible. | 368 // Confirms that the menu is keeping visible. |
341 EXPECT_TRUE(CanCreateMenuItem()); | 369 EXPECT_TRUE(CanCreateMenuItem()); |
342 | 370 |
343 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. | 371 SetShowAccessibilityOptionsInSystemTrayMenu(false); |
344 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); | |
345 prefs->CommitPendingWrite(); | |
346 | 372 |
347 // Confirms that the menu is keeping visible. | 373 // Confirms that the menu is keeping visible. |
348 EXPECT_TRUE(CanCreateMenuItem()); | 374 EXPECT_TRUE(CanCreateMenuItem()); |
349 } | 375 } |
350 | 376 |
351 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { | 377 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { |
352 // Enables high contrast mode. | 378 // Enables high contrast mode. |
353 accessibility::EnableHighContrast(true); | 379 accessibility::EnableHighContrast(true); |
354 EXPECT_TRUE(CanCreateMenuItem()); | 380 EXPECT_TRUE(CanCreateMenuItem()); |
355 | 381 |
356 // Locks the screen. | 382 // Locks the screen. |
357 SetLoginStatus(ash::user::LOGGED_IN_LOCKED); | 383 SetLoginStatus(ash::user::LOGGED_IN_LOCKED); |
358 EXPECT_TRUE(CanCreateMenuItem()); | 384 EXPECT_TRUE(CanCreateMenuItem()); |
359 | 385 |
360 // Disables high contrast mode. | 386 // Disables high contrast mode. |
361 accessibility::EnableHighContrast(false); | 387 accessibility::EnableHighContrast(false); |
362 | 388 |
363 // Confirms that the menu is still visible. | 389 // Confirms that the menu is still visible. |
364 EXPECT_TRUE(CanCreateMenuItem()); | 390 EXPECT_TRUE(CanCreateMenuItem()); |
365 } | 391 } |
366 | 392 |
367 #if defined(OS_CHROMEOS) | 393 #if defined(OS_CHROMEOS) |
368 #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu | 394 #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu |
369 #else | 395 #else |
370 #define MAYBE_ClickDetailMenu ClickDetailMenu | 396 #define MAYBE_ClickDetailMenu ClickDetailMenu |
371 #endif | 397 #endif |
372 | 398 |
373 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { | 399 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { |
374 // Confirms that the check item toggles the spoken feedback. | 400 // Confirms that the check item toggles the spoken feedback. |
375 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); | 401 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); |
376 | 402 |
377 EXPECT_TRUE(CreateDetailedMenu()); | 403 EXPECT_TRUE(CreateDetailedMenu()); |
378 ClickSpokenFeedbackOnDetailMenu(); | 404 ClickSpokenFeedbackOnDetailMenu(); |
379 EXPECT_TRUE(accessibility::IsSpokenFeedbackEnabled()); | 405 EXPECT_TRUE(accessibility::IsSpokenFeedbackEnabled()); |
380 | 406 |
381 EXPECT_TRUE(CreateDetailedMenu()); | 407 EXPECT_TRUE(CreateDetailedMenu()); |
382 ClickSpokenFeedbackOnDetailMenu(); | 408 ClickSpokenFeedbackOnDetailMenu(); |
383 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); | 409 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); |
(...skipping 15 matching lines...) Expand all Loading... |
399 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); | 425 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
400 EXPECT_TRUE(CreateDetailedMenu()); | 426 EXPECT_TRUE(CreateDetailedMenu()); |
401 ClickScreenMagnifierOnDetailMenu(); | 427 ClickScreenMagnifierOnDetailMenu(); |
402 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); | 428 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); |
403 | 429 |
404 EXPECT_TRUE(CreateDetailedMenu()); | 430 EXPECT_TRUE(CreateDetailedMenu()); |
405 ClickScreenMagnifierOnDetailMenu(); | 431 ClickScreenMagnifierOnDetailMenu(); |
406 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); | 432 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
407 } | 433 } |
408 | 434 |
409 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { | 435 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) { |
410 // At first, all of the check is unchecked. | 436 // At first, all of the check is unchecked. |
411 EXPECT_TRUE(CreateDetailedMenu()); | 437 EXPECT_TRUE(CreateDetailedMenu()); |
412 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 438 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
413 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 439 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
414 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 440 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
415 CloseDetailMenu(); | 441 CloseDetailMenu(); |
416 | 442 |
417 // Enabling spoken feedback. | 443 // Enabling spoken feedback. |
418 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 444 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
419 EXPECT_TRUE(CreateDetailedMenu()); | 445 EXPECT_TRUE(CreateDetailedMenu()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 502 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
477 accessibility::EnableHighContrast(false); | 503 accessibility::EnableHighContrast(false); |
478 SetMagnifierEnabled(false); | 504 SetMagnifierEnabled(false); |
479 EXPECT_TRUE(CreateDetailedMenu()); | 505 EXPECT_TRUE(CreateDetailedMenu()); |
480 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 506 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
481 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 507 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
482 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 508 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
483 CloseDetailMenu(); | 509 CloseDetailMenu(); |
484 } | 510 } |
485 | 511 |
| 512 INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, |
| 513 TrayAccessibilityTest, |
| 514 testing::Values(PREF_SERVICE, |
| 515 POLICY)); |
| 516 |
486 } // namespace chromeos | 517 } // namespace chromeos |
OLD | NEW |