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