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