[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" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 8 | #include "ash/system/tray_accessibility.h" |
| 9 | #include "ash/system/user/login_status.h" |
| 10 | #include "base/command_line.h" |
[email protected] | 3853a4c | 2013-02-11 17:15:57 | [diff] [blame] | 11 | #include "base/prefs/pref_service.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 12 | #include "chrome/browser/browser_process.h" |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 13 | #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 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" |
[email protected] | aa8328fb | 2013-04-19 15:09:06 | [diff] [blame] | 18 | #include "chrome/browser/chromeos/login/startup_utils.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 19 | #include "chrome/browser/chromeos/login/user_manager.h" |
| 20 | #include "chrome/browser/chromeos/login/user_manager_impl.h" |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 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" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 25 | #include "chrome/browser/profiles/profile.h" |
| 26 | #include "chrome/browser/profiles/profile_manager.h" |
| 27 | #include "chrome/common/chrome_notification_types.h" |
| 28 | #include "chrome/common/chrome_switches.h" |
| 29 | #include "chrome/common/pref_names.h" |
| 30 | #include "chrome/test/base/testing_profile.h" |
[email protected] | 931d104 | 2013-04-05 17:50:44 | [diff] [blame] | 31 | #include "chromeos/chromeos_switches.h" |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 32 | #include "chromeos/login/login_state.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 33 | #include "content/public/test/test_utils.h" |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 34 | #include "policy/policy_constants.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 35 | #include "testing/gtest/include/gtest/gtest.h" |
| 36 | #include "ui/views/widget/widget.h" |
| 37 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 38 | using testing::AnyNumber; |
| 39 | using testing::Return; |
| 40 | using testing::_; |
| 41 | using testing::WithParamInterface; |
| 42 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 43 | namespace chromeos { |
| 44 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 45 | enum PrefSettingMechanism { |
| 46 | PREF_SERVICE, |
| 47 | POLICY, |
| 48 | }; |
| 49 | |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 50 | void SetMagnifierEnabled(bool enabled) { |
| 51 | MagnificationManager::Get()->SetMagnifierEnabled(enabled); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 52 | } |
| 53 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 54 | class TrayAccessibilityTest |
| 55 | : public CrosInProcessBrowserTest, |
| 56 | public WithParamInterface<PrefSettingMechanism> { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 57 | protected: |
| 58 | TrayAccessibilityTest() {} |
| 59 | virtual ~TrayAccessibilityTest() {} |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 60 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 61 | virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 62 | EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 63 | .WillRepeatedly(Return(true)); |
| 64 | EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber()); |
| 65 | policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
| 66 | } |
| 67 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 68 | virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 69 | command_line->AppendSwitch(switches::kLoginManager); |
| 70 | command_line->AppendSwitchASCII(switches::kLoginProfile, |
| 71 | TestingProfile::kTestUserProfileDir); |
| 72 | } |
| 73 | |
[email protected] | d80f1930 | 2013-06-07 13:12:14 | [diff] [blame^] | 74 | virtual void SetUpOnMainThread() OVERRIDE { |
| 75 | AccessibilityManager::Get()->SetProfileForTest( |
| 76 | ProfileManager::GetDefaultProfile()); |
| 77 | MagnificationManager::Get()->SetProfileForTest( |
| 78 | ProfileManager::GetDefaultProfile()); |
| 79 | } |
| 80 | |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 81 | virtual void RunTestOnMainThreadLoop() OVERRIDE { |
| 82 | // Need to mark oobe completed to show detailed views. |
[email protected] | aa8328fb | 2013-04-19 15:09:06 | [diff] [blame] | 83 | StartupUtils::MarkOobeCompleted(); |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 84 | CrosInProcessBrowserTest::RunTestOnMainThreadLoop(); |
| 85 | } |
| 86 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 87 | void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) { |
| 88 | if (GetParam() == PREF_SERVICE) { |
| 89 | Profile* profile = ProfileManager::GetDefaultProfile(); |
| 90 | PrefService* prefs = profile->GetPrefs(); |
| 91 | prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, value); |
| 92 | } else if (GetParam() == POLICY) { |
| 93 | policy::PolicyMap policy_map; |
| 94 | policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu, |
| 95 | policy::POLICY_LEVEL_MANDATORY, |
| 96 | policy::POLICY_SCOPE_USER, |
| 97 | base::Value::CreateBooleanValue(value)); |
| 98 | provider_.UpdateChromePolicy(policy_map); |
| 99 | base::RunLoop().RunUntilIdle(); |
| 100 | } else { |
| 101 | FAIL() << "Unknown test parameterization"; |
| 102 | } |
| 103 | } |
| 104 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 105 | ash::internal::TrayAccessibility* tray() { |
| 106 | return ash::Shell::GetInstance()->GetPrimarySystemTray()-> |
| 107 | GetTrayAccessibilityForTest(); |
| 108 | } |
| 109 | |
| 110 | bool IsTrayIconVisible() { |
| 111 | return tray()->tray_icon_visible_; |
| 112 | } |
| 113 | |
| 114 | views::View* CreateMenuItem() { |
| 115 | return tray()->CreateDefaultView(GetLoginStatus()); |
| 116 | } |
| 117 | |
| 118 | void DestroyMenuItem() { |
| 119 | return tray()->DestroyDefaultView(); |
| 120 | } |
| 121 | |
| 122 | bool CanCreateMenuItem() { |
| 123 | views::View* menu_item_view = CreateMenuItem(); |
| 124 | DestroyMenuItem(); |
| 125 | return menu_item_view != NULL; |
| 126 | } |
| 127 | |
| 128 | void SetLoginStatus(ash::user::LoginStatus status) { |
| 129 | tray()->UpdateAfterLoginStatusChange(status); |
| 130 | } |
| 131 | |
| 132 | ash::user::LoginStatus GetLoginStatus() { |
| 133 | return tray()->login_; |
| 134 | } |
| 135 | |
| 136 | bool CreateDetailedMenu() { |
| 137 | tray()->PopupDetailedView(0, false); |
| 138 | return tray()->detailed_menu_ != NULL; |
| 139 | } |
| 140 | |
| 141 | void CloseDetailMenu() { |
| 142 | CHECK(tray()->detailed_menu_); |
| 143 | tray()->DestroyDetailedView(); |
| 144 | tray()->detailed_menu_ = NULL; |
| 145 | } |
| 146 | |
| 147 | void ClickSpokenFeedbackOnDetailMenu() { |
| 148 | views::View* button = tray()->detailed_menu_->spoken_feedback_view_; |
[email protected] | acd0fd7a | 2013-03-04 22:00:53 | [diff] [blame] | 149 | tray()->detailed_menu_->OnViewClicked(button); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | void ClickHighContrastOnDetailMenu() { |
| 153 | views::View* button = tray()->detailed_menu_->high_contrast_view_; |
| 154 | EXPECT_TRUE(button); |
[email protected] | acd0fd7a | 2013-03-04 22:00:53 | [diff] [blame] | 155 | tray()->detailed_menu_->OnViewClicked(button); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | void ClickScreenMagnifierOnDetailMenu() { |
| 159 | views::View* button = tray()->detailed_menu_->screen_magnifier_view_; |
| 160 | EXPECT_TRUE(button); |
[email protected] | acd0fd7a | 2013-03-04 22:00:53 | [diff] [blame] | 161 | tray()->detailed_menu_->OnViewClicked(button); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | bool IsSpokenFeedbackEnabledOnDetailMenu() { |
| 165 | return tray()->detailed_menu_->spoken_feedback_enabled_; |
| 166 | } |
| 167 | |
| 168 | bool IsHighContrastEnabledOnDetailMenu() { |
| 169 | return tray()->detailed_menu_->high_contrast_enabled_; |
| 170 | } |
| 171 | |
| 172 | bool IsScreenMagnifierEnabledOnDetailMenu() { |
| 173 | return tray()->detailed_menu_->screen_magnifier_enabled_; |
| 174 | } |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 175 | |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 176 | bool IsLargeCursorEnabledOnDetailMenu() { |
| 177 | return tray()->detailed_menu_->large_cursor_enabled_; |
| 178 | } |
| 179 | |
| 180 | bool IsSpokenFeedbackMenuShownOnDetailMenu() { |
| 181 | return tray()->detailed_menu_->spoken_feedback_view_; |
| 182 | } |
| 183 | |
| 184 | bool IsHighContrastMenuShownOnDetailMenu() { |
| 185 | return tray()->detailed_menu_->high_contrast_view_; |
| 186 | } |
| 187 | |
| 188 | bool IsScreenMagnifierMenuShownOnDetailMenu() { |
| 189 | return tray()->detailed_menu_->screen_magnifier_view_; |
| 190 | } |
| 191 | |
| 192 | bool IsLargeCursorMenuShownOnDetailMenu() { |
| 193 | return tray()->detailed_menu_->large_cursor_view_; |
| 194 | } |
| 195 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 196 | policy::MockConfigurationPolicyProvider provider_; |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 197 | }; |
| 198 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 199 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 200 | EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus()); |
| 201 | |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 202 | UserManager::Get()->UserLoggedIn( |
| 203 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 204 | UserManager::Get()->SessionStarted(); |
| 205 | |
| 206 | EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus()); |
| 207 | } |
| 208 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 209 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 210 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 211 | |
| 212 | // Confirms that the icon is invisible before login. |
| 213 | EXPECT_FALSE(IsTrayIconVisible()); |
| 214 | |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 215 | UserManager::Get()->UserLoggedIn( |
| 216 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 217 | UserManager::Get()->SessionStarted(); |
| 218 | |
| 219 | // Confirms that the icon is invisible just after login. |
| 220 | EXPECT_FALSE(IsTrayIconVisible()); |
| 221 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 222 | // Toggling spoken feedback changes the visibillity of the icon. |
| 223 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 224 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 225 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 226 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 227 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 228 | EXPECT_FALSE(IsTrayIconVisible()); |
| 229 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 230 | // Toggling high contrast the visibillity of the icon. |
| 231 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 232 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 233 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 234 | EXPECT_FALSE(IsTrayIconVisible()); |
| 235 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 236 | // Toggling magnifier the visibility of the icon. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 237 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 238 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 239 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 240 | EXPECT_FALSE(IsTrayIconVisible()); |
| 241 | |
| 242 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 243 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 244 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 245 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 246 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 247 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 248 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 249 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 250 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 251 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 252 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 253 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 254 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 255 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 256 | EXPECT_FALSE(IsTrayIconVisible()); |
| 257 | |
| 258 | // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect |
| 259 | // the icon on the tray. |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 260 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 261 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 262 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 263 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 264 | EXPECT_FALSE(IsTrayIconVisible()); |
| 265 | } |
| 266 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 267 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 268 | // Login |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 269 | UserManager::Get()->UserLoggedIn( |
| 270 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 271 | UserManager::Get()->SessionStarted(); |
| 272 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 273 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 274 | |
| 275 | // Confirms that the menu is hidden. |
| 276 | EXPECT_FALSE(CanCreateMenuItem()); |
| 277 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 278 | // Toggling spoken feedback changes the visibillity of the menu. |
| 279 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 280 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 281 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 282 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 283 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 284 | EXPECT_FALSE(CanCreateMenuItem()); |
| 285 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 286 | // Toggling high contrast changes the visibillity of the menu. |
| 287 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 288 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 289 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 290 | EXPECT_FALSE(CanCreateMenuItem()); |
| 291 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 292 | // Toggling screen magnifier changes the visibility of the menu. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 293 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 294 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 295 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 296 | EXPECT_FALSE(CanCreateMenuItem()); |
| 297 | |
| 298 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 299 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 300 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 301 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 302 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 303 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 304 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 305 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 306 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 307 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 308 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 309 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 310 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 311 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 312 | EXPECT_FALSE(CanCreateMenuItem()); |
| 313 | } |
| 314 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 315 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 316 | // Login |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 317 | UserManager::Get()->UserLoggedIn( |
| 318 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 319 | UserManager::Get()->SessionStarted(); |
| 320 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 321 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 322 | |
| 323 | // Confirms that the menu is visible. |
| 324 | EXPECT_TRUE(CanCreateMenuItem()); |
| 325 | |
| 326 | // The menu is keeping visible regardless of toggling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 327 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 328 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 329 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 330 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 331 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 332 | EXPECT_TRUE(CanCreateMenuItem()); |
| 333 | |
| 334 | // The menu is keeping visible regardless of toggling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 335 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 336 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 337 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 338 | EXPECT_TRUE(CanCreateMenuItem()); |
| 339 | |
| 340 | // The menu is keeping visible regardless of toggling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 341 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 342 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 343 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 344 | EXPECT_TRUE(CanCreateMenuItem()); |
| 345 | |
| 346 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 347 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 348 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 349 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 350 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 351 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 352 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 353 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 354 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 355 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 356 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 357 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 358 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 359 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 360 | EXPECT_TRUE(CanCreateMenuItem()); |
| 361 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 362 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 363 | |
| 364 | // Confirms that the menu is invisible. |
| 365 | EXPECT_FALSE(CanCreateMenuItem()); |
| 366 | } |
| 367 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 368 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 369 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 370 | |
| 371 | // Confirms that the menu is visible. |
| 372 | EXPECT_TRUE(CanCreateMenuItem()); |
| 373 | |
| 374 | // The menu is keeping visible regardless of toggling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 375 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 376 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 377 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 378 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 379 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 380 | EXPECT_TRUE(CanCreateMenuItem()); |
| 381 | |
| 382 | // The menu is keeping visible regardless of toggling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 383 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 384 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 385 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 386 | EXPECT_TRUE(CanCreateMenuItem()); |
| 387 | |
| 388 | // The menu is keeping visible regardless of toggling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 389 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 390 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 391 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 392 | EXPECT_TRUE(CanCreateMenuItem()); |
| 393 | |
| 394 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 395 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 396 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 397 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 398 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 399 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 400 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 401 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 402 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 403 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 404 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 405 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 406 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 407 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 408 | EXPECT_TRUE(CanCreateMenuItem()); |
| 409 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 410 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 411 | |
| 412 | // Confirms that the menu is keeping visible. |
| 413 | EXPECT_TRUE(CanCreateMenuItem()); |
| 414 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 415 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 416 | |
| 417 | // Confirms that the menu is keeping visible. |
| 418 | EXPECT_TRUE(CanCreateMenuItem()); |
| 419 | } |
| 420 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 421 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 422 | // Enables high contrast mode. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 423 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 424 | EXPECT_TRUE(CanCreateMenuItem()); |
| 425 | |
| 426 | // Locks the screen. |
| 427 | SetLoginStatus(ash::user::LOGGED_IN_LOCKED); |
| 428 | EXPECT_TRUE(CanCreateMenuItem()); |
| 429 | |
| 430 | // Disables high contrast mode. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 431 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 432 | |
| 433 | // Confirms that the menu is still visible. |
| 434 | EXPECT_TRUE(CanCreateMenuItem()); |
| 435 | } |
| 436 | |
[email protected] | 8bacb66 | 2013-02-27 03:15:24 | [diff] [blame] | 437 | #if defined(OS_CHROMEOS) |
| 438 | #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu |
| 439 | #else |
| 440 | #define MAYBE_ClickDetailMenu ClickDetailMenu |
| 441 | #endif |
| 442 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 443 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 444 | // Confirms that the check item toggles the spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 445 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 446 | |
| 447 | EXPECT_TRUE(CreateDetailedMenu()); |
| 448 | ClickSpokenFeedbackOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 449 | EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 450 | |
| 451 | EXPECT_TRUE(CreateDetailedMenu()); |
| 452 | ClickSpokenFeedbackOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 453 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 454 | |
| 455 | // Confirms that the check item toggles the high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 456 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 457 | |
| 458 | EXPECT_TRUE(CreateDetailedMenu()); |
| 459 | ClickHighContrastOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 460 | EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 461 | |
| 462 | EXPECT_TRUE(CreateDetailedMenu()); |
| 463 | ClickHighContrastOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 464 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 465 | |
| 466 | // Confirms that the check item toggles the magnifier. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 467 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 468 | |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 469 | EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 470 | EXPECT_TRUE(CreateDetailedMenu()); |
| 471 | ClickScreenMagnifierOnDetailMenu(); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 472 | EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 473 | |
| 474 | EXPECT_TRUE(CreateDetailedMenu()); |
| 475 | ClickScreenMagnifierOnDetailMenu(); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 476 | EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 477 | } |
| 478 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 479 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 480 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 481 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 482 | // At first, all of the check is unchecked. |
| 483 | EXPECT_TRUE(CreateDetailedMenu()); |
| 484 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 485 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 486 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 487 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 488 | CloseDetailMenu(); |
| 489 | |
| 490 | // Enabling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 491 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 492 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 493 | EXPECT_TRUE(CreateDetailedMenu()); |
| 494 | EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 495 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 496 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 497 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 498 | CloseDetailMenu(); |
| 499 | |
| 500 | // Disabling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 501 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 502 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 503 | EXPECT_TRUE(CreateDetailedMenu()); |
| 504 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 505 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 506 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 507 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 508 | CloseDetailMenu(); |
| 509 | |
| 510 | // Enabling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 511 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 512 | EXPECT_TRUE(CreateDetailedMenu()); |
| 513 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 514 | EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 515 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 516 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 517 | CloseDetailMenu(); |
| 518 | |
| 519 | // Disabling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 520 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 521 | EXPECT_TRUE(CreateDetailedMenu()); |
| 522 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 523 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 524 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 525 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 526 | CloseDetailMenu(); |
| 527 | |
| 528 | // Enabling full screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 529 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 530 | EXPECT_TRUE(CreateDetailedMenu()); |
| 531 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 532 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 533 | EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 534 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 535 | CloseDetailMenu(); |
| 536 | |
| 537 | // Disabling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 538 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 539 | EXPECT_TRUE(CreateDetailedMenu()); |
| 540 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 541 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 542 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 543 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 544 | CloseDetailMenu(); |
| 545 | |
| 546 | // Enabling large cursor. |
| 547 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 548 | EXPECT_TRUE(CreateDetailedMenu()); |
| 549 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 550 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 551 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 552 | EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu()); |
| 553 | CloseDetailMenu(); |
| 554 | |
| 555 | // Disabling large cursor. |
| 556 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 557 | EXPECT_TRUE(CreateDetailedMenu()); |
| 558 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 559 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 560 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 561 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 562 | CloseDetailMenu(); |
| 563 | |
| 564 | // Enabling all of the a11y features. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 565 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 566 | true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 567 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 568 | SetMagnifierEnabled(true); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 569 | AccessibilityManager::Get()->EnableLargeCursor(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 570 | EXPECT_TRUE(CreateDetailedMenu()); |
| 571 | EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 572 | EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 573 | EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 574 | EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 575 | CloseDetailMenu(); |
| 576 | |
| 577 | // Disabling all of the a11y features. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 578 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 579 | false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 580 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 581 | SetMagnifierEnabled(false); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 582 | AccessibilityManager::Get()->EnableLargeCursor(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 583 | EXPECT_TRUE(CreateDetailedMenu()); |
| 584 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 585 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 586 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 587 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 588 | CloseDetailMenu(); |
| 589 | } |
| 590 | |
| 591 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMenuVisibilityOnDetailMenu) { |
| 592 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 593 | EXPECT_TRUE(CreateDetailedMenu()); |
| 594 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 595 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 596 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
| 597 | EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu()); |
| 598 | CloseDetailMenu(); |
| 599 | |
| 600 | SetLoginStatus(ash::user::LOGGED_IN_USER); |
| 601 | EXPECT_TRUE(CreateDetailedMenu()); |
| 602 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 603 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 604 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
| 605 | EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu()); |
| 606 | CloseDetailMenu(); |
| 607 | |
| 608 | SetLoginStatus(ash::user::LOGGED_IN_LOCKED); |
| 609 | EXPECT_TRUE(CreateDetailedMenu()); |
| 610 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 611 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 612 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
| 613 | EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 614 | CloseDetailMenu(); |
| 615 | } |
| 616 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 617 | INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, |
| 618 | TrayAccessibilityTest, |
| 619 | testing::Values(PREF_SERVICE, |
| 620 | POLICY)); |
| 621 | |
[email protected] | cce1bad6 | 2013-01-04 02:26:38 | [diff] [blame] | 622 | } // namespace chromeos |