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