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