blob: 3e5d178b5f82d505a6bf46dc7f1311876f6df225 [file] [log] [blame]
[email protected]806d94e2012-12-16 20:31:261// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ash/magnifier/magnification_controller.h"
6#include "ash/shell.h"
7#include "ash/system/tray/system_tray.h"
[email protected]806d94e2012-12-16 20:31:268#include "ash/system/tray_accessibility.h"
9#include "ash/system/user/login_status.h"
[email protected]aecb6082013-07-09 14:29:4110#include "base/callback.h"
[email protected]806d94e2012-12-16 20:31:2611#include "base/command_line.h"
[email protected]3853a4c2013-02-11 17:15:5712#include "base/prefs/pref_service.h"
[email protected]a81b2c32014-03-28 06:35:0113#include "base/strings/utf_string_conversions.h"
[email protected]806d94e2012-12-16 20:31:2614#include "chrome/browser/browser_process.h"
[email protected]fdf40f3e2013-07-11 23:55:4615#include "chrome/browser/chrome_notification_types.h"
[email protected]1dfebfc2013-06-04 03:14:3216#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
[email protected]806d94e2012-12-16 20:31:2617#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
[email protected]806d94e2012-12-16 20:31:2618#include "chrome/browser/chromeos/login/helper.h"
19#include "chrome/browser/chromeos/login/login_utils.h"
[email protected]aa8328fb2013-04-19 15:09:0620#include "chrome/browser/chromeos/login/startup_utils.h"
[email protected]806d94e2012-12-16 20:31:2621#include "chrome/browser/chromeos/login/user_manager.h"
22#include "chrome/browser/chromeos/login/user_manager_impl.h"
[email protected]a81b2c32014-03-28 06:35:0123#include "chrome/browser/extensions/api/braille_display_private/mock_braille_controller.h"
[email protected]806d94e2012-12-16 20:31:2624#include "chrome/browser/profiles/profile.h"
25#include "chrome/browser/profiles/profile_manager.h"
[email protected]806d94e2012-12-16 20:31:2626#include "chrome/common/chrome_switches.h"
27#include "chrome/common/pref_names.h"
[email protected]0b294be2013-08-17 02:18:4128#include "chrome/test/base/in_process_browser_test.h"
[email protected]806d94e2012-12-16 20:31:2629#include "chrome/test/base/testing_profile.h"
[email protected]931d1042013-04-05 17:50:4430#include "chromeos/chromeos_switches.h"
[email protected]97275822014-01-21 19:30:3631#include "components/policy/core/browser/browser_policy_connector.h"
[email protected]c4a138a2013-11-21 19:54:5732#include "components/policy/core/common/external_data_fetcher.h"
[email protected]f20a3a22013-12-03 16:12:3733#include "components/policy/core/common/mock_configuration_policy_provider.h"
[email protected]c4a138a2013-11-21 19:54:5734#include "components/policy/core/common/policy_map.h"
35#include "components/policy/core/common/policy_types.h"
[email protected]806d94e2012-12-16 20:31:2636#include "content/public/test/test_utils.h"
[email protected]5ace0c232013-05-29 00:48:4137#include "policy/policy_constants.h"
[email protected]806d94e2012-12-16 20:31:2638#include "testing/gtest/include/gtest/gtest.h"
[email protected]a81b2c32014-03-28 06:35:0139#include "ui/views/controls/label.h"
[email protected]806d94e2012-12-16 20:31:2640#include "ui/views/widget/widget.h"
41
[email protected]a81b2c32014-03-28 06:35:0142using extensions::api::braille_display_private::BrailleObserver;
43using extensions::api::braille_display_private::DisplayState;
44using extensions::api::braille_display_private::MockBrailleController;
[email protected]5ace0c232013-05-29 00:48:4145using testing::Return;
46using testing::_;
47using testing::WithParamInterface;
48
[email protected]806d94e2012-12-16 20:31:2649namespace chromeos {
50
[email protected]5ace0c232013-05-29 00:48:4151enum PrefSettingMechanism {
52 PREF_SERVICE,
53 POLICY,
54};
55
[email protected]7585f4c2013-01-10 18:26:4156void SetMagnifierEnabled(bool enabled) {
57 MagnificationManager::Get()->SetMagnifierEnabled(enabled);
[email protected]806d94e2012-12-16 20:31:2658}
59
[email protected]5ace0c232013-05-29 00:48:4160class TrayAccessibilityTest
[email protected]0b294be2013-08-17 02:18:4161 : public InProcessBrowserTest,
[email protected]5ace0c232013-05-29 00:48:4162 public WithParamInterface<PrefSettingMechanism> {
[email protected]806d94e2012-12-16 20:31:2663 protected:
64 TrayAccessibilityTest() {}
65 virtual ~TrayAccessibilityTest() {}
[email protected]25cf28e2013-03-25 19:26:2566
[email protected]a81b2c32014-03-28 06:35:0167 // The profile which should be used by these tests.
[email protected]613b3f52013-12-13 23:37:0668 Profile* GetProfile() { return ProfileManager::GetActiveUserProfile(); }
69
[email protected]5ace0c232013-05-29 00:48:4170 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
71 EXPECT_CALL(provider_, IsInitializationComplete(_))
72 .WillRepeatedly(Return(true));
[email protected]5ace0c232013-05-29 00:48:4173 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
[email protected]a81b2c32014-03-28 06:35:0174 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_);
[email protected]5ace0c232013-05-29 00:48:4175 }
76
[email protected]806d94e2012-12-16 20:31:2677 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
78 command_line->AppendSwitch(switches::kLoginManager);
79 command_line->AppendSwitchASCII(switches::kLoginProfile,
80 TestingProfile::kTestUserProfileDir);
81 }
82
[email protected]d80f19302013-06-07 13:12:1483 virtual void SetUpOnMainThread() OVERRIDE {
[email protected]613b3f52013-12-13 23:37:0684 AccessibilityManager::Get()->SetProfileForTest(GetProfile());
85 MagnificationManager::Get()->SetProfileForTest(GetProfile());
[email protected]d80f19302013-06-07 13:12:1486 }
87
[email protected]25cf28e2013-03-25 19:26:2588 virtual void RunTestOnMainThreadLoop() OVERRIDE {
89 // Need to mark oobe completed to show detailed views.
[email protected]aa8328fb2013-04-19 15:09:0690 StartupUtils::MarkOobeCompleted();
[email protected]0b294be2013-08-17 02:18:4191 InProcessBrowserTest::RunTestOnMainThreadLoop();
[email protected]25cf28e2013-03-25 19:26:2592 }
93
[email protected]a81b2c32014-03-28 06:35:0194 virtual void CleanUpOnMainThread() OVERRIDE {
95 AccessibilityManager::SetBrailleControllerForTest(NULL);
96 }
97
[email protected]5ace0c232013-05-29 00:48:4198 void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) {
99 if (GetParam() == PREF_SERVICE) {
[email protected]613b3f52013-12-13 23:37:06100 PrefService* prefs = GetProfile()->GetPrefs();
[email protected]5ace0c232013-05-29 00:48:41101 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, value);
102 } else if (GetParam() == POLICY) {
103 policy::PolicyMap policy_map;
104 policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu,
105 policy::POLICY_LEVEL_MANDATORY,
106 policy::POLICY_SCOPE_USER,
[email protected]aecb6082013-07-09 14:29:41107 base::Value::CreateBooleanValue(value),
108 NULL);
[email protected]5ace0c232013-05-29 00:48:41109 provider_.UpdateChromePolicy(policy_map);
110 base::RunLoop().RunUntilIdle();
111 } else {
112 FAIL() << "Unknown test parameterization";
113 }
114 }
115
[email protected]093b8d642014-04-03 20:59:28116 ash::TrayAccessibility* tray() {
[email protected]806d94e2012-12-16 20:31:26117 return ash::Shell::GetInstance()->GetPrimarySystemTray()->
118 GetTrayAccessibilityForTest();
119 }
120
[email protected]093b8d642014-04-03 20:59:28121 const ash::TrayAccessibility* tray() const {
[email protected]a81b2c32014-03-28 06:35:01122 return ash::Shell::GetInstance()
123 ->GetPrimarySystemTray()
124 ->GetTrayAccessibilityForTest();
[email protected]806d94e2012-12-16 20:31:26125 }
126
[email protected]a81b2c32014-03-28 06:35:01127 bool IsTrayIconVisible() const { return tray()->tray_icon_visible_; }
128
[email protected]806d94e2012-12-16 20:31:26129 views::View* CreateMenuItem() {
130 return tray()->CreateDefaultView(GetLoginStatus());
131 }
132
133 void DestroyMenuItem() {
134 return tray()->DestroyDefaultView();
135 }
136
137 bool CanCreateMenuItem() {
138 views::View* menu_item_view = CreateMenuItem();
139 DestroyMenuItem();
140 return menu_item_view != NULL;
141 }
142
143 void SetLoginStatus(ash::user::LoginStatus status) {
144 tray()->UpdateAfterLoginStatusChange(status);
145 }
146
147 ash::user::LoginStatus GetLoginStatus() {
148 return tray()->login_;
149 }
150
151 bool CreateDetailedMenu() {
152 tray()->PopupDetailedView(0, false);
153 return tray()->detailed_menu_ != NULL;
154 }
155
156 void CloseDetailMenu() {
157 CHECK(tray()->detailed_menu_);
158 tray()->DestroyDetailedView();
159 tray()->detailed_menu_ = NULL;
160 }
161
162 void ClickSpokenFeedbackOnDetailMenu() {
163 views::View* button = tray()->detailed_menu_->spoken_feedback_view_;
[email protected]abdd0d72014-02-05 17:18:07164 ASSERT_TRUE(button);
[email protected]acd0fd7a2013-03-04 22:00:53165 tray()->detailed_menu_->OnViewClicked(button);
[email protected]806d94e2012-12-16 20:31:26166 }
167
168 void ClickHighContrastOnDetailMenu() {
169 views::View* button = tray()->detailed_menu_->high_contrast_view_;
[email protected]abdd0d72014-02-05 17:18:07170 ASSERT_TRUE(button);
[email protected]acd0fd7a2013-03-04 22:00:53171 tray()->detailed_menu_->OnViewClicked(button);
[email protected]806d94e2012-12-16 20:31:26172 }
173
174 void ClickScreenMagnifierOnDetailMenu() {
175 views::View* button = tray()->detailed_menu_->screen_magnifier_view_;
[email protected]abdd0d72014-02-05 17:18:07176 ASSERT_TRUE(button);
[email protected]acd0fd7a2013-03-04 22:00:53177 tray()->detailed_menu_->OnViewClicked(button);
[email protected]806d94e2012-12-16 20:31:26178 }
179
[email protected]7cfa31a2013-10-23 20:08:13180 void ClickAutoclickOnDetailMenu() {
181 views::View* button = tray()->detailed_menu_->autoclick_view_;
[email protected]abdd0d72014-02-05 17:18:07182 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]7cfa31a2013-10-23 20:08:13189 tray()->detailed_menu_->OnViewClicked(button);
190 }
191
[email protected]a81b2c32014-03-28 06:35:01192 bool IsSpokenFeedbackEnabledOnDetailMenu() const {
[email protected]806d94e2012-12-16 20:31:26193 return tray()->detailed_menu_->spoken_feedback_enabled_;
194 }
195
[email protected]a81b2c32014-03-28 06:35:01196 bool IsHighContrastEnabledOnDetailMenu() const {
[email protected]806d94e2012-12-16 20:31:26197 return tray()->detailed_menu_->high_contrast_enabled_;
198 }
199
[email protected]a81b2c32014-03-28 06:35:01200 bool IsScreenMagnifierEnabledOnDetailMenu() const {
[email protected]806d94e2012-12-16 20:31:26201 return tray()->detailed_menu_->screen_magnifier_enabled_;
202 }
[email protected]5ace0c232013-05-29 00:48:41203
[email protected]a81b2c32014-03-28 06:35:01204 bool IsLargeCursorEnabledOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03205 return tray()->detailed_menu_->large_cursor_enabled_;
206 }
207
[email protected]a81b2c32014-03-28 06:35:01208 bool IsAutoclickEnabledOnDetailMenu() const {
[email protected]7cfa31a2013-10-23 20:08:13209 return tray()->detailed_menu_->autoclick_enabled_;
210 }
[email protected]abdd0d72014-02-05 17:18:07211
[email protected]a81b2c32014-03-28 06:35:01212 bool IsVirtualKeyboardEnabledOnDetailMenu() const {
[email protected]abdd0d72014-02-05 17:18:07213 return tray()->detailed_menu_->virtual_keyboard_enabled_;
214 }
215
[email protected]a81b2c32014-03-28 06:35:01216 bool IsSpokenFeedbackMenuShownOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03217 return tray()->detailed_menu_->spoken_feedback_view_;
218 }
219
[email protected]a81b2c32014-03-28 06:35:01220 bool IsHighContrastMenuShownOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03221 return tray()->detailed_menu_->high_contrast_view_;
222 }
223
[email protected]a81b2c32014-03-28 06:35:01224 bool IsScreenMagnifierMenuShownOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03225 return tray()->detailed_menu_->screen_magnifier_view_;
226 }
227
[email protected]a81b2c32014-03-28 06:35:01228 bool IsLargeCursorMenuShownOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03229 return tray()->detailed_menu_->large_cursor_view_;
230 }
231
[email protected]a81b2c32014-03-28 06:35:01232 bool IsAutoclickMenuShownOnDetailMenu() const {
[email protected]7cfa31a2013-10-23 20:08:13233 return tray()->detailed_menu_->autoclick_view_;
234 }
235
[email protected]a81b2c32014-03-28 06:35:01236 bool IsVirtualKeyboardMenuShownOnDetailMenu() const {
[email protected]abdd0d72014-02-05 17:18:07237 return tray()->detailed_menu_->virtual_keyboard_view_;
238 }
239
[email protected]a81b2c32014-03-28 06:35:01240 bool IsNotificationShown() const {
241 return (tray()->detailed_popup_ &&
242 !tray()->detailed_popup_->GetWidget()->IsClosed());
243 }
244
245 base::string16 GetNotificationText() const {
246 if (IsNotificationShown())
247 return tray()->detailed_popup_->label_for_test()->text();
248 else
249 return base::string16();
250 }
251
252 void SetBrailleConnected(bool connected) {
253 braille_controller_.SetAvailable(connected);
[email protected]2e5e0b12014-05-07 13:30:20254 braille_controller_.GetObserver()->OnBrailleDisplayStateChanged(
[email protected]a81b2c32014-03-28 06:35:01255 *braille_controller_.GetDisplayState());
256 }
257
[email protected]5ace0c232013-05-29 00:48:41258 policy::MockConfigurationPolicyProvider provider_;
[email protected]a81b2c32014-03-28 06:35:01259 MockBrailleController braille_controller_;
[email protected]806d94e2012-12-16 20:31:26260};
261
[email protected]5ace0c232013-05-29 00:48:41262IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) {
[email protected]806d94e2012-12-16 20:31:26263 EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus());
264
[email protected]40429592013-03-29 17:52:33265 UserManager::Get()->UserLoggedIn(
266 "[email protected]", "[email protected]", true);
[email protected]806d94e2012-12-16 20:31:26267 UserManager::Get()->SessionStarted();
268
269 EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus());
270}
271
[email protected]5ace0c232013-05-29 00:48:41272IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) {
[email protected]806d94e2012-12-16 20:31:26273 SetLoginStatus(ash::user::LOGGED_IN_NONE);
274
275 // Confirms that the icon is invisible before login.
276 EXPECT_FALSE(IsTrayIconVisible());
277
[email protected]40429592013-03-29 17:52:33278 UserManager::Get()->UserLoggedIn(
279 "[email protected]", "[email protected]", true);
[email protected]806d94e2012-12-16 20:31:26280 UserManager::Get()->SessionStarted();
281
282 // Confirms that the icon is invisible just after login.
283 EXPECT_FALSE(IsTrayIconVisible());
284
[email protected]1dfebfc2013-06-04 03:14:32285 // Toggling spoken feedback changes the visibillity of the icon.
286 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50287 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26288 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32289 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50290 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26291 EXPECT_FALSE(IsTrayIconVisible());
292
[email protected]1dfebfc2013-06-04 03:14:32293 // Toggling high contrast the visibillity of the icon.
294 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26295 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32296 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26297 EXPECT_FALSE(IsTrayIconVisible());
298
[email protected]5ace0c232013-05-29 00:48:41299 // Toggling magnifier the visibility of the icon.
[email protected]7585f4c2013-01-10 18:26:41300 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26301 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41302 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26303 EXPECT_FALSE(IsTrayIconVisible());
304
[email protected]abdd0d72014-02-05 17:18:07305 // Toggling the virtual keyboard setting changes the visibility of the a11y
306 // icon.
307 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
308 EXPECT_TRUE(IsTrayIconVisible());
309 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
310 EXPECT_FALSE(IsTrayIconVisible());
311
[email protected]806d94e2012-12-16 20:31:26312 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41313 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26314 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32315 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26316 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32317 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50318 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26319 EXPECT_TRUE(IsTrayIconVisible());
[email protected]abdd0d72014-02-05 17:18:07320 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
321 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32322 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50323 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26324 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32325 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26326 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41327 SetMagnifierEnabled(false);
[email protected]abdd0d72014-02-05 17:18:07328 EXPECT_TRUE(IsTrayIconVisible());
329 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
[email protected]806d94e2012-12-16 20:31:26330 EXPECT_FALSE(IsTrayIconVisible());
331
332 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect
333 // the icon on the tray.
[email protected]5ace0c232013-05-29 00:48:41334 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]1dfebfc2013-06-04 03:14:32335 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26336 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32337 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26338 EXPECT_FALSE(IsTrayIconVisible());
339}
340
[email protected]5ace0c232013-05-29 00:48:41341IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) {
[email protected]806d94e2012-12-16 20:31:26342 // Login
[email protected]40429592013-03-29 17:52:33343 UserManager::Get()->UserLoggedIn(
344 "[email protected]", "[email protected]", true);
[email protected]806d94e2012-12-16 20:31:26345 UserManager::Get()->SessionStarted();
346
[email protected]5ace0c232013-05-29 00:48:41347 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26348
349 // Confirms that the menu is hidden.
350 EXPECT_FALSE(CanCreateMenuItem());
351
[email protected]1dfebfc2013-06-04 03:14:32352 // Toggling spoken feedback changes the visibillity of the menu.
353 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50354 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26355 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32356 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50357 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26358 EXPECT_FALSE(CanCreateMenuItem());
359
[email protected]1dfebfc2013-06-04 03:14:32360 // Toggling high contrast changes the visibillity of the menu.
361 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26362 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32363 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26364 EXPECT_FALSE(CanCreateMenuItem());
365
[email protected]5ace0c232013-05-29 00:48:41366 // Toggling screen magnifier changes the visibility of the menu.
[email protected]7585f4c2013-01-10 18:26:41367 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26368 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41369 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26370 EXPECT_FALSE(CanCreateMenuItem());
371
[email protected]7cfa31a2013-10-23 20:08:13372 // Toggling autoclick changes the visibility of the menu.
373 AccessibilityManager::Get()->EnableAutoclick(true);
374 EXPECT_TRUE(CanCreateMenuItem());
375 AccessibilityManager::Get()->EnableAutoclick(false);
376 EXPECT_FALSE(CanCreateMenuItem());
377
[email protected]abdd0d72014-02-05 17:18:07378 // Toggling virtual keyboard changes the visibility of the menu.
379 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
380 EXPECT_TRUE(CanCreateMenuItem());
381 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
382 EXPECT_FALSE(CanCreateMenuItem());
383
[email protected]806d94e2012-12-16 20:31:26384 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41385 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26386 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32387 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26388 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32389 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50390 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26391 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13392 AccessibilityManager::Get()->EnableAutoclick(true);
393 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07394 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
395 EXPECT_TRUE(CanCreateMenuItem());
396 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
397 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13398 AccessibilityManager::Get()->EnableAutoclick(false);
399 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32400 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50401 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26402 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32403 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26404 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41405 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26406 EXPECT_FALSE(CanCreateMenuItem());
407}
408
[email protected]5ace0c232013-05-29 00:48:41409IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
[email protected]806d94e2012-12-16 20:31:26410 // Login
[email protected]40429592013-03-29 17:52:33411 UserManager::Get()->UserLoggedIn(
412 "[email protected]", "[email protected]", true);
[email protected]806d94e2012-12-16 20:31:26413 UserManager::Get()->SessionStarted();
414
[email protected]5ace0c232013-05-29 00:48:41415 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26416
417 // Confirms that the menu is visible.
418 EXPECT_TRUE(CanCreateMenuItem());
419
[email protected]abdd0d72014-02-05 17:18:07420 // The menu remains visible regardless of toggling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32421 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50422 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26423 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32424 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50425 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26426 EXPECT_TRUE(CanCreateMenuItem());
427
[email protected]abdd0d72014-02-05 17:18:07428 // The menu remains visible regardless of toggling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32429 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26430 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32431 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26432 EXPECT_TRUE(CanCreateMenuItem());
433
[email protected]abdd0d72014-02-05 17:18:07434 // The menu remains visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41435 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26436 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41437 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26438 EXPECT_TRUE(CanCreateMenuItem());
439
[email protected]abdd0d72014-02-05 17:18:07440 // The menu remains visible regardless of toggling autoclick.
[email protected]7cfa31a2013-10-23 20:08:13441 AccessibilityManager::Get()->EnableAutoclick(true);
442 EXPECT_TRUE(CanCreateMenuItem());
443 AccessibilityManager::Get()->EnableAutoclick(false);
444 EXPECT_TRUE(CanCreateMenuItem());
445
[email protected]abdd0d72014-02-05 17:18:07446 // The menu remains visible regardless of toggling on-screen keyboard.
447 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
448 EXPECT_TRUE(CanCreateMenuItem());
449 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
450 EXPECT_TRUE(CanCreateMenuItem());
451
[email protected]806d94e2012-12-16 20:31:26452 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41453 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26454 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32455 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26456 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32457 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50458 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26459 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13460 AccessibilityManager::Get()->EnableAutoclick(true);
461 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07462 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
463 EXPECT_TRUE(CanCreateMenuItem());
464 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
465 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13466 AccessibilityManager::Get()->EnableAutoclick(false);
467 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32468 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50469 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26470 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32471 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26472 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41473 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26474 EXPECT_TRUE(CanCreateMenuItem());
475
[email protected]5ace0c232013-05-29 00:48:41476 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26477
478 // Confirms that the menu is invisible.
479 EXPECT_FALSE(CanCreateMenuItem());
480}
481
[email protected]5ace0c232013-05-29 00:48:41482IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
[email protected]806d94e2012-12-16 20:31:26483 SetLoginStatus(ash::user::LOGGED_IN_NONE);
484
485 // Confirms that the menu is visible.
486 EXPECT_TRUE(CanCreateMenuItem());
487
[email protected]abdd0d72014-02-05 17:18:07488 // The menu remains visible regardless of toggling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32489 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50490 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26491 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32492 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50493 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26494 EXPECT_TRUE(CanCreateMenuItem());
495
[email protected]abdd0d72014-02-05 17:18:07496 // The menu remains visible regardless of toggling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32497 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26498 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32499 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26500 EXPECT_TRUE(CanCreateMenuItem());
501
[email protected]abdd0d72014-02-05 17:18:07502 // The menu remains visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41503 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26504 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41505 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26506 EXPECT_TRUE(CanCreateMenuItem());
507
[email protected]abdd0d72014-02-05 17:18:07508 // The menu remains visible regardless of toggling on-screen keyboard.
509 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
510 EXPECT_TRUE(CanCreateMenuItem());
511 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
512 EXPECT_TRUE(CanCreateMenuItem());
513
[email protected]806d94e2012-12-16 20:31:26514 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41515 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26516 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32517 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26518 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32519 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50520 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26521 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07522 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
523 EXPECT_TRUE(CanCreateMenuItem());
524 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
525 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32526 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50527 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26528 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32529 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26530 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41531 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26532 EXPECT_TRUE(CanCreateMenuItem());
533
[email protected]5ace0c232013-05-29 00:48:41534 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26535
[email protected]abdd0d72014-02-05 17:18:07536 // Confirms that the menu remains visible.
[email protected]806d94e2012-12-16 20:31:26537 EXPECT_TRUE(CanCreateMenuItem());
538
[email protected]5ace0c232013-05-29 00:48:41539 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26540
[email protected]abdd0d72014-02-05 17:18:07541 // Confirms that the menu remains visible.
[email protected]806d94e2012-12-16 20:31:26542 EXPECT_TRUE(CanCreateMenuItem());
543}
544
[email protected]a81b2c32014-03-28 06:35:01545IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowNotification) {
546 const base::string16 BRAILLE_CONNECTED =
547 base::ASCIIToUTF16("Braille display connected.");
548 const base::string16 CHROMEVOX_ENABLED = base::ASCIIToUTF16(
549 "ChromeVox (spoken feedback) is enabled.\nPress Ctrl+Alt+Z to disable.");
550 const base::string16 BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED(
551 BRAILLE_CONNECTED + base::ASCIIToUTF16(" ") + CHROMEVOX_ENABLED);
552
553 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
554
555 // Enabling spoken feedback should show the notification.
556 AccessibilityManager::Get()->EnableSpokenFeedback(
557 true, ash::A11Y_NOTIFICATION_SHOW);
558 EXPECT_EQ(CHROMEVOX_ENABLED, GetNotificationText());
559
560 // Connecting a braille display when spoken feedback is already enabled
561 // should only show the message about the braille display.
562 SetBrailleConnected(true);
563 EXPECT_EQ(BRAILLE_CONNECTED, GetNotificationText());
564
565 // Neither disconnecting a braille display, nor disabling spoken feedback
566 // should show any notification.
567 SetBrailleConnected(false);
568 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
569 EXPECT_FALSE(IsNotificationShown());
570 AccessibilityManager::Get()->EnableSpokenFeedback(
571 false, ash::A11Y_NOTIFICATION_SHOW);
572 EXPECT_FALSE(IsNotificationShown());
573 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
574
575 // Connecting a braille display should enable spoken feedback and show
576 // both messages.
577 SetBrailleConnected(true);
578 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
579 EXPECT_EQ(BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED, GetNotificationText());
580}
581
[email protected]5ace0c232013-05-29 00:48:41582IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) {
[email protected]14c95c82013-01-30 06:30:29583 // Enables high contrast mode.
[email protected]1dfebfc2013-06-04 03:14:32584 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]14c95c82013-01-30 06:30:29585 EXPECT_TRUE(CanCreateMenuItem());
586
587 // Locks the screen.
588 SetLoginStatus(ash::user::LOGGED_IN_LOCKED);
589 EXPECT_TRUE(CanCreateMenuItem());
590
591 // Disables high contrast mode.
[email protected]1dfebfc2013-06-04 03:14:32592 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]14c95c82013-01-30 06:30:29593
594 // Confirms that the menu is still visible.
595 EXPECT_TRUE(CanCreateMenuItem());
596}
597
[email protected]8bacb662013-02-27 03:15:24598#if defined(OS_CHROMEOS)
599#define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu
600#else
601#define MAYBE_ClickDetailMenu ClickDetailMenu
602#endif
603
[email protected]5ace0c232013-05-29 00:48:41604IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, MAYBE_ClickDetailMenu) {
[email protected]806d94e2012-12-16 20:31:26605 // Confirms that the check item toggles the spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32606 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26607
608 EXPECT_TRUE(CreateDetailedMenu());
609 ClickSpokenFeedbackOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32610 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26611
612 EXPECT_TRUE(CreateDetailedMenu());
613 ClickSpokenFeedbackOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32614 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26615
616 // Confirms that the check item toggles the high contrast.
[email protected]1dfebfc2013-06-04 03:14:32617 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26618
619 EXPECT_TRUE(CreateDetailedMenu());
620 ClickHighContrastOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32621 EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26622
623 EXPECT_TRUE(CreateDetailedMenu());
624 ClickHighContrastOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32625 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26626
627 // Confirms that the check item toggles the magnifier.
[email protected]1dfebfc2013-06-04 03:14:32628 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26629
[email protected]7585f4c2013-01-10 18:26:41630 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26631 EXPECT_TRUE(CreateDetailedMenu());
632 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41633 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26634
635 EXPECT_TRUE(CreateDetailedMenu());
636 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41637 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]7cfa31a2013-10-23 20:08:13638
639 // Confirms that the check item toggles autoclick.
640 EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled());
641
642 EXPECT_TRUE(CreateDetailedMenu());
643 ClickAutoclickOnDetailMenu();
644 EXPECT_TRUE(AccessibilityManager::Get()->IsAutoclickEnabled());
645
646 EXPECT_TRUE(CreateDetailedMenu());
647 ClickAutoclickOnDetailMenu();
648 EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled());
[email protected]abdd0d72014-02-05 17:18:07649
650 // Confirms that the check item toggles on-screen keyboard.
651 EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
652
653 EXPECT_TRUE(CreateDetailedMenu());
654 ClickVirtualKeyboardOnDetailMenu();
655 EXPECT_TRUE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
656
657 EXPECT_TRUE(CreateDetailedMenu());
658 ClickVirtualKeyboardOnDetailMenu();
659 EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
[email protected]806d94e2012-12-16 20:31:26660}
661
[email protected]5ace0c232013-05-29 00:48:41662IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
[email protected]57999022013-06-07 12:52:03663 SetLoginStatus(ash::user::LOGGED_IN_NONE);
664
[email protected]806d94e2012-12-16 20:31:26665 // At first, all of the check is unchecked.
666 EXPECT_TRUE(CreateDetailedMenu());
667 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
668 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
669 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03670 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13671 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07672 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26673 CloseDetailMenu();
674
675 // Enabling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32676 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50677 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26678 EXPECT_TRUE(CreateDetailedMenu());
679 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
680 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
681 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03682 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13683 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07684 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26685 CloseDetailMenu();
686
687 // Disabling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32688 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50689 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26690 EXPECT_TRUE(CreateDetailedMenu());
691 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
692 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
693 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03694 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13695 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07696 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26697 CloseDetailMenu();
698
699 // Enabling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32700 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26701 EXPECT_TRUE(CreateDetailedMenu());
702 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
703 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
704 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03705 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13706 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07707 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26708 CloseDetailMenu();
709
710 // Disabling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32711 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26712 EXPECT_TRUE(CreateDetailedMenu());
713 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
714 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
715 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03716 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13717 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07718 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26719 CloseDetailMenu();
720
721 // Enabling full screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41722 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26723 EXPECT_TRUE(CreateDetailedMenu());
724 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
725 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
726 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03727 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13728 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07729 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26730 CloseDetailMenu();
731
732 // Disabling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41733 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26734 EXPECT_TRUE(CreateDetailedMenu());
735 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
736 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
737 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03738 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13739 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07740 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03741 CloseDetailMenu();
742
743 // Enabling large cursor.
744 AccessibilityManager::Get()->EnableLargeCursor(true);
745 EXPECT_TRUE(CreateDetailedMenu());
746 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
747 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
748 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
749 EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13750 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07751 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03752 CloseDetailMenu();
753
754 // Disabling large cursor.
755 AccessibilityManager::Get()->EnableLargeCursor(false);
756 EXPECT_TRUE(CreateDetailedMenu());
757 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
758 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
759 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
760 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13761 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07762 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
763 CloseDetailMenu();
764
765 // Enable on-screen keyboard.
766 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
767 EXPECT_TRUE(CreateDetailedMenu());
768 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
769 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
770 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
771 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
772 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
773 EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu());
774 CloseDetailMenu();
775
776 // Disable on-screen keyboard.
777 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
778 EXPECT_TRUE(CreateDetailedMenu());
779 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
780 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
781 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
782 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
783 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
784 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26785 CloseDetailMenu();
786
787 // Enabling all of the a11y features.
[email protected]1dfebfc2013-06-04 03:14:32788 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50789 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]1dfebfc2013-06-04 03:14:32790 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]7585f4c2013-01-10 18:26:41791 SetMagnifierEnabled(true);
[email protected]57999022013-06-07 12:52:03792 AccessibilityManager::Get()->EnableLargeCursor(true);
[email protected]abdd0d72014-02-05 17:18:07793 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
[email protected]806d94e2012-12-16 20:31:26794 EXPECT_TRUE(CreateDetailedMenu());
795 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
796 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
797 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03798 EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13799 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07800 EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26801 CloseDetailMenu();
802
803 // Disabling all of the a11y features.
[email protected]1dfebfc2013-06-04 03:14:32804 AccessibilityManager::Get()->EnableSpokenFeedback(
[email protected]681d0532013-06-11 12:52:50805 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]1dfebfc2013-06-04 03:14:32806 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]7585f4c2013-01-10 18:26:41807 SetMagnifierEnabled(false);
[email protected]57999022013-06-07 12:52:03808 AccessibilityManager::Get()->EnableLargeCursor(false);
[email protected]abdd0d72014-02-05 17:18:07809 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
[email protected]806d94e2012-12-16 20:31:26810 EXPECT_TRUE(CreateDetailedMenu());
811 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
812 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
813 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03814 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13815 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07816 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13817 CloseDetailMenu();
818
819 // Autoclick is disabled on login screen.
820 SetLoginStatus(ash::user::LOGGED_IN_USER);
821
822 // Enabling autoclick.
823 AccessibilityManager::Get()->EnableAutoclick(true);
824 EXPECT_TRUE(CreateDetailedMenu());
825 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
826 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
827 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
828 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
829 EXPECT_TRUE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07830 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13831 CloseDetailMenu();
832
833 // Disabling autoclick.
834 AccessibilityManager::Get()->EnableAutoclick(false);
835 EXPECT_TRUE(CreateDetailedMenu());
836 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
837 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
838 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
839 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
840 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07841 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03842 CloseDetailMenu();
843}
844
845IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMenuVisibilityOnDetailMenu) {
846 SetLoginStatus(ash::user::LOGGED_IN_NONE);
847 EXPECT_TRUE(CreateDetailedMenu());
848 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
849 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
850 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
851 EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13852 EXPECT_FALSE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07853 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
[email protected]57999022013-06-07 12:52:03854 CloseDetailMenu();
855
856 SetLoginStatus(ash::user::LOGGED_IN_USER);
857 EXPECT_TRUE(CreateDetailedMenu());
858 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
859 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
860 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
861 EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13862 EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07863 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
[email protected]57999022013-06-07 12:52:03864 CloseDetailMenu();
865
866 SetLoginStatus(ash::user::LOGGED_IN_LOCKED);
867 EXPECT_TRUE(CreateDetailedMenu());
868 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
869 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
870 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
871 EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13872 EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07873 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26874 CloseDetailMenu();
875}
876
[email protected]5ace0c232013-05-29 00:48:41877INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance,
878 TrayAccessibilityTest,
879 testing::Values(PREF_SERVICE,
880 POLICY));
881
[email protected]cce1bad62013-01-04 02:26:38882} // namespace chromeos