blob: 7e4a90e4eaaaac49147ab5e9957dbd548732b2de [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]7570bba2014-08-08 08:04:4710#include "ash/test/shell_test_api.h"
11#include "ash/test/test_session_state_delegate.h"
[email protected]aecb6082013-07-09 14:29:4112#include "base/callback.h"
[email protected]806d94e2012-12-16 20:31:2613#include "base/command_line.h"
[email protected]a81b2c32014-03-28 06:35:0114#include "base/strings/utf_string_conversions.h"
[email protected]806d94e2012-12-16 20:31:2615#include "chrome/browser/browser_process.h"
[email protected]fdf40f3e2013-07-11 23:55:4616#include "chrome/browser/chrome_notification_types.h"
[email protected]1dfebfc2013-06-04 03:14:3217#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
[email protected]806d94e2012-12-16 20:31:2618#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
[email protected]806d94e2012-12-16 20:31:2619#include "chrome/browser/chromeos/login/helper.h"
[email protected]aa8328fb2013-04-19 15:09:0620#include "chrome/browser/chromeos/login/startup_utils.h"
[email protected]a81b2c32014-03-28 06:35:0121#include "chrome/browser/extensions/api/braille_display_private/mock_braille_controller.h"
[email protected]806d94e2012-12-16 20:31:2622#include "chrome/browser/profiles/profile.h"
23#include "chrome/browser/profiles/profile_manager.h"
[email protected]806d94e2012-12-16 20:31:2624#include "chrome/common/chrome_switches.h"
25#include "chrome/common/pref_names.h"
[email protected]0b294be2013-08-17 02:18:4126#include "chrome/test/base/in_process_browser_test.h"
[email protected]806d94e2012-12-16 20:31:2627#include "chrome/test/base/testing_profile.h"
[email protected]931d1042013-04-05 17:50:4428#include "chromeos/chromeos_switches.h"
[email protected]97275822014-01-21 19:30:3629#include "components/policy/core/browser/browser_policy_connector.h"
[email protected]c4a138a2013-11-21 19:54:5730#include "components/policy/core/common/external_data_fetcher.h"
[email protected]f20a3a22013-12-03 16:12:3731#include "components/policy/core/common/mock_configuration_policy_provider.h"
[email protected]c4a138a2013-11-21 19:54:5732#include "components/policy/core/common/policy_map.h"
33#include "components/policy/core/common/policy_types.h"
brettwb1fc1b82016-02-02 00:19:0834#include "components/prefs/pref_service.h"
[email protected]4d390782014-08-15 09:22:5835#include "components/user_manager/user_manager.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
dchengc97a0282015-01-15 23:04:2470 void SetUpInProcessBrowserTestFixture() override {
[email protected]5ace0c232013-05-29 00:48:4171 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
dchengc97a0282015-01-15 23:04:2477 void SetUpCommandLine(base::CommandLine* command_line) override {
[email protected]806d94e2012-12-16 20:31:2678 command_line->AppendSwitch(switches::kLoginManager);
79 command_line->AppendSwitchASCII(switches::kLoginProfile,
80 TestingProfile::kTestUserProfileDir);
81 }
82
dchengc97a0282015-01-15 23:04:2483 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
dchengc97a0282015-01-15 23:04:2488 void RunTestOnMainThreadLoop() override {
[email protected]25cf28e2013-03-25 19:26:2589 // 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
dchengc97a0282015-01-15 23:04:2494 void TearDownOnMainThread() override {
[email protected]a81b2c32014-03-28 06:35:0195 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,
fhorschig64834b712015-09-21 14:20:23107 policy::POLICY_SOURCE_CLOUD,
[email protected]012d1312014-07-17 06:37:40108 new base::FundamentalValue(value),
[email protected]aecb6082013-07-09 14:29:41109 NULL);
[email protected]5ace0c232013-05-29 00:48:41110 provider_.UpdateChromePolicy(policy_map);
111 base::RunLoop().RunUntilIdle();
112 } else {
113 FAIL() << "Unknown test parameterization";
114 }
115 }
116
[email protected]093b8d642014-04-03 20:59:28117 ash::TrayAccessibility* tray() {
[email protected]806d94e2012-12-16 20:31:26118 return ash::Shell::GetInstance()->GetPrimarySystemTray()->
119 GetTrayAccessibilityForTest();
120 }
121
[email protected]093b8d642014-04-03 20:59:28122 const ash::TrayAccessibility* tray() const {
[email protected]a81b2c32014-03-28 06:35:01123 return ash::Shell::GetInstance()
124 ->GetPrimarySystemTray()
125 ->GetTrayAccessibilityForTest();
[email protected]806d94e2012-12-16 20:31:26126 }
127
[email protected]a81b2c32014-03-28 06:35:01128 bool IsTrayIconVisible() const { return tray()->tray_icon_visible_; }
129
[email protected]806d94e2012-12-16 20:31:26130 views::View* CreateMenuItem() {
131 return tray()->CreateDefaultView(GetLoginStatus());
132 }
133
134 void DestroyMenuItem() {
135 return tray()->DestroyDefaultView();
136 }
137
138 bool CanCreateMenuItem() {
139 views::View* menu_item_view = CreateMenuItem();
140 DestroyMenuItem();
141 return menu_item_view != NULL;
142 }
143
144 void SetLoginStatus(ash::user::LoginStatus status) {
145 tray()->UpdateAfterLoginStatusChange(status);
146 }
147
148 ash::user::LoginStatus GetLoginStatus() {
149 return tray()->login_;
150 }
151
152 bool CreateDetailedMenu() {
153 tray()->PopupDetailedView(0, false);
154 return tray()->detailed_menu_ != NULL;
155 }
156
157 void CloseDetailMenu() {
158 CHECK(tray()->detailed_menu_);
159 tray()->DestroyDetailedView();
160 tray()->detailed_menu_ = NULL;
161 }
162
163 void ClickSpokenFeedbackOnDetailMenu() {
164 views::View* button = tray()->detailed_menu_->spoken_feedback_view_;
[email protected]abdd0d72014-02-05 17:18:07165 ASSERT_TRUE(button);
[email protected]acd0fd7a2013-03-04 22:00:53166 tray()->detailed_menu_->OnViewClicked(button);
[email protected]806d94e2012-12-16 20:31:26167 }
168
169 void ClickHighContrastOnDetailMenu() {
170 views::View* button = tray()->detailed_menu_->high_contrast_view_;
[email protected]abdd0d72014-02-05 17:18:07171 ASSERT_TRUE(button);
[email protected]acd0fd7a2013-03-04 22:00:53172 tray()->detailed_menu_->OnViewClicked(button);
[email protected]806d94e2012-12-16 20:31:26173 }
174
175 void ClickScreenMagnifierOnDetailMenu() {
176 views::View* button = tray()->detailed_menu_->screen_magnifier_view_;
[email protected]abdd0d72014-02-05 17:18:07177 ASSERT_TRUE(button);
[email protected]acd0fd7a2013-03-04 22:00:53178 tray()->detailed_menu_->OnViewClicked(button);
[email protected]806d94e2012-12-16 20:31:26179 }
180
[email protected]7cfa31a2013-10-23 20:08:13181 void ClickAutoclickOnDetailMenu() {
182 views::View* button = tray()->detailed_menu_->autoclick_view_;
[email protected]abdd0d72014-02-05 17:18:07183 ASSERT_TRUE(button);
184 tray()->detailed_menu_->OnViewClicked(button);
185 }
186
187 void ClickVirtualKeyboardOnDetailMenu() {
188 views::View* button = tray()->detailed_menu_->virtual_keyboard_view_;
189 ASSERT_TRUE(button);
[email protected]7cfa31a2013-10-23 20:08:13190 tray()->detailed_menu_->OnViewClicked(button);
191 }
192
[email protected]a81b2c32014-03-28 06:35:01193 bool IsSpokenFeedbackEnabledOnDetailMenu() const {
[email protected]806d94e2012-12-16 20:31:26194 return tray()->detailed_menu_->spoken_feedback_enabled_;
195 }
196
[email protected]a81b2c32014-03-28 06:35:01197 bool IsHighContrastEnabledOnDetailMenu() const {
[email protected]806d94e2012-12-16 20:31:26198 return tray()->detailed_menu_->high_contrast_enabled_;
199 }
200
[email protected]a81b2c32014-03-28 06:35:01201 bool IsScreenMagnifierEnabledOnDetailMenu() const {
[email protected]806d94e2012-12-16 20:31:26202 return tray()->detailed_menu_->screen_magnifier_enabled_;
203 }
[email protected]5ace0c232013-05-29 00:48:41204
[email protected]a81b2c32014-03-28 06:35:01205 bool IsLargeCursorEnabledOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03206 return tray()->detailed_menu_->large_cursor_enabled_;
207 }
208
[email protected]a81b2c32014-03-28 06:35:01209 bool IsAutoclickEnabledOnDetailMenu() const {
[email protected]7cfa31a2013-10-23 20:08:13210 return tray()->detailed_menu_->autoclick_enabled_;
211 }
[email protected]abdd0d72014-02-05 17:18:07212
[email protected]a81b2c32014-03-28 06:35:01213 bool IsVirtualKeyboardEnabledOnDetailMenu() const {
[email protected]abdd0d72014-02-05 17:18:07214 return tray()->detailed_menu_->virtual_keyboard_enabled_;
215 }
216
[email protected]a81b2c32014-03-28 06:35:01217 bool IsSpokenFeedbackMenuShownOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03218 return tray()->detailed_menu_->spoken_feedback_view_;
219 }
220
[email protected]a81b2c32014-03-28 06:35:01221 bool IsHighContrastMenuShownOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03222 return tray()->detailed_menu_->high_contrast_view_;
223 }
224
[email protected]a81b2c32014-03-28 06:35:01225 bool IsScreenMagnifierMenuShownOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03226 return tray()->detailed_menu_->screen_magnifier_view_;
227 }
228
[email protected]a81b2c32014-03-28 06:35:01229 bool IsLargeCursorMenuShownOnDetailMenu() const {
[email protected]57999022013-06-07 12:52:03230 return tray()->detailed_menu_->large_cursor_view_;
231 }
232
[email protected]a81b2c32014-03-28 06:35:01233 bool IsAutoclickMenuShownOnDetailMenu() const {
[email protected]7cfa31a2013-10-23 20:08:13234 return tray()->detailed_menu_->autoclick_view_;
235 }
236
[email protected]a81b2c32014-03-28 06:35:01237 bool IsVirtualKeyboardMenuShownOnDetailMenu() const {
[email protected]abdd0d72014-02-05 17:18:07238 return tray()->detailed_menu_->virtual_keyboard_view_;
239 }
240
[email protected]7570bba2014-08-08 08:04:47241 bool IsHelpShownOnDetailMenu() const {
242 return tray()->detailed_menu_->help_view_;
243 }
244
245 bool IsSettingsShownOnDetailMenu() const {
246 return tray()->detailed_menu_->settings_view_;
247 }
248
[email protected]a81b2c32014-03-28 06:35:01249 bool IsNotificationShown() const {
250 return (tray()->detailed_popup_ &&
251 !tray()->detailed_popup_->GetWidget()->IsClosed());
252 }
253
254 base::string16 GetNotificationText() const {
255 if (IsNotificationShown())
256 return tray()->detailed_popup_->label_for_test()->text();
257 else
258 return base::string16();
259 }
260
261 void SetBrailleConnected(bool connected) {
262 braille_controller_.SetAvailable(connected);
[email protected]2e5e0b12014-05-07 13:30:20263 braille_controller_.GetObserver()->OnBrailleDisplayStateChanged(
[email protected]a81b2c32014-03-28 06:35:01264 *braille_controller_.GetDisplayState());
265 }
266
[email protected]5ace0c232013-05-29 00:48:41267 policy::MockConfigurationPolicyProvider provider_;
[email protected]a81b2c32014-03-28 06:35:01268 MockBrailleController braille_controller_;
[email protected]806d94e2012-12-16 20:31:26269};
270
[email protected]5ace0c232013-05-29 00:48:41271IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) {
[email protected]806d94e2012-12-16 20:31:26272 EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus());
273
[email protected]4d390782014-08-15 09:22:58274 user_manager::UserManager::Get()->UserLoggedIn(
alemate3ffbde6f2015-11-03 02:02:55275 AccountId::FromUserEmail("[email protected]"), "[email protected]",
276 true);
[email protected]4d390782014-08-15 09:22:58277 user_manager::UserManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26278
279 EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus());
280}
281
yoshiki064fa9e2015-09-04 06:32:45282IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) {
[email protected]806d94e2012-12-16 20:31:26283 SetLoginStatus(ash::user::LOGGED_IN_NONE);
284
285 // Confirms that the icon is invisible before login.
286 EXPECT_FALSE(IsTrayIconVisible());
287
[email protected]4d390782014-08-15 09:22:58288 user_manager::UserManager::Get()->UserLoggedIn(
alemate3ffbde6f2015-11-03 02:02:55289 AccountId::FromUserEmail("[email protected]"), "[email protected]",
290 true);
[email protected]4d390782014-08-15 09:22:58291 user_manager::UserManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26292
293 // Confirms that the icon is invisible just after login.
294 EXPECT_FALSE(IsTrayIconVisible());
295
[email protected]1dfebfc2013-06-04 03:14:32296 // Toggling spoken feedback changes the visibillity of the icon.
297 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03298 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26299 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32300 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03301 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26302 EXPECT_FALSE(IsTrayIconVisible());
303
[email protected]1dfebfc2013-06-04 03:14:32304 // Toggling high contrast the visibillity of the icon.
305 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26306 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32307 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26308 EXPECT_FALSE(IsTrayIconVisible());
309
[email protected]5ace0c232013-05-29 00:48:41310 // Toggling magnifier the visibility of the icon.
[email protected]7585f4c2013-01-10 18:26:41311 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26312 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41313 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26314 EXPECT_FALSE(IsTrayIconVisible());
315
[email protected]abdd0d72014-02-05 17:18:07316 // Toggling the virtual keyboard setting changes the visibility of the a11y
317 // icon.
318 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
319 EXPECT_TRUE(IsTrayIconVisible());
320 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
321 EXPECT_FALSE(IsTrayIconVisible());
322
[email protected]806d94e2012-12-16 20:31:26323 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41324 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26325 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32326 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26327 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32328 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03329 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26330 EXPECT_TRUE(IsTrayIconVisible());
[email protected]abdd0d72014-02-05 17:18:07331 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
332 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32333 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03334 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26335 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32336 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26337 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41338 SetMagnifierEnabled(false);
[email protected]abdd0d72014-02-05 17:18:07339 EXPECT_TRUE(IsTrayIconVisible());
340 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
[email protected]806d94e2012-12-16 20:31:26341 EXPECT_FALSE(IsTrayIconVisible());
342
343 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect
344 // the icon on the tray.
[email protected]5ace0c232013-05-29 00:48:41345 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]1dfebfc2013-06-04 03:14:32346 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26347 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32348 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26349 EXPECT_FALSE(IsTrayIconVisible());
350}
351
yoshiki064fa9e2015-09-04 06:32:45352IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) {
[email protected]806d94e2012-12-16 20:31:26353 // Login
[email protected]4d390782014-08-15 09:22:58354 user_manager::UserManager::Get()->UserLoggedIn(
alemate3ffbde6f2015-11-03 02:02:55355 AccountId::FromUserEmail("[email protected]"), "[email protected]",
356 true);
[email protected]4d390782014-08-15 09:22:58357 user_manager::UserManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26358
[email protected]5ace0c232013-05-29 00:48:41359 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26360
361 // Confirms that the menu is hidden.
362 EXPECT_FALSE(CanCreateMenuItem());
363
[email protected]1dfebfc2013-06-04 03:14:32364 // Toggling spoken feedback changes the visibillity of the menu.
365 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03366 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26367 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32368 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03369 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26370 EXPECT_FALSE(CanCreateMenuItem());
371
[email protected]1dfebfc2013-06-04 03:14:32372 // Toggling high contrast changes the visibillity of the menu.
373 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26374 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32375 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26376 EXPECT_FALSE(CanCreateMenuItem());
377
[email protected]5ace0c232013-05-29 00:48:41378 // Toggling screen magnifier changes the visibility of the menu.
[email protected]7585f4c2013-01-10 18:26:41379 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26380 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41381 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26382 EXPECT_FALSE(CanCreateMenuItem());
383
[email protected]7cfa31a2013-10-23 20:08:13384 // Toggling autoclick changes the visibility of the menu.
385 AccessibilityManager::Get()->EnableAutoclick(true);
386 EXPECT_TRUE(CanCreateMenuItem());
387 AccessibilityManager::Get()->EnableAutoclick(false);
388 EXPECT_FALSE(CanCreateMenuItem());
389
[email protected]abdd0d72014-02-05 17:18:07390 // Toggling virtual keyboard changes the visibility of the menu.
391 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
392 EXPECT_TRUE(CanCreateMenuItem());
393 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
394 EXPECT_FALSE(CanCreateMenuItem());
395
[email protected]806d94e2012-12-16 20:31:26396 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41397 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26398 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32399 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26400 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32401 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03402 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26403 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13404 AccessibilityManager::Get()->EnableAutoclick(true);
405 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07406 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
407 EXPECT_TRUE(CanCreateMenuItem());
408 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
409 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13410 AccessibilityManager::Get()->EnableAutoclick(false);
411 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32412 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03413 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26414 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32415 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26416 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41417 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26418 EXPECT_FALSE(CanCreateMenuItem());
419}
420
yoshiki064fa9e2015-09-04 06:32:45421IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
[email protected]806d94e2012-12-16 20:31:26422 // Login
[email protected]4d390782014-08-15 09:22:58423 user_manager::UserManager::Get()->UserLoggedIn(
alemate3ffbde6f2015-11-03 02:02:55424 AccountId::FromUserEmail("[email protected]"), "[email protected]",
425 true);
[email protected]4d390782014-08-15 09:22:58426 user_manager::UserManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26427
[email protected]5ace0c232013-05-29 00:48:41428 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26429
430 // Confirms that the menu is visible.
431 EXPECT_TRUE(CanCreateMenuItem());
432
[email protected]abdd0d72014-02-05 17:18:07433 // The menu remains visible regardless of toggling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32434 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03435 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26436 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32437 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03438 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26439 EXPECT_TRUE(CanCreateMenuItem());
440
[email protected]abdd0d72014-02-05 17:18:07441 // The menu remains visible regardless of toggling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32442 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26443 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32444 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26445 EXPECT_TRUE(CanCreateMenuItem());
446
[email protected]abdd0d72014-02-05 17:18:07447 // The menu remains visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41448 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26449 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41450 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26451 EXPECT_TRUE(CanCreateMenuItem());
452
[email protected]abdd0d72014-02-05 17:18:07453 // The menu remains visible regardless of toggling autoclick.
[email protected]7cfa31a2013-10-23 20:08:13454 AccessibilityManager::Get()->EnableAutoclick(true);
455 EXPECT_TRUE(CanCreateMenuItem());
456 AccessibilityManager::Get()->EnableAutoclick(false);
457 EXPECT_TRUE(CanCreateMenuItem());
458
[email protected]abdd0d72014-02-05 17:18:07459 // The menu remains visible regardless of toggling on-screen keyboard.
460 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
461 EXPECT_TRUE(CanCreateMenuItem());
462 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
463 EXPECT_TRUE(CanCreateMenuItem());
464
[email protected]806d94e2012-12-16 20:31:26465 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41466 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26467 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32468 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26469 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32470 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03471 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26472 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13473 AccessibilityManager::Get()->EnableAutoclick(true);
474 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07475 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
476 EXPECT_TRUE(CanCreateMenuItem());
477 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
478 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13479 AccessibilityManager::Get()->EnableAutoclick(false);
480 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32481 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03482 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26483 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32484 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26485 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41486 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26487 EXPECT_TRUE(CanCreateMenuItem());
488
[email protected]5ace0c232013-05-29 00:48:41489 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26490
491 // Confirms that the menu is invisible.
492 EXPECT_FALSE(CanCreateMenuItem());
493}
494
[email protected]5ace0c232013-05-29 00:48:41495IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
[email protected]806d94e2012-12-16 20:31:26496 SetLoginStatus(ash::user::LOGGED_IN_NONE);
497
498 // Confirms that the menu is visible.
499 EXPECT_TRUE(CanCreateMenuItem());
500
[email protected]abdd0d72014-02-05 17:18:07501 // The menu remains visible regardless of toggling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32502 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03503 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26504 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32505 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03506 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26507 EXPECT_TRUE(CanCreateMenuItem());
508
[email protected]abdd0d72014-02-05 17:18:07509 // The menu remains visible regardless of toggling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32510 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26511 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32512 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26513 EXPECT_TRUE(CanCreateMenuItem());
514
[email protected]abdd0d72014-02-05 17:18:07515 // The menu remains visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41516 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26517 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41518 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26519 EXPECT_TRUE(CanCreateMenuItem());
520
[email protected]abdd0d72014-02-05 17:18:07521 // The menu remains visible regardless of toggling on-screen keyboard.
522 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
523 EXPECT_TRUE(CanCreateMenuItem());
524 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
525 EXPECT_TRUE(CanCreateMenuItem());
526
[email protected]806d94e2012-12-16 20:31:26527 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41528 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26529 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32530 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26531 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32532 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03533 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26534 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07535 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
536 EXPECT_TRUE(CanCreateMenuItem());
537 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
538 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32539 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03540 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26541 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32542 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26543 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41544 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26545 EXPECT_TRUE(CanCreateMenuItem());
546
[email protected]5ace0c232013-05-29 00:48:41547 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26548
[email protected]abdd0d72014-02-05 17:18:07549 // Confirms that the menu remains visible.
[email protected]806d94e2012-12-16 20:31:26550 EXPECT_TRUE(CanCreateMenuItem());
551
[email protected]5ace0c232013-05-29 00:48:41552 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26553
[email protected]abdd0d72014-02-05 17:18:07554 // Confirms that the menu remains visible.
[email protected]806d94e2012-12-16 20:31:26555 EXPECT_TRUE(CanCreateMenuItem());
556}
557
[email protected]a81b2c32014-03-28 06:35:01558IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowNotification) {
559 const base::string16 BRAILLE_CONNECTED =
560 base::ASCIIToUTF16("Braille display connected.");
561 const base::string16 CHROMEVOX_ENABLED = base::ASCIIToUTF16(
562 "ChromeVox (spoken feedback) is enabled.\nPress Ctrl+Alt+Z to disable.");
563 const base::string16 BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED(
564 BRAILLE_CONNECTED + base::ASCIIToUTF16(" ") + CHROMEVOX_ENABLED);
565
566 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
567
568 // Enabling spoken feedback should show the notification.
569 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03570 true, ui::A11Y_NOTIFICATION_SHOW);
[email protected]a81b2c32014-03-28 06:35:01571 EXPECT_EQ(CHROMEVOX_ENABLED, GetNotificationText());
572
573 // Connecting a braille display when spoken feedback is already enabled
574 // should only show the message about the braille display.
575 SetBrailleConnected(true);
576 EXPECT_EQ(BRAILLE_CONNECTED, GetNotificationText());
577
578 // Neither disconnecting a braille display, nor disabling spoken feedback
579 // should show any notification.
580 SetBrailleConnected(false);
581 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
582 EXPECT_FALSE(IsNotificationShown());
583 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03584 false, ui::A11Y_NOTIFICATION_SHOW);
[email protected]a81b2c32014-03-28 06:35:01585 EXPECT_FALSE(IsNotificationShown());
586 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
587
588 // Connecting a braille display should enable spoken feedback and show
589 // both messages.
590 SetBrailleConnected(true);
591 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
592 EXPECT_EQ(BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED, GetNotificationText());
593}
594
[email protected]5ace0c232013-05-29 00:48:41595IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) {
[email protected]14c95c82013-01-30 06:30:29596 // Enables high contrast mode.
[email protected]1dfebfc2013-06-04 03:14:32597 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]14c95c82013-01-30 06:30:29598 EXPECT_TRUE(CanCreateMenuItem());
599
600 // Locks the screen.
601 SetLoginStatus(ash::user::LOGGED_IN_LOCKED);
602 EXPECT_TRUE(CanCreateMenuItem());
603
604 // Disables high contrast mode.
[email protected]1dfebfc2013-06-04 03:14:32605 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]14c95c82013-01-30 06:30:29606
607 // Confirms that the menu is still visible.
608 EXPECT_TRUE(CanCreateMenuItem());
609}
610
yoshiki82c93e1c2015-09-02 19:33:17611IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ClickDetailMenu) {
612 SetLoginStatus(ash::user::LOGGED_IN_USER);
[email protected]8bacb662013-02-27 03:15:24613
[email protected]806d94e2012-12-16 20:31:26614 // Confirms that the check item toggles the spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32615 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26616
617 EXPECT_TRUE(CreateDetailedMenu());
618 ClickSpokenFeedbackOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32619 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26620
621 EXPECT_TRUE(CreateDetailedMenu());
622 ClickSpokenFeedbackOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32623 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26624
625 // Confirms that the check item toggles the high contrast.
[email protected]1dfebfc2013-06-04 03:14:32626 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26627
628 EXPECT_TRUE(CreateDetailedMenu());
629 ClickHighContrastOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32630 EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26631
632 EXPECT_TRUE(CreateDetailedMenu());
633 ClickHighContrastOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32634 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26635
636 // Confirms that the check item toggles the magnifier.
[email protected]1dfebfc2013-06-04 03:14:32637 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26638
[email protected]7585f4c2013-01-10 18:26:41639 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26640 EXPECT_TRUE(CreateDetailedMenu());
641 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41642 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26643
644 EXPECT_TRUE(CreateDetailedMenu());
645 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41646 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]7cfa31a2013-10-23 20:08:13647
648 // Confirms that the check item toggles autoclick.
649 EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled());
650
651 EXPECT_TRUE(CreateDetailedMenu());
652 ClickAutoclickOnDetailMenu();
653 EXPECT_TRUE(AccessibilityManager::Get()->IsAutoclickEnabled());
654
655 EXPECT_TRUE(CreateDetailedMenu());
656 ClickAutoclickOnDetailMenu();
657 EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled());
[email protected]abdd0d72014-02-05 17:18:07658
659 // Confirms that the check item toggles on-screen keyboard.
660 EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
661
662 EXPECT_TRUE(CreateDetailedMenu());
663 ClickVirtualKeyboardOnDetailMenu();
664 EXPECT_TRUE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
665
666 EXPECT_TRUE(CreateDetailedMenu());
667 ClickVirtualKeyboardOnDetailMenu();
668 EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
[email protected]806d94e2012-12-16 20:31:26669}
670
[email protected]5ace0c232013-05-29 00:48:41671IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
[email protected]57999022013-06-07 12:52:03672 SetLoginStatus(ash::user::LOGGED_IN_NONE);
673
[email protected]806d94e2012-12-16 20:31:26674 // At first, all of the check is unchecked.
675 EXPECT_TRUE(CreateDetailedMenu());
676 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
677 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
678 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03679 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13680 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07681 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26682 CloseDetailMenu();
683
684 // Enabling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32685 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03686 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26687 EXPECT_TRUE(CreateDetailedMenu());
688 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
689 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
690 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03691 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13692 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07693 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26694 CloseDetailMenu();
695
696 // Disabling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32697 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03698 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26699 EXPECT_TRUE(CreateDetailedMenu());
700 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
701 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
702 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03703 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13704 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07705 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26706 CloseDetailMenu();
707
708 // Enabling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32709 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26710 EXPECT_TRUE(CreateDetailedMenu());
711 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
712 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
713 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03714 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13715 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07716 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26717 CloseDetailMenu();
718
719 // Disabling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32720 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26721 EXPECT_TRUE(CreateDetailedMenu());
722 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
723 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
724 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03725 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13726 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07727 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26728 CloseDetailMenu();
729
730 // Enabling full screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41731 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26732 EXPECT_TRUE(CreateDetailedMenu());
733 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
734 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
735 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03736 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13737 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07738 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26739 CloseDetailMenu();
740
741 // Disabling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41742 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26743 EXPECT_TRUE(CreateDetailedMenu());
744 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
745 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
746 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03747 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13748 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07749 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03750 CloseDetailMenu();
751
752 // Enabling large cursor.
753 AccessibilityManager::Get()->EnableLargeCursor(true);
754 EXPECT_TRUE(CreateDetailedMenu());
755 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
756 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
757 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
758 EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13759 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07760 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03761 CloseDetailMenu();
762
763 // Disabling large cursor.
764 AccessibilityManager::Get()->EnableLargeCursor(false);
765 EXPECT_TRUE(CreateDetailedMenu());
766 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
767 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
768 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
769 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13770 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07771 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
772 CloseDetailMenu();
773
774 // Enable on-screen keyboard.
775 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
776 EXPECT_TRUE(CreateDetailedMenu());
777 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
778 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
779 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
780 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
781 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
782 EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu());
783 CloseDetailMenu();
784
785 // Disable on-screen keyboard.
786 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
787 EXPECT_TRUE(CreateDetailedMenu());
788 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
789 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
790 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
791 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
792 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
793 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26794 CloseDetailMenu();
795
796 // Enabling all of the a11y features.
[email protected]1dfebfc2013-06-04 03:14:32797 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03798 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]1dfebfc2013-06-04 03:14:32799 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]7585f4c2013-01-10 18:26:41800 SetMagnifierEnabled(true);
[email protected]57999022013-06-07 12:52:03801 AccessibilityManager::Get()->EnableLargeCursor(true);
[email protected]abdd0d72014-02-05 17:18:07802 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
[email protected]806d94e2012-12-16 20:31:26803 EXPECT_TRUE(CreateDetailedMenu());
804 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
805 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
806 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03807 EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13808 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07809 EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26810 CloseDetailMenu();
811
812 // Disabling all of the a11y features.
[email protected]1dfebfc2013-06-04 03:14:32813 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03814 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]1dfebfc2013-06-04 03:14:32815 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]7585f4c2013-01-10 18:26:41816 SetMagnifierEnabled(false);
[email protected]57999022013-06-07 12:52:03817 AccessibilityManager::Get()->EnableLargeCursor(false);
[email protected]abdd0d72014-02-05 17:18:07818 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
[email protected]806d94e2012-12-16 20:31:26819 EXPECT_TRUE(CreateDetailedMenu());
820 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
821 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
822 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03823 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13824 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07825 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13826 CloseDetailMenu();
827
828 // Autoclick is disabled on login screen.
829 SetLoginStatus(ash::user::LOGGED_IN_USER);
830
831 // Enabling autoclick.
832 AccessibilityManager::Get()->EnableAutoclick(true);
833 EXPECT_TRUE(CreateDetailedMenu());
834 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
835 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
836 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
837 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
838 EXPECT_TRUE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07839 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13840 CloseDetailMenu();
841
842 // Disabling autoclick.
843 AccessibilityManager::Get()->EnableAutoclick(false);
844 EXPECT_TRUE(CreateDetailedMenu());
845 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
846 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
847 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
848 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
849 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07850 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03851 CloseDetailMenu();
852}
853
854IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMenuVisibilityOnDetailMenu) {
855 SetLoginStatus(ash::user::LOGGED_IN_NONE);
856 EXPECT_TRUE(CreateDetailedMenu());
857 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
858 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
859 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
860 EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13861 EXPECT_FALSE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07862 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
[email protected]7570bba2014-08-08 08:04:47863 EXPECT_FALSE(IsHelpShownOnDetailMenu());
864 EXPECT_FALSE(IsSettingsShownOnDetailMenu());
[email protected]57999022013-06-07 12:52:03865 CloseDetailMenu();
866
867 SetLoginStatus(ash::user::LOGGED_IN_USER);
868 EXPECT_TRUE(CreateDetailedMenu());
869 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
870 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
871 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
872 EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13873 EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07874 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
[email protected]7570bba2014-08-08 08:04:47875 EXPECT_TRUE(IsHelpShownOnDetailMenu());
876 EXPECT_TRUE(IsSettingsShownOnDetailMenu());
[email protected]57999022013-06-07 12:52:03877 CloseDetailMenu();
878
879 SetLoginStatus(ash::user::LOGGED_IN_LOCKED);
880 EXPECT_TRUE(CreateDetailedMenu());
881 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
882 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
883 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
884 EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13885 EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07886 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
[email protected]7570bba2014-08-08 08:04:47887 EXPECT_FALSE(IsHelpShownOnDetailMenu());
888 EXPECT_FALSE(IsSettingsShownOnDetailMenu());
889 CloseDetailMenu();
890
891 ash::test::TestSessionStateDelegate* session_state_delegate =
892 new ash::test::TestSessionStateDelegate;
893 ash::test::ShellTestApi test_api(ash::Shell::GetInstance());
894 test_api.SetSessionStateDelegate(session_state_delegate);
895 session_state_delegate->SetUserAddingScreenRunning(true);
896 SetLoginStatus(ash::user::LOGGED_IN_USER);
897 EXPECT_TRUE(CreateDetailedMenu());
898 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
899 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
900 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
901 EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu());
902 EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu());
903 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
904 EXPECT_FALSE(IsHelpShownOnDetailMenu());
905 EXPECT_FALSE(IsSettingsShownOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26906 CloseDetailMenu();
907}
908
[email protected]5ace0c232013-05-29 00:48:41909INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance,
910 TrayAccessibilityTest,
911 testing::Values(PREF_SERVICE,
912 POLICY));
913
[email protected]cce1bad62013-01-04 02:26:38914} // namespace chromeos