[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] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 13 | #include "base/strings/utf_string_conversions.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 14 | #include "chrome/browser/browser_process.h" |
[email protected] | fdf40f3e | 2013-07-11 23:55:46 | [diff] [blame] | 15 | #include "chrome/browser/chrome_notification_types.h" |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 16 | #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 17 | #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 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] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 23 | #include "chrome/browser/extensions/api/braille_display_private/mock_braille_controller.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 24 | #include "chrome/browser/profiles/profile.h" |
| 25 | #include "chrome/browser/profiles/profile_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 26 | #include "chrome/common/chrome_switches.h" |
| 27 | #include "chrome/common/pref_names.h" |
[email protected] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 28 | #include "chrome/test/base/in_process_browser_test.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 29 | #include "chrome/test/base/testing_profile.h" |
[email protected] | 931d104 | 2013-04-05 17:50:44 | [diff] [blame] | 30 | #include "chromeos/chromeos_switches.h" |
[email protected] | 9727582 | 2014-01-21 19:30:36 | [diff] [blame] | 31 | #include "components/policy/core/browser/browser_policy_connector.h" |
[email protected] | c4a138a | 2013-11-21 19:54:57 | [diff] [blame] | 32 | #include "components/policy/core/common/external_data_fetcher.h" |
[email protected] | f20a3a2 | 2013-12-03 16:12:37 | [diff] [blame] | 33 | #include "components/policy/core/common/mock_configuration_policy_provider.h" |
[email protected] | c4a138a | 2013-11-21 19:54:57 | [diff] [blame] | 34 | #include "components/policy/core/common/policy_map.h" |
| 35 | #include "components/policy/core/common/policy_types.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 36 | #include "content/public/test/test_utils.h" |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 37 | #include "policy/policy_constants.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 38 | #include "testing/gtest/include/gtest/gtest.h" |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 39 | #include "ui/views/controls/label.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 40 | #include "ui/views/widget/widget.h" |
| 41 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 42 | using extensions::api::braille_display_private::BrailleObserver; |
| 43 | using extensions::api::braille_display_private::DisplayState; |
| 44 | using extensions::api::braille_display_private::MockBrailleController; |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 45 | using testing::Return; |
| 46 | using testing::_; |
| 47 | using testing::WithParamInterface; |
| 48 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 49 | namespace chromeos { |
| 50 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 51 | enum PrefSettingMechanism { |
| 52 | PREF_SERVICE, |
| 53 | POLICY, |
| 54 | }; |
| 55 | |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 56 | void SetMagnifierEnabled(bool enabled) { |
| 57 | MagnificationManager::Get()->SetMagnifierEnabled(enabled); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 58 | } |
| 59 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 60 | class TrayAccessibilityTest |
[email protected] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 61 | : public InProcessBrowserTest, |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 62 | public WithParamInterface<PrefSettingMechanism> { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 63 | protected: |
| 64 | TrayAccessibilityTest() {} |
| 65 | virtual ~TrayAccessibilityTest() {} |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 66 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 67 | // The profile which should be used by these tests. |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame] | 68 | Profile* GetProfile() { return ProfileManager::GetActiveUserProfile(); } |
| 69 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 70 | virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 71 | EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 72 | .WillRepeatedly(Return(true)); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 73 | policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 74 | AccessibilityManager::SetBrailleControllerForTest(&braille_controller_); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 75 | } |
| 76 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 77 | virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 78 | command_line->AppendSwitch(switches::kLoginManager); |
| 79 | command_line->AppendSwitchASCII(switches::kLoginProfile, |
| 80 | TestingProfile::kTestUserProfileDir); |
| 81 | } |
| 82 | |
[email protected] | d80f1930 | 2013-06-07 13:12:14 | [diff] [blame] | 83 | virtual void SetUpOnMainThread() OVERRIDE { |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame] | 84 | AccessibilityManager::Get()->SetProfileForTest(GetProfile()); |
| 85 | MagnificationManager::Get()->SetProfileForTest(GetProfile()); |
[email protected] | d80f1930 | 2013-06-07 13:12:14 | [diff] [blame] | 86 | } |
| 87 | |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 88 | virtual void RunTestOnMainThreadLoop() OVERRIDE { |
| 89 | // Need to mark oobe completed to show detailed views. |
[email protected] | aa8328fb | 2013-04-19 15:09:06 | [diff] [blame] | 90 | StartupUtils::MarkOobeCompleted(); |
[email protected] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 91 | InProcessBrowserTest::RunTestOnMainThreadLoop(); |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 92 | } |
| 93 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 94 | virtual void CleanUpOnMainThread() OVERRIDE { |
| 95 | AccessibilityManager::SetBrailleControllerForTest(NULL); |
| 96 | } |
| 97 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 98 | void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) { |
| 99 | if (GetParam() == PREF_SERVICE) { |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame] | 100 | PrefService* prefs = GetProfile()->GetPrefs(); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 101 | prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, value); |
| 102 | } else if (GetParam() == POLICY) { |
| 103 | policy::PolicyMap policy_map; |
| 104 | policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu, |
| 105 | policy::POLICY_LEVEL_MANDATORY, |
| 106 | policy::POLICY_SCOPE_USER, |
[email protected] | aecb608 | 2013-07-09 14:29:41 | [diff] [blame] | 107 | base::Value::CreateBooleanValue(value), |
| 108 | NULL); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 109 | provider_.UpdateChromePolicy(policy_map); |
| 110 | base::RunLoop().RunUntilIdle(); |
| 111 | } else { |
| 112 | FAIL() << "Unknown test parameterization"; |
| 113 | } |
| 114 | } |
| 115 | |
[email protected] | 093b8d64 | 2014-04-03 20:59:28 | [diff] [blame] | 116 | ash::TrayAccessibility* tray() { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 117 | return ash::Shell::GetInstance()->GetPrimarySystemTray()-> |
| 118 | GetTrayAccessibilityForTest(); |
| 119 | } |
| 120 | |
[email protected] | 093b8d64 | 2014-04-03 20:59:28 | [diff] [blame] | 121 | const ash::TrayAccessibility* tray() const { |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 122 | return ash::Shell::GetInstance() |
| 123 | ->GetPrimarySystemTray() |
| 124 | ->GetTrayAccessibilityForTest(); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 125 | } |
| 126 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 127 | bool IsTrayIconVisible() const { return tray()->tray_icon_visible_; } |
| 128 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 129 | views::View* CreateMenuItem() { |
| 130 | return tray()->CreateDefaultView(GetLoginStatus()); |
| 131 | } |
| 132 | |
| 133 | void DestroyMenuItem() { |
| 134 | return tray()->DestroyDefaultView(); |
| 135 | } |
| 136 | |
| 137 | bool CanCreateMenuItem() { |
| 138 | views::View* menu_item_view = CreateMenuItem(); |
| 139 | DestroyMenuItem(); |
| 140 | return menu_item_view != NULL; |
| 141 | } |
| 142 | |
| 143 | void SetLoginStatus(ash::user::LoginStatus status) { |
| 144 | tray()->UpdateAfterLoginStatusChange(status); |
| 145 | } |
| 146 | |
| 147 | ash::user::LoginStatus GetLoginStatus() { |
| 148 | return tray()->login_; |
| 149 | } |
| 150 | |
| 151 | bool CreateDetailedMenu() { |
| 152 | tray()->PopupDetailedView(0, false); |
| 153 | return tray()->detailed_menu_ != NULL; |
| 154 | } |
| 155 | |
| 156 | void CloseDetailMenu() { |
| 157 | CHECK(tray()->detailed_menu_); |
| 158 | tray()->DestroyDetailedView(); |
| 159 | tray()->detailed_menu_ = NULL; |
| 160 | } |
| 161 | |
| 162 | void ClickSpokenFeedbackOnDetailMenu() { |
| 163 | views::View* button = tray()->detailed_menu_->spoken_feedback_view_; |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 164 | ASSERT_TRUE(button); |
[email protected] | acd0fd7a | 2013-03-04 22:00:53 | [diff] [blame] | 165 | tray()->detailed_menu_->OnViewClicked(button); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | void ClickHighContrastOnDetailMenu() { |
| 169 | views::View* button = tray()->detailed_menu_->high_contrast_view_; |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 170 | ASSERT_TRUE(button); |
[email protected] | acd0fd7a | 2013-03-04 22:00:53 | [diff] [blame] | 171 | tray()->detailed_menu_->OnViewClicked(button); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | void ClickScreenMagnifierOnDetailMenu() { |
| 175 | views::View* button = tray()->detailed_menu_->screen_magnifier_view_; |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 176 | ASSERT_TRUE(button); |
[email protected] | acd0fd7a | 2013-03-04 22:00:53 | [diff] [blame] | 177 | tray()->detailed_menu_->OnViewClicked(button); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 178 | } |
| 179 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 180 | void ClickAutoclickOnDetailMenu() { |
| 181 | views::View* button = tray()->detailed_menu_->autoclick_view_; |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 182 | ASSERT_TRUE(button); |
| 183 | tray()->detailed_menu_->OnViewClicked(button); |
| 184 | } |
| 185 | |
| 186 | void ClickVirtualKeyboardOnDetailMenu() { |
| 187 | views::View* button = tray()->detailed_menu_->virtual_keyboard_view_; |
| 188 | ASSERT_TRUE(button); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 189 | tray()->detailed_menu_->OnViewClicked(button); |
| 190 | } |
| 191 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 192 | bool IsSpokenFeedbackEnabledOnDetailMenu() const { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 193 | return tray()->detailed_menu_->spoken_feedback_enabled_; |
| 194 | } |
| 195 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 196 | bool IsHighContrastEnabledOnDetailMenu() const { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 197 | return tray()->detailed_menu_->high_contrast_enabled_; |
| 198 | } |
| 199 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 200 | bool IsScreenMagnifierEnabledOnDetailMenu() const { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 201 | return tray()->detailed_menu_->screen_magnifier_enabled_; |
| 202 | } |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 203 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 204 | bool IsLargeCursorEnabledOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 205 | return tray()->detailed_menu_->large_cursor_enabled_; |
| 206 | } |
| 207 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 208 | bool IsAutoclickEnabledOnDetailMenu() const { |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 209 | return tray()->detailed_menu_->autoclick_enabled_; |
| 210 | } |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 211 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 212 | bool IsVirtualKeyboardEnabledOnDetailMenu() const { |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 213 | return tray()->detailed_menu_->virtual_keyboard_enabled_; |
| 214 | } |
| 215 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 216 | bool IsSpokenFeedbackMenuShownOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 217 | return tray()->detailed_menu_->spoken_feedback_view_; |
| 218 | } |
| 219 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 220 | bool IsHighContrastMenuShownOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 221 | return tray()->detailed_menu_->high_contrast_view_; |
| 222 | } |
| 223 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 224 | bool IsScreenMagnifierMenuShownOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 225 | return tray()->detailed_menu_->screen_magnifier_view_; |
| 226 | } |
| 227 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 228 | bool IsLargeCursorMenuShownOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 229 | return tray()->detailed_menu_->large_cursor_view_; |
| 230 | } |
| 231 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 232 | bool IsAutoclickMenuShownOnDetailMenu() const { |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 233 | return tray()->detailed_menu_->autoclick_view_; |
| 234 | } |
| 235 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 236 | bool IsVirtualKeyboardMenuShownOnDetailMenu() const { |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 237 | return tray()->detailed_menu_->virtual_keyboard_view_; |
| 238 | } |
| 239 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 240 | bool IsNotificationShown() const { |
| 241 | return (tray()->detailed_popup_ && |
| 242 | !tray()->detailed_popup_->GetWidget()->IsClosed()); |
| 243 | } |
| 244 | |
| 245 | base::string16 GetNotificationText() const { |
| 246 | if (IsNotificationShown()) |
| 247 | return tray()->detailed_popup_->label_for_test()->text(); |
| 248 | else |
| 249 | return base::string16(); |
| 250 | } |
| 251 | |
| 252 | void SetBrailleConnected(bool connected) { |
| 253 | braille_controller_.SetAvailable(connected); |
[email protected] | 2e5e0b1 | 2014-05-07 13:30:20 | [diff] [blame^] | 254 | braille_controller_.GetObserver()->OnBrailleDisplayStateChanged( |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 255 | *braille_controller_.GetDisplayState()); |
| 256 | } |
| 257 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 258 | policy::MockConfigurationPolicyProvider provider_; |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 259 | MockBrailleController braille_controller_; |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 260 | }; |
| 261 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 262 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 263 | EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus()); |
| 264 | |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 265 | UserManager::Get()->UserLoggedIn( |
| 266 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 267 | UserManager::Get()->SessionStarted(); |
| 268 | |
| 269 | EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus()); |
| 270 | } |
| 271 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 272 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 273 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 274 | |
| 275 | // Confirms that the icon is invisible before login. |
| 276 | EXPECT_FALSE(IsTrayIconVisible()); |
| 277 | |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 278 | UserManager::Get()->UserLoggedIn( |
| 279 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 280 | UserManager::Get()->SessionStarted(); |
| 281 | |
| 282 | // Confirms that the icon is invisible just after login. |
| 283 | EXPECT_FALSE(IsTrayIconVisible()); |
| 284 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 285 | // Toggling spoken feedback changes the visibillity of the icon. |
| 286 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 287 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 288 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 289 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 290 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 291 | EXPECT_FALSE(IsTrayIconVisible()); |
| 292 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 293 | // Toggling high contrast the visibillity of the icon. |
| 294 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 295 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 296 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 297 | EXPECT_FALSE(IsTrayIconVisible()); |
| 298 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 299 | // Toggling magnifier the visibility of the icon. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 300 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 301 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 302 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 303 | EXPECT_FALSE(IsTrayIconVisible()); |
| 304 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 305 | // Toggling the virtual keyboard setting changes the visibility of the a11y |
| 306 | // icon. |
| 307 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 308 | EXPECT_TRUE(IsTrayIconVisible()); |
| 309 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 310 | EXPECT_FALSE(IsTrayIconVisible()); |
| 311 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 312 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 313 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 314 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 315 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 316 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 317 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 318 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 319 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 320 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 321 | EXPECT_TRUE(IsTrayIconVisible()); |
[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 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 324 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 325 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 326 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 327 | SetMagnifierEnabled(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 328 | EXPECT_TRUE(IsTrayIconVisible()); |
| 329 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 330 | EXPECT_FALSE(IsTrayIconVisible()); |
| 331 | |
| 332 | // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect |
| 333 | // the icon on the tray. |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 334 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 335 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 336 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 337 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 338 | EXPECT_FALSE(IsTrayIconVisible()); |
| 339 | } |
| 340 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 341 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 342 | // Login |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 343 | UserManager::Get()->UserLoggedIn( |
| 344 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 345 | UserManager::Get()->SessionStarted(); |
| 346 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 347 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 348 | |
| 349 | // Confirms that the menu is hidden. |
| 350 | EXPECT_FALSE(CanCreateMenuItem()); |
| 351 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 352 | // Toggling spoken feedback changes the visibillity of the menu. |
| 353 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 354 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 355 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 356 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 357 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 358 | EXPECT_FALSE(CanCreateMenuItem()); |
| 359 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 360 | // Toggling high contrast changes the visibillity of the menu. |
| 361 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 362 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 363 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 364 | EXPECT_FALSE(CanCreateMenuItem()); |
| 365 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 366 | // Toggling screen magnifier changes the visibility of the menu. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 367 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 368 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 369 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 370 | EXPECT_FALSE(CanCreateMenuItem()); |
| 371 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 372 | // Toggling autoclick changes the visibility of the menu. |
| 373 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 374 | EXPECT_TRUE(CanCreateMenuItem()); |
| 375 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 376 | EXPECT_FALSE(CanCreateMenuItem()); |
| 377 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 378 | // Toggling virtual keyboard changes the visibility of the menu. |
| 379 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 380 | EXPECT_TRUE(CanCreateMenuItem()); |
| 381 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 382 | EXPECT_FALSE(CanCreateMenuItem()); |
| 383 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 384 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 385 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 386 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 387 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 388 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 389 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 390 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 391 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 392 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 393 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 394 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 395 | EXPECT_TRUE(CanCreateMenuItem()); |
| 396 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 397 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 398 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 399 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 400 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 401 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 402 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 403 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 404 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 405 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 406 | EXPECT_FALSE(CanCreateMenuItem()); |
| 407 | } |
| 408 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 409 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 410 | // Login |
[email protected] | 4042959 | 2013-03-29 17:52:33 | [diff] [blame] | 411 | UserManager::Get()->UserLoggedIn( |
| 412 | "[email protected]", "[email protected]", true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 413 | UserManager::Get()->SessionStarted(); |
| 414 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 415 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 416 | |
| 417 | // Confirms that the menu is visible. |
| 418 | EXPECT_TRUE(CanCreateMenuItem()); |
| 419 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 420 | // The menu remains visible regardless of toggling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 421 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 422 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 423 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 424 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 425 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 426 | EXPECT_TRUE(CanCreateMenuItem()); |
| 427 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 428 | // The menu remains visible regardless of toggling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 429 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 430 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 431 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 432 | EXPECT_TRUE(CanCreateMenuItem()); |
| 433 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 434 | // The menu remains visible regardless of toggling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 435 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 436 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 437 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 438 | EXPECT_TRUE(CanCreateMenuItem()); |
| 439 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 440 | // The menu remains visible regardless of toggling autoclick. |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 441 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 442 | EXPECT_TRUE(CanCreateMenuItem()); |
| 443 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 444 | EXPECT_TRUE(CanCreateMenuItem()); |
| 445 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 446 | // The menu remains visible regardless of toggling on-screen keyboard. |
| 447 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 448 | EXPECT_TRUE(CanCreateMenuItem()); |
| 449 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 450 | EXPECT_TRUE(CanCreateMenuItem()); |
| 451 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 452 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 453 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 454 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 455 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 456 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 457 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 458 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 459 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 460 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 461 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 462 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 463 | EXPECT_TRUE(CanCreateMenuItem()); |
| 464 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 465 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 466 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 467 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 468 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 469 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 470 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 471 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 472 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 473 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 474 | EXPECT_TRUE(CanCreateMenuItem()); |
| 475 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 476 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 477 | |
| 478 | // Confirms that the menu is invisible. |
| 479 | EXPECT_FALSE(CanCreateMenuItem()); |
| 480 | } |
| 481 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 482 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 483 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 484 | |
| 485 | // Confirms that the menu is visible. |
| 486 | EXPECT_TRUE(CanCreateMenuItem()); |
| 487 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 488 | // The menu remains visible regardless of toggling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 489 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 490 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 491 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 492 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 493 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 494 | EXPECT_TRUE(CanCreateMenuItem()); |
| 495 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 496 | // The menu remains visible regardless of toggling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 497 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 498 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 499 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 500 | EXPECT_TRUE(CanCreateMenuItem()); |
| 501 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 502 | // The menu remains visible regardless of toggling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 503 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 504 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 505 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 506 | EXPECT_TRUE(CanCreateMenuItem()); |
| 507 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 508 | // The menu remains visible regardless of toggling on-screen keyboard. |
| 509 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 510 | EXPECT_TRUE(CanCreateMenuItem()); |
| 511 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 512 | EXPECT_TRUE(CanCreateMenuItem()); |
| 513 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 514 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 515 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 516 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 517 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 518 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 519 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 520 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 521 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 522 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 523 | EXPECT_TRUE(CanCreateMenuItem()); |
| 524 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 525 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 526 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 527 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 528 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 529 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 530 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 531 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 532 | EXPECT_TRUE(CanCreateMenuItem()); |
| 533 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 534 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 535 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 536 | // Confirms that the menu remains visible. |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 537 | EXPECT_TRUE(CanCreateMenuItem()); |
| 538 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 539 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 540 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 541 | // Confirms that the menu remains visible. |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 542 | EXPECT_TRUE(CanCreateMenuItem()); |
| 543 | } |
| 544 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 545 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowNotification) { |
| 546 | const base::string16 BRAILLE_CONNECTED = |
| 547 | base::ASCIIToUTF16("Braille display connected."); |
| 548 | const base::string16 CHROMEVOX_ENABLED = base::ASCIIToUTF16( |
| 549 | "ChromeVox (spoken feedback) is enabled.\nPress Ctrl+Alt+Z to disable."); |
| 550 | const base::string16 BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED( |
| 551 | BRAILLE_CONNECTED + base::ASCIIToUTF16(" ") + CHROMEVOX_ENABLED); |
| 552 | |
| 553 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 554 | |
| 555 | // Enabling spoken feedback should show the notification. |
| 556 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 557 | true, ash::A11Y_NOTIFICATION_SHOW); |
| 558 | EXPECT_EQ(CHROMEVOX_ENABLED, GetNotificationText()); |
| 559 | |
| 560 | // Connecting a braille display when spoken feedback is already enabled |
| 561 | // should only show the message about the braille display. |
| 562 | SetBrailleConnected(true); |
| 563 | EXPECT_EQ(BRAILLE_CONNECTED, GetNotificationText()); |
| 564 | |
| 565 | // Neither disconnecting a braille display, nor disabling spoken feedback |
| 566 | // should show any notification. |
| 567 | SetBrailleConnected(false); |
| 568 | EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 569 | EXPECT_FALSE(IsNotificationShown()); |
| 570 | AccessibilityManager::Get()->EnableSpokenFeedback( |
| 571 | false, ash::A11Y_NOTIFICATION_SHOW); |
| 572 | EXPECT_FALSE(IsNotificationShown()); |
| 573 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 574 | |
| 575 | // Connecting a braille display should enable spoken feedback and show |
| 576 | // both messages. |
| 577 | SetBrailleConnected(true); |
| 578 | EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 579 | EXPECT_EQ(BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED, GetNotificationText()); |
| 580 | } |
| 581 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 582 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 583 | // Enables high contrast mode. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 584 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 585 | EXPECT_TRUE(CanCreateMenuItem()); |
| 586 | |
| 587 | // Locks the screen. |
| 588 | SetLoginStatus(ash::user::LOGGED_IN_LOCKED); |
| 589 | EXPECT_TRUE(CanCreateMenuItem()); |
| 590 | |
| 591 | // Disables high contrast mode. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 592 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 593 | |
| 594 | // Confirms that the menu is still visible. |
| 595 | EXPECT_TRUE(CanCreateMenuItem()); |
| 596 | } |
| 597 | |
[email protected] | 8bacb66 | 2013-02-27 03:15:24 | [diff] [blame] | 598 | #if defined(OS_CHROMEOS) |
| 599 | #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu |
| 600 | #else |
| 601 | #define MAYBE_ClickDetailMenu ClickDetailMenu |
| 602 | #endif |
| 603 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 604 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 605 | // Confirms that the check item toggles the spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 606 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 607 | |
| 608 | EXPECT_TRUE(CreateDetailedMenu()); |
| 609 | ClickSpokenFeedbackOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 610 | EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 611 | |
| 612 | EXPECT_TRUE(CreateDetailedMenu()); |
| 613 | ClickSpokenFeedbackOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 614 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 615 | |
| 616 | // Confirms that the check item toggles the high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 617 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 618 | |
| 619 | EXPECT_TRUE(CreateDetailedMenu()); |
| 620 | ClickHighContrastOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 621 | EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 622 | |
| 623 | EXPECT_TRUE(CreateDetailedMenu()); |
| 624 | ClickHighContrastOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 625 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 626 | |
| 627 | // Confirms that the check item toggles the magnifier. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 628 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 629 | |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 630 | EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 631 | EXPECT_TRUE(CreateDetailedMenu()); |
| 632 | ClickScreenMagnifierOnDetailMenu(); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 633 | EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 634 | |
| 635 | EXPECT_TRUE(CreateDetailedMenu()); |
| 636 | ClickScreenMagnifierOnDetailMenu(); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 637 | EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 638 | |
| 639 | // Confirms that the check item toggles autoclick. |
| 640 | EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled()); |
| 641 | |
| 642 | EXPECT_TRUE(CreateDetailedMenu()); |
| 643 | ClickAutoclickOnDetailMenu(); |
| 644 | EXPECT_TRUE(AccessibilityManager::Get()->IsAutoclickEnabled()); |
| 645 | |
| 646 | EXPECT_TRUE(CreateDetailedMenu()); |
| 647 | ClickAutoclickOnDetailMenu(); |
| 648 | EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 649 | |
| 650 | // Confirms that the check item toggles on-screen keyboard. |
| 651 | EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled()); |
| 652 | |
| 653 | EXPECT_TRUE(CreateDetailedMenu()); |
| 654 | ClickVirtualKeyboardOnDetailMenu(); |
| 655 | EXPECT_TRUE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled()); |
| 656 | |
| 657 | EXPECT_TRUE(CreateDetailedMenu()); |
| 658 | ClickVirtualKeyboardOnDetailMenu(); |
| 659 | EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 660 | } |
| 661 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 662 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 663 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 664 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 665 | // At first, all of the check is unchecked. |
| 666 | EXPECT_TRUE(CreateDetailedMenu()); |
| 667 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 668 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 669 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 670 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 671 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 672 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 673 | CloseDetailMenu(); |
| 674 | |
| 675 | // Enabling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 676 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 677 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 678 | EXPECT_TRUE(CreateDetailedMenu()); |
| 679 | EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 680 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 681 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 682 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 683 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 684 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 685 | CloseDetailMenu(); |
| 686 | |
| 687 | // Disabling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 688 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 689 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 690 | EXPECT_TRUE(CreateDetailedMenu()); |
| 691 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 692 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 693 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 694 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 695 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 696 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 697 | CloseDetailMenu(); |
| 698 | |
| 699 | // Enabling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 700 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 701 | EXPECT_TRUE(CreateDetailedMenu()); |
| 702 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 703 | EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 704 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 705 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 706 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 707 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 708 | CloseDetailMenu(); |
| 709 | |
| 710 | // Disabling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 711 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 712 | EXPECT_TRUE(CreateDetailedMenu()); |
| 713 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 714 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 715 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 716 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 717 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 718 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 719 | CloseDetailMenu(); |
| 720 | |
| 721 | // Enabling full screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 722 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 723 | EXPECT_TRUE(CreateDetailedMenu()); |
| 724 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 725 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 726 | EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 727 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 728 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 729 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 730 | CloseDetailMenu(); |
| 731 | |
| 732 | // Disabling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 733 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 734 | EXPECT_TRUE(CreateDetailedMenu()); |
| 735 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 736 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 737 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 738 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 739 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 740 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 741 | CloseDetailMenu(); |
| 742 | |
| 743 | // Enabling large cursor. |
| 744 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 745 | EXPECT_TRUE(CreateDetailedMenu()); |
| 746 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 747 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 748 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 749 | EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 750 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 751 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 752 | CloseDetailMenu(); |
| 753 | |
| 754 | // Disabling large cursor. |
| 755 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 756 | EXPECT_TRUE(CreateDetailedMenu()); |
| 757 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 758 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 759 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 760 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 761 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 762 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 763 | CloseDetailMenu(); |
| 764 | |
| 765 | // Enable on-screen keyboard. |
| 766 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 767 | EXPECT_TRUE(CreateDetailedMenu()); |
| 768 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 769 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 770 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 771 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 772 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 773 | EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 774 | CloseDetailMenu(); |
| 775 | |
| 776 | // Disable on-screen keyboard. |
| 777 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 778 | EXPECT_TRUE(CreateDetailedMenu()); |
| 779 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 780 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 781 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 782 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 783 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 784 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 785 | CloseDetailMenu(); |
| 786 | |
| 787 | // Enabling all of the a11y features. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 788 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 789 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 790 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 791 | SetMagnifierEnabled(true); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 792 | AccessibilityManager::Get()->EnableLargeCursor(true); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 793 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 794 | EXPECT_TRUE(CreateDetailedMenu()); |
| 795 | EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 796 | EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 797 | EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 798 | EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 799 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 800 | EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 801 | CloseDetailMenu(); |
| 802 | |
| 803 | // Disabling all of the a11y features. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 804 | AccessibilityManager::Get()->EnableSpokenFeedback( |
[email protected] | 681d053 | 2013-06-11 12:52:50 | [diff] [blame] | 805 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 806 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 807 | SetMagnifierEnabled(false); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 808 | AccessibilityManager::Get()->EnableLargeCursor(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 809 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 810 | EXPECT_TRUE(CreateDetailedMenu()); |
| 811 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 812 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 813 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 814 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 815 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 816 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 817 | CloseDetailMenu(); |
| 818 | |
| 819 | // Autoclick is disabled on login screen. |
| 820 | SetLoginStatus(ash::user::LOGGED_IN_USER); |
| 821 | |
| 822 | // Enabling autoclick. |
| 823 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 824 | EXPECT_TRUE(CreateDetailedMenu()); |
| 825 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 826 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 827 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 828 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 829 | EXPECT_TRUE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 830 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 831 | CloseDetailMenu(); |
| 832 | |
| 833 | // Disabling autoclick. |
| 834 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 835 | EXPECT_TRUE(CreateDetailedMenu()); |
| 836 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 837 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 838 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 839 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 840 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 841 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 842 | CloseDetailMenu(); |
| 843 | } |
| 844 | |
| 845 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMenuVisibilityOnDetailMenu) { |
| 846 | SetLoginStatus(ash::user::LOGGED_IN_NONE); |
| 847 | EXPECT_TRUE(CreateDetailedMenu()); |
| 848 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 849 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 850 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
| 851 | EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 852 | EXPECT_FALSE(IsAutoclickMenuShownOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 853 | EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 854 | CloseDetailMenu(); |
| 855 | |
| 856 | SetLoginStatus(ash::user::LOGGED_IN_USER); |
| 857 | EXPECT_TRUE(CreateDetailedMenu()); |
| 858 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 859 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 860 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
| 861 | EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 862 | EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 863 | EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 864 | CloseDetailMenu(); |
| 865 | |
| 866 | SetLoginStatus(ash::user::LOGGED_IN_LOCKED); |
| 867 | EXPECT_TRUE(CreateDetailedMenu()); |
| 868 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 869 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 870 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
| 871 | EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 872 | EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 873 | EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 874 | CloseDetailMenu(); |
| 875 | } |
| 876 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 877 | INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, |
| 878 | TrayAccessibilityTest, |
| 879 | testing::Values(PREF_SERVICE, |
| 880 | POLICY)); |
| 881 | |
[email protected] | cce1bad6 | 2013-01-04 02:26:38 | [diff] [blame] | 882 | } // namespace chromeos |