blob: 98d553574e15c9454ad1d33279eec7c8c548305b [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"
10#include "base/command_line.h"
[email protected]3853a4c2013-02-11 17:15:5711#include "base/prefs/pref_service.h"
[email protected]806d94e2012-12-16 20:31:2612#include "chrome/browser/browser_process.h"
13#include "chrome/browser/chromeos/accessibility/accessibility_util.h"
14#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
15#include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
16#include "chrome/browser/chromeos/login/helper.h"
17#include "chrome/browser/chromeos/login/login_utils.h"
[email protected]aa8328fb2013-04-19 15:09:0618#include "chrome/browser/chromeos/login/startup_utils.h"
[email protected]806d94e2012-12-16 20:31:2619#include "chrome/browser/chromeos/login/user_manager.h"
20#include "chrome/browser/chromeos/login/user_manager_impl.h"
[email protected]5ace0c232013-05-29 00:48:4121#include "chrome/browser/policy/browser_policy_connector.h"
22#include "chrome/browser/policy/mock_configuration_policy_provider.h"
23#include "chrome/browser/policy/policy_map.h"
24#include "chrome/browser/policy/policy_types.h"
[email protected]806d94e2012-12-16 20:31:2625#include "chrome/browser/profiles/profile.h"
26#include "chrome/browser/profiles/profile_manager.h"
27#include "chrome/common/chrome_notification_types.h"
28#include "chrome/common/chrome_switches.h"
29#include "chrome/common/pref_names.h"
30#include "chrome/test/base/testing_profile.h"
[email protected]931d1042013-04-05 17:50:4431#include "chromeos/chromeos_switches.h"
[email protected]806d94e2012-12-16 20:31:2632#include "content/public/test/test_utils.h"
[email protected]5ace0c232013-05-29 00:48:4133#include "policy/policy_constants.h"
[email protected]806d94e2012-12-16 20:31:2634#include "testing/gtest/include/gtest/gtest.h"
35#include "ui/views/widget/widget.h"
36
[email protected]5ace0c232013-05-29 00:48:4137using testing::AnyNumber;
38using testing::Return;
39using testing::_;
40using testing::WithParamInterface;
41
[email protected]806d94e2012-12-16 20:31:2642namespace chromeos {
43
[email protected]5ace0c232013-05-29 00:48:4144enum PrefSettingMechanism {
45 PREF_SERVICE,
46 POLICY,
47};
48
[email protected]7585f4c2013-01-10 18:26:4149void SetMagnifierEnabled(bool enabled) {
50 MagnificationManager::Get()->SetMagnifierEnabled(enabled);
[email protected]806d94e2012-12-16 20:31:2651}
52
[email protected]5ace0c232013-05-29 00:48:4153class TrayAccessibilityTest
54 : public CrosInProcessBrowserTest,
55 public WithParamInterface<PrefSettingMechanism> {
[email protected]806d94e2012-12-16 20:31:2656 protected:
57 TrayAccessibilityTest() {}
58 virtual ~TrayAccessibilityTest() {}
[email protected]25cf28e2013-03-25 19:26:2559
[email protected]5ace0c232013-05-29 00:48:4160 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
61 EXPECT_CALL(provider_, IsInitializationComplete(_))
62 .WillRepeatedly(Return(true));
63 EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber());
64 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
65 }
66
[email protected]806d94e2012-12-16 20:31:2667 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
68 command_line->AppendSwitch(switches::kLoginManager);
69 command_line->AppendSwitchASCII(switches::kLoginProfile,
70 TestingProfile::kTestUserProfileDir);
71 }
72
[email protected]25cf28e2013-03-25 19:26:2573 virtual void RunTestOnMainThreadLoop() OVERRIDE {
74 // Need to mark oobe completed to show detailed views.
[email protected]aa8328fb2013-04-19 15:09:0675 StartupUtils::MarkOobeCompleted();
[email protected]25cf28e2013-03-25 19:26:2576 CrosInProcessBrowserTest::RunTestOnMainThreadLoop();
77 }
78
[email protected]5ace0c232013-05-29 00:48:4179 void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) {
80 if (GetParam() == PREF_SERVICE) {
81 Profile* profile = ProfileManager::GetDefaultProfile();
82 PrefService* prefs = profile->GetPrefs();
83 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, value);
84 } else if (GetParam() == POLICY) {
85 policy::PolicyMap policy_map;
86 policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu,
87 policy::POLICY_LEVEL_MANDATORY,
88 policy::POLICY_SCOPE_USER,
89 base::Value::CreateBooleanValue(value));
90 provider_.UpdateChromePolicy(policy_map);
91 base::RunLoop().RunUntilIdle();
92 } else {
93 FAIL() << "Unknown test parameterization";
94 }
95 }
96
[email protected]806d94e2012-12-16 20:31:2697 ash::internal::TrayAccessibility* tray() {
98 return ash::Shell::GetInstance()->GetPrimarySystemTray()->
99 GetTrayAccessibilityForTest();
100 }
101
102 bool IsTrayIconVisible() {
103 return tray()->tray_icon_visible_;
104 }
105
106 views::View* CreateMenuItem() {
107 return tray()->CreateDefaultView(GetLoginStatus());
108 }
109
110 void DestroyMenuItem() {
111 return tray()->DestroyDefaultView();
112 }
113
114 bool CanCreateMenuItem() {
115 views::View* menu_item_view = CreateMenuItem();
116 DestroyMenuItem();
117 return menu_item_view != NULL;
118 }
119
120 void SetLoginStatus(ash::user::LoginStatus status) {
121 tray()->UpdateAfterLoginStatusChange(status);
122 }
123
124 ash::user::LoginStatus GetLoginStatus() {
125 return tray()->login_;
126 }
127
128 bool CreateDetailedMenu() {
129 tray()->PopupDetailedView(0, false);
130 return tray()->detailed_menu_ != NULL;
131 }
132
133 void CloseDetailMenu() {
134 CHECK(tray()->detailed_menu_);
135 tray()->DestroyDetailedView();
136 tray()->detailed_menu_ = NULL;
137 }
138
139 void ClickSpokenFeedbackOnDetailMenu() {
140 views::View* button = tray()->detailed_menu_->spoken_feedback_view_;
[email protected]acd0fd7a2013-03-04 22:00:53141 tray()->detailed_menu_->OnViewClicked(button);
[email protected]806d94e2012-12-16 20:31:26142 }
143
144 void ClickHighContrastOnDetailMenu() {
145 views::View* button = tray()->detailed_menu_->high_contrast_view_;
146 EXPECT_TRUE(button);
[email protected]acd0fd7a2013-03-04 22:00:53147 tray()->detailed_menu_->OnViewClicked(button);
[email protected]806d94e2012-12-16 20:31:26148 }
149
150 void ClickScreenMagnifierOnDetailMenu() {
151 views::View* button = tray()->detailed_menu_->screen_magnifier_view_;
152 EXPECT_TRUE(button);
[email protected]acd0fd7a2013-03-04 22:00:53153 tray()->detailed_menu_->OnViewClicked(button);
[email protected]806d94e2012-12-16 20:31:26154 }
155
156 bool IsSpokenFeedbackEnabledOnDetailMenu() {
157 return tray()->detailed_menu_->spoken_feedback_enabled_;
158 }
159
160 bool IsHighContrastEnabledOnDetailMenu() {
161 return tray()->detailed_menu_->high_contrast_enabled_;
162 }
163
164 bool IsScreenMagnifierEnabledOnDetailMenu() {
165 return tray()->detailed_menu_->screen_magnifier_enabled_;
166 }
[email protected]5ace0c232013-05-29 00:48:41167
168 policy::MockConfigurationPolicyProvider provider_;
[email protected]806d94e2012-12-16 20:31:26169};
170
[email protected]5ace0c232013-05-29 00:48:41171IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) {
[email protected]806d94e2012-12-16 20:31:26172 EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus());
173
[email protected]40429592013-03-29 17:52:33174 UserManager::Get()->UserLoggedIn(
175 "[email protected]", "[email protected]", true);
[email protected]806d94e2012-12-16 20:31:26176 UserManager::Get()->SessionStarted();
177
178 EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus());
179}
180
[email protected]5ace0c232013-05-29 00:48:41181IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) {
[email protected]806d94e2012-12-16 20:31:26182 SetLoginStatus(ash::user::LOGGED_IN_NONE);
183
184 // Confirms that the icon is invisible before login.
185 EXPECT_FALSE(IsTrayIconVisible());
186
[email protected]40429592013-03-29 17:52:33187 UserManager::Get()->UserLoggedIn(
188 "[email protected]", "[email protected]", true);
[email protected]806d94e2012-12-16 20:31:26189 UserManager::Get()->SessionStarted();
190
191 // Confirms that the icon is invisible just after login.
192 EXPECT_FALSE(IsTrayIconVisible());
193
[email protected]5ace0c232013-05-29 00:48:41194 // Toggling spoken feedback changes the visibility of the icon.
[email protected]806d94e2012-12-16 20:31:26195 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
196 EXPECT_TRUE(IsTrayIconVisible());
197 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
198 EXPECT_FALSE(IsTrayIconVisible());
199
[email protected]5ace0c232013-05-29 00:48:41200 // Toggling high contrast the visibility of the icon.
[email protected]806d94e2012-12-16 20:31:26201 accessibility::EnableHighContrast(true);
202 EXPECT_TRUE(IsTrayIconVisible());
203 accessibility::EnableHighContrast(false);
204 EXPECT_FALSE(IsTrayIconVisible());
205
[email protected]5ace0c232013-05-29 00:48:41206 // Toggling magnifier the visibility of the icon.
[email protected]7585f4c2013-01-10 18:26:41207 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26208 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41209 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26210 EXPECT_FALSE(IsTrayIconVisible());
211
212 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41213 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26214 EXPECT_TRUE(IsTrayIconVisible());
215 accessibility::EnableHighContrast(true);
216 EXPECT_TRUE(IsTrayIconVisible());
217 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
218 EXPECT_TRUE(IsTrayIconVisible());
219 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
220 EXPECT_TRUE(IsTrayIconVisible());
221 accessibility::EnableHighContrast(false);
222 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41223 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26224 EXPECT_FALSE(IsTrayIconVisible());
225
226 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect
227 // the icon on the tray.
[email protected]5ace0c232013-05-29 00:48:41228 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26229 accessibility::EnableHighContrast(true);
230 EXPECT_TRUE(IsTrayIconVisible());
231 accessibility::EnableHighContrast(false);
232 EXPECT_FALSE(IsTrayIconVisible());
233}
234
[email protected]5ace0c232013-05-29 00:48:41235IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) {
[email protected]806d94e2012-12-16 20:31:26236 // Login
[email protected]40429592013-03-29 17:52:33237 UserManager::Get()->UserLoggedIn(
238 "[email protected]", "[email protected]", true);
[email protected]806d94e2012-12-16 20:31:26239 UserManager::Get()->SessionStarted();
240
[email protected]5ace0c232013-05-29 00:48:41241 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26242
243 // Confirms that the menu is hidden.
244 EXPECT_FALSE(CanCreateMenuItem());
245
[email protected]5ace0c232013-05-29 00:48:41246 // Toggling spoken feedback changes the visibility of the menu.
[email protected]806d94e2012-12-16 20:31:26247 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
248 EXPECT_TRUE(CanCreateMenuItem());
249 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
250 EXPECT_FALSE(CanCreateMenuItem());
251
[email protected]5ace0c232013-05-29 00:48:41252 // Toggling high contrast changes the visibility of the menu.
[email protected]806d94e2012-12-16 20:31:26253 accessibility::EnableHighContrast(true);
254 EXPECT_TRUE(CanCreateMenuItem());
255 accessibility::EnableHighContrast(false);
256 EXPECT_FALSE(CanCreateMenuItem());
257
[email protected]5ace0c232013-05-29 00:48:41258 // Toggling screen magnifier changes the visibility of the menu.
[email protected]7585f4c2013-01-10 18:26:41259 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26260 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41261 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26262 EXPECT_FALSE(CanCreateMenuItem());
263
264 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41265 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26266 EXPECT_TRUE(CanCreateMenuItem());
267 accessibility::EnableHighContrast(true);
268 EXPECT_TRUE(CanCreateMenuItem());
269 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
270 EXPECT_TRUE(CanCreateMenuItem());
271 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
272 EXPECT_TRUE(CanCreateMenuItem());
273 accessibility::EnableHighContrast(false);
274 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41275 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26276 EXPECT_FALSE(CanCreateMenuItem());
277}
278
[email protected]5ace0c232013-05-29 00:48:41279IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
[email protected]806d94e2012-12-16 20:31:26280 // Login
[email protected]40429592013-03-29 17:52:33281 UserManager::Get()->UserLoggedIn(
282 "[email protected]", "[email protected]", true);
[email protected]806d94e2012-12-16 20:31:26283 UserManager::Get()->SessionStarted();
284
[email protected]5ace0c232013-05-29 00:48:41285 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26286
287 // Confirms that the menu is visible.
288 EXPECT_TRUE(CanCreateMenuItem());
289
290 // The menu is keeping visible regardless of toggling spoken feedback.
291 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
292 EXPECT_TRUE(CanCreateMenuItem());
293 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
294 EXPECT_TRUE(CanCreateMenuItem());
295
296 // The menu is keeping visible regardless of toggling high contrast.
297 accessibility::EnableHighContrast(true);
298 EXPECT_TRUE(CanCreateMenuItem());
299 accessibility::EnableHighContrast(false);
300 EXPECT_TRUE(CanCreateMenuItem());
301
302 // The menu is keeping visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41303 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26304 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41305 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26306 EXPECT_TRUE(CanCreateMenuItem());
307
308 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41309 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26310 EXPECT_TRUE(CanCreateMenuItem());
311 accessibility::EnableHighContrast(true);
312 EXPECT_TRUE(CanCreateMenuItem());
313 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
314 EXPECT_TRUE(CanCreateMenuItem());
315 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
316 EXPECT_TRUE(CanCreateMenuItem());
317 accessibility::EnableHighContrast(false);
318 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41319 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26320 EXPECT_TRUE(CanCreateMenuItem());
321
[email protected]5ace0c232013-05-29 00:48:41322 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26323
324 // Confirms that the menu is invisible.
325 EXPECT_FALSE(CanCreateMenuItem());
326}
327
[email protected]5ace0c232013-05-29 00:48:41328IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
[email protected]806d94e2012-12-16 20:31:26329 SetLoginStatus(ash::user::LOGGED_IN_NONE);
330
331 // Confirms that the menu is visible.
332 EXPECT_TRUE(CanCreateMenuItem());
333
334 // The menu is keeping visible regardless of toggling spoken feedback.
335 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
336 EXPECT_TRUE(CanCreateMenuItem());
337 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
338 EXPECT_TRUE(CanCreateMenuItem());
339
340 // The menu is keeping visible regardless of toggling high contrast.
341 accessibility::EnableHighContrast(true);
342 EXPECT_TRUE(CanCreateMenuItem());
343 accessibility::EnableHighContrast(false);
344 EXPECT_TRUE(CanCreateMenuItem());
345
346 // The menu is keeping visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41347 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26348 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41349 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26350 EXPECT_TRUE(CanCreateMenuItem());
351
352 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41353 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26354 EXPECT_TRUE(CanCreateMenuItem());
355 accessibility::EnableHighContrast(true);
356 EXPECT_TRUE(CanCreateMenuItem());
357 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
358 EXPECT_TRUE(CanCreateMenuItem());
359 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
360 EXPECT_TRUE(CanCreateMenuItem());
361 accessibility::EnableHighContrast(false);
362 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41363 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26364 EXPECT_TRUE(CanCreateMenuItem());
365
[email protected]5ace0c232013-05-29 00:48:41366 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26367
368 // Confirms that the menu is keeping visible.
369 EXPECT_TRUE(CanCreateMenuItem());
370
[email protected]5ace0c232013-05-29 00:48:41371 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26372
373 // Confirms that the menu is keeping visible.
374 EXPECT_TRUE(CanCreateMenuItem());
375}
376
[email protected]5ace0c232013-05-29 00:48:41377IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) {
[email protected]14c95c82013-01-30 06:30:29378 // Enables high contrast mode.
379 accessibility::EnableHighContrast(true);
380 EXPECT_TRUE(CanCreateMenuItem());
381
382 // Locks the screen.
383 SetLoginStatus(ash::user::LOGGED_IN_LOCKED);
384 EXPECT_TRUE(CanCreateMenuItem());
385
386 // Disables high contrast mode.
387 accessibility::EnableHighContrast(false);
388
389 // Confirms that the menu is still visible.
390 EXPECT_TRUE(CanCreateMenuItem());
391}
392
[email protected]8bacb662013-02-27 03:15:24393#if defined(OS_CHROMEOS)
394#define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu
395#else
396#define MAYBE_ClickDetailMenu ClickDetailMenu
397#endif
398
[email protected]5ace0c232013-05-29 00:48:41399IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, MAYBE_ClickDetailMenu) {
[email protected]806d94e2012-12-16 20:31:26400 // Confirms that the check item toggles the spoken feedback.
401 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled());
402
403 EXPECT_TRUE(CreateDetailedMenu());
404 ClickSpokenFeedbackOnDetailMenu();
405 EXPECT_TRUE(accessibility::IsSpokenFeedbackEnabled());
406
407 EXPECT_TRUE(CreateDetailedMenu());
408 ClickSpokenFeedbackOnDetailMenu();
409 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled());
410
411 // Confirms that the check item toggles the high contrast.
412 EXPECT_FALSE(accessibility::IsHighContrastEnabled());
413
414 EXPECT_TRUE(CreateDetailedMenu());
415 ClickHighContrastOnDetailMenu();
416 EXPECT_TRUE(accessibility::IsHighContrastEnabled());
417
418 EXPECT_TRUE(CreateDetailedMenu());
419 ClickHighContrastOnDetailMenu();
420 EXPECT_FALSE(accessibility::IsHighContrastEnabled());
421
422 // Confirms that the check item toggles the magnifier.
423 EXPECT_FALSE(accessibility::IsHighContrastEnabled());
424
[email protected]7585f4c2013-01-10 18:26:41425 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26426 EXPECT_TRUE(CreateDetailedMenu());
427 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41428 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26429
430 EXPECT_TRUE(CreateDetailedMenu());
431 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41432 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26433}
434
[email protected]5ace0c232013-05-29 00:48:41435IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
[email protected]806d94e2012-12-16 20:31:26436 // At first, all of the check is unchecked.
437 EXPECT_TRUE(CreateDetailedMenu());
438 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
439 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
440 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
441 CloseDetailMenu();
442
443 // Enabling spoken feedback.
444 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
445 EXPECT_TRUE(CreateDetailedMenu());
446 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
447 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
448 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
449 CloseDetailMenu();
450
451 // Disabling spoken feedback.
452 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
453 EXPECT_TRUE(CreateDetailedMenu());
454 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
455 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
456 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
457 CloseDetailMenu();
458
459 // Enabling high contrast.
460 accessibility::EnableHighContrast(true);
461 EXPECT_TRUE(CreateDetailedMenu());
462 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
463 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
464 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
465 CloseDetailMenu();
466
467 // Disabling high contrast.
468 accessibility::EnableHighContrast(false);
469 EXPECT_TRUE(CreateDetailedMenu());
470 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
471 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
472 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
473 CloseDetailMenu();
474
475 // Enabling full screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41476 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26477 EXPECT_TRUE(CreateDetailedMenu());
478 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
479 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
480 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
481 CloseDetailMenu();
482
483 // Disabling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41484 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26485 EXPECT_TRUE(CreateDetailedMenu());
486 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
487 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
488 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
489 CloseDetailMenu();
490
491 // Enabling all of the a11y features.
492 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
493 accessibility::EnableHighContrast(true);
[email protected]7585f4c2013-01-10 18:26:41494 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26495 EXPECT_TRUE(CreateDetailedMenu());
496 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
497 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
498 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
499 CloseDetailMenu();
500
501 // Disabling all of the a11y features.
502 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
503 accessibility::EnableHighContrast(false);
[email protected]7585f4c2013-01-10 18:26:41504 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26505 EXPECT_TRUE(CreateDetailedMenu());
506 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
507 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
508 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
509 CloseDetailMenu();
510}
511
[email protected]5ace0c232013-05-29 00:48:41512INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance,
513 TrayAccessibilityTest,
514 testing::Values(PREF_SERVICE,
515 POLICY));
516
[email protected]cce1bad62013-01-04 02:26:38517} // namespace chromeos