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