OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/magnifier/magnification_controller.h" |
| 6 #include "ash/shell.h" |
| 7 #include "ash/system/tray/system_tray.h" |
| 8 #include "ash/system/tray/tray_views.h" |
| 9 #include "ash/system/tray_accessibility.h" |
| 10 #include "ash/system/user/login_status.h" |
| 11 #include "base/command_line.h" |
| 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 15 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
| 16 #include "chrome/browser/chromeos/login/helper.h" |
| 17 #include "chrome/browser/chromeos/login/login_utils.h" |
| 18 #include "chrome/browser/chromeos/login/user_manager.h" |
| 19 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/common/chrome_notification_types.h" |
| 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/test/base/testing_profile.h" |
| 27 #include "content/public/browser/browser_thread.h" |
| 28 #include "content/public/test/test_utils.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" |
| 30 #include "ui/views/widget/widget.h" |
| 31 |
| 32 namespace chromeos { |
| 33 |
| 34 namespace { |
| 35 ui::MouseEvent& dummyEvent = *((ui::MouseEvent*)0); |
| 36 } |
| 37 |
| 38 class TrayAccessibilityTest : public CrosInProcessBrowserTest { |
| 39 protected: |
| 40 TrayAccessibilityTest() {} |
| 41 virtual ~TrayAccessibilityTest() {} |
| 42 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 43 command_line->AppendSwitch(switches::kLoginManager); |
| 44 command_line->AppendSwitchASCII(switches::kLoginProfile, |
| 45 TestingProfile::kTestUserProfileDir); |
| 46 } |
| 47 |
| 48 ash::internal::TrayAccessibility* tray() { |
| 49 return ash::Shell::GetInstance()->GetPrimarySystemTray()-> |
| 50 GetTrayAccessibilityForTest(); |
| 51 } |
| 52 |
| 53 bool IsTrayIconVisible() { |
| 54 return tray()->tray_icon_visible_; |
| 55 } |
| 56 |
| 57 views::View* CreateMenuItem() { |
| 58 return tray()->CreateDefaultView(GetLoginStatus()); |
| 59 } |
| 60 |
| 61 void DestroyMenuItem() { |
| 62 return tray()->DestroyDefaultView(); |
| 63 } |
| 64 |
| 65 bool CanCreateMenuItem() { |
| 66 views::View* menu_item_view = CreateMenuItem(); |
| 67 DestroyMenuItem(); |
| 68 return menu_item_view != NULL; |
| 69 } |
| 70 |
| 71 void SetLoginStatus(ash::user::LoginStatus status) { |
| 72 tray()->UpdateAfterLoginStatusChange(status); |
| 73 } |
| 74 |
| 75 ash::user::LoginStatus GetLoginStatus() { |
| 76 return tray()->login_; |
| 77 } |
| 78 |
| 79 bool CreateDetailedMenu() { |
| 80 tray()->PopupDetailedView(0, false); |
| 81 return tray()->detailed_menu_ != NULL; |
| 82 } |
| 83 |
| 84 void CloseDetailMenu() { |
| 85 CHECK(tray()->detailed_menu_); |
| 86 tray()->DestroyDetailedView(); |
| 87 tray()->detailed_menu_ = NULL; |
| 88 } |
| 89 |
| 90 void ClickSpokenFeedbackOnDetailMenu() { |
| 91 views::View* button = tray()->detailed_menu_->spoken_feedback_view_; |
| 92 tray()->detailed_menu_->ClickedOn(button); |
| 93 } |
| 94 |
| 95 void ClickHighContrastOnDetailMenu() { |
| 96 views::View* button = tray()->detailed_menu_->high_contrast_view_; |
| 97 EXPECT_TRUE(button); |
| 98 tray()->detailed_menu_->ClickedOn(button); |
| 99 } |
| 100 |
| 101 void ClickScreenMagnifierOnDetailMenu() { |
| 102 views::View* button = tray()->detailed_menu_->screen_magnifier_view_; |
| 103 EXPECT_TRUE(button); |
| 104 tray()->detailed_menu_->ClickedOn(button); |
| 105 } |
| 106 |
| 107 bool IsSpokenFeedbackEnabledOnDetailMenu() { |
| 108 return tray()->detailed_menu_->spoken_feedback_enabled_; |
| 109 } |
| 110 |
| 111 bool IsHighContrastEnabledOnDetailMenu() { |
| 112 return tray()->detailed_menu_->high_contrast_enabled_; |
| 113 } |
| 114 |
| 115 bool IsScreenMagnifierEnabledOnDetailMenu() { |
| 116 return tray()->detailed_menu_->screen_magnifier_enabled_; |
| 117 } |
| 118 }; |
| 119 |
| 120 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, LoginStatus) { |
| 121 EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus()); |
| 122 |
| 123 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true); |
| 124 UserManager::Get()->SessionStarted(); |
| 125 |
| 126 EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus()); |
| 127 } |
| 128 |
| 129 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) { |
| 130 SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 131 |
| 132 // Confirms that the icon is invisible before login. |
| 133 EXPECT_FALSE(IsTrayIconVisible()); |
| 134 |
| 135 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true); |
| 136 UserManager::Get()->SessionStarted(); |
| 137 |
| 138 // Confirms that the icon is invisible just after login. |
| 139 EXPECT_FALSE(IsTrayIconVisible()); |
| 140 |
| 141 // Toggling spoken feedback changes the visibillity of the icon. |
| 142 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 143 EXPECT_TRUE(IsTrayIconVisible()); |
| 144 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 145 EXPECT_FALSE(IsTrayIconVisible()); |
| 146 |
| 147 // Toggling high contrast the visibillity of the icon. |
| 148 accessibility::EnableHighContrast(true); |
| 149 EXPECT_TRUE(IsTrayIconVisible()); |
| 150 accessibility::EnableHighContrast(false); |
| 151 EXPECT_FALSE(IsTrayIconVisible()); |
| 152 |
| 153 // Toggling magnifier the visibillity of the icon. |
| 154 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 155 EXPECT_TRUE(IsTrayIconVisible()); |
| 156 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 157 EXPECT_FALSE(IsTrayIconVisible()); |
| 158 |
| 159 // Enabling all accessibility features. |
| 160 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 161 EXPECT_TRUE(IsTrayIconVisible()); |
| 162 accessibility::EnableHighContrast(true); |
| 163 EXPECT_TRUE(IsTrayIconVisible()); |
| 164 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 165 EXPECT_TRUE(IsTrayIconVisible()); |
| 166 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 167 EXPECT_TRUE(IsTrayIconVisible()); |
| 168 accessibility::EnableHighContrast(false); |
| 169 EXPECT_TRUE(IsTrayIconVisible()); |
| 170 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 171 EXPECT_FALSE(IsTrayIconVisible()); |
| 172 |
| 173 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect |
| 174 // the icon on the tray. |
| 175 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 176 PrefService* prefs = profile->GetPrefs(); |
| 177 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); |
| 178 prefs->CommitPendingWrite(); |
| 179 accessibility::EnableHighContrast(true); |
| 180 EXPECT_TRUE(IsTrayIconVisible()); |
| 181 accessibility::EnableHighContrast(false); |
| 182 EXPECT_FALSE(IsTrayIconVisible()); |
| 183 } |
| 184 |
| 185 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) { |
| 186 // Login |
| 187 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true); |
| 188 UserManager::Get()->SessionStarted(); |
| 189 |
| 190 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. |
| 191 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 192 PrefService* prefs = profile->GetPrefs(); |
| 193 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); |
| 194 prefs->CommitPendingWrite(); |
| 195 |
| 196 // Confirms that the menu is hidden. |
| 197 EXPECT_FALSE(CanCreateMenuItem()); |
| 198 |
| 199 // Toggling spoken feedback changes the visibillity of the menu. |
| 200 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 201 EXPECT_TRUE(CanCreateMenuItem()); |
| 202 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 203 EXPECT_FALSE(CanCreateMenuItem()); |
| 204 |
| 205 // Toggling high contrast changes the visibillity of the menu. |
| 206 accessibility::EnableHighContrast(true); |
| 207 EXPECT_TRUE(CanCreateMenuItem()); |
| 208 accessibility::EnableHighContrast(false); |
| 209 EXPECT_FALSE(CanCreateMenuItem()); |
| 210 |
| 211 // Toggling screen magnifier changes the visibillity of the menu. |
| 212 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 213 EXPECT_TRUE(CanCreateMenuItem()); |
| 214 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 215 EXPECT_FALSE(CanCreateMenuItem()); |
| 216 |
| 217 // Enabling all accessibility features. |
| 218 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 219 EXPECT_TRUE(CanCreateMenuItem()); |
| 220 accessibility::EnableHighContrast(true); |
| 221 EXPECT_TRUE(CanCreateMenuItem()); |
| 222 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 223 EXPECT_TRUE(CanCreateMenuItem()); |
| 224 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 225 EXPECT_TRUE(CanCreateMenuItem()); |
| 226 accessibility::EnableHighContrast(false); |
| 227 EXPECT_TRUE(CanCreateMenuItem()); |
| 228 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 229 EXPECT_FALSE(CanCreateMenuItem()); |
| 230 } |
| 231 |
| 232 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
| 233 // Login |
| 234 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true); |
| 235 UserManager::Get()->SessionStarted(); |
| 236 |
| 237 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. |
| 238 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 239 PrefService* prefs = profile->GetPrefs(); |
| 240 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); |
| 241 prefs->CommitPendingWrite(); |
| 242 |
| 243 // Confirms that the menu is visible. |
| 244 EXPECT_TRUE(CanCreateMenuItem()); |
| 245 |
| 246 // The menu is keeping visible regardless of toggling spoken feedback. |
| 247 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 248 EXPECT_TRUE(CanCreateMenuItem()); |
| 249 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 250 EXPECT_TRUE(CanCreateMenuItem()); |
| 251 |
| 252 // The menu is keeping visible regardless of toggling high contrast. |
| 253 accessibility::EnableHighContrast(true); |
| 254 EXPECT_TRUE(CanCreateMenuItem()); |
| 255 accessibility::EnableHighContrast(false); |
| 256 EXPECT_TRUE(CanCreateMenuItem()); |
| 257 |
| 258 // The menu is keeping visible regardless of toggling screen magnifier. |
| 259 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 260 EXPECT_TRUE(CanCreateMenuItem()); |
| 261 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 262 EXPECT_TRUE(CanCreateMenuItem()); |
| 263 |
| 264 // Enabling all accessibility features. |
| 265 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 266 EXPECT_TRUE(CanCreateMenuItem()); |
| 267 accessibility::EnableHighContrast(true); |
| 268 EXPECT_TRUE(CanCreateMenuItem()); |
| 269 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 270 EXPECT_TRUE(CanCreateMenuItem()); |
| 271 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 272 EXPECT_TRUE(CanCreateMenuItem()); |
| 273 accessibility::EnableHighContrast(false); |
| 274 EXPECT_TRUE(CanCreateMenuItem()); |
| 275 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 276 EXPECT_TRUE(CanCreateMenuItem()); |
| 277 |
| 278 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. |
| 279 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); |
| 280 |
| 281 // Confirms that the menu is invisible. |
| 282 EXPECT_FALSE(CanCreateMenuItem()); |
| 283 } |
| 284 |
| 285 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { |
| 286 SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 287 |
| 288 // Confirms that the menu is visible. |
| 289 EXPECT_TRUE(CanCreateMenuItem()); |
| 290 |
| 291 // The menu is keeping visible regardless of toggling spoken feedback. |
| 292 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 293 EXPECT_TRUE(CanCreateMenuItem()); |
| 294 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 295 EXPECT_TRUE(CanCreateMenuItem()); |
| 296 |
| 297 // The menu is keeping visible regardless of toggling high contrast. |
| 298 accessibility::EnableHighContrast(true); |
| 299 EXPECT_TRUE(CanCreateMenuItem()); |
| 300 accessibility::EnableHighContrast(false); |
| 301 EXPECT_TRUE(CanCreateMenuItem()); |
| 302 |
| 303 // The menu is keeping visible regardless of toggling screen magnifier. |
| 304 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 305 EXPECT_TRUE(CanCreateMenuItem()); |
| 306 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 307 EXPECT_TRUE(CanCreateMenuItem()); |
| 308 |
| 309 // Enabling all accessibility features. |
| 310 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 311 EXPECT_TRUE(CanCreateMenuItem()); |
| 312 accessibility::EnableHighContrast(true); |
| 313 EXPECT_TRUE(CanCreateMenuItem()); |
| 314 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 315 EXPECT_TRUE(CanCreateMenuItem()); |
| 316 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 317 EXPECT_TRUE(CanCreateMenuItem()); |
| 318 accessibility::EnableHighContrast(false); |
| 319 EXPECT_TRUE(CanCreateMenuItem()); |
| 320 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 321 EXPECT_TRUE(CanCreateMenuItem()); |
| 322 |
| 323 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. |
| 324 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 325 PrefService* prefs = profile->GetPrefs(); |
| 326 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); |
| 327 prefs->CommitPendingWrite(); |
| 328 |
| 329 // Confirms that the menu is keeping visible. |
| 330 EXPECT_TRUE(CanCreateMenuItem()); |
| 331 |
| 332 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. |
| 333 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); |
| 334 prefs->CommitPendingWrite(); |
| 335 |
| 336 // Confirms that the menu is keeping visible. |
| 337 EXPECT_TRUE(CanCreateMenuItem()); |
| 338 } |
| 339 |
| 340 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ClickDetailMenu) { |
| 341 // Confirms that the check item toggles the spoken feedback. |
| 342 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); |
| 343 |
| 344 EXPECT_TRUE(CreateDetailedMenu()); |
| 345 ClickSpokenFeedbackOnDetailMenu(); |
| 346 EXPECT_TRUE(accessibility::IsSpokenFeedbackEnabled()); |
| 347 |
| 348 EXPECT_TRUE(CreateDetailedMenu()); |
| 349 ClickSpokenFeedbackOnDetailMenu(); |
| 350 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); |
| 351 |
| 352 // Confirms that the check item toggles the high contrast. |
| 353 EXPECT_FALSE(accessibility::IsHighContrastEnabled()); |
| 354 |
| 355 EXPECT_TRUE(CreateDetailedMenu()); |
| 356 ClickHighContrastOnDetailMenu(); |
| 357 EXPECT_TRUE(accessibility::IsHighContrastEnabled()); |
| 358 |
| 359 EXPECT_TRUE(CreateDetailedMenu()); |
| 360 ClickHighContrastOnDetailMenu(); |
| 361 EXPECT_FALSE(accessibility::IsHighContrastEnabled()); |
| 362 |
| 363 // Confirms that the check item toggles the magnifier. |
| 364 EXPECT_FALSE(accessibility::IsHighContrastEnabled()); |
| 365 |
| 366 EXPECT_EQ(ash::MAGNIFIER_OFF, |
| 367 MagnificationManager::Get()->GetMagnifierType()); |
| 368 EXPECT_TRUE(CreateDetailedMenu()); |
| 369 ClickScreenMagnifierOnDetailMenu(); |
| 370 EXPECT_EQ(ash::MAGNIFIER_FULL, |
| 371 MagnificationManager::Get()->GetMagnifierType()); |
| 372 |
| 373 EXPECT_TRUE(CreateDetailedMenu()); |
| 374 ClickScreenMagnifierOnDetailMenu(); |
| 375 EXPECT_EQ(ash::MAGNIFIER_OFF, |
| 376 MagnificationManager::Get()->GetMagnifierType()); |
| 377 } |
| 378 |
| 379 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { |
| 380 // At first, all of the check is unchecked. |
| 381 EXPECT_TRUE(CreateDetailedMenu()); |
| 382 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 383 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 384 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 385 CloseDetailMenu(); |
| 386 |
| 387 // Enabling spoken feedback. |
| 388 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 389 EXPECT_TRUE(CreateDetailedMenu()); |
| 390 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 391 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 392 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 393 CloseDetailMenu(); |
| 394 |
| 395 // Disabling spoken feedback. |
| 396 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 397 EXPECT_TRUE(CreateDetailedMenu()); |
| 398 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 399 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 400 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 401 CloseDetailMenu(); |
| 402 |
| 403 // Enabling high contrast. |
| 404 accessibility::EnableHighContrast(true); |
| 405 EXPECT_TRUE(CreateDetailedMenu()); |
| 406 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 407 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 408 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 409 CloseDetailMenu(); |
| 410 |
| 411 // Disabling high contrast. |
| 412 accessibility::EnableHighContrast(false); |
| 413 EXPECT_TRUE(CreateDetailedMenu()); |
| 414 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 415 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 416 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 417 CloseDetailMenu(); |
| 418 |
| 419 // Enabling full screen magnifier. |
| 420 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 421 EXPECT_TRUE(CreateDetailedMenu()); |
| 422 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 423 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 424 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 425 CloseDetailMenu(); |
| 426 |
| 427 // Disabling screen magnifier. |
| 428 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 429 EXPECT_TRUE(CreateDetailedMenu()); |
| 430 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 431 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 432 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 433 CloseDetailMenu(); |
| 434 |
| 435 // Enabling all of the a11y features. |
| 436 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 437 accessibility::EnableHighContrast(true); |
| 438 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_FULL); |
| 439 EXPECT_TRUE(CreateDetailedMenu()); |
| 440 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 441 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 442 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 443 CloseDetailMenu(); |
| 444 |
| 445 // Disabling all of the a11y features. |
| 446 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 447 accessibility::EnableHighContrast(false); |
| 448 MagnificationManager::Get()->SetMagnifier(ash::MAGNIFIER_OFF); |
| 449 EXPECT_TRUE(CreateDetailedMenu()); |
| 450 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 451 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 452 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 453 CloseDetailMenu(); |
| 454 } |
| 455 |
| 456 } |
OLD | NEW |