blob: 391a211559aa5c1a3d5a388b0eb700ab55befc39 [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]3853a4c2013-02-11 17:15:5714#include "base/prefs/pref_service.h"
[email protected]a81b2c32014-03-28 06:35:0115#include "base/strings/utf_string_conversions.h"
[email protected]806d94e2012-12-16 20:31:2616#include "chrome/browser/browser_process.h"
[email protected]fdf40f3e2013-07-11 23:55:4617#include "chrome/browser/chrome_notification_types.h"
[email protected]1dfebfc2013-06-04 03:14:3218#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
[email protected]806d94e2012-12-16 20:31:2619#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
[email protected]806d94e2012-12-16 20:31:2620#include "chrome/browser/chromeos/login/helper.h"
[email protected]aa8328fb2013-04-19 15:09:0621#include "chrome/browser/chromeos/login/startup_utils.h"
[email protected]a81b2c32014-03-28 06:35:0122#include "chrome/browser/extensions/api/braille_display_private/mock_braille_controller.h"
[email protected]806d94e2012-12-16 20:31:2623#include "chrome/browser/profiles/profile.h"
24#include "chrome/browser/profiles/profile_manager.h"
[email protected]806d94e2012-12-16 20:31:2625#include "chrome/common/chrome_switches.h"
26#include "chrome/common/pref_names.h"
[email protected]0b294be2013-08-17 02:18:4127#include "chrome/test/base/in_process_browser_test.h"
[email protected]806d94e2012-12-16 20:31:2628#include "chrome/test/base/testing_profile.h"
[email protected]931d1042013-04-05 17:50:4429#include "chromeos/chromeos_switches.h"
[email protected]97275822014-01-21 19:30:3630#include "components/policy/core/browser/browser_policy_connector.h"
[email protected]c4a138a2013-11-21 19:54:5731#include "components/policy/core/common/external_data_fetcher.h"
[email protected]f20a3a22013-12-03 16:12:3732#include "components/policy/core/common/mock_configuration_policy_provider.h"
[email protected]c4a138a2013-11-21 19:54:5733#include "components/policy/core/common/policy_map.h"
34#include "components/policy/core/common/policy_types.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,
[email protected]012d1312014-07-17 06:37:40107 new base::FundamentalValue(value),
[email protected]aecb6082013-07-09 14:29:41108 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]7570bba2014-08-08 08:04:47240 bool IsHelpShownOnDetailMenu() const {
241 return tray()->detailed_menu_->help_view_;
242 }
243
244 bool IsSettingsShownOnDetailMenu() const {
245 return tray()->detailed_menu_->settings_view_;
246 }
247
[email protected]a81b2c32014-03-28 06:35:01248 bool IsNotificationShown() const {
249 return (tray()->detailed_popup_ &&
250 !tray()->detailed_popup_->GetWidget()->IsClosed());
251 }
252
253 base::string16 GetNotificationText() const {
254 if (IsNotificationShown())
255 return tray()->detailed_popup_->label_for_test()->text();
256 else
257 return base::string16();
258 }
259
260 void SetBrailleConnected(bool connected) {
261 braille_controller_.SetAvailable(connected);
[email protected]2e5e0b12014-05-07 13:30:20262 braille_controller_.GetObserver()->OnBrailleDisplayStateChanged(
[email protected]a81b2c32014-03-28 06:35:01263 *braille_controller_.GetDisplayState());
264 }
265
[email protected]5ace0c232013-05-29 00:48:41266 policy::MockConfigurationPolicyProvider provider_;
[email protected]a81b2c32014-03-28 06:35:01267 MockBrailleController braille_controller_;
[email protected]806d94e2012-12-16 20:31:26268};
269
[email protected]5ace0c232013-05-29 00:48:41270IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) {
[email protected]806d94e2012-12-16 20:31:26271 EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus());
272
[email protected]4d390782014-08-15 09:22:58273 user_manager::UserManager::Get()->UserLoggedIn(
[email protected]40429592013-03-29 17:52:33274 "[email protected]", "[email protected]", true);
[email protected]4d390782014-08-15 09:22:58275 user_manager::UserManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26276
277 EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus());
278}
279
[email protected]c4c0c0a12014-07-23 17:06:02280// http://crbug.com/396342
281IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, DISABLED_ShowTrayIcon) {
[email protected]806d94e2012-12-16 20:31:26282 SetLoginStatus(ash::user::LOGGED_IN_NONE);
283
284 // Confirms that the icon is invisible before login.
285 EXPECT_FALSE(IsTrayIconVisible());
286
[email protected]4d390782014-08-15 09:22:58287 user_manager::UserManager::Get()->UserLoggedIn(
[email protected]40429592013-03-29 17:52:33288 "[email protected]", "[email protected]", true);
[email protected]4d390782014-08-15 09:22:58289 user_manager::UserManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26290
291 // Confirms that the icon is invisible just after login.
292 EXPECT_FALSE(IsTrayIconVisible());
293
[email protected]1dfebfc2013-06-04 03:14:32294 // Toggling spoken feedback changes the visibillity of the icon.
295 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03296 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26297 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32298 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03299 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26300 EXPECT_FALSE(IsTrayIconVisible());
301
[email protected]1dfebfc2013-06-04 03:14:32302 // Toggling high contrast the visibillity of the icon.
303 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26304 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32305 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26306 EXPECT_FALSE(IsTrayIconVisible());
307
[email protected]5ace0c232013-05-29 00:48:41308 // Toggling magnifier the visibility of the icon.
[email protected]7585f4c2013-01-10 18:26:41309 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26310 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41311 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26312 EXPECT_FALSE(IsTrayIconVisible());
313
[email protected]abdd0d72014-02-05 17:18:07314 // Toggling the virtual keyboard setting changes the visibility of the a11y
315 // icon.
316 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
317 EXPECT_TRUE(IsTrayIconVisible());
318 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
319 EXPECT_FALSE(IsTrayIconVisible());
320
[email protected]806d94e2012-12-16 20:31:26321 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41322 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26323 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32324 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26325 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32326 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03327 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26328 EXPECT_TRUE(IsTrayIconVisible());
[email protected]abdd0d72014-02-05 17:18:07329 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
330 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32331 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03332 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26333 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32334 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26335 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41336 SetMagnifierEnabled(false);
[email protected]abdd0d72014-02-05 17:18:07337 EXPECT_TRUE(IsTrayIconVisible());
338 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
[email protected]806d94e2012-12-16 20:31:26339 EXPECT_FALSE(IsTrayIconVisible());
340
341 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect
342 // the icon on the tray.
[email protected]5ace0c232013-05-29 00:48:41343 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]1dfebfc2013-06-04 03:14:32344 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26345 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32346 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26347 EXPECT_FALSE(IsTrayIconVisible());
348}
349
[email protected]c4c0c0a12014-07-23 17:06:02350// http://crbug.com/396342
351IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, DISABLED_ShowMenu) {
[email protected]806d94e2012-12-16 20:31:26352 // Login
[email protected]4d390782014-08-15 09:22:58353 user_manager::UserManager::Get()->UserLoggedIn(
[email protected]40429592013-03-29 17:52:33354 "[email protected]", "[email protected]", true);
[email protected]4d390782014-08-15 09:22:58355 user_manager::UserManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26356
[email protected]5ace0c232013-05-29 00:48:41357 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26358
359 // Confirms that the menu is hidden.
360 EXPECT_FALSE(CanCreateMenuItem());
361
[email protected]1dfebfc2013-06-04 03:14:32362 // Toggling spoken feedback changes the visibillity of the menu.
363 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03364 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26365 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32366 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03367 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26368 EXPECT_FALSE(CanCreateMenuItem());
369
[email protected]1dfebfc2013-06-04 03:14:32370 // Toggling high contrast changes the visibillity of the menu.
371 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26372 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32373 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26374 EXPECT_FALSE(CanCreateMenuItem());
375
[email protected]5ace0c232013-05-29 00:48:41376 // Toggling screen magnifier changes the visibility of the menu.
[email protected]7585f4c2013-01-10 18:26:41377 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26378 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41379 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26380 EXPECT_FALSE(CanCreateMenuItem());
381
[email protected]7cfa31a2013-10-23 20:08:13382 // Toggling autoclick changes the visibility of the menu.
383 AccessibilityManager::Get()->EnableAutoclick(true);
384 EXPECT_TRUE(CanCreateMenuItem());
385 AccessibilityManager::Get()->EnableAutoclick(false);
386 EXPECT_FALSE(CanCreateMenuItem());
387
[email protected]abdd0d72014-02-05 17:18:07388 // Toggling virtual keyboard changes the visibility of the menu.
389 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
390 EXPECT_TRUE(CanCreateMenuItem());
391 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
392 EXPECT_FALSE(CanCreateMenuItem());
393
[email protected]806d94e2012-12-16 20:31:26394 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41395 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26396 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32397 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26398 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32399 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03400 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26401 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13402 AccessibilityManager::Get()->EnableAutoclick(true);
403 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07404 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
405 EXPECT_TRUE(CanCreateMenuItem());
406 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
407 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13408 AccessibilityManager::Get()->EnableAutoclick(false);
409 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32410 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03411 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26412 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32413 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26414 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41415 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26416 EXPECT_FALSE(CanCreateMenuItem());
417}
418
[email protected]c4c0c0a12014-07-23 17:06:02419// http://crbug.com/396318
420IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest,
421 DISABLED_ShowMenuWithShowMenuOption) {
[email protected]806d94e2012-12-16 20:31:26422 // Login
[email protected]4d390782014-08-15 09:22:58423 user_manager::UserManager::Get()->UserLoggedIn(
[email protected]40429592013-03-29 17:52:33424 "[email protected]", "[email protected]", true);
[email protected]4d390782014-08-15 09:22:58425 user_manager::UserManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26426
[email protected]5ace0c232013-05-29 00:48:41427 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26428
429 // Confirms that the menu is visible.
430 EXPECT_TRUE(CanCreateMenuItem());
431
[email protected]abdd0d72014-02-05 17:18:07432 // The menu remains visible regardless of toggling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32433 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03434 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26435 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32436 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03437 false, ui::A11Y_NOTIFICATION_NONE);
[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 high contrast.
[email protected]1dfebfc2013-06-04 03:14:32441 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26442 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32443 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26444 EXPECT_TRUE(CanCreateMenuItem());
445
[email protected]abdd0d72014-02-05 17:18:07446 // The menu remains visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41447 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26448 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41449 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26450 EXPECT_TRUE(CanCreateMenuItem());
451
[email protected]abdd0d72014-02-05 17:18:07452 // The menu remains visible regardless of toggling autoclick.
[email protected]7cfa31a2013-10-23 20:08:13453 AccessibilityManager::Get()->EnableAutoclick(true);
454 EXPECT_TRUE(CanCreateMenuItem());
455 AccessibilityManager::Get()->EnableAutoclick(false);
456 EXPECT_TRUE(CanCreateMenuItem());
457
[email protected]abdd0d72014-02-05 17:18:07458 // The menu remains visible regardless of toggling on-screen keyboard.
459 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
460 EXPECT_TRUE(CanCreateMenuItem());
461 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
462 EXPECT_TRUE(CanCreateMenuItem());
463
[email protected]806d94e2012-12-16 20:31:26464 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41465 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26466 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32467 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26468 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32469 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03470 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26471 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13472 AccessibilityManager::Get()->EnableAutoclick(true);
473 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07474 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
475 EXPECT_TRUE(CanCreateMenuItem());
476 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
477 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13478 AccessibilityManager::Get()->EnableAutoclick(false);
479 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32480 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03481 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26482 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32483 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26484 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41485 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26486 EXPECT_TRUE(CanCreateMenuItem());
487
[email protected]5ace0c232013-05-29 00:48:41488 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26489
490 // Confirms that the menu is invisible.
491 EXPECT_FALSE(CanCreateMenuItem());
492}
493
[email protected]5ace0c232013-05-29 00:48:41494IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
[email protected]806d94e2012-12-16 20:31:26495 SetLoginStatus(ash::user::LOGGED_IN_NONE);
496
497 // Confirms that the menu is visible.
498 EXPECT_TRUE(CanCreateMenuItem());
499
[email protected]abdd0d72014-02-05 17:18:07500 // The menu remains visible regardless of toggling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32501 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03502 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26503 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32504 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03505 false, ui::A11Y_NOTIFICATION_NONE);
[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 high contrast.
[email protected]1dfebfc2013-06-04 03:14:32509 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26510 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32511 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26512 EXPECT_TRUE(CanCreateMenuItem());
513
[email protected]abdd0d72014-02-05 17:18:07514 // The menu remains visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41515 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26516 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41517 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26518 EXPECT_TRUE(CanCreateMenuItem());
519
[email protected]abdd0d72014-02-05 17:18:07520 // The menu remains visible regardless of toggling on-screen keyboard.
521 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
522 EXPECT_TRUE(CanCreateMenuItem());
523 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
524 EXPECT_TRUE(CanCreateMenuItem());
525
[email protected]806d94e2012-12-16 20:31:26526 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41527 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26528 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32529 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26530 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32531 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03532 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26533 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07534 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
535 EXPECT_TRUE(CanCreateMenuItem());
536 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
537 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32538 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03539 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26540 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32541 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26542 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41543 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26544 EXPECT_TRUE(CanCreateMenuItem());
545
[email protected]5ace0c232013-05-29 00:48:41546 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26547
[email protected]abdd0d72014-02-05 17:18:07548 // Confirms that the menu remains visible.
[email protected]806d94e2012-12-16 20:31:26549 EXPECT_TRUE(CanCreateMenuItem());
550
[email protected]5ace0c232013-05-29 00:48:41551 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26552
[email protected]abdd0d72014-02-05 17:18:07553 // Confirms that the menu remains visible.
[email protected]806d94e2012-12-16 20:31:26554 EXPECT_TRUE(CanCreateMenuItem());
555}
556
[email protected]a81b2c32014-03-28 06:35:01557IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowNotification) {
558 const base::string16 BRAILLE_CONNECTED =
559 base::ASCIIToUTF16("Braille display connected.");
560 const base::string16 CHROMEVOX_ENABLED = base::ASCIIToUTF16(
561 "ChromeVox (spoken feedback) is enabled.\nPress Ctrl+Alt+Z to disable.");
562 const base::string16 BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED(
563 BRAILLE_CONNECTED + base::ASCIIToUTF16(" ") + CHROMEVOX_ENABLED);
564
565 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
566
567 // Enabling spoken feedback should show the notification.
568 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03569 true, ui::A11Y_NOTIFICATION_SHOW);
[email protected]a81b2c32014-03-28 06:35:01570 EXPECT_EQ(CHROMEVOX_ENABLED, GetNotificationText());
571
572 // Connecting a braille display when spoken feedback is already enabled
573 // should only show the message about the braille display.
574 SetBrailleConnected(true);
575 EXPECT_EQ(BRAILLE_CONNECTED, GetNotificationText());
576
577 // Neither disconnecting a braille display, nor disabling spoken feedback
578 // should show any notification.
579 SetBrailleConnected(false);
580 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
581 EXPECT_FALSE(IsNotificationShown());
582 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03583 false, ui::A11Y_NOTIFICATION_SHOW);
[email protected]a81b2c32014-03-28 06:35:01584 EXPECT_FALSE(IsNotificationShown());
585 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
586
587 // Connecting a braille display should enable spoken feedback and show
588 // both messages.
589 SetBrailleConnected(true);
590 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
591 EXPECT_EQ(BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED, GetNotificationText());
592}
593
[email protected]5ace0c232013-05-29 00:48:41594IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) {
[email protected]14c95c82013-01-30 06:30:29595 // Enables high contrast mode.
[email protected]1dfebfc2013-06-04 03:14:32596 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]14c95c82013-01-30 06:30:29597 EXPECT_TRUE(CanCreateMenuItem());
598
599 // Locks the screen.
600 SetLoginStatus(ash::user::LOGGED_IN_LOCKED);
601 EXPECT_TRUE(CanCreateMenuItem());
602
603 // Disables high contrast mode.
[email protected]1dfebfc2013-06-04 03:14:32604 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]14c95c82013-01-30 06:30:29605
606 // Confirms that the menu is still visible.
607 EXPECT_TRUE(CanCreateMenuItem());
608}
609
yoshiki82c93e1c2015-09-02 19:33:17610IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ClickDetailMenu) {
611 SetLoginStatus(ash::user::LOGGED_IN_USER);
[email protected]8bacb662013-02-27 03:15:24612
[email protected]806d94e2012-12-16 20:31:26613 // Confirms that the check item toggles the spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32614 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26615
616 EXPECT_TRUE(CreateDetailedMenu());
617 ClickSpokenFeedbackOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32618 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26619
620 EXPECT_TRUE(CreateDetailedMenu());
621 ClickSpokenFeedbackOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32622 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26623
624 // Confirms that the check item toggles the high contrast.
[email protected]1dfebfc2013-06-04 03:14:32625 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26626
627 EXPECT_TRUE(CreateDetailedMenu());
628 ClickHighContrastOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32629 EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26630
631 EXPECT_TRUE(CreateDetailedMenu());
632 ClickHighContrastOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32633 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26634
635 // Confirms that the check item toggles the magnifier.
[email protected]1dfebfc2013-06-04 03:14:32636 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26637
[email protected]7585f4c2013-01-10 18:26:41638 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26639 EXPECT_TRUE(CreateDetailedMenu());
640 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41641 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26642
643 EXPECT_TRUE(CreateDetailedMenu());
644 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41645 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]7cfa31a2013-10-23 20:08:13646
647 // Confirms that the check item toggles autoclick.
648 EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled());
649
650 EXPECT_TRUE(CreateDetailedMenu());
651 ClickAutoclickOnDetailMenu();
652 EXPECT_TRUE(AccessibilityManager::Get()->IsAutoclickEnabled());
653
654 EXPECT_TRUE(CreateDetailedMenu());
655 ClickAutoclickOnDetailMenu();
656 EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled());
[email protected]abdd0d72014-02-05 17:18:07657
658 // Confirms that the check item toggles on-screen keyboard.
659 EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
660
661 EXPECT_TRUE(CreateDetailedMenu());
662 ClickVirtualKeyboardOnDetailMenu();
663 EXPECT_TRUE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
664
665 EXPECT_TRUE(CreateDetailedMenu());
666 ClickVirtualKeyboardOnDetailMenu();
667 EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
[email protected]806d94e2012-12-16 20:31:26668}
669
[email protected]5ace0c232013-05-29 00:48:41670IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
[email protected]57999022013-06-07 12:52:03671 SetLoginStatus(ash::user::LOGGED_IN_NONE);
672
[email protected]806d94e2012-12-16 20:31:26673 // At first, all of the check is unchecked.
674 EXPECT_TRUE(CreateDetailedMenu());
675 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
676 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
677 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03678 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13679 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07680 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26681 CloseDetailMenu();
682
683 // Enabling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32684 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03685 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26686 EXPECT_TRUE(CreateDetailedMenu());
687 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
688 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
689 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03690 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13691 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07692 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26693 CloseDetailMenu();
694
695 // Disabling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32696 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03697 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26698 EXPECT_TRUE(CreateDetailedMenu());
699 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
700 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
701 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03702 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13703 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07704 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26705 CloseDetailMenu();
706
707 // Enabling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32708 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26709 EXPECT_TRUE(CreateDetailedMenu());
710 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
711 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
712 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03713 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13714 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07715 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26716 CloseDetailMenu();
717
718 // Disabling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32719 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26720 EXPECT_TRUE(CreateDetailedMenu());
721 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
722 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
723 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03724 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13725 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07726 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26727 CloseDetailMenu();
728
729 // Enabling full screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41730 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26731 EXPECT_TRUE(CreateDetailedMenu());
732 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
733 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
734 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03735 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13736 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07737 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26738 CloseDetailMenu();
739
740 // Disabling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41741 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26742 EXPECT_TRUE(CreateDetailedMenu());
743 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
744 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
745 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03746 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13747 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07748 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03749 CloseDetailMenu();
750
751 // Enabling large cursor.
752 AccessibilityManager::Get()->EnableLargeCursor(true);
753 EXPECT_TRUE(CreateDetailedMenu());
754 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
755 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
756 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
757 EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13758 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07759 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03760 CloseDetailMenu();
761
762 // Disabling large cursor.
763 AccessibilityManager::Get()->EnableLargeCursor(false);
764 EXPECT_TRUE(CreateDetailedMenu());
765 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
766 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
767 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
768 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13769 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07770 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
771 CloseDetailMenu();
772
773 // Enable on-screen keyboard.
774 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
775 EXPECT_TRUE(CreateDetailedMenu());
776 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
777 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
778 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
779 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
780 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
781 EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu());
782 CloseDetailMenu();
783
784 // Disable on-screen keyboard.
785 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
786 EXPECT_TRUE(CreateDetailedMenu());
787 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
788 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
789 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
790 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
791 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
792 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26793 CloseDetailMenu();
794
795 // Enabling all of the a11y features.
[email protected]1dfebfc2013-06-04 03:14:32796 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03797 true, ui::A11Y_NOTIFICATION_NONE);
[email protected]1dfebfc2013-06-04 03:14:32798 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]7585f4c2013-01-10 18:26:41799 SetMagnifierEnabled(true);
[email protected]57999022013-06-07 12:52:03800 AccessibilityManager::Get()->EnableLargeCursor(true);
[email protected]abdd0d72014-02-05 17:18:07801 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
[email protected]806d94e2012-12-16 20:31:26802 EXPECT_TRUE(CreateDetailedMenu());
803 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
804 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
805 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03806 EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13807 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07808 EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26809 CloseDetailMenu();
810
811 // Disabling all of the a11y features.
[email protected]1dfebfc2013-06-04 03:14:32812 AccessibilityManager::Get()->EnableSpokenFeedback(
pkotwicz0991c822014-10-31 04:21:03813 false, ui::A11Y_NOTIFICATION_NONE);
[email protected]1dfebfc2013-06-04 03:14:32814 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]7585f4c2013-01-10 18:26:41815 SetMagnifierEnabled(false);
[email protected]57999022013-06-07 12:52:03816 AccessibilityManager::Get()->EnableLargeCursor(false);
[email protected]abdd0d72014-02-05 17:18:07817 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
[email protected]806d94e2012-12-16 20:31:26818 EXPECT_TRUE(CreateDetailedMenu());
819 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
820 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
821 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03822 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13823 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07824 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13825 CloseDetailMenu();
826
827 // Autoclick is disabled on login screen.
828 SetLoginStatus(ash::user::LOGGED_IN_USER);
829
830 // Enabling autoclick.
831 AccessibilityManager::Get()->EnableAutoclick(true);
832 EXPECT_TRUE(CreateDetailedMenu());
833 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
834 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
835 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
836 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
837 EXPECT_TRUE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07838 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13839 CloseDetailMenu();
840
841 // Disabling autoclick.
842 AccessibilityManager::Get()->EnableAutoclick(false);
843 EXPECT_TRUE(CreateDetailedMenu());
844 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
845 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
846 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
847 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
848 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07849 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03850 CloseDetailMenu();
851}
852
853IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMenuVisibilityOnDetailMenu) {
854 SetLoginStatus(ash::user::LOGGED_IN_NONE);
855 EXPECT_TRUE(CreateDetailedMenu());
856 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
857 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
858 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
859 EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13860 EXPECT_FALSE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07861 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
[email protected]7570bba2014-08-08 08:04:47862 EXPECT_FALSE(IsHelpShownOnDetailMenu());
863 EXPECT_FALSE(IsSettingsShownOnDetailMenu());
[email protected]57999022013-06-07 12:52:03864 CloseDetailMenu();
865
866 SetLoginStatus(ash::user::LOGGED_IN_USER);
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]7570bba2014-08-08 08:04:47874 EXPECT_TRUE(IsHelpShownOnDetailMenu());
875 EXPECT_TRUE(IsSettingsShownOnDetailMenu());
[email protected]57999022013-06-07 12:52:03876 CloseDetailMenu();
877
878 SetLoginStatus(ash::user::LOGGED_IN_LOCKED);
879 EXPECT_TRUE(CreateDetailedMenu());
880 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
881 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
882 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
883 EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13884 EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07885 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
[email protected]7570bba2014-08-08 08:04:47886 EXPECT_FALSE(IsHelpShownOnDetailMenu());
887 EXPECT_FALSE(IsSettingsShownOnDetailMenu());
888 CloseDetailMenu();
889
890 ash::test::TestSessionStateDelegate* session_state_delegate =
891 new ash::test::TestSessionStateDelegate;
892 ash::test::ShellTestApi test_api(ash::Shell::GetInstance());
893 test_api.SetSessionStateDelegate(session_state_delegate);
894 session_state_delegate->SetUserAddingScreenRunning(true);
895 SetLoginStatus(ash::user::LOGGED_IN_USER);
896 EXPECT_TRUE(CreateDetailedMenu());
897 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
898 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
899 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
900 EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu());
901 EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu());
902 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
903 EXPECT_FALSE(IsHelpShownOnDetailMenu());
904 EXPECT_FALSE(IsSettingsShownOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26905 CloseDetailMenu();
906}
907
[email protected]5ace0c232013-05-29 00:48:41908INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance,
909 TrayAccessibilityTest,
910 testing::Values(PREF_SERVICE,
911 POLICY));
912
[email protected]cce1bad62013-01-04 02:26:38913} // namespace chromeos