[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 | 6316a55 | 2017-03-05 21:46:21 | [diff] [blame] | 5 | #include "ash/common/accessibility_types.h" |
| 6 | #include "ash/common/login_status.h" |
James Cook | 6def4d9d | 2017-03-05 22:13:47 | [diff] [blame] | 7 | #include "ash/common/system/tray/system_tray.h" |
| 8 | #include "ash/common/system/tray_accessibility.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 9 | #include "ash/magnifier/magnification_controller.h" |
| 10 | #include "ash/shell.h" |
[email protected] | 7570bba | 2014-08-08 08:04:47 | [diff] [blame] | 11 | #include "ash/test/shell_test_api.h" |
[email protected] | aecb608 | 2013-07-09 14:29:41 | [diff] [blame] | 12 | #include "base/callback.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 13 | #include "base/command_line.h" |
fdoray | ba12142 | 2016-12-23 19:51:48 | [diff] [blame] | 14 | #include "base/memory/ptr_util.h" |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 15 | #include "base/strings/utf_string_conversions.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 16 | #include "chrome/browser/browser_process.h" |
[email protected] | fdf40f3e | 2013-07-11 23:55:46 | [diff] [blame] | 17 | #include "chrome/browser/chrome_notification_types.h" |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 18 | #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 19 | #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 20 | #include "chrome/browser/chromeos/login/helper.h" |
[email protected] | aa8328fb | 2013-04-19 15:09:06 | [diff] [blame] | 21 | #include "chrome/browser/chromeos/login/startup_utils.h" |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 22 | #include "chrome/browser/extensions/api/braille_display_private/mock_braille_controller.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" |
| 27 | #include "chrome/common/pref_names.h" |
[email protected] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 28 | #include "chrome/test/base/in_process_browser_test.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 29 | #include "chrome/test/base/testing_profile.h" |
[email protected] | 931d104 | 2013-04-05 17:50:44 | [diff] [blame] | 30 | #include "chromeos/chromeos_switches.h" |
[email protected] | 9727582 | 2014-01-21 19:30:36 | [diff] [blame] | 31 | #include "components/policy/core/browser/browser_policy_connector.h" |
[email protected] | c4a138a | 2013-11-21 19:54:57 | [diff] [blame] | 32 | #include "components/policy/core/common/external_data_fetcher.h" |
[email protected] | f20a3a2 | 2013-12-03 16:12:37 | [diff] [blame] | 33 | #include "components/policy/core/common/mock_configuration_policy_provider.h" |
[email protected] | c4a138a | 2013-11-21 19:54:57 | [diff] [blame] | 34 | #include "components/policy/core/common/policy_map.h" |
| 35 | #include "components/policy/core/common/policy_types.h" |
brettw | 39d6ba4 | 2016-08-24 16:56:38 | [diff] [blame] | 36 | #include "components/policy/policy_constants.h" |
brettw | b1fc1b8 | 2016-02-02 00:19:08 | [diff] [blame] | 37 | #include "components/prefs/pref_service.h" |
xiyuan | 834f3bc | 2016-10-26 19:40:53 | [diff] [blame] | 38 | #include "components/session_manager/core/session_manager.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 39 | #include "content/public/test/test_utils.h" |
| 40 | #include "testing/gtest/include/gtest/gtest.h" |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 41 | #include "ui/views/controls/button/button.h" |
| 42 | #include "ui/views/controls/button/custom_button.h" |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 43 | #include "ui/views/controls/label.h" |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 44 | #include "ui/views/widget/widget.h" |
| 45 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 46 | using extensions::api::braille_display_private::BrailleObserver; |
| 47 | using extensions::api::braille_display_private::DisplayState; |
| 48 | using extensions::api::braille_display_private::MockBrailleController; |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 49 | using testing::Return; |
| 50 | using testing::_; |
| 51 | using testing::WithParamInterface; |
| 52 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 53 | namespace chromeos { |
| 54 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 55 | enum PrefSettingMechanism { |
| 56 | PREF_SERVICE, |
| 57 | POLICY, |
| 58 | }; |
| 59 | |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 60 | void SetMagnifierEnabled(bool enabled) { |
| 61 | MagnificationManager::Get()->SetMagnifierEnabled(enabled); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 62 | } |
| 63 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 64 | class TrayAccessibilityTest |
[email protected] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 65 | : public InProcessBrowserTest, |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 66 | public WithParamInterface<PrefSettingMechanism> { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 67 | protected: |
| 68 | TrayAccessibilityTest() {} |
| 69 | virtual ~TrayAccessibilityTest() {} |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 70 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 71 | // The profile which should be used by these tests. |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame] | 72 | Profile* GetProfile() { return ProfileManager::GetActiveUserProfile(); } |
| 73 | |
dcheng | c97a028 | 2015-01-15 23:04:24 | [diff] [blame] | 74 | void SetUpInProcessBrowserTestFixture() override { |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 75 | EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 76 | .WillRepeatedly(Return(true)); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 77 | policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 78 | AccessibilityManager::SetBrailleControllerForTest(&braille_controller_); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 79 | } |
| 80 | |
dcheng | c97a028 | 2015-01-15 23:04:24 | [diff] [blame] | 81 | void SetUpCommandLine(base::CommandLine* command_line) override { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 82 | command_line->AppendSwitch(switches::kLoginManager); |
| 83 | command_line->AppendSwitchASCII(switches::kLoginProfile, |
| 84 | TestingProfile::kTestUserProfileDir); |
| 85 | } |
| 86 | |
dcheng | c97a028 | 2015-01-15 23:04:24 | [diff] [blame] | 87 | void SetUpOnMainThread() override { |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame] | 88 | AccessibilityManager::Get()->SetProfileForTest(GetProfile()); |
| 89 | MagnificationManager::Get()->SetProfileForTest(GetProfile()); |
[email protected] | d80f1930 | 2013-06-07 13:12:14 | [diff] [blame] | 90 | } |
| 91 | |
dcheng | c97a028 | 2015-01-15 23:04:24 | [diff] [blame] | 92 | void RunTestOnMainThreadLoop() override { |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 93 | // Need to mark oobe completed to show detailed views. |
[email protected] | aa8328fb | 2013-04-19 15:09:06 | [diff] [blame] | 94 | StartupUtils::MarkOobeCompleted(); |
[email protected] | 0b294be | 2013-08-17 02:18:41 | [diff] [blame] | 95 | InProcessBrowserTest::RunTestOnMainThreadLoop(); |
[email protected] | 25cf28e | 2013-03-25 19:26:25 | [diff] [blame] | 96 | } |
| 97 | |
dcheng | c97a028 | 2015-01-15 23:04:24 | [diff] [blame] | 98 | void TearDownOnMainThread() override { |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 99 | AccessibilityManager::SetBrailleControllerForTest(NULL); |
| 100 | } |
| 101 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 102 | void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) { |
| 103 | if (GetParam() == PREF_SERVICE) { |
[email protected] | 613b3f5 | 2013-12-13 23:37:06 | [diff] [blame] | 104 | PrefService* prefs = GetProfile()->GetPrefs(); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 105 | prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, value); |
| 106 | } else if (GetParam() == POLICY) { |
| 107 | policy::PolicyMap policy_map; |
| 108 | policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu, |
dcheng | 3b344bc2 | 2016-05-10 02:26:09 | [diff] [blame] | 109 | policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
fhorschig | 64834b71 | 2015-09-21 14:20:23 | [diff] [blame] | 110 | policy::POLICY_SOURCE_CLOUD, |
jdoerrie | 23972357 | 2017-03-02 12:09:19 | [diff] [blame] | 111 | base::MakeUnique<base::Value>(value), nullptr); |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 112 | provider_.UpdateChromePolicy(policy_map); |
| 113 | base::RunLoop().RunUntilIdle(); |
| 114 | } else { |
| 115 | FAIL() << "Unknown test parameterization"; |
| 116 | } |
| 117 | } |
| 118 | |
[email protected] | 093b8d64 | 2014-04-03 20:59:28 | [diff] [blame] | 119 | ash::TrayAccessibility* tray() { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 120 | return ash::Shell::GetInstance()->GetPrimarySystemTray()-> |
| 121 | GetTrayAccessibilityForTest(); |
| 122 | } |
| 123 | |
[email protected] | 093b8d64 | 2014-04-03 20:59:28 | [diff] [blame] | 124 | const ash::TrayAccessibility* tray() const { |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 125 | return ash::Shell::GetInstance() |
| 126 | ->GetPrimarySystemTray() |
| 127 | ->GetTrayAccessibilityForTest(); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 128 | } |
| 129 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 130 | bool IsTrayIconVisible() const { return tray()->tray_icon_visible_; } |
| 131 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 132 | views::View* CreateMenuItem() { |
| 133 | return tray()->CreateDefaultView(GetLoginStatus()); |
| 134 | } |
| 135 | |
| 136 | void DestroyMenuItem() { |
| 137 | return tray()->DestroyDefaultView(); |
| 138 | } |
| 139 | |
| 140 | bool CanCreateMenuItem() { |
| 141 | views::View* menu_item_view = CreateMenuItem(); |
| 142 | DestroyMenuItem(); |
| 143 | return menu_item_view != NULL; |
| 144 | } |
| 145 | |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 146 | void SetLoginStatus(ash::LoginStatus status) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 147 | tray()->UpdateAfterLoginStatusChange(status); |
| 148 | } |
| 149 | |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 150 | ash::LoginStatus GetLoginStatus() { return tray()->login_; } |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 151 | |
| 152 | bool CreateDetailedMenu() { |
estade | b0df165 | 2017-03-22 22:41:10 | [diff] [blame] | 153 | tray()->ShowDetailedView(0, false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 154 | return tray()->detailed_menu_ != NULL; |
| 155 | } |
| 156 | |
| 157 | void CloseDetailMenu() { |
| 158 | CHECK(tray()->detailed_menu_); |
| 159 | tray()->DestroyDetailedView(); |
| 160 | tray()->detailed_menu_ = NULL; |
| 161 | } |
| 162 | |
| 163 | void ClickSpokenFeedbackOnDetailMenu() { |
| 164 | views::View* button = tray()->detailed_menu_->spoken_feedback_view_; |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 165 | ASSERT_TRUE(button); |
[email protected] | acd0fd7a | 2013-03-04 22:00:53 | [diff] [blame] | 166 | tray()->detailed_menu_->OnViewClicked(button); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | void ClickHighContrastOnDetailMenu() { |
| 170 | views::View* button = tray()->detailed_menu_->high_contrast_view_; |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 171 | ASSERT_TRUE(button); |
[email protected] | acd0fd7a | 2013-03-04 22:00:53 | [diff] [blame] | 172 | tray()->detailed_menu_->OnViewClicked(button); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | void ClickScreenMagnifierOnDetailMenu() { |
| 176 | views::View* button = tray()->detailed_menu_->screen_magnifier_view_; |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 177 | ASSERT_TRUE(button); |
[email protected] | acd0fd7a | 2013-03-04 22:00:53 | [diff] [blame] | 178 | tray()->detailed_menu_->OnViewClicked(button); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 179 | } |
| 180 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 181 | void ClickAutoclickOnDetailMenu() { |
| 182 | views::View* button = tray()->detailed_menu_->autoclick_view_; |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 183 | ASSERT_TRUE(button); |
| 184 | tray()->detailed_menu_->OnViewClicked(button); |
| 185 | } |
| 186 | |
| 187 | void ClickVirtualKeyboardOnDetailMenu() { |
| 188 | views::View* button = tray()->detailed_menu_->virtual_keyboard_view_; |
| 189 | ASSERT_TRUE(button); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 190 | tray()->detailed_menu_->OnViewClicked(button); |
| 191 | } |
| 192 | |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 193 | void ClickLargeMouseCursorOnDetailMenu() { |
| 194 | views::View* button = tray()->detailed_menu_->large_cursor_view_; |
| 195 | ASSERT_TRUE(button); |
| 196 | tray()->detailed_menu_->OnViewClicked(button); |
| 197 | } |
| 198 | |
| 199 | void ClickMonoAudioOnDetailMenu() { |
| 200 | views::View* button = tray()->detailed_menu_->mono_audio_view_; |
| 201 | ASSERT_TRUE(button); |
| 202 | tray()->detailed_menu_->OnViewClicked(button); |
| 203 | } |
| 204 | |
| 205 | void ClickCaretHighlightOnDetailMenu() { |
| 206 | views::View* button = tray()->detailed_menu_->caret_highlight_view_; |
| 207 | ASSERT_TRUE(button); |
| 208 | tray()->detailed_menu_->OnViewClicked(button); |
| 209 | } |
| 210 | |
| 211 | void ClickHighlightMouseCursorOnDetailMenu() { |
| 212 | views::View* button = tray()->detailed_menu_->highlight_mouse_cursor_view_; |
| 213 | ASSERT_TRUE(button); |
| 214 | tray()->detailed_menu_->OnViewClicked(button); |
| 215 | } |
| 216 | |
| 217 | void ClickHighlishtKeyboardFocusOnDetailMenu() { |
| 218 | views::View* button = |
| 219 | tray()->detailed_menu_->highlight_keyboard_focus_view_; |
| 220 | ASSERT_TRUE(button); |
| 221 | tray()->detailed_menu_->OnViewClicked(button); |
| 222 | } |
| 223 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 224 | bool IsSpokenFeedbackEnabledOnDetailMenu() const { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 225 | return tray()->detailed_menu_->spoken_feedback_enabled_; |
| 226 | } |
| 227 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 228 | bool IsHighContrastEnabledOnDetailMenu() const { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 229 | return tray()->detailed_menu_->high_contrast_enabled_; |
| 230 | } |
| 231 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 232 | bool IsScreenMagnifierEnabledOnDetailMenu() const { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 233 | return tray()->detailed_menu_->screen_magnifier_enabled_; |
| 234 | } |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 235 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 236 | bool IsLargeCursorEnabledOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 237 | return tray()->detailed_menu_->large_cursor_enabled_; |
| 238 | } |
| 239 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 240 | bool IsAutoclickEnabledOnDetailMenu() const { |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 241 | return tray()->detailed_menu_->autoclick_enabled_; |
| 242 | } |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 243 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 244 | bool IsVirtualKeyboardEnabledOnDetailMenu() const { |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 245 | return tray()->detailed_menu_->virtual_keyboard_enabled_; |
| 246 | } |
| 247 | |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 248 | bool IsMonoAudioEnabledOnDetailMenu() const { |
| 249 | return tray()->detailed_menu_->mono_audio_enabled_; |
| 250 | } |
| 251 | |
| 252 | bool IsCaretHighlightEnabledOnDetailMenu() const { |
| 253 | return tray()->detailed_menu_->caret_highlight_enabled_; |
| 254 | } |
| 255 | |
| 256 | bool IsHighlightMouseCursorEnabledOnDetailMenu() const { |
| 257 | return tray()->detailed_menu_->highlight_mouse_cursor_enabled_; |
| 258 | } |
| 259 | |
| 260 | bool IsHighlightKeyboardFocusEnabledOnDetailMenu() const { |
| 261 | return tray()->detailed_menu_->highlight_keyboard_focus_enabled_; |
| 262 | } |
| 263 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 264 | bool IsSpokenFeedbackMenuShownOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 265 | return tray()->detailed_menu_->spoken_feedback_view_; |
| 266 | } |
| 267 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 268 | bool IsHighContrastMenuShownOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 269 | return tray()->detailed_menu_->high_contrast_view_; |
| 270 | } |
| 271 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 272 | bool IsScreenMagnifierMenuShownOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 273 | return tray()->detailed_menu_->screen_magnifier_view_; |
| 274 | } |
| 275 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 276 | bool IsLargeCursorMenuShownOnDetailMenu() const { |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 277 | return tray()->detailed_menu_->large_cursor_view_; |
| 278 | } |
| 279 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 280 | bool IsAutoclickMenuShownOnDetailMenu() const { |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 281 | return tray()->detailed_menu_->autoclick_view_; |
| 282 | } |
| 283 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 284 | bool IsVirtualKeyboardMenuShownOnDetailMenu() const { |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 285 | return tray()->detailed_menu_->virtual_keyboard_view_; |
| 286 | } |
| 287 | |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 288 | bool IsMonoAudioMenuShownOnDetailMenu() const { |
| 289 | return tray()->detailed_menu_->mono_audio_view_; |
| 290 | } |
| 291 | |
| 292 | bool IsCaretHighlightMenuShownOnDetailMenu() const { |
| 293 | return tray()->detailed_menu_->caret_highlight_view_; |
| 294 | } |
| 295 | |
| 296 | bool IsHighlightMouseCursorMenuShownOnDetailMenu() const { |
| 297 | return tray()->detailed_menu_->highlight_mouse_cursor_view_; |
| 298 | } |
| 299 | |
| 300 | bool IsHighlightKeyboardFocusMenuShownOnDetailMenu() const { |
| 301 | return tray()->detailed_menu_->highlight_keyboard_focus_view_; |
| 302 | } |
| 303 | |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 304 | // In material design we show the help button but theme it as disabled if |
mohsen | 6faf4f3 | 2017-02-09 22:09:41 | [diff] [blame] | 305 | // it is not possible to load the help page. |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 306 | bool IsHelpAvailableOnDetailMenu() const { |
mohsen | 6faf4f3 | 2017-02-09 22:09:41 | [diff] [blame] | 307 | return tray()->detailed_menu_->help_view_->state() == |
| 308 | views::Button::STATE_NORMAL; |
[email protected] | 7570bba | 2014-08-08 08:04:47 | [diff] [blame] | 309 | } |
| 310 | |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 311 | // In material design we show the settings button but theme it as disabled if |
mohsen | 6faf4f3 | 2017-02-09 22:09:41 | [diff] [blame] | 312 | // it is not possible to load the settings page. |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 313 | bool IsSettingsAvailableOnDetailMenu() const { |
mohsen | 6faf4f3 | 2017-02-09 22:09:41 | [diff] [blame] | 314 | return tray()->detailed_menu_->settings_view_->state() == |
| 315 | views::Button::STATE_NORMAL; |
[email protected] | 7570bba | 2014-08-08 08:04:47 | [diff] [blame] | 316 | } |
| 317 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 318 | bool IsNotificationShown() const { |
| 319 | return (tray()->detailed_popup_ && |
| 320 | !tray()->detailed_popup_->GetWidget()->IsClosed()); |
| 321 | } |
| 322 | |
| 323 | base::string16 GetNotificationText() const { |
| 324 | if (IsNotificationShown()) |
| 325 | return tray()->detailed_popup_->label_for_test()->text(); |
| 326 | else |
| 327 | return base::string16(); |
| 328 | } |
| 329 | |
| 330 | void SetBrailleConnected(bool connected) { |
| 331 | braille_controller_.SetAvailable(connected); |
[email protected] | 2e5e0b1 | 2014-05-07 13:30:20 | [diff] [blame] | 332 | braille_controller_.GetObserver()->OnBrailleDisplayStateChanged( |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 333 | *braille_controller_.GetDisplayState()); |
| 334 | } |
| 335 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 336 | policy::MockConfigurationPolicyProvider provider_; |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 337 | MockBrailleController braille_controller_; |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 338 | }; |
| 339 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 340 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) { |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 341 | EXPECT_EQ(ash::LoginStatus::NOT_LOGGED_IN, GetLoginStatus()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 342 | |
xiyuan | 30e213c | 2016-11-01 20:00:57 | [diff] [blame] | 343 | session_manager::SessionManager::Get()->CreateSession( |
| 344 | AccountId::FromUserEmail("[email protected]"), "[email protected]"); |
xiyuan | 834f3bc | 2016-10-26 19:40:53 | [diff] [blame] | 345 | session_manager::SessionManager::Get()->SessionStarted(); |
xiyuan | 233f4e7 | 2017-04-06 06:59:56 | [diff] [blame^] | 346 | // Flush to ensure the session state reaches ash and updates login status. |
| 347 | SessionControllerClient::FlushForTesting(); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 348 | |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 349 | EXPECT_EQ(ash::LoginStatus::USER, GetLoginStatus()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 350 | } |
| 351 | |
yoshiki | 064fa9e | 2015-09-04 06:32:45 | [diff] [blame] | 352 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) { |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 353 | SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 354 | |
| 355 | // Confirms that the icon is invisible before login. |
| 356 | EXPECT_FALSE(IsTrayIconVisible()); |
| 357 | |
xiyuan | 30e213c | 2016-11-01 20:00:57 | [diff] [blame] | 358 | session_manager::SessionManager::Get()->CreateSession( |
| 359 | AccountId::FromUserEmail("[email protected]"), "[email protected]"); |
xiyuan | 834f3bc | 2016-10-26 19:40:53 | [diff] [blame] | 360 | session_manager::SessionManager::Get()->SessionStarted(); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 361 | |
| 362 | // Confirms that the icon is invisible just after login. |
| 363 | EXPECT_FALSE(IsTrayIconVisible()); |
| 364 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 365 | // Toggling spoken feedback changes the visibillity of the icon. |
| 366 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 367 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 368 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 369 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 370 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 371 | EXPECT_FALSE(IsTrayIconVisible()); |
| 372 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 373 | // Toggling high contrast the visibillity of the icon. |
| 374 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 375 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 376 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 377 | EXPECT_FALSE(IsTrayIconVisible()); |
| 378 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 379 | // Toggling magnifier the visibility of the icon. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 380 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 381 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 382 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 383 | EXPECT_FALSE(IsTrayIconVisible()); |
| 384 | |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 385 | // Toggling automatic clicks changes the visibility of the icon |
| 386 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 387 | EXPECT_TRUE(IsTrayIconVisible()); |
| 388 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 389 | EXPECT_FALSE(IsTrayIconVisible()); |
| 390 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 391 | // Toggling the virtual keyboard setting changes the visibility of the a11y |
| 392 | // icon. |
| 393 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 394 | EXPECT_TRUE(IsTrayIconVisible()); |
| 395 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 396 | EXPECT_FALSE(IsTrayIconVisible()); |
| 397 | |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 398 | // Toggling the higlight large cursor changes the visibility of the icon |
| 399 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 400 | EXPECT_TRUE(IsTrayIconVisible()); |
| 401 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 402 | EXPECT_FALSE(IsTrayIconVisible()); |
| 403 | |
| 404 | // Toggling the mono audio changes the visibility of the icon |
| 405 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 406 | EXPECT_TRUE(IsTrayIconVisible()); |
| 407 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 408 | EXPECT_FALSE(IsTrayIconVisible()); |
| 409 | |
| 410 | // Toggling the caret highlight changes the visibility of the icon |
| 411 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 412 | EXPECT_TRUE(IsTrayIconVisible()); |
| 413 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 414 | EXPECT_FALSE(IsTrayIconVisible()); |
| 415 | |
| 416 | // Toggling the highlight mouse cursor changes the visibility of the icon |
| 417 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 418 | EXPECT_TRUE(IsTrayIconVisible()); |
| 419 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 420 | EXPECT_FALSE(IsTrayIconVisible()); |
| 421 | |
| 422 | // Toggling the highlight keyboard focus changes the visibility of the icon |
| 423 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
| 424 | EXPECT_TRUE(IsTrayIconVisible()); |
| 425 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
| 426 | EXPECT_FALSE(IsTrayIconVisible()); |
| 427 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 428 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 429 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 430 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 431 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 432 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 433 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 434 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 435 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 436 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 437 | EXPECT_TRUE(IsTrayIconVisible()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 438 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 439 | EXPECT_TRUE(IsTrayIconVisible()); |
| 440 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 441 | EXPECT_TRUE(IsTrayIconVisible()); |
| 442 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 443 | EXPECT_TRUE(IsTrayIconVisible()); |
| 444 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 445 | EXPECT_TRUE(IsTrayIconVisible()); |
| 446 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
| 447 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 448 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 449 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 450 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 451 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 452 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 453 | SetMagnifierEnabled(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 454 | EXPECT_TRUE(IsTrayIconVisible()); |
| 455 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 456 | EXPECT_TRUE(IsTrayIconVisible()); |
| 457 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 458 | EXPECT_TRUE(IsTrayIconVisible()); |
| 459 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 460 | EXPECT_TRUE(IsTrayIconVisible()); |
| 461 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 462 | EXPECT_TRUE(IsTrayIconVisible()); |
| 463 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 464 | EXPECT_TRUE(IsTrayIconVisible()); |
| 465 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 466 | EXPECT_FALSE(IsTrayIconVisible()); |
| 467 | |
| 468 | // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect |
| 469 | // the icon on the tray. |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 470 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 471 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 472 | EXPECT_TRUE(IsTrayIconVisible()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 473 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 474 | EXPECT_FALSE(IsTrayIconVisible()); |
| 475 | } |
| 476 | |
yoshiki | 064fa9e | 2015-09-04 06:32:45 | [diff] [blame] | 477 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 478 | // Login |
xiyuan | 30e213c | 2016-11-01 20:00:57 | [diff] [blame] | 479 | session_manager::SessionManager::Get()->CreateSession( |
| 480 | AccountId::FromUserEmail("[email protected]"), "[email protected]"); |
xiyuan | 834f3bc | 2016-10-26 19:40:53 | [diff] [blame] | 481 | session_manager::SessionManager::Get()->SessionStarted(); |
xiyuan | 233f4e7 | 2017-04-06 06:59:56 | [diff] [blame^] | 482 | // Flush to ensure the session state reaches ash and updates login status. |
| 483 | SessionControllerClient::FlushForTesting(); |
[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 hidden. |
| 488 | EXPECT_FALSE(CanCreateMenuItem()); |
| 489 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 490 | // Toggling spoken feedback changes the visibillity of the menu. |
| 491 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 492 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 493 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 494 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 495 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 496 | EXPECT_FALSE(CanCreateMenuItem()); |
| 497 | |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 498 | // Toggling high contrast changes the visibillity of the menu. |
| 499 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 500 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 501 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 502 | EXPECT_FALSE(CanCreateMenuItem()); |
| 503 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 504 | // Toggling screen magnifier changes the visibility of the menu. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 505 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 506 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 507 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 508 | EXPECT_FALSE(CanCreateMenuItem()); |
| 509 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 510 | // Toggling autoclick changes the visibility of the menu. |
| 511 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 512 | EXPECT_TRUE(CanCreateMenuItem()); |
| 513 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 514 | EXPECT_FALSE(CanCreateMenuItem()); |
| 515 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 516 | // Toggling virtual keyboard changes the visibility of the menu. |
| 517 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 518 | EXPECT_TRUE(CanCreateMenuItem()); |
| 519 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 520 | EXPECT_FALSE(CanCreateMenuItem()); |
| 521 | |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 522 | // Toggling large mouse cursor changes the visibility of the menu. |
| 523 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 524 | EXPECT_TRUE(CanCreateMenuItem()); |
| 525 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 526 | EXPECT_FALSE(CanCreateMenuItem()); |
| 527 | |
| 528 | // Toggling mono audio changes the visibility of the menu. |
| 529 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 530 | EXPECT_TRUE(CanCreateMenuItem()); |
| 531 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 532 | EXPECT_FALSE(CanCreateMenuItem()); |
| 533 | |
| 534 | // Toggling caret highlight changes the visibility of the menu. |
| 535 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 536 | EXPECT_TRUE(CanCreateMenuItem()); |
| 537 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 538 | EXPECT_FALSE(CanCreateMenuItem()); |
| 539 | |
| 540 | // Toggling highlight mouse cursor changes the visibility of the menu. |
| 541 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 542 | EXPECT_TRUE(CanCreateMenuItem()); |
| 543 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 544 | EXPECT_FALSE(CanCreateMenuItem()); |
| 545 | |
| 546 | // Toggling highlight keyboard focus changes the visibility of the menu. |
| 547 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
| 548 | EXPECT_TRUE(CanCreateMenuItem()); |
| 549 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
| 550 | EXPECT_FALSE(CanCreateMenuItem()); |
| 551 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 552 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 553 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 554 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 555 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 556 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 557 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 558 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 559 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 560 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 561 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 562 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 563 | EXPECT_TRUE(CanCreateMenuItem()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 564 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 565 | EXPECT_TRUE(CanCreateMenuItem()); |
| 566 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 567 | EXPECT_TRUE(CanCreateMenuItem()); |
| 568 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 569 | EXPECT_TRUE(CanCreateMenuItem()); |
| 570 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 571 | EXPECT_TRUE(CanCreateMenuItem()); |
| 572 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
| 573 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 574 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 575 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 576 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 577 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 578 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 579 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 580 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 581 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 582 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 583 | SetMagnifierEnabled(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 584 | EXPECT_TRUE(CanCreateMenuItem()); |
| 585 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 586 | EXPECT_TRUE(CanCreateMenuItem()); |
| 587 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 588 | EXPECT_TRUE(CanCreateMenuItem()); |
| 589 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 590 | EXPECT_TRUE(CanCreateMenuItem()); |
| 591 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 592 | EXPECT_TRUE(CanCreateMenuItem()); |
| 593 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 594 | EXPECT_FALSE(CanCreateMenuItem()); |
| 595 | } |
| 596 | |
yoshiki | 064fa9e | 2015-09-04 06:32:45 | [diff] [blame] | 597 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 598 | // Login |
xiyuan | 30e213c | 2016-11-01 20:00:57 | [diff] [blame] | 599 | session_manager::SessionManager::Get()->CreateSession( |
| 600 | AccountId::FromUserEmail("[email protected]"), "[email protected]"); |
xiyuan | 834f3bc | 2016-10-26 19:40:53 | [diff] [blame] | 601 | session_manager::SessionManager::Get()->SessionStarted(); |
xiyuan | 233f4e7 | 2017-04-06 06:59:56 | [diff] [blame^] | 602 | // Flush to ensure the session state reaches ash and updates login status. |
| 603 | SessionControllerClient::FlushForTesting(); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 604 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 605 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 606 | |
| 607 | // Confirms that the menu is visible. |
| 608 | EXPECT_TRUE(CanCreateMenuItem()); |
| 609 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 610 | // The menu remains visible regardless of toggling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 611 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 612 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 613 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 614 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 615 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 616 | EXPECT_TRUE(CanCreateMenuItem()); |
| 617 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 618 | // The menu remains visible regardless of toggling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 619 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 620 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 621 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 622 | EXPECT_TRUE(CanCreateMenuItem()); |
| 623 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 624 | // The menu remains visible regardless of toggling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 625 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 626 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 627 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 628 | EXPECT_TRUE(CanCreateMenuItem()); |
| 629 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 630 | // The menu remains visible regardless of toggling autoclick. |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 631 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 632 | EXPECT_TRUE(CanCreateMenuItem()); |
| 633 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 634 | EXPECT_TRUE(CanCreateMenuItem()); |
| 635 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 636 | // The menu remains visible regardless of toggling on-screen keyboard. |
| 637 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 638 | EXPECT_TRUE(CanCreateMenuItem()); |
| 639 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 640 | EXPECT_TRUE(CanCreateMenuItem()); |
| 641 | |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 642 | // The menu remains visibile regardless of toggling large mouse cursor. |
| 643 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 644 | EXPECT_TRUE(CanCreateMenuItem()); |
| 645 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 646 | EXPECT_TRUE(CanCreateMenuItem()); |
| 647 | |
| 648 | // The menu remains visibile regardless of toggling mono audio. |
| 649 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 650 | EXPECT_TRUE(CanCreateMenuItem()); |
| 651 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 652 | EXPECT_TRUE(CanCreateMenuItem()); |
| 653 | |
| 654 | // The menu remains visibile regardless of toggling caret highlight. |
| 655 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 656 | EXPECT_TRUE(CanCreateMenuItem()); |
| 657 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 658 | EXPECT_TRUE(CanCreateMenuItem()); |
| 659 | |
| 660 | // The menu remains visibile regardless of toggling highlight mouse cursor. |
| 661 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 662 | EXPECT_TRUE(CanCreateMenuItem()); |
| 663 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 664 | EXPECT_TRUE(CanCreateMenuItem()); |
| 665 | |
| 666 | // The menu remains visibile regardless of toggling highlight keyboard focus. |
| 667 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
| 668 | EXPECT_TRUE(CanCreateMenuItem()); |
| 669 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
| 670 | EXPECT_TRUE(CanCreateMenuItem()); |
| 671 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 672 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 673 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 674 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 675 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 676 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 677 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 678 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 679 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 680 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 681 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 682 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 683 | EXPECT_TRUE(CanCreateMenuItem()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 684 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 685 | EXPECT_TRUE(CanCreateMenuItem()); |
| 686 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 687 | EXPECT_TRUE(CanCreateMenuItem()); |
| 688 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 689 | EXPECT_TRUE(CanCreateMenuItem()); |
| 690 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 691 | EXPECT_TRUE(CanCreateMenuItem()); |
| 692 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
| 693 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 694 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 695 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 696 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 697 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 698 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 699 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 700 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 701 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 702 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 703 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 704 | EXPECT_TRUE(CanCreateMenuItem()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 705 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 706 | EXPECT_TRUE(CanCreateMenuItem()); |
| 707 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 708 | EXPECT_TRUE(CanCreateMenuItem()); |
| 709 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 710 | EXPECT_TRUE(CanCreateMenuItem()); |
| 711 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 712 | EXPECT_TRUE(CanCreateMenuItem()); |
| 713 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
| 714 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 715 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 716 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 717 | |
| 718 | // Confirms that the menu is invisible. |
| 719 | EXPECT_FALSE(CanCreateMenuItem()); |
| 720 | } |
| 721 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 722 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 723 | SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 724 | |
| 725 | // Confirms that the menu is visible. |
| 726 | EXPECT_TRUE(CanCreateMenuItem()); |
| 727 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 728 | // The menu remains visible regardless of toggling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 729 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 730 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 731 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 732 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 733 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 734 | EXPECT_TRUE(CanCreateMenuItem()); |
| 735 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 736 | // The menu remains visible regardless of toggling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 737 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 738 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 739 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 740 | EXPECT_TRUE(CanCreateMenuItem()); |
| 741 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 742 | // The menu remains visible regardless of toggling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 743 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 744 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 745 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 746 | EXPECT_TRUE(CanCreateMenuItem()); |
| 747 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 748 | // The menu remains visible regardless of toggling on-screen keyboard. |
| 749 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 750 | EXPECT_TRUE(CanCreateMenuItem()); |
| 751 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 752 | EXPECT_TRUE(CanCreateMenuItem()); |
| 753 | |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 754 | // The menu remains visibile regardless of toggling large mouse cursor. |
| 755 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 756 | EXPECT_TRUE(CanCreateMenuItem()); |
| 757 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 758 | EXPECT_TRUE(CanCreateMenuItem()); |
| 759 | |
| 760 | // The menu remains visibile regardless of toggling mono audio. |
| 761 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 762 | EXPECT_TRUE(CanCreateMenuItem()); |
| 763 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 764 | EXPECT_TRUE(CanCreateMenuItem()); |
| 765 | |
| 766 | // The menu remains visibile regardless of toggling caret highlight. |
| 767 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 768 | EXPECT_TRUE(CanCreateMenuItem()); |
| 769 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 770 | EXPECT_TRUE(CanCreateMenuItem()); |
| 771 | |
| 772 | // The menu remains visibile regardless of toggling highlight mouse cursor. |
| 773 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 774 | EXPECT_TRUE(CanCreateMenuItem()); |
| 775 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 776 | EXPECT_TRUE(CanCreateMenuItem()); |
| 777 | |
| 778 | // The menu remains visibile regardless of toggling highlight keyboard focus. |
| 779 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
| 780 | EXPECT_TRUE(CanCreateMenuItem()); |
| 781 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
| 782 | EXPECT_TRUE(CanCreateMenuItem()); |
| 783 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 784 | // Enabling all accessibility features. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 785 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 786 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 787 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 788 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 789 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 790 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 791 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 792 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 793 | EXPECT_TRUE(CanCreateMenuItem()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 794 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 795 | EXPECT_TRUE(CanCreateMenuItem()); |
| 796 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 797 | EXPECT_TRUE(CanCreateMenuItem()); |
| 798 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 799 | EXPECT_TRUE(CanCreateMenuItem()); |
| 800 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 801 | EXPECT_TRUE(CanCreateMenuItem()); |
| 802 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
| 803 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 804 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 805 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 806 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 807 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 808 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 809 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 810 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 811 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 812 | EXPECT_TRUE(CanCreateMenuItem()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 813 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 814 | EXPECT_TRUE(CanCreateMenuItem()); |
| 815 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 816 | EXPECT_TRUE(CanCreateMenuItem()); |
| 817 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 818 | EXPECT_TRUE(CanCreateMenuItem()); |
| 819 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 820 | EXPECT_TRUE(CanCreateMenuItem()); |
| 821 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
| 822 | EXPECT_TRUE(CanCreateMenuItem()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 823 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 824 | SetShowAccessibilityOptionsInSystemTrayMenu(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 825 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 826 | // Confirms that the menu remains visible. |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 827 | EXPECT_TRUE(CanCreateMenuItem()); |
| 828 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 829 | SetShowAccessibilityOptionsInSystemTrayMenu(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 830 | |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 831 | // Confirms that the menu remains visible. |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 832 | EXPECT_TRUE(CanCreateMenuItem()); |
| 833 | } |
| 834 | |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 835 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowNotification) { |
| 836 | const base::string16 BRAILLE_CONNECTED = |
| 837 | base::ASCIIToUTF16("Braille display connected."); |
| 838 | const base::string16 CHROMEVOX_ENABLED = base::ASCIIToUTF16( |
| 839 | "ChromeVox (spoken feedback) is enabled.\nPress Ctrl+Alt+Z to disable."); |
| 840 | const base::string16 BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED( |
| 841 | BRAILLE_CONNECTED + base::ASCIIToUTF16(" ") + CHROMEVOX_ENABLED); |
| 842 | |
| 843 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 844 | |
| 845 | // Enabling spoken feedback should show the notification. |
| 846 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 847 | true, ash::A11Y_NOTIFICATION_SHOW); |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 848 | EXPECT_EQ(CHROMEVOX_ENABLED, GetNotificationText()); |
| 849 | |
| 850 | // Connecting a braille display when spoken feedback is already enabled |
| 851 | // should only show the message about the braille display. |
| 852 | SetBrailleConnected(true); |
| 853 | EXPECT_EQ(BRAILLE_CONNECTED, GetNotificationText()); |
| 854 | |
| 855 | // Neither disconnecting a braille display, nor disabling spoken feedback |
| 856 | // should show any notification. |
| 857 | SetBrailleConnected(false); |
| 858 | EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 859 | EXPECT_FALSE(IsNotificationShown()); |
| 860 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 861 | false, ash::A11Y_NOTIFICATION_SHOW); |
[email protected] | a81b2c3 | 2014-03-28 06:35:01 | [diff] [blame] | 862 | EXPECT_FALSE(IsNotificationShown()); |
| 863 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 864 | |
| 865 | // Connecting a braille display should enable spoken feedback and show |
| 866 | // both messages. |
| 867 | SetBrailleConnected(true); |
| 868 | EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
| 869 | EXPECT_EQ(BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED, GetNotificationText()); |
| 870 | } |
| 871 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 872 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 873 | // Enables high contrast mode. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 874 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 875 | EXPECT_TRUE(CanCreateMenuItem()); |
| 876 | |
| 877 | // Locks the screen. |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 878 | SetLoginStatus(ash::LoginStatus::LOCKED); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 879 | EXPECT_TRUE(CanCreateMenuItem()); |
| 880 | |
| 881 | // Disables high contrast mode. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 882 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 14c95c8 | 2013-01-30 06:30:29 | [diff] [blame] | 883 | |
| 884 | // Confirms that the menu is still visible. |
| 885 | EXPECT_TRUE(CanCreateMenuItem()); |
| 886 | } |
| 887 | |
yoshiki | 82c93e1c | 2015-09-02 19:33:17 | [diff] [blame] | 888 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ClickDetailMenu) { |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 889 | SetLoginStatus(ash::LoginStatus::USER); |
[email protected] | 8bacb66 | 2013-02-27 03:15:24 | [diff] [blame] | 890 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 891 | // Confirms that the check item toggles the spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 892 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 893 | |
| 894 | EXPECT_TRUE(CreateDetailedMenu()); |
| 895 | ClickSpokenFeedbackOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 896 | EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 897 | |
| 898 | EXPECT_TRUE(CreateDetailedMenu()); |
| 899 | ClickSpokenFeedbackOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 900 | EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 901 | |
| 902 | // Confirms that the check item toggles the high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 903 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 904 | |
| 905 | EXPECT_TRUE(CreateDetailedMenu()); |
| 906 | ClickHighContrastOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 907 | EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 908 | |
| 909 | EXPECT_TRUE(CreateDetailedMenu()); |
| 910 | ClickHighContrastOnDetailMenu(); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 911 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 912 | |
| 913 | // Confirms that the check item toggles the magnifier. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 914 | EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 915 | |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 916 | EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 917 | EXPECT_TRUE(CreateDetailedMenu()); |
| 918 | ClickScreenMagnifierOnDetailMenu(); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 919 | EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 920 | |
| 921 | EXPECT_TRUE(CreateDetailedMenu()); |
| 922 | ClickScreenMagnifierOnDetailMenu(); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 923 | EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 924 | |
| 925 | // Confirms that the check item toggles autoclick. |
| 926 | EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled()); |
| 927 | |
| 928 | EXPECT_TRUE(CreateDetailedMenu()); |
| 929 | ClickAutoclickOnDetailMenu(); |
| 930 | EXPECT_TRUE(AccessibilityManager::Get()->IsAutoclickEnabled()); |
| 931 | |
| 932 | EXPECT_TRUE(CreateDetailedMenu()); |
| 933 | ClickAutoclickOnDetailMenu(); |
| 934 | EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 935 | |
| 936 | // Confirms that the check item toggles on-screen keyboard. |
| 937 | EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled()); |
| 938 | |
| 939 | EXPECT_TRUE(CreateDetailedMenu()); |
| 940 | ClickVirtualKeyboardOnDetailMenu(); |
| 941 | EXPECT_TRUE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled()); |
| 942 | |
| 943 | EXPECT_TRUE(CreateDetailedMenu()); |
| 944 | ClickVirtualKeyboardOnDetailMenu(); |
| 945 | EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 946 | |
| 947 | // Confirms that the check item toggles large mouse cursor. |
| 948 | EXPECT_FALSE(AccessibilityManager::Get()->IsLargeCursorEnabled()); |
| 949 | |
| 950 | EXPECT_TRUE(CreateDetailedMenu()); |
| 951 | ClickLargeMouseCursorOnDetailMenu(); |
| 952 | EXPECT_TRUE(AccessibilityManager::Get()->IsLargeCursorEnabled()); |
| 953 | |
| 954 | EXPECT_TRUE(CreateDetailedMenu()); |
| 955 | ClickLargeMouseCursorOnDetailMenu(); |
| 956 | EXPECT_FALSE(AccessibilityManager::Get()->IsLargeCursorEnabled()); |
| 957 | |
| 958 | // Confirms that the check item toggles mono audio. |
| 959 | EXPECT_FALSE(AccessibilityManager::Get()->IsMonoAudioEnabled()); |
| 960 | |
| 961 | EXPECT_TRUE(CreateDetailedMenu()); |
| 962 | ClickMonoAudioOnDetailMenu(); |
| 963 | EXPECT_TRUE(AccessibilityManager::Get()->IsMonoAudioEnabled()); |
| 964 | |
| 965 | EXPECT_TRUE(CreateDetailedMenu()); |
| 966 | ClickMonoAudioOnDetailMenu(); |
| 967 | EXPECT_FALSE(AccessibilityManager::Get()->IsMonoAudioEnabled()); |
| 968 | |
| 969 | // Confirms that the check item toggles caret highlight. |
| 970 | EXPECT_FALSE(AccessibilityManager::Get()->IsCaretHighlightEnabled()); |
| 971 | |
| 972 | EXPECT_TRUE(CreateDetailedMenu()); |
| 973 | ClickCaretHighlightOnDetailMenu(); |
| 974 | EXPECT_TRUE(AccessibilityManager::Get()->IsCaretHighlightEnabled()); |
| 975 | |
| 976 | EXPECT_TRUE(CreateDetailedMenu()); |
| 977 | ClickCaretHighlightOnDetailMenu(); |
| 978 | EXPECT_FALSE(AccessibilityManager::Get()->IsCaretHighlightEnabled()); |
| 979 | |
| 980 | // Confirms that the check item toggles highlight mouse cursor. |
| 981 | EXPECT_FALSE(AccessibilityManager::Get()->IsCursorHighlightEnabled()); |
| 982 | |
| 983 | EXPECT_TRUE(CreateDetailedMenu()); |
| 984 | ClickHighlightMouseCursorOnDetailMenu(); |
| 985 | EXPECT_TRUE(AccessibilityManager::Get()->IsCursorHighlightEnabled()); |
| 986 | |
| 987 | EXPECT_TRUE(CreateDetailedMenu()); |
| 988 | ClickHighlightMouseCursorOnDetailMenu(); |
| 989 | EXPECT_FALSE(AccessibilityManager::Get()->IsCursorHighlightEnabled()); |
| 990 | |
| 991 | // Confirms that the check item toggles highlight keyboard focus. |
| 992 | EXPECT_FALSE(AccessibilityManager::Get()->IsFocusHighlightEnabled()); |
| 993 | |
| 994 | EXPECT_TRUE(CreateDetailedMenu()); |
| 995 | ClickHighlishtKeyboardFocusOnDetailMenu(); |
| 996 | EXPECT_TRUE(AccessibilityManager::Get()->IsFocusHighlightEnabled()); |
| 997 | |
| 998 | EXPECT_TRUE(CreateDetailedMenu()); |
| 999 | ClickHighlishtKeyboardFocusOnDetailMenu(); |
| 1000 | EXPECT_FALSE(AccessibilityManager::Get()->IsFocusHighlightEnabled()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1001 | } |
| 1002 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 1003 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) { |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 1004 | SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1005 | |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1006 | // At first, all of the check is unchecked. |
| 1007 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1008 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1009 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1010 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1011 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1012 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1013 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1014 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1015 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1016 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1017 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1018 | CloseDetailMenu(); |
| 1019 | |
| 1020 | // Enabling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 1021 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 1022 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1023 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1024 | EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1025 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1026 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1027 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1028 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1029 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1030 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1031 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1032 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1033 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1034 | CloseDetailMenu(); |
| 1035 | |
| 1036 | // Disabling spoken feedback. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 1037 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 1038 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1039 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1040 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1041 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1042 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1043 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1044 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1045 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1046 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1047 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1048 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1049 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1050 | CloseDetailMenu(); |
| 1051 | |
| 1052 | // Enabling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 1053 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1054 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1055 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1056 | EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 1057 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1058 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1059 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1060 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1061 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1062 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1063 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1064 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1065 | CloseDetailMenu(); |
| 1066 | |
| 1067 | // Disabling high contrast. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 1068 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1069 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1070 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1071 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1072 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1073 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1074 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1075 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1076 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1077 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1078 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1079 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1080 | CloseDetailMenu(); |
| 1081 | |
| 1082 | // Enabling full screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 1083 | SetMagnifierEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1084 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1085 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1086 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1087 | EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1088 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1089 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1090 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1091 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1092 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1093 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1094 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1095 | CloseDetailMenu(); |
| 1096 | |
| 1097 | // Disabling screen magnifier. |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 1098 | SetMagnifierEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1099 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1100 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1101 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1102 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1103 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1104 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1105 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1106 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1107 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1108 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1109 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1110 | CloseDetailMenu(); |
| 1111 | |
| 1112 | // Enabling large cursor. |
| 1113 | AccessibilityManager::Get()->EnableLargeCursor(true); |
| 1114 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1115 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1116 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1117 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1118 | EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1119 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1120 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1121 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1122 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1123 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1124 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1125 | CloseDetailMenu(); |
| 1126 | |
| 1127 | // Disabling large cursor. |
| 1128 | AccessibilityManager::Get()->EnableLargeCursor(false); |
| 1129 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1130 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1131 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1132 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1133 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1134 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1135 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1136 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1137 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1138 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1139 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1140 | CloseDetailMenu(); |
| 1141 | |
| 1142 | // Enable on-screen keyboard. |
| 1143 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
| 1144 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1145 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1146 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1147 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1148 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1149 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1150 | EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1151 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1152 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1153 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1154 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1155 | CloseDetailMenu(); |
| 1156 | |
| 1157 | // Disable on-screen keyboard. |
| 1158 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
| 1159 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1160 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1161 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1162 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1163 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1164 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1165 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1166 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1167 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1168 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1169 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
| 1170 | CloseDetailMenu(); |
| 1171 | |
| 1172 | // Enabling mono audio. |
| 1173 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 1174 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1175 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1176 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1177 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1178 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1179 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1180 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 1181 | EXPECT_TRUE(IsMonoAudioEnabledOnDetailMenu()); |
| 1182 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1183 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1184 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
| 1185 | CloseDetailMenu(); |
| 1186 | |
| 1187 | // Disabling mono audio. |
| 1188 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 1189 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1190 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1191 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1192 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1193 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1194 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1195 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 1196 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1197 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1198 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1199 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
| 1200 | CloseDetailMenu(); |
| 1201 | |
| 1202 | // Enabling caret highlight. |
| 1203 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 1204 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1205 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1206 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1207 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1208 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1209 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1210 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 1211 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1212 | EXPECT_TRUE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1213 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1214 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
| 1215 | CloseDetailMenu(); |
| 1216 | |
| 1217 | // Disabling caret highlight. |
| 1218 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 1219 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1220 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1221 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1222 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1223 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1224 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1225 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 1226 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1227 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1228 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1229 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
| 1230 | CloseDetailMenu(); |
| 1231 | |
| 1232 | // Enabling highlight mouse cursor. |
| 1233 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 1234 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1235 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1236 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1237 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1238 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1239 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1240 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 1241 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1242 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1243 | EXPECT_TRUE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1244 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
| 1245 | CloseDetailMenu(); |
| 1246 | |
| 1247 | // Disabling highlight mouse cursor. |
| 1248 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 1249 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1250 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1251 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1252 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1253 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1254 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1255 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 1256 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1257 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1258 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1259 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
| 1260 | CloseDetailMenu(); |
| 1261 | |
| 1262 | // Enabling highlight keyboard focus. |
| 1263 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
| 1264 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1265 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1266 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1267 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1268 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1269 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1270 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 1271 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1272 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1273 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1274 | EXPECT_TRUE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
| 1275 | CloseDetailMenu(); |
| 1276 | |
| 1277 | // Disabling highlight keyboard focus. |
| 1278 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
| 1279 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1280 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1281 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1282 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1283 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1284 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
| 1285 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
| 1286 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1287 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1288 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1289 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1290 | CloseDetailMenu(); |
| 1291 | |
| 1292 | // Enabling all of the a11y features. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 1293 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 1294 | true, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 1295 | AccessibilityManager::Get()->EnableHighContrast(true); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 1296 | SetMagnifierEnabled(true); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1297 | AccessibilityManager::Get()->EnableLargeCursor(true); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1298 | AccessibilityManager::Get()->EnableVirtualKeyboard(true); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1299 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 1300 | AccessibilityManager::Get()->EnableMonoAudio(true); |
| 1301 | AccessibilityManager::Get()->SetCaretHighlightEnabled(true); |
| 1302 | AccessibilityManager::Get()->SetCursorHighlightEnabled(true); |
| 1303 | AccessibilityManager::Get()->SetFocusHighlightEnabled(true); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1304 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1305 | EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1306 | EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
| 1307 | EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1308 | EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1309 | EXPECT_TRUE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1310 | EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1311 | EXPECT_TRUE(IsMonoAudioEnabledOnDetailMenu()); |
| 1312 | EXPECT_TRUE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1313 | EXPECT_TRUE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1314 | // Focus highlighting can't be on when spoken feedback is on |
| 1315 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1316 | CloseDetailMenu(); |
| 1317 | |
| 1318 | // Disabling all of the a11y features. |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 1319 | AccessibilityManager::Get()->EnableSpokenFeedback( |
jamescook | a7f8dab | 2016-06-21 01:44:03 | [diff] [blame] | 1320 | false, ash::A11Y_NOTIFICATION_NONE); |
[email protected] | 1dfebfc | 2013-06-04 03:14:32 | [diff] [blame] | 1321 | AccessibilityManager::Get()->EnableHighContrast(false); |
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 1322 | SetMagnifierEnabled(false); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1323 | AccessibilityManager::Get()->EnableLargeCursor(false); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1324 | AccessibilityManager::Get()->EnableVirtualKeyboard(false); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1325 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 1326 | AccessibilityManager::Get()->EnableMonoAudio(false); |
| 1327 | AccessibilityManager::Get()->SetCaretHighlightEnabled(false); |
| 1328 | AccessibilityManager::Get()->SetCursorHighlightEnabled(false); |
| 1329 | AccessibilityManager::Get()->SetFocusHighlightEnabled(false); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1330 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1331 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1332 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1333 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1334 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1335 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1336 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1337 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1338 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1339 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1340 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1341 | CloseDetailMenu(); |
| 1342 | |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1343 | // Enabling autoclick. |
| 1344 | AccessibilityManager::Get()->EnableAutoclick(true); |
| 1345 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1346 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1347 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1348 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1349 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1350 | EXPECT_TRUE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1351 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1352 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1353 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1354 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1355 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1356 | CloseDetailMenu(); |
| 1357 | |
| 1358 | // Disabling autoclick. |
| 1359 | AccessibilityManager::Get()->EnableAutoclick(false); |
| 1360 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1361 | EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
| 1362 | EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
| 1363 | EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
| 1364 | EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu()); |
| 1365 | EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1366 | EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1367 | EXPECT_FALSE(IsMonoAudioEnabledOnDetailMenu()); |
| 1368 | EXPECT_FALSE(IsCaretHighlightEnabledOnDetailMenu()); |
| 1369 | EXPECT_FALSE(IsHighlightMouseCursorEnabledOnDetailMenu()); |
| 1370 | EXPECT_FALSE(IsHighlightKeyboardFocusEnabledOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1371 | CloseDetailMenu(); |
| 1372 | } |
| 1373 | |
| 1374 | IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMenuVisibilityOnDetailMenu) { |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1375 | // Except help & settings, others should be kept the same |
| 1376 | // in LOGIN | NOT LOGIN | LOCKED. https://crbug.com/632107. |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 1377 | SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1378 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1379 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 1380 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 1381 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1382 | EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1383 | EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu()); |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 1384 | EXPECT_FALSE(IsHelpAvailableOnDetailMenu()); |
| 1385 | EXPECT_FALSE(IsSettingsAvailableOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1386 | EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu()); |
| 1387 | EXPECT_TRUE(IsMonoAudioMenuShownOnDetailMenu()); |
| 1388 | EXPECT_TRUE(IsCaretHighlightMenuShownOnDetailMenu()); |
| 1389 | EXPECT_TRUE(IsHighlightMouseCursorMenuShownOnDetailMenu()); |
| 1390 | EXPECT_TRUE(IsHighlightKeyboardFocusMenuShownOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1391 | CloseDetailMenu(); |
| 1392 | |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 1393 | SetLoginStatus(ash::LoginStatus::USER); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1394 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1395 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 1396 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 1397 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1398 | EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1399 | EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu()); |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 1400 | EXPECT_TRUE(IsHelpAvailableOnDetailMenu()); |
| 1401 | EXPECT_TRUE(IsSettingsAvailableOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1402 | EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu()); |
| 1403 | EXPECT_TRUE(IsMonoAudioMenuShownOnDetailMenu()); |
| 1404 | EXPECT_TRUE(IsCaretHighlightMenuShownOnDetailMenu()); |
| 1405 | EXPECT_TRUE(IsHighlightMouseCursorMenuShownOnDetailMenu()); |
| 1406 | EXPECT_TRUE(IsHighlightKeyboardFocusMenuShownOnDetailMenu()); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1407 | CloseDetailMenu(); |
| 1408 | |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 1409 | SetLoginStatus(ash::LoginStatus::LOCKED); |
[email protected] | 5799902 | 2013-06-07 12:52:03 | [diff] [blame] | 1410 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1411 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 1412 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 1413 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
[email protected] | 7cfa31a | 2013-10-23 20:08:13 | [diff] [blame] | 1414 | EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu()); |
[email protected] | abdd0d7 | 2014-02-05 17:18:07 | [diff] [blame] | 1415 | EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu()); |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 1416 | EXPECT_FALSE(IsHelpAvailableOnDetailMenu()); |
| 1417 | EXPECT_FALSE(IsSettingsAvailableOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1418 | EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu()); |
| 1419 | EXPECT_TRUE(IsMonoAudioMenuShownOnDetailMenu()); |
| 1420 | EXPECT_TRUE(IsCaretHighlightMenuShownOnDetailMenu()); |
| 1421 | EXPECT_TRUE(IsHighlightMouseCursorMenuShownOnDetailMenu()); |
| 1422 | EXPECT_TRUE(IsHighlightKeyboardFocusMenuShownOnDetailMenu()); |
[email protected] | 7570bba | 2014-08-08 08:04:47 | [diff] [blame] | 1423 | CloseDetailMenu(); |
| 1424 | |
xiyuan | f1ff14d | 2017-03-20 20:28:14 | [diff] [blame] | 1425 | session_manager::SessionManager::Get()->SetSessionState( |
| 1426 | session_manager::SessionState::LOGIN_SECONDARY); |
xiyuan | 233f4e7 | 2017-04-06 06:59:56 | [diff] [blame^] | 1427 | // Flush to ensure the session state reaches ash and updates login status. |
| 1428 | SessionControllerClient::FlushForTesting(); |
sky | e79274a | 2016-06-08 05:39:02 | [diff] [blame] | 1429 | SetLoginStatus(ash::LoginStatus::USER); |
[email protected] | 7570bba | 2014-08-08 08:04:47 | [diff] [blame] | 1430 | EXPECT_TRUE(CreateDetailedMenu()); |
| 1431 | EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu()); |
| 1432 | EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu()); |
| 1433 | EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu()); |
[email protected] | 7570bba | 2014-08-08 08:04:47 | [diff] [blame] | 1434 | EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu()); |
| 1435 | EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu()); |
tdanderson | 58114942 | 2016-10-25 21:37:58 | [diff] [blame] | 1436 | EXPECT_FALSE(IsHelpAvailableOnDetailMenu()); |
| 1437 | EXPECT_FALSE(IsSettingsAvailableOnDetailMenu()); |
minch | a0b24ab | 2017-03-31 22:16:01 | [diff] [blame] | 1438 | EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu()); |
| 1439 | EXPECT_TRUE(IsMonoAudioMenuShownOnDetailMenu()); |
| 1440 | EXPECT_TRUE(IsCaretHighlightMenuShownOnDetailMenu()); |
| 1441 | EXPECT_TRUE(IsHighlightMouseCursorMenuShownOnDetailMenu()); |
| 1442 | EXPECT_TRUE(IsHighlightKeyboardFocusMenuShownOnDetailMenu()); |
[email protected] | 806d94e | 2012-12-16 20:31:26 | [diff] [blame] | 1443 | CloseDetailMenu(); |
| 1444 | } |
| 1445 | |
[email protected] | 5ace0c23 | 2013-05-29 00:48:41 | [diff] [blame] | 1446 | INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, |
| 1447 | TrayAccessibilityTest, |
| 1448 | testing::Values(PREF_SERVICE, |
| 1449 | POLICY)); |
| 1450 | |
[email protected] | cce1bad6 | 2013-01-04 02:26:38 | [diff] [blame] | 1451 | } // namespace chromeos |