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

Side by Side Diff: chrome/browser/chromeos/system/tray_accessibility_browsertest.cc

Issue 14200048: Introduce AcccessibilityManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
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_manager.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" 21 #include "chrome/browser/policy/browser_policy_connector.h"
22 #include "chrome/browser/policy/mock_configuration_policy_provider.h" 22 #include "chrome/browser/policy/mock_configuration_policy_provider.h"
23 #include "chrome/browser/policy/policy_map.h" 23 #include "chrome/browser/policy/policy_map.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // Confirms that the icon is invisible before login. 184 // Confirms that the icon is invisible before login.
185 EXPECT_FALSE(IsTrayIconVisible()); 185 EXPECT_FALSE(IsTrayIconVisible());
186 186
187 UserManager::Get()->UserLoggedIn( 187 UserManager::Get()->UserLoggedIn(
188 "owner@invalid.domain", "owner@invalid.domain", true); 188 "owner@invalid.domain", "owner@invalid.domain", true);
189 UserManager::Get()->SessionStarted(); 189 UserManager::Get()->SessionStarted();
190 190
191 // Confirms that the icon is invisible just after login. 191 // Confirms that the icon is invisible just after login.
192 EXPECT_FALSE(IsTrayIconVisible()); 192 EXPECT_FALSE(IsTrayIconVisible());
193 193
194 // Toggling spoken feedback changes the visibility of the icon. 194 // Toggling spoken feedback changes the visibillity of the icon.
195 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 195 AccessibilityManager::Get()->EnableSpokenFeedback(
196 true, NULL, ash::A11Y_NOTIFICATION_NONE);
196 EXPECT_TRUE(IsTrayIconVisible()); 197 EXPECT_TRUE(IsTrayIconVisible());
197 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 198 AccessibilityManager::Get()->EnableSpokenFeedback(
199 false, NULL, ash::A11Y_NOTIFICATION_NONE);
198 EXPECT_FALSE(IsTrayIconVisible()); 200 EXPECT_FALSE(IsTrayIconVisible());
199 201
200 // Toggling high contrast the visibility of the icon. 202 // Toggling high contrast the visibillity of the icon.
201 accessibility::EnableHighContrast(true); 203 AccessibilityManager::Get()->EnableHighContrast(true);
202 EXPECT_TRUE(IsTrayIconVisible()); 204 EXPECT_TRUE(IsTrayIconVisible());
203 accessibility::EnableHighContrast(false); 205 AccessibilityManager::Get()->EnableHighContrast(false);
204 EXPECT_FALSE(IsTrayIconVisible()); 206 EXPECT_FALSE(IsTrayIconVisible());
205 207
206 // Toggling magnifier the visibility of the icon. 208 // Toggling magnifier the visibility of the icon.
207 SetMagnifierEnabled(true); 209 SetMagnifierEnabled(true);
208 EXPECT_TRUE(IsTrayIconVisible()); 210 EXPECT_TRUE(IsTrayIconVisible());
209 SetMagnifierEnabled(false); 211 SetMagnifierEnabled(false);
210 EXPECT_FALSE(IsTrayIconVisible()); 212 EXPECT_FALSE(IsTrayIconVisible());
211 213
212 // Enabling all accessibility features. 214 // Enabling all accessibility features.
213 SetMagnifierEnabled(true); 215 SetMagnifierEnabled(true);
214 EXPECT_TRUE(IsTrayIconVisible()); 216 EXPECT_TRUE(IsTrayIconVisible());
215 accessibility::EnableHighContrast(true); 217 AccessibilityManager::Get()->EnableHighContrast(true);
216 EXPECT_TRUE(IsTrayIconVisible()); 218 EXPECT_TRUE(IsTrayIconVisible());
217 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 219 AccessibilityManager::Get()->EnableSpokenFeedback(
220 true, NULL, ash::A11Y_NOTIFICATION_NONE);
218 EXPECT_TRUE(IsTrayIconVisible()); 221 EXPECT_TRUE(IsTrayIconVisible());
219 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 222 AccessibilityManager::Get()->EnableSpokenFeedback(
223 false, NULL, ash::A11Y_NOTIFICATION_NONE);
220 EXPECT_TRUE(IsTrayIconVisible()); 224 EXPECT_TRUE(IsTrayIconVisible());
221 accessibility::EnableHighContrast(false); 225 AccessibilityManager::Get()->EnableHighContrast(false);
222 EXPECT_TRUE(IsTrayIconVisible()); 226 EXPECT_TRUE(IsTrayIconVisible());
223 SetMagnifierEnabled(false); 227 SetMagnifierEnabled(false);
224 EXPECT_FALSE(IsTrayIconVisible()); 228 EXPECT_FALSE(IsTrayIconVisible());
225 229
226 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect 230 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect
227 // the icon on the tray. 231 // the icon on the tray.
228 SetShowAccessibilityOptionsInSystemTrayMenu(true); 232 SetShowAccessibilityOptionsInSystemTrayMenu(true);
229 accessibility::EnableHighContrast(true); 233 AccessibilityManager::Get()->EnableHighContrast(true);
230 EXPECT_TRUE(IsTrayIconVisible()); 234 EXPECT_TRUE(IsTrayIconVisible());
231 accessibility::EnableHighContrast(false); 235 AccessibilityManager::Get()->EnableHighContrast(false);
232 EXPECT_FALSE(IsTrayIconVisible()); 236 EXPECT_FALSE(IsTrayIconVisible());
233 } 237 }
234 238
235 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { 239 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) {
236 // Login 240 // Login
237 UserManager::Get()->UserLoggedIn( 241 UserManager::Get()->UserLoggedIn(
238 "owner@invalid.domain", "owner@invalid.domain", true); 242 "owner@invalid.domain", "owner@invalid.domain", true);
239 UserManager::Get()->SessionStarted(); 243 UserManager::Get()->SessionStarted();
240 244
241 SetShowAccessibilityOptionsInSystemTrayMenu(false); 245 SetShowAccessibilityOptionsInSystemTrayMenu(false);
242 246
243 // Confirms that the menu is hidden. 247 // Confirms that the menu is hidden.
244 EXPECT_FALSE(CanCreateMenuItem()); 248 EXPECT_FALSE(CanCreateMenuItem());
245 249
246 // Toggling spoken feedback changes the visibility of the menu. 250 // Toggling spoken feedback changes the visibillity of the menu.
247 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 251 AccessibilityManager::Get()->EnableSpokenFeedback(
252 true, NULL, ash::A11Y_NOTIFICATION_NONE);
248 EXPECT_TRUE(CanCreateMenuItem()); 253 EXPECT_TRUE(CanCreateMenuItem());
249 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 254 AccessibilityManager::Get()->EnableSpokenFeedback(
255 false, NULL, ash::A11Y_NOTIFICATION_NONE);
250 EXPECT_FALSE(CanCreateMenuItem()); 256 EXPECT_FALSE(CanCreateMenuItem());
251 257
252 // Toggling high contrast changes the visibility of the menu. 258 // Toggling high contrast changes the visibillity of the menu.
253 accessibility::EnableHighContrast(true); 259 AccessibilityManager::Get()->EnableHighContrast(true);
254 EXPECT_TRUE(CanCreateMenuItem()); 260 EXPECT_TRUE(CanCreateMenuItem());
255 accessibility::EnableHighContrast(false); 261 AccessibilityManager::Get()->EnableHighContrast(false);
256 EXPECT_FALSE(CanCreateMenuItem()); 262 EXPECT_FALSE(CanCreateMenuItem());
257 263
258 // Toggling screen magnifier changes the visibility of the menu. 264 // Toggling screen magnifier changes the visibility of the menu.
259 SetMagnifierEnabled(true); 265 SetMagnifierEnabled(true);
260 EXPECT_TRUE(CanCreateMenuItem()); 266 EXPECT_TRUE(CanCreateMenuItem());
261 SetMagnifierEnabled(false); 267 SetMagnifierEnabled(false);
262 EXPECT_FALSE(CanCreateMenuItem()); 268 EXPECT_FALSE(CanCreateMenuItem());
263 269
264 // Enabling all accessibility features. 270 // Enabling all accessibility features.
265 SetMagnifierEnabled(true); 271 SetMagnifierEnabled(true);
266 EXPECT_TRUE(CanCreateMenuItem()); 272 EXPECT_TRUE(CanCreateMenuItem());
267 accessibility::EnableHighContrast(true); 273 AccessibilityManager::Get()->EnableHighContrast(true);
268 EXPECT_TRUE(CanCreateMenuItem()); 274 EXPECT_TRUE(CanCreateMenuItem());
269 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 275 AccessibilityManager::Get()->EnableSpokenFeedback(
276 true, NULL, ash::A11Y_NOTIFICATION_NONE);
270 EXPECT_TRUE(CanCreateMenuItem()); 277 EXPECT_TRUE(CanCreateMenuItem());
271 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 278 AccessibilityManager::Get()->EnableSpokenFeedback(
279 false, NULL, ash::A11Y_NOTIFICATION_NONE);
272 EXPECT_TRUE(CanCreateMenuItem()); 280 EXPECT_TRUE(CanCreateMenuItem());
273 accessibility::EnableHighContrast(false); 281 AccessibilityManager::Get()->EnableHighContrast(false);
274 EXPECT_TRUE(CanCreateMenuItem()); 282 EXPECT_TRUE(CanCreateMenuItem());
275 SetMagnifierEnabled(false); 283 SetMagnifierEnabled(false);
276 EXPECT_FALSE(CanCreateMenuItem()); 284 EXPECT_FALSE(CanCreateMenuItem());
277 } 285 }
278 286
279 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { 287 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
280 // Login 288 // Login
281 UserManager::Get()->UserLoggedIn( 289 UserManager::Get()->UserLoggedIn(
282 "owner@invalid.domain", "owner@invalid.domain", true); 290 "owner@invalid.domain", "owner@invalid.domain", true);
283 UserManager::Get()->SessionStarted(); 291 UserManager::Get()->SessionStarted();
284 292
285 SetShowAccessibilityOptionsInSystemTrayMenu(true); 293 SetShowAccessibilityOptionsInSystemTrayMenu(true);
286 294
287 // Confirms that the menu is visible. 295 // Confirms that the menu is visible.
288 EXPECT_TRUE(CanCreateMenuItem()); 296 EXPECT_TRUE(CanCreateMenuItem());
289 297
290 // The menu is keeping visible regardless of toggling spoken feedback. 298 // The menu is keeping visible regardless of toggling spoken feedback.
291 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 299 AccessibilityManager::Get()->EnableSpokenFeedback(
300 true, NULL, ash::A11Y_NOTIFICATION_NONE);
292 EXPECT_TRUE(CanCreateMenuItem()); 301 EXPECT_TRUE(CanCreateMenuItem());
293 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 302 AccessibilityManager::Get()->EnableSpokenFeedback(
303 false, NULL, ash::A11Y_NOTIFICATION_NONE);
294 EXPECT_TRUE(CanCreateMenuItem()); 304 EXPECT_TRUE(CanCreateMenuItem());
295 305
296 // The menu is keeping visible regardless of toggling high contrast. 306 // The menu is keeping visible regardless of toggling high contrast.
297 accessibility::EnableHighContrast(true); 307 AccessibilityManager::Get()->EnableHighContrast(true);
298 EXPECT_TRUE(CanCreateMenuItem()); 308 EXPECT_TRUE(CanCreateMenuItem());
299 accessibility::EnableHighContrast(false); 309 AccessibilityManager::Get()->EnableHighContrast(false);
300 EXPECT_TRUE(CanCreateMenuItem()); 310 EXPECT_TRUE(CanCreateMenuItem());
301 311
302 // The menu is keeping visible regardless of toggling screen magnifier. 312 // The menu is keeping visible regardless of toggling screen magnifier.
303 SetMagnifierEnabled(true); 313 SetMagnifierEnabled(true);
304 EXPECT_TRUE(CanCreateMenuItem()); 314 EXPECT_TRUE(CanCreateMenuItem());
305 SetMagnifierEnabled(false); 315 SetMagnifierEnabled(false);
306 EXPECT_TRUE(CanCreateMenuItem()); 316 EXPECT_TRUE(CanCreateMenuItem());
307 317
308 // Enabling all accessibility features. 318 // Enabling all accessibility features.
309 SetMagnifierEnabled(true); 319 SetMagnifierEnabled(true);
310 EXPECT_TRUE(CanCreateMenuItem()); 320 EXPECT_TRUE(CanCreateMenuItem());
311 accessibility::EnableHighContrast(true); 321 AccessibilityManager::Get()->EnableHighContrast(true);
312 EXPECT_TRUE(CanCreateMenuItem()); 322 EXPECT_TRUE(CanCreateMenuItem());
313 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 323 AccessibilityManager::Get()->EnableSpokenFeedback(
324 true, NULL, ash::A11Y_NOTIFICATION_NONE);
314 EXPECT_TRUE(CanCreateMenuItem()); 325 EXPECT_TRUE(CanCreateMenuItem());
315 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 326 AccessibilityManager::Get()->EnableSpokenFeedback(
327 false, NULL, ash::A11Y_NOTIFICATION_NONE);
316 EXPECT_TRUE(CanCreateMenuItem()); 328 EXPECT_TRUE(CanCreateMenuItem());
317 accessibility::EnableHighContrast(false); 329 AccessibilityManager::Get()->EnableHighContrast(false);
318 EXPECT_TRUE(CanCreateMenuItem()); 330 EXPECT_TRUE(CanCreateMenuItem());
319 SetMagnifierEnabled(false); 331 SetMagnifierEnabled(false);
320 EXPECT_TRUE(CanCreateMenuItem()); 332 EXPECT_TRUE(CanCreateMenuItem());
321 333
322 SetShowAccessibilityOptionsInSystemTrayMenu(false); 334 SetShowAccessibilityOptionsInSystemTrayMenu(false);
323 335
324 // Confirms that the menu is invisible. 336 // Confirms that the menu is invisible.
325 EXPECT_FALSE(CanCreateMenuItem()); 337 EXPECT_FALSE(CanCreateMenuItem());
326 } 338 }
327 339
328 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { 340 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
329 SetLoginStatus(ash::user::LOGGED_IN_NONE); 341 SetLoginStatus(ash::user::LOGGED_IN_NONE);
330 342
331 // Confirms that the menu is visible. 343 // Confirms that the menu is visible.
332 EXPECT_TRUE(CanCreateMenuItem()); 344 EXPECT_TRUE(CanCreateMenuItem());
333 345
334 // The menu is keeping visible regardless of toggling spoken feedback. 346 // The menu is keeping visible regardless of toggling spoken feedback.
335 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 347 AccessibilityManager::Get()->EnableSpokenFeedback(
348 true, NULL, ash::A11Y_NOTIFICATION_NONE);
336 EXPECT_TRUE(CanCreateMenuItem()); 349 EXPECT_TRUE(CanCreateMenuItem());
337 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 350 AccessibilityManager::Get()->EnableSpokenFeedback(
351 false, NULL, ash::A11Y_NOTIFICATION_NONE);
338 EXPECT_TRUE(CanCreateMenuItem()); 352 EXPECT_TRUE(CanCreateMenuItem());
339 353
340 // The menu is keeping visible regardless of toggling high contrast. 354 // The menu is keeping visible regardless of toggling high contrast.
341 accessibility::EnableHighContrast(true); 355 AccessibilityManager::Get()->EnableHighContrast(true);
342 EXPECT_TRUE(CanCreateMenuItem()); 356 EXPECT_TRUE(CanCreateMenuItem());
343 accessibility::EnableHighContrast(false); 357 AccessibilityManager::Get()->EnableHighContrast(false);
344 EXPECT_TRUE(CanCreateMenuItem()); 358 EXPECT_TRUE(CanCreateMenuItem());
345 359
346 // The menu is keeping visible regardless of toggling screen magnifier. 360 // The menu is keeping visible regardless of toggling screen magnifier.
347 SetMagnifierEnabled(true); 361 SetMagnifierEnabled(true);
348 EXPECT_TRUE(CanCreateMenuItem()); 362 EXPECT_TRUE(CanCreateMenuItem());
349 SetMagnifierEnabled(false); 363 SetMagnifierEnabled(false);
350 EXPECT_TRUE(CanCreateMenuItem()); 364 EXPECT_TRUE(CanCreateMenuItem());
351 365
352 // Enabling all accessibility features. 366 // Enabling all accessibility features.
353 SetMagnifierEnabled(true); 367 SetMagnifierEnabled(true);
354 EXPECT_TRUE(CanCreateMenuItem()); 368 EXPECT_TRUE(CanCreateMenuItem());
355 accessibility::EnableHighContrast(true); 369 AccessibilityManager::Get()->EnableHighContrast(true);
356 EXPECT_TRUE(CanCreateMenuItem()); 370 EXPECT_TRUE(CanCreateMenuItem());
357 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 371 AccessibilityManager::Get()->EnableSpokenFeedback(
372 true, NULL, ash::A11Y_NOTIFICATION_NONE);
358 EXPECT_TRUE(CanCreateMenuItem()); 373 EXPECT_TRUE(CanCreateMenuItem());
359 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 374 AccessibilityManager::Get()->EnableSpokenFeedback(
375 false, NULL, ash::A11Y_NOTIFICATION_NONE);
360 EXPECT_TRUE(CanCreateMenuItem()); 376 EXPECT_TRUE(CanCreateMenuItem());
361 accessibility::EnableHighContrast(false); 377 AccessibilityManager::Get()->EnableHighContrast(false);
362 EXPECT_TRUE(CanCreateMenuItem()); 378 EXPECT_TRUE(CanCreateMenuItem());
363 SetMagnifierEnabled(false); 379 SetMagnifierEnabled(false);
364 EXPECT_TRUE(CanCreateMenuItem()); 380 EXPECT_TRUE(CanCreateMenuItem());
365 381
366 SetShowAccessibilityOptionsInSystemTrayMenu(true); 382 SetShowAccessibilityOptionsInSystemTrayMenu(true);
367 383
368 // Confirms that the menu is keeping visible. 384 // Confirms that the menu is keeping visible.
369 EXPECT_TRUE(CanCreateMenuItem()); 385 EXPECT_TRUE(CanCreateMenuItem());
370 386
371 SetShowAccessibilityOptionsInSystemTrayMenu(false); 387 SetShowAccessibilityOptionsInSystemTrayMenu(false);
372 388
373 // Confirms that the menu is keeping visible. 389 // Confirms that the menu is keeping visible.
374 EXPECT_TRUE(CanCreateMenuItem()); 390 EXPECT_TRUE(CanCreateMenuItem());
375 } 391 }
376 392
377 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { 393 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) {
378 // Enables high contrast mode. 394 // Enables high contrast mode.
379 accessibility::EnableHighContrast(true); 395 AccessibilityManager::Get()->EnableHighContrast(true);
380 EXPECT_TRUE(CanCreateMenuItem()); 396 EXPECT_TRUE(CanCreateMenuItem());
381 397
382 // Locks the screen. 398 // Locks the screen.
383 SetLoginStatus(ash::user::LOGGED_IN_LOCKED); 399 SetLoginStatus(ash::user::LOGGED_IN_LOCKED);
384 EXPECT_TRUE(CanCreateMenuItem()); 400 EXPECT_TRUE(CanCreateMenuItem());
385 401
386 // Disables high contrast mode. 402 // Disables high contrast mode.
387 accessibility::EnableHighContrast(false); 403 AccessibilityManager::Get()->EnableHighContrast(false);
388 404
389 // Confirms that the menu is still visible. 405 // Confirms that the menu is still visible.
390 EXPECT_TRUE(CanCreateMenuItem()); 406 EXPECT_TRUE(CanCreateMenuItem());
391 } 407 }
392 408
393 #if defined(OS_CHROMEOS) 409 #if defined(OS_CHROMEOS)
394 #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu 410 #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu
395 #else 411 #else
396 #define MAYBE_ClickDetailMenu ClickDetailMenu 412 #define MAYBE_ClickDetailMenu ClickDetailMenu
397 #endif 413 #endif
398 414
399 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { 415 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, MAYBE_ClickDetailMenu) {
400 // Confirms that the check item toggles the spoken feedback. 416 // Confirms that the check item toggles the spoken feedback.
401 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); 417 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
402 418
403 EXPECT_TRUE(CreateDetailedMenu()); 419 EXPECT_TRUE(CreateDetailedMenu());
404 ClickSpokenFeedbackOnDetailMenu(); 420 ClickSpokenFeedbackOnDetailMenu();
405 EXPECT_TRUE(accessibility::IsSpokenFeedbackEnabled()); 421 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
406 422
407 EXPECT_TRUE(CreateDetailedMenu()); 423 EXPECT_TRUE(CreateDetailedMenu());
408 ClickSpokenFeedbackOnDetailMenu(); 424 ClickSpokenFeedbackOnDetailMenu();
409 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); 425 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
410 426
411 // Confirms that the check item toggles the high contrast. 427 // Confirms that the check item toggles the high contrast.
412 EXPECT_FALSE(accessibility::IsHighContrastEnabled()); 428 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
413 429
414 EXPECT_TRUE(CreateDetailedMenu()); 430 EXPECT_TRUE(CreateDetailedMenu());
415 ClickHighContrastOnDetailMenu(); 431 ClickHighContrastOnDetailMenu();
416 EXPECT_TRUE(accessibility::IsHighContrastEnabled()); 432 EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled());
417 433
418 EXPECT_TRUE(CreateDetailedMenu()); 434 EXPECT_TRUE(CreateDetailedMenu());
419 ClickHighContrastOnDetailMenu(); 435 ClickHighContrastOnDetailMenu();
420 EXPECT_FALSE(accessibility::IsHighContrastEnabled()); 436 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
421 437
422 // Confirms that the check item toggles the magnifier. 438 // Confirms that the check item toggles the magnifier.
423 EXPECT_FALSE(accessibility::IsHighContrastEnabled()); 439 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
424 440
425 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); 441 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
426 EXPECT_TRUE(CreateDetailedMenu()); 442 EXPECT_TRUE(CreateDetailedMenu());
427 ClickScreenMagnifierOnDetailMenu(); 443 ClickScreenMagnifierOnDetailMenu();
428 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); 444 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled());
429 445
430 EXPECT_TRUE(CreateDetailedMenu()); 446 EXPECT_TRUE(CreateDetailedMenu());
431 ClickScreenMagnifierOnDetailMenu(); 447 ClickScreenMagnifierOnDetailMenu();
432 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); 448 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
433 } 449 }
434 450
435 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) { 451 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
436 // At first, all of the check is unchecked. 452 // At first, all of the check is unchecked.
437 EXPECT_TRUE(CreateDetailedMenu()); 453 EXPECT_TRUE(CreateDetailedMenu());
438 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); 454 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
439 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); 455 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
440 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); 456 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
441 CloseDetailMenu(); 457 CloseDetailMenu();
442 458
443 // Enabling spoken feedback. 459 // Enabling spoken feedback.
444 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 460 AccessibilityManager::Get()->EnableSpokenFeedback(
461 true, NULL, ash::A11Y_NOTIFICATION_NONE);
445 EXPECT_TRUE(CreateDetailedMenu()); 462 EXPECT_TRUE(CreateDetailedMenu());
446 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); 463 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
447 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); 464 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
448 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); 465 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
449 CloseDetailMenu(); 466 CloseDetailMenu();
450 467
451 // Disabling spoken feedback. 468 // Disabling spoken feedback.
452 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 469 AccessibilityManager::Get()->EnableSpokenFeedback(
470 false, NULL, ash::A11Y_NOTIFICATION_NONE);
453 EXPECT_TRUE(CreateDetailedMenu()); 471 EXPECT_TRUE(CreateDetailedMenu());
454 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); 472 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
455 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); 473 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
456 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); 474 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
457 CloseDetailMenu(); 475 CloseDetailMenu();
458 476
459 // Enabling high contrast. 477 // Enabling high contrast.
460 accessibility::EnableHighContrast(true); 478 AccessibilityManager::Get()->EnableHighContrast(true);
461 EXPECT_TRUE(CreateDetailedMenu()); 479 EXPECT_TRUE(CreateDetailedMenu());
462 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); 480 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
463 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); 481 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
464 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); 482 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
465 CloseDetailMenu(); 483 CloseDetailMenu();
466 484
467 // Disabling high contrast. 485 // Disabling high contrast.
468 accessibility::EnableHighContrast(false); 486 AccessibilityManager::Get()->EnableHighContrast(false);
469 EXPECT_TRUE(CreateDetailedMenu()); 487 EXPECT_TRUE(CreateDetailedMenu());
470 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); 488 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
471 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); 489 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
472 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); 490 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
473 CloseDetailMenu(); 491 CloseDetailMenu();
474 492
475 // Enabling full screen magnifier. 493 // Enabling full screen magnifier.
476 SetMagnifierEnabled(true); 494 SetMagnifierEnabled(true);
477 EXPECT_TRUE(CreateDetailedMenu()); 495 EXPECT_TRUE(CreateDetailedMenu());
478 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); 496 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
479 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); 497 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
480 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); 498 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
481 CloseDetailMenu(); 499 CloseDetailMenu();
482 500
483 // Disabling screen magnifier. 501 // Disabling screen magnifier.
484 SetMagnifierEnabled(false); 502 SetMagnifierEnabled(false);
485 EXPECT_TRUE(CreateDetailedMenu()); 503 EXPECT_TRUE(CreateDetailedMenu());
486 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); 504 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
487 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); 505 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
488 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); 506 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
489 CloseDetailMenu(); 507 CloseDetailMenu();
490 508
491 // Enabling all of the a11y features. 509 // Enabling all of the a11y features.
492 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); 510 AccessibilityManager::Get()->EnableSpokenFeedback(
493 accessibility::EnableHighContrast(true); 511 true, NULL, ash::A11Y_NOTIFICATION_NONE);
512 AccessibilityManager::Get()->EnableHighContrast(true);
494 SetMagnifierEnabled(true); 513 SetMagnifierEnabled(true);
495 EXPECT_TRUE(CreateDetailedMenu()); 514 EXPECT_TRUE(CreateDetailedMenu());
496 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); 515 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
497 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); 516 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
498 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); 517 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
499 CloseDetailMenu(); 518 CloseDetailMenu();
500 519
501 // Disabling all of the a11y features. 520 // Disabling all of the a11y features.
502 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); 521 AccessibilityManager::Get()->EnableSpokenFeedback(
503 accessibility::EnableHighContrast(false); 522 false, NULL, ash::A11Y_NOTIFICATION_NONE);
523 AccessibilityManager::Get()->EnableHighContrast(false);
504 SetMagnifierEnabled(false); 524 SetMagnifierEnabled(false);
505 EXPECT_TRUE(CreateDetailedMenu()); 525 EXPECT_TRUE(CreateDetailedMenu());
506 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); 526 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
507 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); 527 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
508 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); 528 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
509 CloseDetailMenu(); 529 CloseDetailMenu();
510 } 530 }
511 531
512 INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, 532 INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance,
513 TrayAccessibilityTest, 533 TrayAccessibilityTest,
514 testing::Values(PREF_SERVICE, 534 testing::Values(PREF_SERVICE,
515 POLICY)); 535 POLICY));
516 536
517 } // namespace chromeos 537 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/ash_system_tray_delegate.cc ('k') | chrome/browser/extensions/component_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698