blob: ad627bf1a39eab9d79500b0919ddfbfe00babda0 [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
James Cook6316a552017-03-05 21:46:215#include "ash/common/accessibility_types.h"
6#include "ash/common/login_status.h"
James Cook6def4d9d2017-03-05 22:13:477#include "ash/common/system/tray/system_tray.h"
8#include "ash/common/system/tray_accessibility.h"
[email protected]806d94e2012-12-16 20:31:269#include "ash/magnifier/magnification_controller.h"
10#include "ash/shell.h"
[email protected]7570bba2014-08-08 08:04:4711#include "ash/test/shell_test_api.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"
fdorayba121422016-12-23 19:51:4814#include "base/memory/ptr_util.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"
brettw39d6ba42016-08-24 16:56:3835#include "components/policy/policy_constants.h"
brettwb1fc1b82016-02-02 00:19:0836#include "components/prefs/pref_service.h"
xiyuan834f3bc2016-10-26 19:40:5337#include "components/session_manager/core/session_manager.h"
[email protected]806d94e2012-12-16 20:31:2638#include "content/public/test/test_utils.h"
39#include "testing/gtest/include/gtest/gtest.h"
tdanderson581149422016-10-25 21:37:5840#include "ui/views/controls/button/button.h"
41#include "ui/views/controls/button/custom_button.h"
[email protected]a81b2c32014-03-28 06:35:0142#include "ui/views/controls/label.h"
[email protected]806d94e2012-12-16 20:31:2643#include "ui/views/widget/widget.h"
44
[email protected]a81b2c32014-03-28 06:35:0145using extensions::api::braille_display_private::BrailleObserver;
46using extensions::api::braille_display_private::DisplayState;
47using extensions::api::braille_display_private::MockBrailleController;
[email protected]5ace0c232013-05-29 00:48:4148using testing::Return;
49using testing::_;
50using testing::WithParamInterface;
51
[email protected]806d94e2012-12-16 20:31:2652namespace chromeos {
53
[email protected]5ace0c232013-05-29 00:48:4154enum PrefSettingMechanism {
55 PREF_SERVICE,
56 POLICY,
57};
58
[email protected]7585f4c2013-01-10 18:26:4159void SetMagnifierEnabled(bool enabled) {
60 MagnificationManager::Get()->SetMagnifierEnabled(enabled);
[email protected]806d94e2012-12-16 20:31:2661}
62
[email protected]5ace0c232013-05-29 00:48:4163class TrayAccessibilityTest
[email protected]0b294be2013-08-17 02:18:4164 : public InProcessBrowserTest,
[email protected]5ace0c232013-05-29 00:48:4165 public WithParamInterface<PrefSettingMechanism> {
[email protected]806d94e2012-12-16 20:31:2666 protected:
67 TrayAccessibilityTest() {}
68 virtual ~TrayAccessibilityTest() {}
[email protected]25cf28e2013-03-25 19:26:2569
[email protected]a81b2c32014-03-28 06:35:0170 // The profile which should be used by these tests.
[email protected]613b3f52013-12-13 23:37:0671 Profile* GetProfile() { return ProfileManager::GetActiveUserProfile(); }
72
dchengc97a0282015-01-15 23:04:2473 void SetUpInProcessBrowserTestFixture() override {
[email protected]5ace0c232013-05-29 00:48:4174 EXPECT_CALL(provider_, IsInitializationComplete(_))
75 .WillRepeatedly(Return(true));
[email protected]5ace0c232013-05-29 00:48:4176 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
[email protected]a81b2c32014-03-28 06:35:0177 AccessibilityManager::SetBrailleControllerForTest(&braille_controller_);
[email protected]5ace0c232013-05-29 00:48:4178 }
79
dchengc97a0282015-01-15 23:04:2480 void SetUpCommandLine(base::CommandLine* command_line) override {
[email protected]806d94e2012-12-16 20:31:2681 command_line->AppendSwitch(switches::kLoginManager);
82 command_line->AppendSwitchASCII(switches::kLoginProfile,
83 TestingProfile::kTestUserProfileDir);
84 }
85
dchengc97a0282015-01-15 23:04:2486 void SetUpOnMainThread() override {
[email protected]613b3f52013-12-13 23:37:0687 AccessibilityManager::Get()->SetProfileForTest(GetProfile());
88 MagnificationManager::Get()->SetProfileForTest(GetProfile());
[email protected]d80f19302013-06-07 13:12:1489 }
90
dchengc97a0282015-01-15 23:04:2491 void RunTestOnMainThreadLoop() override {
[email protected]25cf28e2013-03-25 19:26:2592 // Need to mark oobe completed to show detailed views.
[email protected]aa8328fb2013-04-19 15:09:0693 StartupUtils::MarkOobeCompleted();
[email protected]0b294be2013-08-17 02:18:4194 InProcessBrowserTest::RunTestOnMainThreadLoop();
[email protected]25cf28e2013-03-25 19:26:2595 }
96
dchengc97a0282015-01-15 23:04:2497 void TearDownOnMainThread() override {
[email protected]a81b2c32014-03-28 06:35:0198 AccessibilityManager::SetBrailleControllerForTest(NULL);
99 }
100
[email protected]5ace0c232013-05-29 00:48:41101 void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) {
102 if (GetParam() == PREF_SERVICE) {
[email protected]613b3f52013-12-13 23:37:06103 PrefService* prefs = GetProfile()->GetPrefs();
[email protected]5ace0c232013-05-29 00:48:41104 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, value);
105 } else if (GetParam() == POLICY) {
106 policy::PolicyMap policy_map;
107 policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu,
dcheng3b344bc22016-05-10 02:26:09108 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
fhorschig64834b712015-09-21 14:20:23109 policy::POLICY_SOURCE_CLOUD,
jdoerrie239723572017-03-02 12:09:19110 base::MakeUnique<base::Value>(value), nullptr);
[email protected]5ace0c232013-05-29 00:48:41111 provider_.UpdateChromePolicy(policy_map);
112 base::RunLoop().RunUntilIdle();
113 } else {
114 FAIL() << "Unknown test parameterization";
115 }
116 }
117
[email protected]093b8d642014-04-03 20:59:28118 ash::TrayAccessibility* tray() {
[email protected]806d94e2012-12-16 20:31:26119 return ash::Shell::GetInstance()->GetPrimarySystemTray()->
120 GetTrayAccessibilityForTest();
121 }
122
[email protected]093b8d642014-04-03 20:59:28123 const ash::TrayAccessibility* tray() const {
[email protected]a81b2c32014-03-28 06:35:01124 return ash::Shell::GetInstance()
125 ->GetPrimarySystemTray()
126 ->GetTrayAccessibilityForTest();
[email protected]806d94e2012-12-16 20:31:26127 }
128
[email protected]a81b2c32014-03-28 06:35:01129 bool IsTrayIconVisible() const { return tray()->tray_icon_visible_; }
130
[email protected]806d94e2012-12-16 20:31:26131 views::View* CreateMenuItem() {
132 return tray()->CreateDefaultView(GetLoginStatus());
133 }
134
135 void DestroyMenuItem() {
136 return tray()->DestroyDefaultView();
137 }
138
139 bool CanCreateMenuItem() {
140 views::View* menu_item_view = CreateMenuItem();
141 DestroyMenuItem();
142 return menu_item_view != NULL;
143 }
144
skye79274a2016-06-08 05:39:02145 void SetLoginStatus(ash::LoginStatus status) {
[email protected]806d94e2012-12-16 20:31:26146 tray()->UpdateAfterLoginStatusChange(status);
147 }
148
skye79274a2016-06-08 05:39:02149 ash::LoginStatus GetLoginStatus() { return tray()->login_; }
[email protected]806d94e2012-12-16 20:31:26150
151 bool CreateDetailedMenu() {
estadeb0df1652017-03-22 22:41:10152 tray()->ShowDetailedView(0, false);
[email protected]806d94e2012-12-16 20:31:26153 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
tdanderson581149422016-10-25 21:37:58240 // In material design we show the help button but theme it as disabled if
mohsen6faf4f32017-02-09 22:09:41241 // it is not possible to load the help page.
tdanderson581149422016-10-25 21:37:58242 bool IsHelpAvailableOnDetailMenu() const {
mohsen6faf4f32017-02-09 22:09:41243 return tray()->detailed_menu_->help_view_->state() ==
244 views::Button::STATE_NORMAL;
[email protected]7570bba2014-08-08 08:04:47245 }
246
tdanderson581149422016-10-25 21:37:58247 // In material design we show the settings button but theme it as disabled if
mohsen6faf4f32017-02-09 22:09:41248 // it is not possible to load the settings page.
tdanderson581149422016-10-25 21:37:58249 bool IsSettingsAvailableOnDetailMenu() const {
mohsen6faf4f32017-02-09 22:09:41250 return tray()->detailed_menu_->settings_view_->state() ==
251 views::Button::STATE_NORMAL;
[email protected]7570bba2014-08-08 08:04:47252 }
253
[email protected]a81b2c32014-03-28 06:35:01254 bool IsNotificationShown() const {
255 return (tray()->detailed_popup_ &&
256 !tray()->detailed_popup_->GetWidget()->IsClosed());
257 }
258
259 base::string16 GetNotificationText() const {
260 if (IsNotificationShown())
261 return tray()->detailed_popup_->label_for_test()->text();
262 else
263 return base::string16();
264 }
265
266 void SetBrailleConnected(bool connected) {
267 braille_controller_.SetAvailable(connected);
[email protected]2e5e0b12014-05-07 13:30:20268 braille_controller_.GetObserver()->OnBrailleDisplayStateChanged(
[email protected]a81b2c32014-03-28 06:35:01269 *braille_controller_.GetDisplayState());
270 }
271
[email protected]5ace0c232013-05-29 00:48:41272 policy::MockConfigurationPolicyProvider provider_;
[email protected]a81b2c32014-03-28 06:35:01273 MockBrailleController braille_controller_;
[email protected]806d94e2012-12-16 20:31:26274};
275
[email protected]5ace0c232013-05-29 00:48:41276IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) {
skye79274a2016-06-08 05:39:02277 EXPECT_EQ(ash::LoginStatus::NOT_LOGGED_IN, GetLoginStatus());
[email protected]806d94e2012-12-16 20:31:26278
xiyuan30e213c2016-11-01 20:00:57279 session_manager::SessionManager::Get()->CreateSession(
280 AccountId::FromUserEmail("[email protected]"), "[email protected]");
xiyuan834f3bc2016-10-26 19:40:53281 session_manager::SessionManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26282
skye79274a2016-06-08 05:39:02283 EXPECT_EQ(ash::LoginStatus::USER, GetLoginStatus());
[email protected]806d94e2012-12-16 20:31:26284}
285
yoshiki064fa9e2015-09-04 06:32:45286IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) {
skye79274a2016-06-08 05:39:02287 SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN);
[email protected]806d94e2012-12-16 20:31:26288
289 // Confirms that the icon is invisible before login.
290 EXPECT_FALSE(IsTrayIconVisible());
291
xiyuan30e213c2016-11-01 20:00:57292 session_manager::SessionManager::Get()->CreateSession(
293 AccountId::FromUserEmail("[email protected]"), "[email protected]");
xiyuan834f3bc2016-10-26 19:40:53294 session_manager::SessionManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26295
296 // Confirms that the icon is invisible just after login.
297 EXPECT_FALSE(IsTrayIconVisible());
298
[email protected]1dfebfc2013-06-04 03:14:32299 // Toggling spoken feedback changes the visibillity of the icon.
300 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03301 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26302 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32303 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03304 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26305 EXPECT_FALSE(IsTrayIconVisible());
306
[email protected]1dfebfc2013-06-04 03:14:32307 // Toggling high contrast the visibillity of the icon.
308 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26309 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32310 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26311 EXPECT_FALSE(IsTrayIconVisible());
312
[email protected]5ace0c232013-05-29 00:48:41313 // Toggling magnifier the visibility of the icon.
[email protected]7585f4c2013-01-10 18:26:41314 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26315 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41316 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26317 EXPECT_FALSE(IsTrayIconVisible());
318
[email protected]abdd0d72014-02-05 17:18:07319 // Toggling the virtual keyboard setting changes the visibility of the a11y
320 // icon.
321 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
322 EXPECT_TRUE(IsTrayIconVisible());
323 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
324 EXPECT_FALSE(IsTrayIconVisible());
325
[email protected]806d94e2012-12-16 20:31:26326 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41327 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26328 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32329 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26330 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32331 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03332 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26333 EXPECT_TRUE(IsTrayIconVisible());
[email protected]abdd0d72014-02-05 17:18:07334 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
335 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32336 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03337 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26338 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32339 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26340 EXPECT_TRUE(IsTrayIconVisible());
[email protected]7585f4c2013-01-10 18:26:41341 SetMagnifierEnabled(false);
[email protected]abdd0d72014-02-05 17:18:07342 EXPECT_TRUE(IsTrayIconVisible());
343 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
[email protected]806d94e2012-12-16 20:31:26344 EXPECT_FALSE(IsTrayIconVisible());
345
346 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect
347 // the icon on the tray.
[email protected]5ace0c232013-05-29 00:48:41348 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]1dfebfc2013-06-04 03:14:32349 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26350 EXPECT_TRUE(IsTrayIconVisible());
[email protected]1dfebfc2013-06-04 03:14:32351 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26352 EXPECT_FALSE(IsTrayIconVisible());
353}
354
yoshiki064fa9e2015-09-04 06:32:45355IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) {
[email protected]806d94e2012-12-16 20:31:26356 // Login
xiyuan30e213c2016-11-01 20:00:57357 session_manager::SessionManager::Get()->CreateSession(
358 AccountId::FromUserEmail("[email protected]"), "[email protected]");
xiyuan834f3bc2016-10-26 19:40:53359 session_manager::SessionManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26360
[email protected]5ace0c232013-05-29 00:48:41361 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26362
363 // Confirms that the menu is hidden.
364 EXPECT_FALSE(CanCreateMenuItem());
365
[email protected]1dfebfc2013-06-04 03:14:32366 // Toggling spoken feedback changes the visibillity of the menu.
367 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03368 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26369 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32370 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03371 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26372 EXPECT_FALSE(CanCreateMenuItem());
373
[email protected]1dfebfc2013-06-04 03:14:32374 // Toggling high contrast changes the visibillity of the menu.
375 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26376 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32377 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26378 EXPECT_FALSE(CanCreateMenuItem());
379
[email protected]5ace0c232013-05-29 00:48:41380 // Toggling screen magnifier changes the visibility of the menu.
[email protected]7585f4c2013-01-10 18:26:41381 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26382 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41383 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26384 EXPECT_FALSE(CanCreateMenuItem());
385
[email protected]7cfa31a2013-10-23 20:08:13386 // Toggling autoclick changes the visibility of the menu.
387 AccessibilityManager::Get()->EnableAutoclick(true);
388 EXPECT_TRUE(CanCreateMenuItem());
389 AccessibilityManager::Get()->EnableAutoclick(false);
390 EXPECT_FALSE(CanCreateMenuItem());
391
[email protected]abdd0d72014-02-05 17:18:07392 // Toggling virtual keyboard changes the visibility of the menu.
393 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
394 EXPECT_TRUE(CanCreateMenuItem());
395 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
396 EXPECT_FALSE(CanCreateMenuItem());
397
[email protected]806d94e2012-12-16 20:31:26398 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41399 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26400 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32401 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26402 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32403 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03404 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26405 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13406 AccessibilityManager::Get()->EnableAutoclick(true);
407 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07408 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
409 EXPECT_TRUE(CanCreateMenuItem());
410 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
411 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13412 AccessibilityManager::Get()->EnableAutoclick(false);
413 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32414 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03415 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26416 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32417 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26418 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41419 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26420 EXPECT_FALSE(CanCreateMenuItem());
421}
422
yoshiki064fa9e2015-09-04 06:32:45423IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
[email protected]806d94e2012-12-16 20:31:26424 // Login
xiyuan30e213c2016-11-01 20:00:57425 session_manager::SessionManager::Get()->CreateSession(
426 AccountId::FromUserEmail("[email protected]"), "[email protected]");
xiyuan834f3bc2016-10-26 19:40:53427 session_manager::SessionManager::Get()->SessionStarted();
[email protected]806d94e2012-12-16 20:31:26428
[email protected]5ace0c232013-05-29 00:48:41429 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26430
431 // Confirms that the menu is visible.
432 EXPECT_TRUE(CanCreateMenuItem());
433
[email protected]abdd0d72014-02-05 17:18:07434 // The menu remains visible regardless of toggling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32435 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03436 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26437 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32438 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03439 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26440 EXPECT_TRUE(CanCreateMenuItem());
441
[email protected]abdd0d72014-02-05 17:18:07442 // The menu remains visible regardless of toggling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32443 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26444 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32445 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26446 EXPECT_TRUE(CanCreateMenuItem());
447
[email protected]abdd0d72014-02-05 17:18:07448 // The menu remains visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41449 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26450 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41451 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26452 EXPECT_TRUE(CanCreateMenuItem());
453
[email protected]abdd0d72014-02-05 17:18:07454 // The menu remains visible regardless of toggling autoclick.
[email protected]7cfa31a2013-10-23 20:08:13455 AccessibilityManager::Get()->EnableAutoclick(true);
456 EXPECT_TRUE(CanCreateMenuItem());
457 AccessibilityManager::Get()->EnableAutoclick(false);
458 EXPECT_TRUE(CanCreateMenuItem());
459
[email protected]abdd0d72014-02-05 17:18:07460 // The menu remains visible regardless of toggling on-screen keyboard.
461 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
462 EXPECT_TRUE(CanCreateMenuItem());
463 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
464 EXPECT_TRUE(CanCreateMenuItem());
465
[email protected]806d94e2012-12-16 20:31:26466 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41467 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26468 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32469 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26470 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32471 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03472 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26473 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13474 AccessibilityManager::Get()->EnableAutoclick(true);
475 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07476 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
477 EXPECT_TRUE(CanCreateMenuItem());
478 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
479 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7cfa31a2013-10-23 20:08:13480 AccessibilityManager::Get()->EnableAutoclick(false);
481 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32482 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03483 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26484 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32485 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26486 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41487 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26488 EXPECT_TRUE(CanCreateMenuItem());
489
[email protected]5ace0c232013-05-29 00:48:41490 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26491
492 // Confirms that the menu is invisible.
493 EXPECT_FALSE(CanCreateMenuItem());
494}
495
[email protected]5ace0c232013-05-29 00:48:41496IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
skye79274a2016-06-08 05:39:02497 SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN);
[email protected]806d94e2012-12-16 20:31:26498
499 // Confirms that the menu is visible.
500 EXPECT_TRUE(CanCreateMenuItem());
501
[email protected]abdd0d72014-02-05 17:18:07502 // The menu remains visible regardless of toggling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32503 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03504 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26505 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32506 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03507 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26508 EXPECT_TRUE(CanCreateMenuItem());
509
[email protected]abdd0d72014-02-05 17:18:07510 // The menu remains visible regardless of toggling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32511 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26512 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32513 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26514 EXPECT_TRUE(CanCreateMenuItem());
515
[email protected]abdd0d72014-02-05 17:18:07516 // The menu remains visible regardless of toggling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41517 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26518 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41519 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26520 EXPECT_TRUE(CanCreateMenuItem());
521
[email protected]abdd0d72014-02-05 17:18:07522 // The menu remains visible regardless of toggling on-screen keyboard.
523 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
524 EXPECT_TRUE(CanCreateMenuItem());
525 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
526 EXPECT_TRUE(CanCreateMenuItem());
527
[email protected]806d94e2012-12-16 20:31:26528 // Enabling all accessibility features.
[email protected]7585f4c2013-01-10 18:26:41529 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26530 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32531 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26532 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32533 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03534 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26535 EXPECT_TRUE(CanCreateMenuItem());
[email protected]abdd0d72014-02-05 17:18:07536 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
537 EXPECT_TRUE(CanCreateMenuItem());
538 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
539 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32540 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03541 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26542 EXPECT_TRUE(CanCreateMenuItem());
[email protected]1dfebfc2013-06-04 03:14:32543 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26544 EXPECT_TRUE(CanCreateMenuItem());
[email protected]7585f4c2013-01-10 18:26:41545 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26546 EXPECT_TRUE(CanCreateMenuItem());
547
[email protected]5ace0c232013-05-29 00:48:41548 SetShowAccessibilityOptionsInSystemTrayMenu(true);
[email protected]806d94e2012-12-16 20:31:26549
[email protected]abdd0d72014-02-05 17:18:07550 // Confirms that the menu remains visible.
[email protected]806d94e2012-12-16 20:31:26551 EXPECT_TRUE(CanCreateMenuItem());
552
[email protected]5ace0c232013-05-29 00:48:41553 SetShowAccessibilityOptionsInSystemTrayMenu(false);
[email protected]806d94e2012-12-16 20:31:26554
[email protected]abdd0d72014-02-05 17:18:07555 // Confirms that the menu remains visible.
[email protected]806d94e2012-12-16 20:31:26556 EXPECT_TRUE(CanCreateMenuItem());
557}
558
[email protected]a81b2c32014-03-28 06:35:01559IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowNotification) {
560 const base::string16 BRAILLE_CONNECTED =
561 base::ASCIIToUTF16("Braille display connected.");
562 const base::string16 CHROMEVOX_ENABLED = base::ASCIIToUTF16(
563 "ChromeVox (spoken feedback) is enabled.\nPress Ctrl+Alt+Z to disable.");
564 const base::string16 BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED(
565 BRAILLE_CONNECTED + base::ASCIIToUTF16(" ") + CHROMEVOX_ENABLED);
566
567 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
568
569 // Enabling spoken feedback should show the notification.
570 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03571 true, ash::A11Y_NOTIFICATION_SHOW);
[email protected]a81b2c32014-03-28 06:35:01572 EXPECT_EQ(CHROMEVOX_ENABLED, GetNotificationText());
573
574 // Connecting a braille display when spoken feedback is already enabled
575 // should only show the message about the braille display.
576 SetBrailleConnected(true);
577 EXPECT_EQ(BRAILLE_CONNECTED, GetNotificationText());
578
579 // Neither disconnecting a braille display, nor disabling spoken feedback
580 // should show any notification.
581 SetBrailleConnected(false);
582 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
583 EXPECT_FALSE(IsNotificationShown());
584 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03585 false, ash::A11Y_NOTIFICATION_SHOW);
[email protected]a81b2c32014-03-28 06:35:01586 EXPECT_FALSE(IsNotificationShown());
587 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
588
589 // Connecting a braille display should enable spoken feedback and show
590 // both messages.
591 SetBrailleConnected(true);
592 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
593 EXPECT_EQ(BRAILLE_CONNECTED_AND_CHROMEVOX_ENABLED, GetNotificationText());
594}
595
[email protected]5ace0c232013-05-29 00:48:41596IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) {
[email protected]14c95c82013-01-30 06:30:29597 // Enables high contrast mode.
[email protected]1dfebfc2013-06-04 03:14:32598 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]14c95c82013-01-30 06:30:29599 EXPECT_TRUE(CanCreateMenuItem());
600
601 // Locks the screen.
skye79274a2016-06-08 05:39:02602 SetLoginStatus(ash::LoginStatus::LOCKED);
[email protected]14c95c82013-01-30 06:30:29603 EXPECT_TRUE(CanCreateMenuItem());
604
605 // Disables high contrast mode.
[email protected]1dfebfc2013-06-04 03:14:32606 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]14c95c82013-01-30 06:30:29607
608 // Confirms that the menu is still visible.
609 EXPECT_TRUE(CanCreateMenuItem());
610}
611
yoshiki82c93e1c2015-09-02 19:33:17612IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ClickDetailMenu) {
skye79274a2016-06-08 05:39:02613 SetLoginStatus(ash::LoginStatus::USER);
[email protected]8bacb662013-02-27 03:15:24614
[email protected]806d94e2012-12-16 20:31:26615 // Confirms that the check item toggles the spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32616 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26617
618 EXPECT_TRUE(CreateDetailedMenu());
619 ClickSpokenFeedbackOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32620 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26621
622 EXPECT_TRUE(CreateDetailedMenu());
623 ClickSpokenFeedbackOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32624 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
[email protected]806d94e2012-12-16 20:31:26625
626 // Confirms that the check item toggles the high contrast.
[email protected]1dfebfc2013-06-04 03:14:32627 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26628
629 EXPECT_TRUE(CreateDetailedMenu());
630 ClickHighContrastOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32631 EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26632
633 EXPECT_TRUE(CreateDetailedMenu());
634 ClickHighContrastOnDetailMenu();
[email protected]1dfebfc2013-06-04 03:14:32635 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26636
637 // Confirms that the check item toggles the magnifier.
[email protected]1dfebfc2013-06-04 03:14:32638 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
[email protected]806d94e2012-12-16 20:31:26639
[email protected]7585f4c2013-01-10 18:26:41640 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26641 EXPECT_TRUE(CreateDetailedMenu());
642 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41643 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]806d94e2012-12-16 20:31:26644
645 EXPECT_TRUE(CreateDetailedMenu());
646 ClickScreenMagnifierOnDetailMenu();
[email protected]7585f4c2013-01-10 18:26:41647 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
[email protected]7cfa31a2013-10-23 20:08:13648
649 // Confirms that the check item toggles autoclick.
650 EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled());
651
652 EXPECT_TRUE(CreateDetailedMenu());
653 ClickAutoclickOnDetailMenu();
654 EXPECT_TRUE(AccessibilityManager::Get()->IsAutoclickEnabled());
655
656 EXPECT_TRUE(CreateDetailedMenu());
657 ClickAutoclickOnDetailMenu();
658 EXPECT_FALSE(AccessibilityManager::Get()->IsAutoclickEnabled());
[email protected]abdd0d72014-02-05 17:18:07659
660 // Confirms that the check item toggles on-screen keyboard.
661 EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
662
663 EXPECT_TRUE(CreateDetailedMenu());
664 ClickVirtualKeyboardOnDetailMenu();
665 EXPECT_TRUE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
666
667 EXPECT_TRUE(CreateDetailedMenu());
668 ClickVirtualKeyboardOnDetailMenu();
669 EXPECT_FALSE(AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
[email protected]806d94e2012-12-16 20:31:26670}
671
[email protected]5ace0c232013-05-29 00:48:41672IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
skye79274a2016-06-08 05:39:02673 SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN);
[email protected]57999022013-06-07 12:52:03674
[email protected]806d94e2012-12-16 20:31:26675 // At first, all of the check is unchecked.
676 EXPECT_TRUE(CreateDetailedMenu());
677 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
678 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
679 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03680 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13681 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07682 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26683 CloseDetailMenu();
684
685 // Enabling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32686 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03687 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26688 EXPECT_TRUE(CreateDetailedMenu());
689 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
690 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
691 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03692 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13693 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07694 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26695 CloseDetailMenu();
696
697 // Disabling spoken feedback.
[email protected]1dfebfc2013-06-04 03:14:32698 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03699 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]806d94e2012-12-16 20:31:26700 EXPECT_TRUE(CreateDetailedMenu());
701 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
702 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
703 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03704 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13705 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07706 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26707 CloseDetailMenu();
708
709 // Enabling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32710 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]806d94e2012-12-16 20:31:26711 EXPECT_TRUE(CreateDetailedMenu());
712 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
713 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
714 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03715 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13716 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07717 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26718 CloseDetailMenu();
719
720 // Disabling high contrast.
[email protected]1dfebfc2013-06-04 03:14:32721 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]806d94e2012-12-16 20:31:26722 EXPECT_TRUE(CreateDetailedMenu());
723 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
724 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
725 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03726 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13727 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07728 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26729 CloseDetailMenu();
730
731 // Enabling full screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41732 SetMagnifierEnabled(true);
[email protected]806d94e2012-12-16 20:31:26733 EXPECT_TRUE(CreateDetailedMenu());
734 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
735 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
736 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03737 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13738 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07739 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26740 CloseDetailMenu();
741
742 // Disabling screen magnifier.
[email protected]7585f4c2013-01-10 18:26:41743 SetMagnifierEnabled(false);
[email protected]806d94e2012-12-16 20:31:26744 EXPECT_TRUE(CreateDetailedMenu());
745 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
746 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
747 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03748 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13749 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07750 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03751 CloseDetailMenu();
752
753 // Enabling large cursor.
754 AccessibilityManager::Get()->EnableLargeCursor(true);
755 EXPECT_TRUE(CreateDetailedMenu());
756 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
757 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
758 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
759 EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13760 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07761 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03762 CloseDetailMenu();
763
764 // Disabling large cursor.
765 AccessibilityManager::Get()->EnableLargeCursor(false);
766 EXPECT_TRUE(CreateDetailedMenu());
767 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
768 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
769 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
770 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13771 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07772 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
773 CloseDetailMenu();
774
775 // Enable on-screen keyboard.
776 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
777 EXPECT_TRUE(CreateDetailedMenu());
778 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
779 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
780 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
781 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
782 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
783 EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu());
784 CloseDetailMenu();
785
786 // Disable on-screen keyboard.
787 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
788 EXPECT_TRUE(CreateDetailedMenu());
789 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
790 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
791 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
792 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
793 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
794 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26795 CloseDetailMenu();
796
797 // Enabling all of the a11y features.
[email protected]1dfebfc2013-06-04 03:14:32798 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03799 true, ash::A11Y_NOTIFICATION_NONE);
[email protected]1dfebfc2013-06-04 03:14:32800 AccessibilityManager::Get()->EnableHighContrast(true);
[email protected]7585f4c2013-01-10 18:26:41801 SetMagnifierEnabled(true);
[email protected]57999022013-06-07 12:52:03802 AccessibilityManager::Get()->EnableLargeCursor(true);
[email protected]abdd0d72014-02-05 17:18:07803 AccessibilityManager::Get()->EnableVirtualKeyboard(true);
[email protected]806d94e2012-12-16 20:31:26804 EXPECT_TRUE(CreateDetailedMenu());
805 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
806 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
807 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03808 EXPECT_TRUE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13809 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07810 EXPECT_TRUE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]806d94e2012-12-16 20:31:26811 CloseDetailMenu();
812
813 // Disabling all of the a11y features.
[email protected]1dfebfc2013-06-04 03:14:32814 AccessibilityManager::Get()->EnableSpokenFeedback(
jamescooka7f8dab2016-06-21 01:44:03815 false, ash::A11Y_NOTIFICATION_NONE);
[email protected]1dfebfc2013-06-04 03:14:32816 AccessibilityManager::Get()->EnableHighContrast(false);
[email protected]7585f4c2013-01-10 18:26:41817 SetMagnifierEnabled(false);
[email protected]57999022013-06-07 12:52:03818 AccessibilityManager::Get()->EnableLargeCursor(false);
[email protected]abdd0d72014-02-05 17:18:07819 AccessibilityManager::Get()->EnableVirtualKeyboard(false);
[email protected]806d94e2012-12-16 20:31:26820 EXPECT_TRUE(CreateDetailedMenu());
821 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
822 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
823 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03824 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13825 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07826 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13827 CloseDetailMenu();
828
829 // Autoclick is disabled on login screen.
skye79274a2016-06-08 05:39:02830 SetLoginStatus(ash::LoginStatus::USER);
[email protected]7cfa31a2013-10-23 20:08:13831
832 // Enabling autoclick.
833 AccessibilityManager::Get()->EnableAutoclick(true);
834 EXPECT_TRUE(CreateDetailedMenu());
835 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
836 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
837 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
838 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
839 EXPECT_TRUE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07840 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13841 CloseDetailMenu();
842
843 // Disabling autoclick.
844 AccessibilityManager::Get()->EnableAutoclick(false);
845 EXPECT_TRUE(CreateDetailedMenu());
846 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
847 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
848 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu());
849 EXPECT_FALSE(IsLargeCursorEnabledOnDetailMenu());
850 EXPECT_FALSE(IsAutoclickEnabledOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07851 EXPECT_FALSE(IsVirtualKeyboardEnabledOnDetailMenu());
[email protected]57999022013-06-07 12:52:03852 CloseDetailMenu();
853}
854
855IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMenuVisibilityOnDetailMenu) {
skye79274a2016-06-08 05:39:02856 SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN);
[email protected]57999022013-06-07 12:52:03857 EXPECT_TRUE(CreateDetailedMenu());
858 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
859 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
860 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
861 EXPECT_TRUE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13862 EXPECT_FALSE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07863 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
tdanderson581149422016-10-25 21:37:58864 EXPECT_FALSE(IsHelpAvailableOnDetailMenu());
865 EXPECT_FALSE(IsSettingsAvailableOnDetailMenu());
[email protected]57999022013-06-07 12:52:03866 CloseDetailMenu();
867
skye79274a2016-06-08 05:39:02868 SetLoginStatus(ash::LoginStatus::USER);
[email protected]57999022013-06-07 12:52:03869 EXPECT_TRUE(CreateDetailedMenu());
870 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
871 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
872 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
873 EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13874 EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07875 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
tdanderson581149422016-10-25 21:37:58876 EXPECT_TRUE(IsHelpAvailableOnDetailMenu());
877 EXPECT_TRUE(IsSettingsAvailableOnDetailMenu());
[email protected]57999022013-06-07 12:52:03878 CloseDetailMenu();
879
skye79274a2016-06-08 05:39:02880 SetLoginStatus(ash::LoginStatus::LOCKED);
[email protected]57999022013-06-07 12:52:03881 EXPECT_TRUE(CreateDetailedMenu());
882 EXPECT_TRUE(IsSpokenFeedbackMenuShownOnDetailMenu());
883 EXPECT_TRUE(IsHighContrastMenuShownOnDetailMenu());
884 EXPECT_TRUE(IsScreenMagnifierMenuShownOnDetailMenu());
885 EXPECT_FALSE(IsLargeCursorMenuShownOnDetailMenu());
[email protected]7cfa31a2013-10-23 20:08:13886 EXPECT_TRUE(IsAutoclickMenuShownOnDetailMenu());
[email protected]abdd0d72014-02-05 17:18:07887 EXPECT_TRUE(IsVirtualKeyboardMenuShownOnDetailMenu());
tdanderson581149422016-10-25 21:37:58888 EXPECT_FALSE(IsHelpAvailableOnDetailMenu());
889 EXPECT_FALSE(IsSettingsAvailableOnDetailMenu());
[email protected]7570bba2014-08-08 08:04:47890 CloseDetailMenu();
891
xiyuanf1ff14d2017-03-20 20:28:14892 session_manager::SessionManager::Get()->SetSessionState(
893 session_manager::SessionState::LOGIN_SECONDARY);
894 base::RunLoop().RunUntilIdle(); // Flush session state to ash.
skye79274a2016-06-08 05:39:02895 SetLoginStatus(ash::LoginStatus::USER);
[email protected]7570bba2014-08-08 08:04:47896 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());
tdanderson581149422016-10-25 21:37:58903 EXPECT_FALSE(IsHelpAvailableOnDetailMenu());
904 EXPECT_FALSE(IsSettingsAvailableOnDetailMenu());
[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