[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" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 17 | #include "chrome/browser/chromeos/login/helper.h" |
| 18 | #include "chrome/browser/chromeos/login/login_utils.h" |
[email protected] | aa8328fb | 2013-04-19 15:09:06 | [diff] [blame] | 19 | #include "chrome/browser/chromeos/login/startup_utils.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 20 | #include "chrome/browser/chromeos/login/user_manager.h" |
| 21 | #include "chrome/browser/chromeos/login/user_manager_impl.h" |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 22 | #include "chrome/browser/policy/browser_policy_connector.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 23 | #include "chrome/browser/profiles/profile.h" |
| 24 | #include "chrome/browser/profiles/profile_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 25 | #include "chrome/common/chrome_switches.h" |
| 26 | #include "chrome/common/pref_names.h" |
[email protected] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 27 | #include "chrome/test/base/in_process_browser_test.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 28 | #include "chrome/test/base/testing_profile.h" |
[email protected] | 931d104 | 2013-04-05 17:50:44 | [diff] [blame] | 29 | #include "chromeos/chromeos_switches.h" |
[email protected] | c4a138a | 2013-11-21 19:54:57 | [diff] [blame] | 30 | #include "components/policy/core/common/external_data_fetcher.h" |
[email protected] | f20a3a2 | 2013-12-03 16:12:37 | [diff] [blame] | 31 | #include "components/policy/core/common/mock_configuration_policy_provider.h" |
[email protected] | c4a138a | 2013-11-21 19:54:57 | [diff] [blame] | 32 | #include "components/policy/core/common/policy_map.h" |
| 33 | #include "components/policy/core/common/policy_types.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 34 | #include "content/public/test/test_utils.h" |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 35 | #include "policy/policy_constants.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 36 | #include "testing/gtest/include/gtest/gtest.h" |
| 37 | #include "ui/views/widget/widget.h" |
| 38 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 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 |
[email protected] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 55 | : public InProcessBrowserTest, |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 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] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame^] | 61 | // The profile which should be used by tese tests. |
| 62 | Profile* GetProfile() { return ProfileManager::GetActiveUserProfile(); } |
| 63 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 64 | virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 65 | EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 66 | .WillRepeatedly(Return(true)); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 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 { |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame^] | 77 | AccessibilityManager::Get()->SetProfileForTest(GetProfile()); |
| 78 | MagnificationManager::Get()->SetProfileForTest(GetProfile()); |
[email protected] | d80f1930 | 2013-06-07 13:12:14 | [diff] [blame] | 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] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 84 | InProcessBrowserTest::RunTestOnMainThreadLoop(); |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 85 | } |
| 86 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 87 | void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) { |
| 88 | if (GetParam() == PREF_SERVICE) { |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame^] | 89 | PrefService* prefs = GetProfile()->GetPrefs(); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 90 | prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, value); |
| 91 | } else if (GetParam() == POLICY) { |
| 92 | policy::PolicyMap policy_map; |
| 93 | policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu, |
| 94 | policy::POLICY_LEVEL_MANDATORY, |
| 95 | policy::POLICY_SCOPE_USER, |
[email protected] | aecb608 | 2013-07-09 14:29:41 | [diff] [blame] | 96 | base::Value::CreateBooleanValue(value), |
| 97 | NULL); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 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 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 164 | void ClickAutoclickOnDetailMenu() { |
| 165 | views::View* button = tray()->detailed_menu_->autoclick_view_; |
| 166 | EXPECT_TRUE(button); |
| 167 | tray()->detailed_menu_->OnViewClicked(button); |
| 168 | } |
| 169 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 170 | bool IsSpokenFeedbackEnabledOnDetailMenu() { |
| 171 | return tray()->detailed_menu_->spoken_feedback_enabled_; |
| 172 | } |
| 173 | |
| 174 | bool IsHighContrastEnabledOnDetailMenu() { |
| 175 | return tray()->detailed_menu_->high_contrast_enabled_; |
| 176 | } |
| 177 | |
| 178 | bool IsScreenMagnifierEnabledOnDetailMenu() { |
| 179 | return tray()->detailed_menu_->screen_magnifier_enabled_; |
| 180 | } |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 181 | |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 182 | bool IsLargeCursorEnabledOnDetailMenu() { |
| 183 | return tray()->detailed_menu_->large_cursor_enabled_; |
| 184 | } |
| 185 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 186 | bool IsAutoclickEnabledOnDetailMenu() { |
| 187 | return tray()->detailed_menu_->autoclick_enabled_; |
| 188 | } |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 189 | bool IsSpokenFeedbackMenuShownOnDetailMenu() { |
| 190 | return tray()->detailed_menu_->spoken_feedback_view_; |
| 191 | } |
| 192 | |
| 193 | bool IsHighContrastMenuShownOnDetailMenu() { |
| 194 | return tray()->detailed_menu_->high_contrast_view_; |
| 195 | } |
| 196 | |
| 197 | bool IsScreenMagnifierMenuShownOnDetailMenu() { |
| 198 | return tray()->detailed_menu_->screen_magnifier_view_; |
| 199 | } |
| 200 | |
| 201 | bool IsLargeCursorMenuShownOnDetailMenu() { |
| 202 | return tray()->detailed_menu_->large_cursor_view_; |
| 203 | } |
| 204 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 205 | bool IsAutoclickMenuShownOnDetailMenu() { |
| 206 | return tray()->detailed_menu_->autoclick_view_; |
| 207 | } |
| 208 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 209 | policy::MockConfigurationPolicyProvider provider_; |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 210 | }; |
| 211 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 212 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 213 | EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus()); |
| 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 | EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus()); |
| 220 | } |
| 221 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 222 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 223 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 224 | |
| 225 | // Confirms that the icon is invisible before login. |
| 226 | EXPECT_FALSE(IsTrayIconVisible()); |
| 227 | |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 228 | UserManager::Get()->UserLoggedIn( |
| 229 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 230 | UserManager::Get()->SessionStarted(); |
| 231 | |
| 232 | // Confirms that the icon is invisible just after login. |
| 233 | EXPECT_FALSE(IsTrayIconVisible()); |
| 234 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 235 | // Toggling spoken feedback changes the visibillity of the icon. |
| 236 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 237 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 238 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 239 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 240 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 241 | EXPECT_FALSE(IsTrayIconVisible()); |
| 242 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 243 | // Toggling high contrast the visibillity of the icon. |
| 244 | AccessibilityManager::Get()->EnableHighContrast(true); |
[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_FALSE(IsTrayIconVisible()); |
| 248 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 249 | // Toggling magnifier the visibility of the icon. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 250 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 251 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 252 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 253 | EXPECT_FALSE(IsTrayIconVisible()); |
| 254 | |
| 255 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 256 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 257 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 258 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 259 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 260 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 261 | true, ash::A11Y_NOTIFICATION_NONE); |
[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()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 264 | false, ash::A11Y_NOTIFICATION_NONE); |
[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_TRUE(IsTrayIconVisible()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 268 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 269 | EXPECT_FALSE(IsTrayIconVisible()); |
| 270 | |
| 271 | // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect |
| 272 | // the icon on the tray. |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 273 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 274 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 275 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 276 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 277 | EXPECT_FALSE(IsTrayIconVisible()); |
| 278 | } |
| 279 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 280 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 281 | // Login |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 282 | UserManager::Get()->UserLoggedIn( |
| 283 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 284 | UserManager::Get()->SessionStarted(); |
| 285 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 286 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 287 | |
| 288 | // Confirms that the menu is hidden. |
| 289 | EXPECT_FALSE(CanCreateMenuItem()); |
| 290 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 291 | // Toggling spoken feedback changes the visibillity of the menu. |
| 292 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 293 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 294 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 295 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 296 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 297 | EXPECT_FALSE(CanCreateMenuItem()); |
| 298 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 299 | // Toggling high contrast changes the visibillity of the menu. |
| 300 | AccessibilityManager::Get()->EnableHighContrast(true); |
[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_FALSE(CanCreateMenuItem()); |
| 304 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 305 | // Toggling screen magnifier changes the visibility of the menu. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 306 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 307 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 308 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 309 | EXPECT_FALSE(CanCreateMenuItem()); |
| 310 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 311 | // Toggling autoclick changes the visibility of the menu. |
| 312 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 313 | EXPECT_TRUE(CanCreateMenuItem()); |
| 314 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 315 | EXPECT_FALSE(CanCreateMenuItem()); |
| 316 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 317 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 318 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 319 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 320 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 321 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 322 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 323 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 324 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 325 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 326 | EXPECT_TRUE(CanCreateMenuItem()); |
| 327 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 328 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 329 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 330 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 331 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 332 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 333 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 334 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 335 | EXPECT_FALSE(CanCreateMenuItem()); |
| 336 | } |
| 337 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 338 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 339 | // Login |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 340 | UserManager::Get()->UserLoggedIn( |
| 341 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 342 | UserManager::Get()->SessionStarted(); |
| 343 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 344 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 345 | |
| 346 | // Confirms that the menu is visible. |
| 347 | EXPECT_TRUE(CanCreateMenuItem()); |
| 348 | |
| 349 | // The menu is keeping visible regardless of toggling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 350 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 351 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 352 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 353 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 354 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 355 | EXPECT_TRUE(CanCreateMenuItem()); |
| 356 | |
| 357 | // The menu is keeping visible regardless of toggling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 358 | AccessibilityManager::Get()->EnableHighContrast(true); |
[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()); |
| 362 | |
| 363 | // The menu is keeping visible regardless of toggling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 364 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 365 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 366 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 367 | EXPECT_TRUE(CanCreateMenuItem()); |
| 368 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 369 | // The menu is keeping visible regardless of toggling autoclick. |
| 370 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 371 | EXPECT_TRUE(CanCreateMenuItem()); |
| 372 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 373 | EXPECT_TRUE(CanCreateMenuItem()); |
| 374 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 375 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 376 | SetMagnifierEnabled(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(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 379 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 380 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 381 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 382 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 383 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 384 | EXPECT_TRUE(CanCreateMenuItem()); |
| 385 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 386 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 387 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 388 | false, ash::A11Y_NOTIFICATION_NONE); |
[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(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 391 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 392 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 393 | EXPECT_TRUE(CanCreateMenuItem()); |
| 394 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 395 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 396 | |
| 397 | // Confirms that the menu is invisible. |
| 398 | EXPECT_FALSE(CanCreateMenuItem()); |
| 399 | } |
| 400 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 401 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 402 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 403 | |
| 404 | // Confirms that the menu is visible. |
| 405 | EXPECT_TRUE(CanCreateMenuItem()); |
| 406 | |
| 407 | // The menu is keeping visible regardless of toggling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 408 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 409 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 410 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 411 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 412 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 413 | EXPECT_TRUE(CanCreateMenuItem()); |
| 414 | |
| 415 | // The menu is keeping visible regardless of toggling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 416 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 417 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 418 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 419 | EXPECT_TRUE(CanCreateMenuItem()); |
| 420 | |
| 421 | // The menu is keeping visible regardless of toggling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 422 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 423 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 424 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 425 | EXPECT_TRUE(CanCreateMenuItem()); |
| 426 | |
| 427 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 428 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 429 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 430 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 431 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 432 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 433 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 434 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 435 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 436 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 437 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 438 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 439 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 440 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 441 | EXPECT_TRUE(CanCreateMenuItem()); |
| 442 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 443 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 444 | |
| 445 | // Confirms that the menu is keeping visible. |
| 446 | EXPECT_TRUE(CanCreateMenuItem()); |
| 447 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 448 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 449 | |
| 450 | // Confirms that the menu is keeping visible. |
| 451 | EXPECT_TRUE(CanCreateMenuItem()); |
| 452 | } |
| 453 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 454 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 455 | // Enables high contrast mode. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 456 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 457 | EXPECT_TRUE(CanCreateMenuItem()); |
| 458 | |
| 459 | // Locks the screen. |
| 460 | SetLoginStatus(ash::user::LOGGED_IN_LOCKED); |
| 461 | EXPECT_TRUE(CanCreateMenuItem()); |
| 462 | |
| 463 | // Disables high contrast mode. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 464 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 465 | |
| 466 | // Confirms that the menu is still visible. |
| 467 | EXPECT_TRUE(CanCreateMenuItem()); |
| 468 | } |
| 469 | |
[email protected] | 8bacb66 | 2013-02-27 03:15:24 | [diff] [blame] | 470 | #if defined(OS_CHROMEOS) |
| 471 | #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu |
| 472 | #else |
| 473 | #define MAYBE_ClickDetailMenu ClickDetailMenu |
| 474 | #endif |
| 475 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 476 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 477 | // Confirms that the check item toggles the spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 478 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 479 | |
| 480 | EXPECT_TRUE(CreateDetailedMenu()); |
| 481 | ClickSpokenFeedbackOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 482 | EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 483 | |
| 484 | EXPECT_TRUE(CreateDetailedMenu()); |
| 485 | ClickSpokenFeedbackOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 486 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 487 | |
| 488 | // Confirms that the check item toggles the high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 489 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 490 | |
| 491 | EXPECT_TRUE(CreateDetailedMenu()); |
| 492 | ClickHighContrastOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 493 | EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 494 | |
| 495 | EXPECT_TRUE(CreateDetailedMenu()); |
| 496 | ClickHighContrastOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 497 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 498 | |
| 499 | // Confirms that the check item toggles the magnifier. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 500 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 501 | |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 502 | EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 503 | EXPECT_TRUE(CreateDetailedMenu()); |
| 504 | ClickScreenMagnifierOnDetailMenu(); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 505 | EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 506 | |
| 507 | EXPECT_TRUE(CreateDetailedMenu()); |
| 508 | ClickScreenMagnifierOnDetailMenu(); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 509 | EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 510 | |
| 511 | // Confirms that the check item toggles autoclick. |
| 512 | EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled()); |
| 513 | |
| 514 | EXPECT_TRUE(CreateDetailedMenu()); |
| 515 | ClickAutoclickOnDetailMenu(); |
| 516 | EXPECT_TRUE(AccessibilityManager::Get()->IsAutoclickEnabled()); |
| 517 | |
| 518 | EXPECT_TRUE(CreateDetailedMenu()); |
| 519 | ClickAutoclickOnDetailMenu(); |
| 520 | EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 521 | } |
| 522 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 523 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 524 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 525 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 526 | // At first, all of the check is unchecked. |
| 527 | EXPECT_TRUE(CreateDetailedMenu()); |
| 528 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 529 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 530 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 531 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 532 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 533 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 534 | CloseDetailMenu(); |
| 535 | |
| 536 | // Enabling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 537 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 538 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 539 | EXPECT_TRUE(CreateDetailedMenu()); |
| 540 | EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 541 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 542 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 543 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 544 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 545 | CloseDetailMenu(); |
| 546 | |
| 547 | // Disabling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 548 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 549 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 550 | EXPECT_TRUE(CreateDetailedMenu()); |
| 551 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 552 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 553 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 554 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 555 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 556 | CloseDetailMenu(); |
| 557 | |
| 558 | // Enabling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 559 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 560 | EXPECT_TRUE(CreateDetailedMenu()); |
| 561 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 562 | EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 563 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 564 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 565 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 566 | CloseDetailMenu(); |
| 567 | |
| 568 | // Disabling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 569 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 570 | EXPECT_TRUE(CreateDetailedMenu()); |
| 571 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 572 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 573 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 574 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 575 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 576 | CloseDetailMenu(); |
| 577 | |
| 578 | // Enabling full screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 579 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 580 | EXPECT_TRUE(CreateDetailedMenu()); |
| 581 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 582 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 583 | EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 584 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 585 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 586 | CloseDetailMenu(); |
| 587 | |
| 588 | // Disabling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 589 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 590 | EXPECT_TRUE(CreateDetailedMenu()); |
| 591 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 592 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 593 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 594 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 595 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 596 | CloseDetailMenu(); |
| 597 | |
| 598 | // Enabling large cursor. |
| 599 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 600 | EXPECT_TRUE(CreateDetailedMenu()); |
| 601 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 602 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 603 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 604 | EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 605 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 606 | CloseDetailMenu(); |
| 607 | |
| 608 | // Disabling large cursor. |
| 609 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 610 | EXPECT_TRUE(CreateDetailedMenu()); |
| 611 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 612 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 613 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 614 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 615 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 616 | CloseDetailMenu(); |
| 617 | |
| 618 | // Enabling all of the a11y features. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 619 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 620 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 621 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 622 | SetMagnifierEnabled(true); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 623 | AccessibilityManager::Get()->EnableLargeCursor(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 624 | EXPECT_TRUE(CreateDetailedMenu()); |
| 625 | EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 626 | EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 627 | EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 628 | EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 629 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 630 | CloseDetailMenu(); |
| 631 | |
| 632 | // Disabling all of the a11y features. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 633 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 634 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 635 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 636 | SetMagnifierEnabled(false); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 637 | AccessibilityManager::Get()->EnableLargeCursor(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 638 | EXPECT_TRUE(CreateDetailedMenu()); |
| 639 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 640 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 641 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 642 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 643 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 644 | CloseDetailMenu(); |
| 645 | |
| 646 | // Autoclick is disabled on login screen. |
| 647 | SetLoginStatus(ash::user::LOGGED_IN_USER); |
| 648 | |
| 649 | // Enabling autoclick. |
| 650 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 651 | EXPECT_TRUE(CreateDetailedMenu()); |
| 652 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 653 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 654 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 655 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 656 | EXPECT_TRUE(IsAutoclickEnabledOnDetailMenu()); |
| 657 | CloseDetailMenu(); |
| 658 | |
| 659 | // Disabling autoclick. |
| 660 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 661 | EXPECT_TRUE(CreateDetailedMenu()); |
| 662 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 663 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 664 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 665 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 666 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 667 | CloseDetailMenu(); |
| 668 | } |
| 669 | |
| 670 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMenuVisibilityOnDetailMenu) { |
| 671 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 672 | EXPECT_TRUE(CreateDetailedMenu()); |
| 673 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 674 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 675 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
| 676 | EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 677 | EXPECT_FALSE(IsAutoclickMenuShownOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 678 | CloseDetailMenu(); |
| 679 | |
| 680 | SetLoginStatus(ash::user::LOGGED_IN_USER); |
| 681 | EXPECT_TRUE(CreateDetailedMenu()); |
| 682 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 683 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 684 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
| 685 | EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 686 | EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 687 | CloseDetailMenu(); |
| 688 | |
| 689 | SetLoginStatus(ash::user::LOGGED_IN_LOCKED); |
| 690 | EXPECT_TRUE(CreateDetailedMenu()); |
| 691 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 692 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 693 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
| 694 | EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 695 | EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 696 | CloseDetailMenu(); |
| 697 | } |
| 698 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 699 | INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, |
| 700 | TrayAccessibilityTest, |
| 701 | testing::Values(PREF_SERVICE, |
| 702 | POLICY)); |
| 703 | |
[email protected] | cce1bad6 | 2013-01-04 02:26:38 | [diff] [blame] | 704 | } // namespace chromeos |