OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/magnifier/magnification_controller.h" | 5 #include "ash/magnifier/magnification_controller.h" |
6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
7 #include "ash/system/tray/system_tray.h" | 7 #include "ash/system/tray/system_tray.h" |
8 #include "ash/system/tray_accessibility.h" | 8 #include "ash/system/tray_accessibility.h" |
9 #include "ash/system/user/login_status.h" | 9 #include "ash/system/user/login_status.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
15 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 15 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
16 #include "chrome/browser/chromeos/login/helper.h" | 16 #include "chrome/browser/chromeos/login/helper.h" |
17 #include "chrome/browser/chromeos/login/login_utils.h" | 17 #include "chrome/browser/chromeos/login/login_utils.h" |
18 #include "chrome/browser/chromeos/login/startup_utils.h" | 18 #include "chrome/browser/chromeos/login/startup_utils.h" |
19 #include "chrome/browser/chromeos/login/user_manager.h" | 19 #include "chrome/browser/chromeos/login/user_manager.h" |
20 #include "chrome/browser/chromeos/login/user_manager_impl.h" | 20 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
21 #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" | |
21 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
23 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
26 #include "chrome/test/base/testing_profile.h" | 30 #include "chrome/test/base/testing_profile.h" |
27 #include "chromeos/chromeos_switches.h" | 31 #include "chromeos/chromeos_switches.h" |
28 #include "content/public/test/test_utils.h" | 32 #include "content/public/test/test_utils.h" |
33 #include "policy/policy_constants.h" | |
29 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
30 #include "ui/views/widget/widget.h" | 35 #include "ui/views/widget/widget.h" |
31 | 36 |
37 using policy::BrowserPolicyConnector; | |
38 using policy::MockConfigurationPolicyProvider; | |
39 using policy::PolicyMap; | |
Mattias Nissler (ping if slow)
2013/05/13 08:27:44
Why usually don't add using declarations for these
David Roche
2013/05/16 22:20:57
Done.
| |
40 using testing::AnyNumber; | |
41 using testing::Return; | |
42 using testing::_; | |
43 using testing::WithParamInterface; | |
44 | |
32 namespace chromeos { | 45 namespace chromeos { |
33 | 46 |
47 enum PrefSettingMechanism { | |
48 PREF_SERVICE, | |
49 POLICY, | |
50 }; | |
51 | |
34 void SetMagnifierEnabled(bool enabled) { | 52 void SetMagnifierEnabled(bool enabled) { |
35 MagnificationManager::Get()->SetMagnifierEnabled(enabled); | 53 MagnificationManager::Get()->SetMagnifierEnabled(enabled); |
36 } | 54 } |
37 | 55 |
38 class TrayAccessibilityTest : public CrosInProcessBrowserTest { | 56 class TrayAccessibilityTest |
57 : public CrosInProcessBrowserTest, | |
58 public WithParamInterface<PrefSettingMechanism> { | |
Mattias Nissler (ping if slow)
2013/05/13 08:27:44
I'm not sure whether it's a good idea essentially
dmazzoni
2013/05/14 17:42:14
Actually in this case it seems reasonable. The tes
David Roche
2013/05/16 22:20:57
The test names look like so:
TrayAccessibilityTes
| |
39 protected: | 59 protected: |
40 TrayAccessibilityTest() {} | 60 TrayAccessibilityTest() {} |
41 virtual ~TrayAccessibilityTest() {} | 61 virtual ~TrayAccessibilityTest() {} |
42 | 62 |
63 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | |
64 EXPECT_CALL(provider_, IsInitializationComplete(_)) | |
65 .WillRepeatedly(Return(true)); | |
66 EXPECT_CALL(provider_, RegisterPolicyDomain(_, _)).Times(AnyNumber()); | |
67 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | |
68 } | |
69 | |
43 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 70 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
44 command_line->AppendSwitch(switches::kLoginManager); | 71 command_line->AppendSwitch(switches::kLoginManager); |
45 command_line->AppendSwitchASCII(switches::kLoginProfile, | 72 command_line->AppendSwitchASCII(switches::kLoginProfile, |
46 TestingProfile::kTestUserProfileDir); | 73 TestingProfile::kTestUserProfileDir); |
47 } | 74 } |
48 | 75 |
49 virtual void RunTestOnMainThreadLoop() OVERRIDE { | 76 virtual void RunTestOnMainThreadLoop() OVERRIDE { |
50 // Need to mark oobe completed to show detailed views. | 77 // Need to mark oobe completed to show detailed views. |
51 StartupUtils::MarkOobeCompleted(); | 78 StartupUtils::MarkOobeCompleted(); |
52 CrosInProcessBrowserTest::RunTestOnMainThreadLoop(); | 79 CrosInProcessBrowserTest::RunTestOnMainThreadLoop(); |
53 } | 80 } |
54 | 81 |
82 void SetShowAccessibilityOptionsInSystemTrayMenu(bool value) { | |
83 if (GetParam() == PREF_SERVICE) { | |
84 Profile* profile = ProfileManager::GetDefaultProfile(); | |
85 PrefService* prefs = profile->GetPrefs(); | |
86 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, value); | |
87 prefs->CommitPendingWrite(); | |
Mattias Nissler (ping if slow)
2013/05/13 08:27:44
This shouldn't be necessary.
David Roche
2013/05/16 22:20:57
Done.
| |
88 } else if (GetParam() == POLICY) { | |
89 PolicyMap policy_map; | |
90 policy_map.Set(policy::key::kShowAccessibilityOptionsInSystemTrayMenu, | |
91 policy::POLICY_LEVEL_MANDATORY, | |
92 policy::POLICY_SCOPE_USER, | |
93 base::Value::CreateBooleanValue(value)); | |
94 provider_.UpdateChromePolicy(policy_map); | |
95 base::RunLoop().RunUntilIdle(); | |
Mattias Nissler (ping if slow)
2013/05/13 08:27:44
#include "base/run_loop.h"
David Roche
2013/05/16 22:20:57
Done.
| |
96 } else { | |
97 FAIL() << "Unknown test parameterization"; | |
98 } | |
99 } | |
100 | |
55 ash::internal::TrayAccessibility* tray() { | 101 ash::internal::TrayAccessibility* tray() { |
56 return ash::Shell::GetInstance()->GetPrimarySystemTray()-> | 102 return ash::Shell::GetInstance()->GetPrimarySystemTray()-> |
57 GetTrayAccessibilityForTest(); | 103 GetTrayAccessibilityForTest(); |
58 } | 104 } |
59 | 105 |
60 bool IsTrayIconVisible() { | 106 bool IsTrayIconVisible() { |
61 return tray()->tray_icon_visible_; | 107 return tray()->tray_icon_visible_; |
62 } | 108 } |
63 | 109 |
64 views::View* CreateMenuItem() { | 110 views::View* CreateMenuItem() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 return tray()->detailed_menu_->spoken_feedback_enabled_; | 161 return tray()->detailed_menu_->spoken_feedback_enabled_; |
116 } | 162 } |
117 | 163 |
118 bool IsHighContrastEnabledOnDetailMenu() { | 164 bool IsHighContrastEnabledOnDetailMenu() { |
119 return tray()->detailed_menu_->high_contrast_enabled_; | 165 return tray()->detailed_menu_->high_contrast_enabled_; |
120 } | 166 } |
121 | 167 |
122 bool IsScreenMagnifierEnabledOnDetailMenu() { | 168 bool IsScreenMagnifierEnabledOnDetailMenu() { |
123 return tray()->detailed_menu_->screen_magnifier_enabled_; | 169 return tray()->detailed_menu_->screen_magnifier_enabled_; |
124 } | 170 } |
171 | |
172 MockConfigurationPolicyProvider provider_; | |
125 }; | 173 }; |
126 | 174 |
127 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, LoginStatus) { | 175 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) { |
128 EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus()); | 176 EXPECT_EQ(ash::user::LOGGED_IN_NONE, GetLoginStatus()); |
129 | 177 |
130 UserManager::Get()->UserLoggedIn( | 178 UserManager::Get()->UserLoggedIn( |
131 "owner@invalid.domain", "owner@invalid.domain", true); | 179 "owner@invalid.domain", "owner@invalid.domain", true); |
132 UserManager::Get()->SessionStarted(); | 180 UserManager::Get()->SessionStarted(); |
133 | 181 |
134 EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus()); | 182 EXPECT_EQ(ash::user::LOGGED_IN_USER, GetLoginStatus()); |
135 } | 183 } |
136 | 184 |
137 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) { | 185 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) { |
138 SetLoginStatus(ash::user::LOGGED_IN_NONE); | 186 SetLoginStatus(ash::user::LOGGED_IN_NONE); |
139 | 187 |
140 // Confirms that the icon is invisible before login. | 188 // Confirms that the icon is invisible before login. |
141 EXPECT_FALSE(IsTrayIconVisible()); | 189 EXPECT_FALSE(IsTrayIconVisible()); |
142 | 190 |
143 UserManager::Get()->UserLoggedIn( | 191 UserManager::Get()->UserLoggedIn( |
144 "owner@invalid.domain", "owner@invalid.domain", true); | 192 "owner@invalid.domain", "owner@invalid.domain", true); |
145 UserManager::Get()->SessionStarted(); | 193 UserManager::Get()->SessionStarted(); |
146 | 194 |
147 // Confirms that the icon is invisible just after login. | 195 // Confirms that the icon is invisible just after login. |
148 EXPECT_FALSE(IsTrayIconVisible()); | 196 EXPECT_FALSE(IsTrayIconVisible()); |
149 | 197 |
150 // Toggling spoken feedback changes the visibillity of the icon. | 198 // Toggling spoken feedback changes the visibility of the icon. |
151 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 199 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
152 EXPECT_TRUE(IsTrayIconVisible()); | 200 EXPECT_TRUE(IsTrayIconVisible()); |
153 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 201 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
154 EXPECT_FALSE(IsTrayIconVisible()); | 202 EXPECT_FALSE(IsTrayIconVisible()); |
155 | 203 |
156 // Toggling high contrast the visibillity of the icon. | 204 // Toggling high contrast the visibility of the icon. |
157 accessibility::EnableHighContrast(true); | 205 accessibility::EnableHighContrast(true); |
158 EXPECT_TRUE(IsTrayIconVisible()); | 206 EXPECT_TRUE(IsTrayIconVisible()); |
159 accessibility::EnableHighContrast(false); | 207 accessibility::EnableHighContrast(false); |
160 EXPECT_FALSE(IsTrayIconVisible()); | 208 EXPECT_FALSE(IsTrayIconVisible()); |
161 | 209 |
162 // Toggling magnifier the visibillity of the icon. | 210 // Toggling magnifier the visibility of the icon. |
163 SetMagnifierEnabled(true); | 211 SetMagnifierEnabled(true); |
164 EXPECT_TRUE(IsTrayIconVisible()); | 212 EXPECT_TRUE(IsTrayIconVisible()); |
165 SetMagnifierEnabled(false); | 213 SetMagnifierEnabled(false); |
166 EXPECT_FALSE(IsTrayIconVisible()); | 214 EXPECT_FALSE(IsTrayIconVisible()); |
167 | 215 |
168 // Enabling all accessibility features. | 216 // Enabling all accessibility features. |
169 SetMagnifierEnabled(true); | 217 SetMagnifierEnabled(true); |
170 EXPECT_TRUE(IsTrayIconVisible()); | 218 EXPECT_TRUE(IsTrayIconVisible()); |
171 accessibility::EnableHighContrast(true); | 219 accessibility::EnableHighContrast(true); |
172 EXPECT_TRUE(IsTrayIconVisible()); | 220 EXPECT_TRUE(IsTrayIconVisible()); |
173 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 221 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
174 EXPECT_TRUE(IsTrayIconVisible()); | 222 EXPECT_TRUE(IsTrayIconVisible()); |
175 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 223 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
176 EXPECT_TRUE(IsTrayIconVisible()); | 224 EXPECT_TRUE(IsTrayIconVisible()); |
177 accessibility::EnableHighContrast(false); | 225 accessibility::EnableHighContrast(false); |
178 EXPECT_TRUE(IsTrayIconVisible()); | 226 EXPECT_TRUE(IsTrayIconVisible()); |
179 SetMagnifierEnabled(false); | 227 SetMagnifierEnabled(false); |
180 EXPECT_FALSE(IsTrayIconVisible()); | 228 EXPECT_FALSE(IsTrayIconVisible()); |
181 | 229 |
182 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect | 230 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect |
183 // the icon on the tray. | 231 // the icon on the tray. |
184 Profile* profile = ProfileManager::GetDefaultProfile(); | 232 SetShowAccessibilityOptionsInSystemTrayMenu(true); |
185 PrefService* prefs = profile->GetPrefs(); | |
186 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); | |
187 prefs->CommitPendingWrite(); | |
188 accessibility::EnableHighContrast(true); | 233 accessibility::EnableHighContrast(true); |
189 EXPECT_TRUE(IsTrayIconVisible()); | 234 EXPECT_TRUE(IsTrayIconVisible()); |
190 accessibility::EnableHighContrast(false); | 235 accessibility::EnableHighContrast(false); |
191 EXPECT_FALSE(IsTrayIconVisible()); | 236 EXPECT_FALSE(IsTrayIconVisible()); |
192 } | 237 } |
193 | 238 |
194 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) { | 239 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { |
195 // Login | 240 // Login |
196 UserManager::Get()->UserLoggedIn( | 241 UserManager::Get()->UserLoggedIn( |
197 "owner@invalid.domain", "owner@invalid.domain", true); | 242 "owner@invalid.domain", "owner@invalid.domain", true); |
198 UserManager::Get()->SessionStarted(); | 243 UserManager::Get()->SessionStarted(); |
199 | 244 |
200 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. | 245 SetShowAccessibilityOptionsInSystemTrayMenu(false); |
201 Profile* profile = ProfileManager::GetDefaultProfile(); | |
202 PrefService* prefs = profile->GetPrefs(); | |
203 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); | |
204 prefs->CommitPendingWrite(); | |
205 | 246 |
206 // Confirms that the menu is hidden. | 247 // Confirms that the menu is hidden. |
207 EXPECT_FALSE(CanCreateMenuItem()); | 248 EXPECT_FALSE(CanCreateMenuItem()); |
208 | 249 |
209 // Toggling spoken feedback changes the visibillity of the menu. | 250 // Toggling spoken feedback changes the visibility of the menu. |
210 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 251 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
211 EXPECT_TRUE(CanCreateMenuItem()); | 252 EXPECT_TRUE(CanCreateMenuItem()); |
212 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 253 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
213 EXPECT_FALSE(CanCreateMenuItem()); | 254 EXPECT_FALSE(CanCreateMenuItem()); |
214 | 255 |
215 // Toggling high contrast changes the visibillity of the menu. | 256 // Toggling high contrast changes the visibility of the menu. |
216 accessibility::EnableHighContrast(true); | 257 accessibility::EnableHighContrast(true); |
217 EXPECT_TRUE(CanCreateMenuItem()); | 258 EXPECT_TRUE(CanCreateMenuItem()); |
218 accessibility::EnableHighContrast(false); | 259 accessibility::EnableHighContrast(false); |
219 EXPECT_FALSE(CanCreateMenuItem()); | 260 EXPECT_FALSE(CanCreateMenuItem()); |
220 | 261 |
221 // Toggling screen magnifier changes the visibillity of the menu. | 262 // Toggling screen magnifier changes the visibility of the menu. |
222 SetMagnifierEnabled(true); | 263 SetMagnifierEnabled(true); |
223 EXPECT_TRUE(CanCreateMenuItem()); | 264 EXPECT_TRUE(CanCreateMenuItem()); |
224 SetMagnifierEnabled(false); | 265 SetMagnifierEnabled(false); |
225 EXPECT_FALSE(CanCreateMenuItem()); | 266 EXPECT_FALSE(CanCreateMenuItem()); |
226 | 267 |
227 // Enabling all accessibility features. | 268 // Enabling all accessibility features. |
228 SetMagnifierEnabled(true); | 269 SetMagnifierEnabled(true); |
229 EXPECT_TRUE(CanCreateMenuItem()); | 270 EXPECT_TRUE(CanCreateMenuItem()); |
230 accessibility::EnableHighContrast(true); | 271 accessibility::EnableHighContrast(true); |
231 EXPECT_TRUE(CanCreateMenuItem()); | 272 EXPECT_TRUE(CanCreateMenuItem()); |
232 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 273 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
233 EXPECT_TRUE(CanCreateMenuItem()); | 274 EXPECT_TRUE(CanCreateMenuItem()); |
234 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 275 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
235 EXPECT_TRUE(CanCreateMenuItem()); | 276 EXPECT_TRUE(CanCreateMenuItem()); |
236 accessibility::EnableHighContrast(false); | 277 accessibility::EnableHighContrast(false); |
237 EXPECT_TRUE(CanCreateMenuItem()); | 278 EXPECT_TRUE(CanCreateMenuItem()); |
238 SetMagnifierEnabled(false); | 279 SetMagnifierEnabled(false); |
239 EXPECT_FALSE(CanCreateMenuItem()); | 280 EXPECT_FALSE(CanCreateMenuItem()); |
240 } | 281 } |
241 | 282 |
242 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { | 283 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
243 // Login | 284 // Login |
244 UserManager::Get()->UserLoggedIn( | 285 UserManager::Get()->UserLoggedIn( |
245 "owner@invalid.domain", "owner@invalid.domain", true); | 286 "owner@invalid.domain", "owner@invalid.domain", true); |
246 UserManager::Get()->SessionStarted(); | 287 UserManager::Get()->SessionStarted(); |
247 | 288 |
248 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. | 289 SetShowAccessibilityOptionsInSystemTrayMenu(true); |
249 Profile* profile = ProfileManager::GetDefaultProfile(); | |
250 PrefService* prefs = profile->GetPrefs(); | |
251 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); | |
252 prefs->CommitPendingWrite(); | |
253 | 290 |
254 // Confirms that the menu is visible. | 291 // Confirms that the menu is visible. |
255 EXPECT_TRUE(CanCreateMenuItem()); | 292 EXPECT_TRUE(CanCreateMenuItem()); |
256 | 293 |
257 // The menu is keeping visible regardless of toggling spoken feedback. | 294 // The menu is keeping visible regardless of toggling spoken feedback. |
258 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 295 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
259 EXPECT_TRUE(CanCreateMenuItem()); | 296 EXPECT_TRUE(CanCreateMenuItem()); |
260 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 297 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
261 EXPECT_TRUE(CanCreateMenuItem()); | 298 EXPECT_TRUE(CanCreateMenuItem()); |
262 | 299 |
(...skipping 16 matching lines...) Expand all Loading... | |
279 EXPECT_TRUE(CanCreateMenuItem()); | 316 EXPECT_TRUE(CanCreateMenuItem()); |
280 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 317 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
281 EXPECT_TRUE(CanCreateMenuItem()); | 318 EXPECT_TRUE(CanCreateMenuItem()); |
282 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 319 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
283 EXPECT_TRUE(CanCreateMenuItem()); | 320 EXPECT_TRUE(CanCreateMenuItem()); |
284 accessibility::EnableHighContrast(false); | 321 accessibility::EnableHighContrast(false); |
285 EXPECT_TRUE(CanCreateMenuItem()); | 322 EXPECT_TRUE(CanCreateMenuItem()); |
286 SetMagnifierEnabled(false); | 323 SetMagnifierEnabled(false); |
287 EXPECT_TRUE(CanCreateMenuItem()); | 324 EXPECT_TRUE(CanCreateMenuItem()); |
288 | 325 |
289 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. | 326 SetShowAccessibilityOptionsInSystemTrayMenu(false); |
290 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); | |
291 | 327 |
292 // Confirms that the menu is invisible. | 328 // Confirms that the menu is invisible. |
293 EXPECT_FALSE(CanCreateMenuItem()); | 329 EXPECT_FALSE(CanCreateMenuItem()); |
294 } | 330 } |
295 | 331 |
296 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { | 332 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { |
297 SetLoginStatus(ash::user::LOGGED_IN_NONE); | 333 SetLoginStatus(ash::user::LOGGED_IN_NONE); |
298 | 334 |
299 // Confirms that the menu is visible. | 335 // Confirms that the menu is visible. |
300 EXPECT_TRUE(CanCreateMenuItem()); | 336 EXPECT_TRUE(CanCreateMenuItem()); |
301 | 337 |
302 // The menu is keeping visible regardless of toggling spoken feedback. | 338 // The menu is keeping visible regardless of toggling spoken feedback. |
303 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 339 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
304 EXPECT_TRUE(CanCreateMenuItem()); | 340 EXPECT_TRUE(CanCreateMenuItem()); |
305 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 341 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
306 EXPECT_TRUE(CanCreateMenuItem()); | 342 EXPECT_TRUE(CanCreateMenuItem()); |
(...skipping 17 matching lines...) Expand all Loading... | |
324 EXPECT_TRUE(CanCreateMenuItem()); | 360 EXPECT_TRUE(CanCreateMenuItem()); |
325 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 361 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
326 EXPECT_TRUE(CanCreateMenuItem()); | 362 EXPECT_TRUE(CanCreateMenuItem()); |
327 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 363 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
328 EXPECT_TRUE(CanCreateMenuItem()); | 364 EXPECT_TRUE(CanCreateMenuItem()); |
329 accessibility::EnableHighContrast(false); | 365 accessibility::EnableHighContrast(false); |
330 EXPECT_TRUE(CanCreateMenuItem()); | 366 EXPECT_TRUE(CanCreateMenuItem()); |
331 SetMagnifierEnabled(false); | 367 SetMagnifierEnabled(false); |
332 EXPECT_TRUE(CanCreateMenuItem()); | 368 EXPECT_TRUE(CanCreateMenuItem()); |
333 | 369 |
334 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. | 370 SetShowAccessibilityOptionsInSystemTrayMenu(true); |
335 Profile* profile = ProfileManager::GetDefaultProfile(); | |
336 PrefService* prefs = profile->GetPrefs(); | |
337 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); | |
338 prefs->CommitPendingWrite(); | |
339 | 371 |
340 // Confirms that the menu is keeping visible. | 372 // Confirms that the menu is keeping visible. |
341 EXPECT_TRUE(CanCreateMenuItem()); | 373 EXPECT_TRUE(CanCreateMenuItem()); |
342 | 374 |
343 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. | 375 SetShowAccessibilityOptionsInSystemTrayMenu(false); |
344 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); | |
345 prefs->CommitPendingWrite(); | |
346 | 376 |
347 // Confirms that the menu is keeping visible. | 377 // Confirms that the menu is keeping visible. |
348 EXPECT_TRUE(CanCreateMenuItem()); | 378 EXPECT_TRUE(CanCreateMenuItem()); |
349 } | 379 } |
350 | 380 |
351 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { | 381 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { |
352 // Enables high contrast mode. | 382 // Enables high contrast mode. |
353 accessibility::EnableHighContrast(true); | 383 accessibility::EnableHighContrast(true); |
354 EXPECT_TRUE(CanCreateMenuItem()); | 384 EXPECT_TRUE(CanCreateMenuItem()); |
355 | 385 |
356 // Locks the screen. | 386 // Locks the screen. |
357 SetLoginStatus(ash::user::LOGGED_IN_LOCKED); | 387 SetLoginStatus(ash::user::LOGGED_IN_LOCKED); |
358 EXPECT_TRUE(CanCreateMenuItem()); | 388 EXPECT_TRUE(CanCreateMenuItem()); |
359 | 389 |
360 // Disables high contrast mode. | 390 // Disables high contrast mode. |
361 accessibility::EnableHighContrast(false); | 391 accessibility::EnableHighContrast(false); |
362 | 392 |
363 // Confirms that the menu is still visible. | 393 // Confirms that the menu is still visible. |
364 EXPECT_TRUE(CanCreateMenuItem()); | 394 EXPECT_TRUE(CanCreateMenuItem()); |
365 } | 395 } |
366 | 396 |
367 #if defined(OS_CHROMEOS) | 397 #if defined(OS_CHROMEOS) |
368 #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu | 398 #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu |
369 #else | 399 #else |
370 #define MAYBE_ClickDetailMenu ClickDetailMenu | 400 #define MAYBE_ClickDetailMenu ClickDetailMenu |
371 #endif | 401 #endif |
372 | 402 |
373 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { | 403 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { |
374 // Confirms that the check item toggles the spoken feedback. | 404 // Confirms that the check item toggles the spoken feedback. |
375 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); | 405 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); |
376 | 406 |
377 EXPECT_TRUE(CreateDetailedMenu()); | 407 EXPECT_TRUE(CreateDetailedMenu()); |
378 ClickSpokenFeedbackOnDetailMenu(); | 408 ClickSpokenFeedbackOnDetailMenu(); |
379 EXPECT_TRUE(accessibility::IsSpokenFeedbackEnabled()); | 409 EXPECT_TRUE(accessibility::IsSpokenFeedbackEnabled()); |
380 | 410 |
381 EXPECT_TRUE(CreateDetailedMenu()); | 411 EXPECT_TRUE(CreateDetailedMenu()); |
382 ClickSpokenFeedbackOnDetailMenu(); | 412 ClickSpokenFeedbackOnDetailMenu(); |
383 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); | 413 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); |
(...skipping 15 matching lines...) Expand all Loading... | |
399 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); | 429 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
400 EXPECT_TRUE(CreateDetailedMenu()); | 430 EXPECT_TRUE(CreateDetailedMenu()); |
401 ClickScreenMagnifierOnDetailMenu(); | 431 ClickScreenMagnifierOnDetailMenu(); |
402 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); | 432 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); |
403 | 433 |
404 EXPECT_TRUE(CreateDetailedMenu()); | 434 EXPECT_TRUE(CreateDetailedMenu()); |
405 ClickScreenMagnifierOnDetailMenu(); | 435 ClickScreenMagnifierOnDetailMenu(); |
406 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); | 436 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
407 } | 437 } |
408 | 438 |
409 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { | 439 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, CheckMarksOnDetailMenu) { |
410 // At first, all of the check is unchecked. | 440 // At first, all of the check is unchecked. |
411 EXPECT_TRUE(CreateDetailedMenu()); | 441 EXPECT_TRUE(CreateDetailedMenu()); |
412 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 442 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
413 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 443 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
414 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 444 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
415 CloseDetailMenu(); | 445 CloseDetailMenu(); |
416 | 446 |
417 // Enabling spoken feedback. | 447 // Enabling spoken feedback. |
418 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 448 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); |
419 EXPECT_TRUE(CreateDetailedMenu()); | 449 EXPECT_TRUE(CreateDetailedMenu()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 506 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); |
477 accessibility::EnableHighContrast(false); | 507 accessibility::EnableHighContrast(false); |
478 SetMagnifierEnabled(false); | 508 SetMagnifierEnabled(false); |
479 EXPECT_TRUE(CreateDetailedMenu()); | 509 EXPECT_TRUE(CreateDetailedMenu()); |
480 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 510 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
481 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 511 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
482 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 512 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
483 CloseDetailMenu(); | 513 CloseDetailMenu(); |
484 } | 514 } |
485 | 515 |
516 INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, | |
517 TrayAccessibilityTest, | |
518 testing::Values(PREF_SERVICE, | |
519 POLICY)); | |
520 | |
486 } // namespace chromeos | 521 } // namespace chromeos |
OLD | NEW |