[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 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 5 | #include "ash/login_status.h" |
Tetsui Ohkubo | 8b83e531 | 2018-06-07 01:26:23 | [diff] [blame] | 6 | #include "ash/public/cpp/ash_features.h" |
James Cook | c63b9fd | 2017-08-18 18:48:32 | [diff] [blame] | 7 | #include "ash/public/cpp/ash_pref_names.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 8 | #include "ash/shell.h" |
James Cook | 346c8c6 | 2017-07-18 19:38:37 | [diff] [blame] | 9 | #include "ash/shell_test_api.h" |
Tetsui Ohkubo | a6ceebd | 2018-10-18 03:48:05 | [diff] [blame] | 10 | #include "ash/system/accessibility/tray_accessibility.h" |
Sammie Quon | b5f32e0 | 2017-10-10 19:16:12 | [diff] [blame] | 11 | #include "ash/system/tray/hover_highlight_view.h" |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 12 | #include "ash/system/tray/system_tray.h" |
jamescook | a1b2a09 | 2017-06-08 15:07:55 | [diff] [blame] | 13 | #include "ash/system/tray/system_tray_test_api.h" |
[email protected] | aecb608 | 2013-07-09 14:29:41 | [diff] [blame] | 14 | #include "base/callback.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 15 | #include "base/command_line.h" |
Gabriel Charette | 078e366 | 2017-08-28 22:59:04 | [diff] [blame] | 16 | #include "base/run_loop.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 17 | #include "chrome/browser/browser_process.h" |
[email protected] | fdf40f3e | 2013-07-11 23:55:46 | [diff] [blame] | 18 | #include "chrome/browser/chrome_notification_types.h" |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 19 | #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 20 | #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 21 | #include "chrome/browser/chromeos/login/helper.h" |
[email protected] | aa8328fb | 2013-04-19 15:09:06 | [diff] [blame] | 22 | #include "chrome/browser/chromeos/login/startup_utils.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" |
xiyuan | 233f4e7 | 2017-04-06 06:59:56 | [diff] [blame] | 25 | #include "chrome/browser/ui/ash/session_controller_client.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 26 | #include "chrome/common/chrome_switches.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] | 9727582 | 2014-01-21 19:30:36 | [diff] [blame] | 30 | #include "components/policy/core/browser/browser_policy_connector.h" |
[email protected] | c4a138a | 2013-11-21 19:54:57 | [diff] [blame] | 31 | #include "components/policy/core/common/external_data_fetcher.h" |
[email protected] | f20a3a2 | 2013-12-03 16:12:37 | [diff] [blame] | 32 | #include "components/policy/core/common/mock_configuration_policy_provider.h" |
[email protected] | c4a138a | 2013-11-21 19:54:57 | [diff] [blame] | 33 | #include "components/policy/core/common/policy_map.h" |
| 34 | #include "components/policy/core/common/policy_types.h" |
brettw | 39d6ba4 | 2016-08-24 16:56:38 | [diff] [blame] | 35 | #include "components/policy/policy_constants.h" |
brettw | b1fc1b8 | 2016-02-02 00:19:08 | [diff] [blame] | 36 | #include "components/prefs/pref_service.h" |
xiyuan | 834f3bc | 2016-10-26 19:40:53 | [diff] [blame] | 37 | #include "components/session_manager/core/session_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 38 | #include "content/public/test/test_utils.h" |
| 39 | #include "testing/gtest/include/gtest/gtest.h" |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 40 | #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 41 | #include "ui/views/controls/button/button.h" |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 42 | #include "ui/views/controls/label.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 43 | #include "ui/views/widget/widget.h" |
| 44 | |
[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 | |
Tetsui Ohkubo | a12026d | 2018-10-31 02:42:05 | [diff] [blame^] | 56 | namespace { |
| 57 | |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 58 | //////////////////////////////////////////////////////////////////////////////// |
| 59 | // Changing accessibility settings may change preferences, so these helpers spin |
| 60 | // the message loop to ensure ash sees the change. |
| 61 | |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 62 | void SetMagnifierEnabled(bool enabled) { |
| 63 | MagnificationManager::Get()->SetMagnifierEnabled(enabled); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 64 | base::RunLoop().RunUntilIdle(); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 65 | } |
| 66 | |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 67 | void EnableSpokenFeedback(bool enabled) { |
| 68 | AccessibilityManager::Get()->EnableSpokenFeedback(enabled); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 69 | base::RunLoop().RunUntilIdle(); |
xiyuan | 8c6a411 | 2017-06-19 21:03:49 | [diff] [blame] | 70 | } |
| 71 | |
Katie D | 6af68c5e | 2018-02-14 23:21:16 | [diff] [blame] | 72 | void EnableSelectToSpeak(bool enabled) { |
| 73 | AccessibilityManager::Get()->SetSelectToSpeakEnabled(enabled); |
| 74 | base::RunLoop().RunUntilIdle(); |
| 75 | } |
| 76 | |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 77 | void EnableHighContrast(bool enabled) { |
| 78 | AccessibilityManager::Get()->EnableHighContrast(enabled); |
| 79 | base::RunLoop().RunUntilIdle(); |
| 80 | } |
| 81 | |
| 82 | void EnableAutoclick(bool enabled) { |
| 83 | AccessibilityManager::Get()->EnableAutoclick(enabled); |
| 84 | base::RunLoop().RunUntilIdle(); |
| 85 | } |
| 86 | |
| 87 | void EnableVirtualKeyboard(bool enabled) { |
| 88 | AccessibilityManager::Get()->EnableVirtualKeyboard(enabled); |
| 89 | base::RunLoop().RunUntilIdle(); |
| 90 | } |
| 91 | |
| 92 | void EnableLargeCursor(bool enabled) { |
| 93 | AccessibilityManager::Get()->EnableLargeCursor(enabled); |
| 94 | base::RunLoop().RunUntilIdle(); |
| 95 | } |
| 96 | |
| 97 | void EnableMonoAudio(bool enabled) { |
| 98 | AccessibilityManager::Get()->EnableMonoAudio(enabled); |
| 99 | base::RunLoop().RunUntilIdle(); |
| 100 | } |
| 101 | |
| 102 | void SetCaretHighlightEnabled(bool enabled) { |
| 103 | AccessibilityManager::Get()->SetCaretHighlightEnabled(enabled); |
| 104 | base::RunLoop().RunUntilIdle(); |
| 105 | } |
| 106 | |
| 107 | void SetCursorHighlightEnabled(bool enabled) { |
| 108 | AccessibilityManager::Get()->SetCursorHighlightEnabled(enabled); |
| 109 | base::RunLoop().RunUntilIdle(); |
| 110 | } |
| 111 | |
| 112 | void SetFocusHighlightEnabled(bool enabled) { |
| 113 | AccessibilityManager::Get()->SetFocusHighlightEnabled(enabled); |
| 114 | base::RunLoop().RunUntilIdle(); |
| 115 | } |
| 116 | |
| 117 | void EnableStickyKeys(bool enabled) { |
| 118 | AccessibilityManager::Get()->EnableStickyKeys(enabled); |
| 119 | base::RunLoop().RunUntilIdle(); |
| 120 | } |
| 121 | |
Tetsui Ohkubo | a12026d | 2018-10-31 02:42:05 | [diff] [blame^] | 122 | } // namespace |
| 123 | |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 124 | // Uses InProcessBrowserTest instead of OobeBaseTest because most of the tests |
| 125 | // don't need to test the login screen. |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 126 | class TrayAccessibilityTest |
[email protected] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 127 | : public InProcessBrowserTest, |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 128 | public WithParamInterface<PrefSettingMechanism> { |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 129 | public: |
| 130 | TrayAccessibilityTest() |
| 131 | : disable_animations_( |
| 132 | ui::ScopedAnimationDurationScaleMode::ZERO_DURATION) {} |
| 133 | ~TrayAccessibilityTest() override = default; |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 134 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 135 | // The profile which should be used by these tests. |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame] | 136 | Profile* GetProfile() { return ProfileManager::GetActiveUserProfile(); } |
| 137 | |
dcheng | c97a028 | 2015-01-15 23:04:24 | [diff] [blame] | 138 | void SetUpInProcessBrowserTestFixture() override { |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 139 | InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 140 | EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 141 | .WillRepeatedly(Return(true)); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 142 | policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 143 | } |
| 144 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 145 | void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) { |
| 146 | if (GetParam() == PREF_SERVICE) { |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame] | 147 | PrefService* prefs = GetProfile()->GetPrefs(); |
James Cook | c63b9fd | 2017-08-18 18:48:32 | [diff] [blame] | 148 | prefs->SetBoolean(ash::prefs::kShouldAlwaysShowAccessibilityMenu, value); |
James Cook | b601dd5c | 2018-01-29 21:07:19 | [diff] [blame] | 149 | // Prefs are sent to ash asynchronously. |
| 150 | base::RunLoop().RunUntilIdle(); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 151 | } else if (GetParam() == POLICY) { |
| 152 | policy::PolicyMap policy_map; |
| 153 | policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu, |
dcheng | 3b344bc2 | 2016-05-10 02:26:09 | [diff] [blame] | 154 | policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
fhorschig | 64834b71 | 2015-09-21 14:20:23 | [diff] [blame] | 155 | policy::POLICY_SOURCE_CLOUD, |
Jinho Bang | 341ce5b0 | 2018-01-17 22:46:03 | [diff] [blame] | 156 | std::make_unique<base::Value>(value), nullptr); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 157 | provider_.UpdateChromePolicy(policy_map); |
| 158 | base::RunLoop().RunUntilIdle(); |
| 159 | } else { |
| 160 | FAIL() << "Unknown test parameterization"; |
| 161 | } |
| 162 | } |
| 163 | |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 164 | static ash::TrayAccessibility* tray() { |
jamescook | a1b2a09 | 2017-06-08 15:07:55 | [diff] [blame] | 165 | return ash::SystemTrayTestApi(ash::Shell::Get()->GetPrimarySystemTray()) |
| 166 | .tray_accessibility(); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 167 | } |
| 168 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 169 | views::View* CreateMenuItem() { |
| 170 | return tray()->CreateDefaultView(GetLoginStatus()); |
| 171 | } |
| 172 | |
Evan Stade | e70b0a6 | 2017-06-05 20:42:30 | [diff] [blame] | 173 | void DestroyMenuItem() { return tray()->OnDefaultViewDestroyed(); } |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 174 | |
| 175 | bool CanCreateMenuItem() { |
| 176 | views::View* menu_item_view = CreateMenuItem(); |
| 177 | DestroyMenuItem(); |
Qiang Xu | 800e389 | 2017-10-03 17:36:26 | [diff] [blame] | 178 | return menu_item_view != nullptr; |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 179 | } |
| 180 | |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 181 | void SetLoginStatus(ash::LoginStatus status) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 182 | tray()->UpdateAfterLoginStatusChange(status); |
| 183 | } |
| 184 | |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 185 | ash::LoginStatus GetLoginStatus() { return tray()->login_; } |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 186 | |
| 187 | bool CreateDetailedMenu() { |
Qiang Xu | 800e389 | 2017-10-03 17:36:26 | [diff] [blame] | 188 | tray()->ShowDetailedView(0); |
| 189 | return tray()->detailed_menu_ != nullptr; |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 190 | } |
| 191 | |
Sammie Quon | b5f32e0 | 2017-10-10 19:16:12 | [diff] [blame] | 192 | ash::tray::AccessibilityDetailedView* GetDetailedMenu() { |
| 193 | return tray()->detailed_menu_; |
| 194 | } |
| 195 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 196 | void CloseDetailMenu() { |
Evan Stade | e70b0a6 | 2017-06-05 20:42:30 | [diff] [blame] | 197 | ASSERT_TRUE(tray()->detailed_menu_); |
| 198 | tray()->OnDetailedViewDestroyed(); |
| 199 | EXPECT_FALSE(tray()->detailed_menu_); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 200 | } |
| 201 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 202 | void ClickAutoclickOnDetailMenu() { |
Sammie Quon | b5f32e0 | 2017-10-10 19:16:12 | [diff] [blame] | 203 | ash::HoverHighlightView* view = tray()->detailed_menu_->autoclick_view_; |
Sammie Quon | b5f32e0 | 2017-10-10 19:16:12 | [diff] [blame] | 204 | tray()->detailed_menu_->OnViewClicked(view); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 205 | base::RunLoop().RunUntilIdle(); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 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 | |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 212 | // Disable animations so that tray icons hide immediately. |
| 213 | ui::ScopedAnimationDurationScaleMode disable_animations_; |
| 214 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 215 | policy::MockConfigurationPolicyProvider provider_; |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 216 | }; |
| 217 | |
yoshiki | 064fa9e | 2015-09-04 06:32:45 | [diff] [blame] | 218 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { |
Tetsui Ohkubo | 8b83e531 | 2018-06-07 01:26:23 | [diff] [blame] | 219 | // TODO(tetsui): Restore after AccessibilityManager is moved to ash. |
| 220 | // https://crbug.com/850014 |
| 221 | if (ash::features::IsSystemTrayUnifiedEnabled()) |
| 222 | return; |
| 223 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 224 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 225 | |
| 226 | // Confirms that the menu is hidden. |
| 227 | EXPECT_FALSE(CanCreateMenuItem()); |
| 228 | |
James Cook | fc97f0a | 2017-08-16 20:05:35 | [diff] [blame] | 229 | // Toggling spoken feedback changes the visibility of the menu. |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 230 | EnableSpokenFeedback(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 231 | EXPECT_TRUE(CanCreateMenuItem()); |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 232 | EnableSpokenFeedback(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 233 | EXPECT_FALSE(CanCreateMenuItem()); |
| 234 | |
James Cook | fc97f0a | 2017-08-16 20:05:35 | [diff] [blame] | 235 | // Toggling high contrast changes the visibility of the menu. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 236 | EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 237 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 238 | EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 239 | EXPECT_FALSE(CanCreateMenuItem()); |
| 240 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 241 | // Toggling screen magnifier changes the visibility of the menu. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 242 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 243 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 244 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 245 | EXPECT_FALSE(CanCreateMenuItem()); |
| 246 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 247 | // Toggling autoclick changes the visibility of the menu. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 248 | EnableAutoclick(true); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 249 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 250 | EnableAutoclick(false); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 251 | EXPECT_FALSE(CanCreateMenuItem()); |
| 252 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 253 | // Toggling virtual keyboard changes the visibility of the menu. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 254 | EnableVirtualKeyboard(true); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 255 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 256 | EnableVirtualKeyboard(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 257 | EXPECT_FALSE(CanCreateMenuItem()); |
| 258 | |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 259 | // Toggling large mouse cursor changes the visibility of the menu. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 260 | EnableLargeCursor(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 261 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 262 | EnableLargeCursor(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 263 | EXPECT_FALSE(CanCreateMenuItem()); |
| 264 | |
| 265 | // Toggling mono audio changes the visibility of the menu. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 266 | EnableMonoAudio(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 267 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 268 | EnableMonoAudio(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 269 | EXPECT_FALSE(CanCreateMenuItem()); |
| 270 | |
| 271 | // Toggling caret highlight changes the visibility of the menu. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 272 | SetCaretHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 273 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 274 | SetCaretHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 275 | EXPECT_FALSE(CanCreateMenuItem()); |
| 276 | |
| 277 | // Toggling highlight mouse cursor changes the visibility of the menu. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 278 | SetCursorHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 279 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 280 | SetCursorHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 281 | EXPECT_FALSE(CanCreateMenuItem()); |
| 282 | |
| 283 | // Toggling highlight keyboard focus changes the visibility of the menu. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 284 | SetFocusHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 285 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 286 | SetFocusHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 287 | EXPECT_FALSE(CanCreateMenuItem()); |
| 288 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 289 | // Toggling sticky keys changes the visibility of the menu. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 290 | EnableStickyKeys(true); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 291 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 292 | EnableStickyKeys(false); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 293 | EXPECT_FALSE(CanCreateMenuItem()); |
| 294 | |
Katie D | 6af68c5e | 2018-02-14 23:21:16 | [diff] [blame] | 295 | // Toggling select-to-speak dragging changes the visibility of the menu. |
| 296 | EnableSelectToSpeak(true); |
| 297 | EXPECT_TRUE(CanCreateMenuItem()); |
| 298 | EnableSelectToSpeak(false); |
| 299 | EXPECT_FALSE(CanCreateMenuItem()); |
| 300 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 301 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 302 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 303 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 304 | EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 305 | EXPECT_TRUE(CanCreateMenuItem()); |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 306 | EnableSpokenFeedback(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 307 | EXPECT_TRUE(CanCreateMenuItem()); |
Katie D | 6af68c5e | 2018-02-14 23:21:16 | [diff] [blame] | 308 | EnableSelectToSpeak(true); |
| 309 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 310 | EnableAutoclick(true); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 311 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 312 | EnableVirtualKeyboard(true); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 313 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 314 | EnableLargeCursor(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 315 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 316 | EnableMonoAudio(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 317 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 318 | SetCaretHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 319 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 320 | SetCursorHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 321 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 322 | SetFocusHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 323 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 324 | EnableStickyKeys(true); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 325 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 326 | EnableVirtualKeyboard(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 327 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 328 | EnableAutoclick(false); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 329 | EXPECT_TRUE(CanCreateMenuItem()); |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 330 | EnableSpokenFeedback(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 331 | EXPECT_TRUE(CanCreateMenuItem()); |
Katie D | 6af68c5e | 2018-02-14 23:21:16 | [diff] [blame] | 332 | EnableSelectToSpeak(false); |
| 333 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 334 | EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 335 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 336 | SetMagnifierEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 337 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 338 | EnableLargeCursor(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 339 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 340 | EnableMonoAudio(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 341 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 342 | SetCaretHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 343 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 344 | SetCursorHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 345 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 346 | SetFocusHighlightEnabled(false); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 347 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 348 | EnableStickyKeys(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 349 | EXPECT_FALSE(CanCreateMenuItem()); |
| 350 | } |
| 351 | |
yoshiki | 064fa9e | 2015-09-04 06:32:45 | [diff] [blame] | 352 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
Tetsui Ohkubo | 8b83e531 | 2018-06-07 01:26:23 | [diff] [blame] | 353 | // TODO(tetsui): Restore after AccessibilityManager is moved to ash. |
| 354 | // https://crbug.com/850014 |
| 355 | if (ash::features::IsSystemTrayUnifiedEnabled()) |
| 356 | return; |
| 357 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 358 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 359 | |
| 360 | // Confirms that the menu is visible. |
| 361 | EXPECT_TRUE(CanCreateMenuItem()); |
| 362 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 363 | // The menu remains visible regardless of toggling spoken feedback. |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 364 | EnableSpokenFeedback(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 365 | EXPECT_TRUE(CanCreateMenuItem()); |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 366 | EnableSpokenFeedback(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 367 | EXPECT_TRUE(CanCreateMenuItem()); |
| 368 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 369 | // The menu remains visible regardless of toggling high contrast. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 370 | EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 371 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 372 | EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 373 | EXPECT_TRUE(CanCreateMenuItem()); |
| 374 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 375 | // The menu remains visible regardless of toggling screen magnifier. |
[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] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 378 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 379 | EXPECT_TRUE(CanCreateMenuItem()); |
| 380 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 381 | // The menu remains visible regardless of toggling autoclick. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 382 | EnableAutoclick(true); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 383 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 384 | EnableAutoclick(false); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 385 | EXPECT_TRUE(CanCreateMenuItem()); |
| 386 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 387 | // The menu remains visible regardless of toggling on-screen keyboard. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 388 | EnableVirtualKeyboard(true); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 389 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 390 | EnableVirtualKeyboard(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 391 | EXPECT_TRUE(CanCreateMenuItem()); |
| 392 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 393 | // The menu remains visible regardless of toggling large mouse cursor. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 394 | EnableLargeCursor(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 395 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 396 | EnableLargeCursor(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 397 | EXPECT_TRUE(CanCreateMenuItem()); |
| 398 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 399 | // The menu remains visible regardless of toggling mono audio. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 400 | EnableMonoAudio(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 401 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 402 | EnableMonoAudio(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 403 | EXPECT_TRUE(CanCreateMenuItem()); |
| 404 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 405 | // The menu remains visible regardless of toggling caret highlight. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 406 | SetCaretHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 407 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 408 | SetCaretHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 409 | EXPECT_TRUE(CanCreateMenuItem()); |
| 410 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 411 | // The menu remains visible regardless of toggling highlight mouse cursor. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 412 | SetCursorHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 413 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 414 | SetCursorHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 415 | EXPECT_TRUE(CanCreateMenuItem()); |
| 416 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 417 | // The menu remains visible regardless of toggling highlight keyboard focus. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 418 | SetFocusHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 419 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 420 | SetFocusHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 421 | EXPECT_TRUE(CanCreateMenuItem()); |
| 422 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 423 | // The menu remains visible regardless of the toggling sticky keys. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 424 | EnableStickyKeys(true); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 425 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 426 | EnableStickyKeys(false); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 427 | EXPECT_TRUE(CanCreateMenuItem()); |
| 428 | |
Katie D | 6af68c5e | 2018-02-14 23:21:16 | [diff] [blame] | 429 | // The menu remains visible regardless of toggling select-to-speak. |
| 430 | EnableSelectToSpeak(true); |
| 431 | EXPECT_TRUE(CanCreateMenuItem()); |
| 432 | EnableSelectToSpeak(false); |
| 433 | EXPECT_TRUE(CanCreateMenuItem()); |
| 434 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 435 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 436 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 437 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 438 | EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 439 | EXPECT_TRUE(CanCreateMenuItem()); |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 440 | EnableSpokenFeedback(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 441 | EXPECT_TRUE(CanCreateMenuItem()); |
Katie D | 6af68c5e | 2018-02-14 23:21:16 | [diff] [blame] | 442 | EnableSelectToSpeak(true); |
| 443 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 444 | EnableAutoclick(true); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 445 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 446 | EnableVirtualKeyboard(true); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 447 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 448 | EnableLargeCursor(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 449 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 450 | EnableMonoAudio(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 451 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 452 | SetCaretHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 453 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 454 | SetCursorHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 455 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 456 | SetFocusHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 457 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 458 | EnableStickyKeys(true); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 459 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 460 | EnableVirtualKeyboard(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 461 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 462 | EnableAutoclick(false); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 463 | EXPECT_TRUE(CanCreateMenuItem()); |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 464 | EnableSpokenFeedback(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 465 | EXPECT_TRUE(CanCreateMenuItem()); |
Katie D | 6af68c5e | 2018-02-14 23:21:16 | [diff] [blame] | 466 | EnableSelectToSpeak(false); |
| 467 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 468 | EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 469 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 470 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 471 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 472 | EnableLargeCursor(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 473 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 474 | EnableMonoAudio(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 475 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 476 | SetCaretHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 477 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 478 | SetCursorHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 479 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 480 | SetFocusHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 481 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 482 | EnableStickyKeys(false); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 483 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 484 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 485 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 486 | |
| 487 | // Confirms that the menu is invisible. |
| 488 | EXPECT_FALSE(CanCreateMenuItem()); |
| 489 | } |
| 490 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 491 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { |
Tetsui Ohkubo | 8b83e531 | 2018-06-07 01:26:23 | [diff] [blame] | 492 | // TODO(tetsui): Restore after AccessibilityManager is moved to ash. |
| 493 | // https://crbug.com/850014 |
| 494 | if (ash::features::IsSystemTrayUnifiedEnabled()) |
| 495 | return; |
| 496 | |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 497 | SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 498 | |
| 499 | // Confirms that the menu is visible. |
| 500 | EXPECT_TRUE(CanCreateMenuItem()); |
| 501 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 502 | // The menu remains visible regardless of toggling spoken feedback. |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 503 | EnableSpokenFeedback(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 504 | EXPECT_TRUE(CanCreateMenuItem()); |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 505 | EnableSpokenFeedback(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 high contrast. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 509 | EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 510 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 511 | EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 512 | EXPECT_TRUE(CanCreateMenuItem()); |
| 513 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 514 | // The menu remains visible regardless of toggling screen magnifier. |
[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] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 517 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 518 | EXPECT_TRUE(CanCreateMenuItem()); |
| 519 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 520 | // The menu remains visible regardless of toggling on-screen keyboard. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 521 | EnableVirtualKeyboard(true); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 522 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 523 | EnableVirtualKeyboard(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 524 | EXPECT_TRUE(CanCreateMenuItem()); |
| 525 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 526 | // The menu remains visible regardless of toggling large mouse cursor. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 527 | EnableLargeCursor(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 528 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 529 | EnableLargeCursor(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 530 | EXPECT_TRUE(CanCreateMenuItem()); |
| 531 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 532 | // The menu remains visible regardless of toggling mono audio. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 533 | EnableMonoAudio(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 534 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 535 | EnableMonoAudio(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 536 | EXPECT_TRUE(CanCreateMenuItem()); |
| 537 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 538 | // The menu remains visible regardless of toggling caret highlight. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 539 | SetCaretHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 540 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 541 | SetCaretHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 542 | EXPECT_TRUE(CanCreateMenuItem()); |
| 543 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 544 | // The menu remains visible regardless of toggling highlight mouse cursor. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 545 | SetCursorHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 546 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 547 | SetCursorHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 548 | EXPECT_TRUE(CanCreateMenuItem()); |
| 549 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 550 | // The menu remains visible regardless of toggling highlight keyboard focus. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 551 | SetFocusHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 552 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 553 | SetFocusHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 554 | EXPECT_TRUE(CanCreateMenuItem()); |
| 555 | |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 556 | // The menu remains visible regardless of toggling sticky keys. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 557 | EnableStickyKeys(true); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 558 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 559 | EnableStickyKeys(false); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 560 | EXPECT_TRUE(CanCreateMenuItem()); |
| 561 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 562 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 563 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 564 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 565 | EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 566 | EXPECT_TRUE(CanCreateMenuItem()); |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 567 | EnableSpokenFeedback(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 568 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 569 | EnableVirtualKeyboard(true); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 570 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 571 | EnableLargeCursor(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 572 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 573 | EnableMonoAudio(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 574 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 575 | SetCaretHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 576 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 577 | SetCursorHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 578 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 579 | SetFocusHighlightEnabled(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 580 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 581 | EnableStickyKeys(true); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 582 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 583 | EnableVirtualKeyboard(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 584 | EXPECT_TRUE(CanCreateMenuItem()); |
Qiang Xu | 60e7903 | 2018-03-29 08:18:31 | [diff] [blame] | 585 | EnableSpokenFeedback(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 586 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 587 | EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 588 | EXPECT_TRUE(CanCreateMenuItem()); |
[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(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 591 | EnableLargeCursor(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 592 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 593 | EnableMonoAudio(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 594 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 595 | SetCaretHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 596 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 597 | SetCursorHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 598 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 599 | SetFocusHighlightEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 600 | EXPECT_TRUE(CanCreateMenuItem()); |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 601 | EnableStickyKeys(false); |
minch | d9d54248 | 2017-04-07 19:29:56 | [diff] [blame] | 602 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 603 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 604 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 605 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 606 | // Confirms that the menu remains visible. |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 607 | EXPECT_TRUE(CanCreateMenuItem()); |
| 608 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 609 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 610 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 611 | // Confirms that the menu remains visible. |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 612 | EXPECT_TRUE(CanCreateMenuItem()); |
| 613 | } |
| 614 | |
James Cook | 78a058bc | 2018-03-09 21:09:44 | [diff] [blame] | 615 | // TODO: Move to ash_unittests. |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 616 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { |
Tetsui Ohkubo | 8b83e531 | 2018-06-07 01:26:23 | [diff] [blame] | 617 | // TODO(tetsui): Restore after AccessibilityManager is moved to ash. |
| 618 | // https://crbug.com/850014 |
| 619 | if (ash::features::IsSystemTrayUnifiedEnabled()) |
| 620 | return; |
| 621 | |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 622 | // Enables high contrast mode. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 623 | EnableHighContrast(true); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 624 | EXPECT_TRUE(CanCreateMenuItem()); |
| 625 | |
| 626 | // Locks the screen. |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 627 | SetLoginStatus(ash::LoginStatus::LOCKED); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 628 | EXPECT_TRUE(CanCreateMenuItem()); |
| 629 | |
| 630 | // Disables high contrast mode. |
James Cook | 928f23c | 2017-11-09 22:45:50 | [diff] [blame] | 631 | EnableHighContrast(false); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 632 | |
| 633 | // Confirms that the menu is still visible. |
| 634 | EXPECT_TRUE(CanCreateMenuItem()); |
| 635 | } |
| 636 | |
Sammie Quon | b5f32e0 | 2017-10-10 19:16:12 | [diff] [blame] | 637 | // Verify that the accessiblity system detailed menu remains open when an item |
| 638 | // is selected or deselected. |
James Cook | 78a058bc | 2018-03-09 21:09:44 | [diff] [blame] | 639 | // TODO: Move to ash_unittests. |
Sammie Quon | b5f32e0 | 2017-10-10 19:16:12 | [diff] [blame] | 640 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, DetailMenuRemainsOpen) { |
Tetsui Ohkubo | 8b83e531 | 2018-06-07 01:26:23 | [diff] [blame] | 641 | // TODO(tetsui): Restore after AccessibilityManager is moved to ash. |
| 642 | // https://crbug.com/850014 |
| 643 | if (ash::features::IsSystemTrayUnifiedEnabled()) |
| 644 | return; |
| 645 | |
Sammie Quon | b5f32e0 | 2017-10-10 19:16:12 | [diff] [blame] | 646 | EXPECT_TRUE(CreateDetailedMenu()); |
Sammie Quon | b5f32e0 | 2017-10-10 19:16:12 | [diff] [blame] | 647 | |
| 648 | ClickAutoclickOnDetailMenu(); |
| 649 | EXPECT_TRUE(IsAutoclickEnabledOnDetailMenu()); |
| 650 | { |
| 651 | base::RunLoop run_loop; |
| 652 | run_loop.RunUntilIdle(); |
| 653 | } |
| 654 | EXPECT_TRUE(GetDetailedMenu()); |
| 655 | |
| 656 | ClickAutoclickOnDetailMenu(); |
| 657 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 658 | { |
| 659 | base::RunLoop run_loop; |
| 660 | run_loop.RunUntilIdle(); |
| 661 | } |
| 662 | EXPECT_TRUE(GetDetailedMenu()); |
| 663 | } |
| 664 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 665 | INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, |
| 666 | TrayAccessibilityTest, |
| 667 | testing::Values(PREF_SERVICE, |
| 668 | POLICY)); |
| 669 | |
[email protected] | cce1bad6 | 2013-01-04 02:26:38 | [diff] [blame] | 670 | } // namespace chromeos |