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/tray_views.h" | 8 #include "ash/system/tray/tray_views.h" |
9 #include "ash/system/tray_accessibility.h" | 9 #include "ash/system/tray_accessibility.h" |
10 #include "ash/system/user/login_status.h" | 10 #include "ash/system/user/login_status.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
15 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 15 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
16 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 16 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
17 #include "chrome/browser/chromeos/login/helper.h" | 17 #include "chrome/browser/chromeos/login/helper.h" |
18 #include "chrome/browser/chromeos/login/login_utils.h" | 18 #include "chrome/browser/chromeos/login/login_utils.h" |
19 #include "chrome/browser/chromeos/login/startup_utils.h" | 19 #include "chrome/browser/chromeos/login/startup_utils.h" |
20 #include "chrome/browser/chromeos/login/user_manager.h" | 20 #include "chrome/browser/chromeos/login/user_manager.h" |
21 #include "chrome/browser/chromeos/login/user_manager_impl.h" | 21 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 EXPECT_FALSE(IsTrayIconVisible()); | 142 EXPECT_FALSE(IsTrayIconVisible()); |
143 | 143 |
144 UserManager::Get()->UserLoggedIn( | 144 UserManager::Get()->UserLoggedIn( |
145 "owner@invalid.domain", "owner@invalid.domain", true); | 145 "owner@invalid.domain", "owner@invalid.domain", true); |
146 UserManager::Get()->SessionStarted(); | 146 UserManager::Get()->SessionStarted(); |
147 | 147 |
148 // Confirms that the icon is invisible just after login. | 148 // Confirms that the icon is invisible just after login. |
149 EXPECT_FALSE(IsTrayIconVisible()); | 149 EXPECT_FALSE(IsTrayIconVisible()); |
150 | 150 |
151 // Toggling spoken feedback changes the visibillity of the icon. | 151 // Toggling spoken feedback changes the visibillity of the icon. |
152 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 152 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 153 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
153 EXPECT_TRUE(IsTrayIconVisible()); | 154 EXPECT_TRUE(IsTrayIconVisible()); |
154 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 155 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 156 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
155 EXPECT_FALSE(IsTrayIconVisible()); | 157 EXPECT_FALSE(IsTrayIconVisible()); |
156 | 158 |
157 // Toggling high contrast the visibillity of the icon. | 159 // Toggling high contrast the visibillity of the icon. |
158 accessibility::EnableHighContrast(true); | 160 AccessibilityManager::Get()->EnableHighContrast(true); |
159 EXPECT_TRUE(IsTrayIconVisible()); | 161 EXPECT_TRUE(IsTrayIconVisible()); |
160 accessibility::EnableHighContrast(false); | 162 AccessibilityManager::Get()->EnableHighContrast(false); |
161 EXPECT_FALSE(IsTrayIconVisible()); | 163 EXPECT_FALSE(IsTrayIconVisible()); |
162 | 164 |
163 // Toggling magnifier the visibillity of the icon. | 165 // Toggling magnifier the visibillity of the icon. |
164 SetMagnifierEnabled(true); | 166 SetMagnifierEnabled(true); |
165 EXPECT_TRUE(IsTrayIconVisible()); | 167 EXPECT_TRUE(IsTrayIconVisible()); |
166 SetMagnifierEnabled(false); | 168 SetMagnifierEnabled(false); |
167 EXPECT_FALSE(IsTrayIconVisible()); | 169 EXPECT_FALSE(IsTrayIconVisible()); |
168 | 170 |
169 // Enabling all accessibility features. | 171 // Enabling all accessibility features. |
170 SetMagnifierEnabled(true); | 172 SetMagnifierEnabled(true); |
171 EXPECT_TRUE(IsTrayIconVisible()); | 173 EXPECT_TRUE(IsTrayIconVisible()); |
172 accessibility::EnableHighContrast(true); | 174 AccessibilityManager::Get()->EnableHighContrast(true); |
173 EXPECT_TRUE(IsTrayIconVisible()); | 175 EXPECT_TRUE(IsTrayIconVisible()); |
174 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 176 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 177 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
175 EXPECT_TRUE(IsTrayIconVisible()); | 178 EXPECT_TRUE(IsTrayIconVisible()); |
176 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 179 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 180 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
177 EXPECT_TRUE(IsTrayIconVisible()); | 181 EXPECT_TRUE(IsTrayIconVisible()); |
178 accessibility::EnableHighContrast(false); | 182 AccessibilityManager::Get()->EnableHighContrast(false); |
179 EXPECT_TRUE(IsTrayIconVisible()); | 183 EXPECT_TRUE(IsTrayIconVisible()); |
180 SetMagnifierEnabled(false); | 184 SetMagnifierEnabled(false); |
181 EXPECT_FALSE(IsTrayIconVisible()); | 185 EXPECT_FALSE(IsTrayIconVisible()); |
182 | 186 |
183 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect | 187 // Confirms that prefs::kShouldAlwaysShowAccessibilityMenu doesn't affect |
184 // the icon on the tray. | 188 // the icon on the tray. |
185 Profile* profile = ProfileManager::GetDefaultProfile(); | 189 Profile* profile = ProfileManager::GetDefaultProfile(); |
186 PrefService* prefs = profile->GetPrefs(); | 190 PrefService* prefs = profile->GetPrefs(); |
187 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); | 191 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); |
188 prefs->CommitPendingWrite(); | 192 prefs->CommitPendingWrite(); |
189 accessibility::EnableHighContrast(true); | 193 AccessibilityManager::Get()->EnableHighContrast(true); |
190 EXPECT_TRUE(IsTrayIconVisible()); | 194 EXPECT_TRUE(IsTrayIconVisible()); |
191 accessibility::EnableHighContrast(false); | 195 AccessibilityManager::Get()->EnableHighContrast(false); |
192 EXPECT_FALSE(IsTrayIconVisible()); | 196 EXPECT_FALSE(IsTrayIconVisible()); |
193 } | 197 } |
194 | 198 |
195 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) { | 199 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) { |
196 // Login | 200 // Login |
197 UserManager::Get()->UserLoggedIn( | 201 UserManager::Get()->UserLoggedIn( |
198 "owner@invalid.domain", "owner@invalid.domain", true); | 202 "owner@invalid.domain", "owner@invalid.domain", true); |
199 UserManager::Get()->SessionStarted(); | 203 UserManager::Get()->SessionStarted(); |
200 | 204 |
201 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. | 205 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. |
202 Profile* profile = ProfileManager::GetDefaultProfile(); | 206 Profile* profile = ProfileManager::GetDefaultProfile(); |
203 PrefService* prefs = profile->GetPrefs(); | 207 PrefService* prefs = profile->GetPrefs(); |
204 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); | 208 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); |
205 prefs->CommitPendingWrite(); | 209 prefs->CommitPendingWrite(); |
206 | 210 |
207 // Confirms that the menu is hidden. | 211 // Confirms that the menu is hidden. |
208 EXPECT_FALSE(CanCreateMenuItem()); | 212 EXPECT_FALSE(CanCreateMenuItem()); |
209 | 213 |
210 // Toggling spoken feedback changes the visibillity of the menu. | 214 // Toggling spoken feedback changes the visibillity of the menu. |
211 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 215 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 216 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
212 EXPECT_TRUE(CanCreateMenuItem()); | 217 EXPECT_TRUE(CanCreateMenuItem()); |
213 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 218 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 219 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
214 EXPECT_FALSE(CanCreateMenuItem()); | 220 EXPECT_FALSE(CanCreateMenuItem()); |
215 | 221 |
216 // Toggling high contrast changes the visibillity of the menu. | 222 // Toggling high contrast changes the visibillity of the menu. |
217 accessibility::EnableHighContrast(true); | 223 AccessibilityManager::Get()->EnableHighContrast(true); |
218 EXPECT_TRUE(CanCreateMenuItem()); | 224 EXPECT_TRUE(CanCreateMenuItem()); |
219 accessibility::EnableHighContrast(false); | 225 AccessibilityManager::Get()->EnableHighContrast(false); |
220 EXPECT_FALSE(CanCreateMenuItem()); | 226 EXPECT_FALSE(CanCreateMenuItem()); |
221 | 227 |
222 // Toggling screen magnifier changes the visibillity of the menu. | 228 // Toggling screen magnifier changes the visibillity of the menu. |
223 SetMagnifierEnabled(true); | 229 SetMagnifierEnabled(true); |
224 EXPECT_TRUE(CanCreateMenuItem()); | 230 EXPECT_TRUE(CanCreateMenuItem()); |
225 SetMagnifierEnabled(false); | 231 SetMagnifierEnabled(false); |
226 EXPECT_FALSE(CanCreateMenuItem()); | 232 EXPECT_FALSE(CanCreateMenuItem()); |
227 | 233 |
228 // Enabling all accessibility features. | 234 // Enabling all accessibility features. |
229 SetMagnifierEnabled(true); | 235 SetMagnifierEnabled(true); |
230 EXPECT_TRUE(CanCreateMenuItem()); | 236 EXPECT_TRUE(CanCreateMenuItem()); |
231 accessibility::EnableHighContrast(true); | 237 AccessibilityManager::Get()->EnableHighContrast(true); |
232 EXPECT_TRUE(CanCreateMenuItem()); | 238 EXPECT_TRUE(CanCreateMenuItem()); |
233 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 239 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 240 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
234 EXPECT_TRUE(CanCreateMenuItem()); | 241 EXPECT_TRUE(CanCreateMenuItem()); |
235 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 242 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 243 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
236 EXPECT_TRUE(CanCreateMenuItem()); | 244 EXPECT_TRUE(CanCreateMenuItem()); |
237 accessibility::EnableHighContrast(false); | 245 AccessibilityManager::Get()->EnableHighContrast(false); |
238 EXPECT_TRUE(CanCreateMenuItem()); | 246 EXPECT_TRUE(CanCreateMenuItem()); |
239 SetMagnifierEnabled(false); | 247 SetMagnifierEnabled(false); |
240 EXPECT_FALSE(CanCreateMenuItem()); | 248 EXPECT_FALSE(CanCreateMenuItem()); |
241 } | 249 } |
242 | 250 |
243 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { | 251 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
244 // Login | 252 // Login |
245 UserManager::Get()->UserLoggedIn( | 253 UserManager::Get()->UserLoggedIn( |
246 "owner@invalid.domain", "owner@invalid.domain", true); | 254 "owner@invalid.domain", "owner@invalid.domain", true); |
247 UserManager::Get()->SessionStarted(); | 255 UserManager::Get()->SessionStarted(); |
248 | 256 |
249 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. | 257 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. |
250 Profile* profile = ProfileManager::GetDefaultProfile(); | 258 Profile* profile = ProfileManager::GetDefaultProfile(); |
251 PrefService* prefs = profile->GetPrefs(); | 259 PrefService* prefs = profile->GetPrefs(); |
252 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); | 260 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); |
253 prefs->CommitPendingWrite(); | 261 prefs->CommitPendingWrite(); |
254 | 262 |
255 // Confirms that the menu is visible. | 263 // Confirms that the menu is visible. |
256 EXPECT_TRUE(CanCreateMenuItem()); | 264 EXPECT_TRUE(CanCreateMenuItem()); |
257 | 265 |
258 // The menu is keeping visible regardless of toggling spoken feedback. | 266 // The menu is keeping visible regardless of toggling spoken feedback. |
259 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 267 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 268 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
260 EXPECT_TRUE(CanCreateMenuItem()); | 269 EXPECT_TRUE(CanCreateMenuItem()); |
261 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 270 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 271 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
262 EXPECT_TRUE(CanCreateMenuItem()); | 272 EXPECT_TRUE(CanCreateMenuItem()); |
263 | 273 |
264 // The menu is keeping visible regardless of toggling high contrast. | 274 // The menu is keeping visible regardless of toggling high contrast. |
265 accessibility::EnableHighContrast(true); | 275 AccessibilityManager::Get()->EnableHighContrast(true); |
266 EXPECT_TRUE(CanCreateMenuItem()); | 276 EXPECT_TRUE(CanCreateMenuItem()); |
267 accessibility::EnableHighContrast(false); | 277 AccessibilityManager::Get()->EnableHighContrast(false); |
268 EXPECT_TRUE(CanCreateMenuItem()); | 278 EXPECT_TRUE(CanCreateMenuItem()); |
269 | 279 |
270 // The menu is keeping visible regardless of toggling screen magnifier. | 280 // The menu is keeping visible regardless of toggling screen magnifier. |
271 SetMagnifierEnabled(true); | 281 SetMagnifierEnabled(true); |
272 EXPECT_TRUE(CanCreateMenuItem()); | 282 EXPECT_TRUE(CanCreateMenuItem()); |
273 SetMagnifierEnabled(false); | 283 SetMagnifierEnabled(false); |
274 EXPECT_TRUE(CanCreateMenuItem()); | 284 EXPECT_TRUE(CanCreateMenuItem()); |
275 | 285 |
276 // Enabling all accessibility features. | 286 // Enabling all accessibility features. |
277 SetMagnifierEnabled(true); | 287 SetMagnifierEnabled(true); |
278 EXPECT_TRUE(CanCreateMenuItem()); | 288 EXPECT_TRUE(CanCreateMenuItem()); |
279 accessibility::EnableHighContrast(true); | 289 AccessibilityManager::Get()->EnableHighContrast(true); |
280 EXPECT_TRUE(CanCreateMenuItem()); | 290 EXPECT_TRUE(CanCreateMenuItem()); |
281 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 291 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 292 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
282 EXPECT_TRUE(CanCreateMenuItem()); | 293 EXPECT_TRUE(CanCreateMenuItem()); |
283 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 294 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 295 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
284 EXPECT_TRUE(CanCreateMenuItem()); | 296 EXPECT_TRUE(CanCreateMenuItem()); |
285 accessibility::EnableHighContrast(false); | 297 AccessibilityManager::Get()->EnableHighContrast(false); |
286 EXPECT_TRUE(CanCreateMenuItem()); | 298 EXPECT_TRUE(CanCreateMenuItem()); |
287 SetMagnifierEnabled(false); | 299 SetMagnifierEnabled(false); |
288 EXPECT_TRUE(CanCreateMenuItem()); | 300 EXPECT_TRUE(CanCreateMenuItem()); |
289 | 301 |
290 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. | 302 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. |
291 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); | 303 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); |
292 | 304 |
293 // Confirms that the menu is invisible. | 305 // Confirms that the menu is invisible. |
294 EXPECT_FALSE(CanCreateMenuItem()); | 306 EXPECT_FALSE(CanCreateMenuItem()); |
295 } | 307 } |
296 | 308 |
297 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { | 309 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) { |
298 SetLoginStatus(ash::user::LOGGED_IN_NONE); | 310 SetLoginStatus(ash::user::LOGGED_IN_NONE); |
299 | 311 |
300 // Confirms that the menu is visible. | 312 // Confirms that the menu is visible. |
301 EXPECT_TRUE(CanCreateMenuItem()); | 313 EXPECT_TRUE(CanCreateMenuItem()); |
302 | 314 |
303 // The menu is keeping visible regardless of toggling spoken feedback. | 315 // The menu is keeping visible regardless of toggling spoken feedback. |
304 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 316 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 317 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
305 EXPECT_TRUE(CanCreateMenuItem()); | 318 EXPECT_TRUE(CanCreateMenuItem()); |
306 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 319 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 320 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
307 EXPECT_TRUE(CanCreateMenuItem()); | 321 EXPECT_TRUE(CanCreateMenuItem()); |
308 | 322 |
309 // The menu is keeping visible regardless of toggling high contrast. | 323 // The menu is keeping visible regardless of toggling high contrast. |
310 accessibility::EnableHighContrast(true); | 324 AccessibilityManager::Get()->EnableHighContrast(true); |
311 EXPECT_TRUE(CanCreateMenuItem()); | 325 EXPECT_TRUE(CanCreateMenuItem()); |
312 accessibility::EnableHighContrast(false); | 326 AccessibilityManager::Get()->EnableHighContrast(false); |
313 EXPECT_TRUE(CanCreateMenuItem()); | 327 EXPECT_TRUE(CanCreateMenuItem()); |
314 | 328 |
315 // The menu is keeping visible regardless of toggling screen magnifier. | 329 // The menu is keeping visible regardless of toggling screen magnifier. |
316 SetMagnifierEnabled(true); | 330 SetMagnifierEnabled(true); |
317 EXPECT_TRUE(CanCreateMenuItem()); | 331 EXPECT_TRUE(CanCreateMenuItem()); |
318 SetMagnifierEnabled(false); | 332 SetMagnifierEnabled(false); |
319 EXPECT_TRUE(CanCreateMenuItem()); | 333 EXPECT_TRUE(CanCreateMenuItem()); |
320 | 334 |
321 // Enabling all accessibility features. | 335 // Enabling all accessibility features. |
322 SetMagnifierEnabled(true); | 336 SetMagnifierEnabled(true); |
323 EXPECT_TRUE(CanCreateMenuItem()); | 337 EXPECT_TRUE(CanCreateMenuItem()); |
324 accessibility::EnableHighContrast(true); | 338 AccessibilityManager::Get()->EnableHighContrast(true); |
325 EXPECT_TRUE(CanCreateMenuItem()); | 339 EXPECT_TRUE(CanCreateMenuItem()); |
326 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 340 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 341 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
327 EXPECT_TRUE(CanCreateMenuItem()); | 342 EXPECT_TRUE(CanCreateMenuItem()); |
328 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 343 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 344 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
329 EXPECT_TRUE(CanCreateMenuItem()); | 345 EXPECT_TRUE(CanCreateMenuItem()); |
330 accessibility::EnableHighContrast(false); | 346 AccessibilityManager::Get()->EnableHighContrast(false); |
331 EXPECT_TRUE(CanCreateMenuItem()); | 347 EXPECT_TRUE(CanCreateMenuItem()); |
332 SetMagnifierEnabled(false); | 348 SetMagnifierEnabled(false); |
333 EXPECT_TRUE(CanCreateMenuItem()); | 349 EXPECT_TRUE(CanCreateMenuItem()); |
334 | 350 |
335 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. | 351 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = true. |
336 Profile* profile = ProfileManager::GetDefaultProfile(); | 352 Profile* profile = ProfileManager::GetDefaultProfile(); |
337 PrefService* prefs = profile->GetPrefs(); | 353 PrefService* prefs = profile->GetPrefs(); |
338 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); | 354 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true); |
339 prefs->CommitPendingWrite(); | 355 prefs->CommitPendingWrite(); |
340 | 356 |
341 // Confirms that the menu is keeping visible. | 357 // Confirms that the menu is keeping visible. |
342 EXPECT_TRUE(CanCreateMenuItem()); | 358 EXPECT_TRUE(CanCreateMenuItem()); |
343 | 359 |
344 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. | 360 // Sets prefs::kShouldAlwaysShowAccessibilityMenu = false. |
345 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); | 361 prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, false); |
346 prefs->CommitPendingWrite(); | 362 prefs->CommitPendingWrite(); |
347 | 363 |
348 // Confirms that the menu is keeping visible. | 364 // Confirms that the menu is keeping visible. |
349 EXPECT_TRUE(CanCreateMenuItem()); | 365 EXPECT_TRUE(CanCreateMenuItem()); |
350 } | 366 } |
351 | 367 |
352 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { | 368 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) { |
353 // Enables high contrast mode. | 369 // Enables high contrast mode. |
354 accessibility::EnableHighContrast(true); | 370 AccessibilityManager::Get()->EnableHighContrast(true); |
355 EXPECT_TRUE(CanCreateMenuItem()); | 371 EXPECT_TRUE(CanCreateMenuItem()); |
356 | 372 |
357 // Locks the screen. | 373 // Locks the screen. |
358 SetLoginStatus(ash::user::LOGGED_IN_LOCKED); | 374 SetLoginStatus(ash::user::LOGGED_IN_LOCKED); |
359 EXPECT_TRUE(CanCreateMenuItem()); | 375 EXPECT_TRUE(CanCreateMenuItem()); |
360 | 376 |
361 // Disables high contrast mode. | 377 // Disables high contrast mode. |
362 accessibility::EnableHighContrast(false); | 378 AccessibilityManager::Get()->EnableHighContrast(false); |
363 | 379 |
364 // Confirms that the menu is still visible. | 380 // Confirms that the menu is still visible. |
365 EXPECT_TRUE(CanCreateMenuItem()); | 381 EXPECT_TRUE(CanCreateMenuItem()); |
366 } | 382 } |
367 | 383 |
368 #if defined(OS_CHROMEOS) | 384 #if defined(OS_CHROMEOS) |
369 #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu | 385 #define MAYBE_ClickDetailMenu DISABLED_ClickDetailMenu |
370 #else | 386 #else |
371 #define MAYBE_ClickDetailMenu ClickDetailMenu | 387 #define MAYBE_ClickDetailMenu ClickDetailMenu |
372 #endif | 388 #endif |
373 | 389 |
374 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { | 390 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, MAYBE_ClickDetailMenu) { |
375 // Confirms that the check item toggles the spoken feedback. | 391 // Confirms that the check item toggles the spoken feedback. |
376 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); | 392 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
377 | 393 |
378 EXPECT_TRUE(CreateDetailedMenu()); | 394 EXPECT_TRUE(CreateDetailedMenu()); |
379 ClickSpokenFeedbackOnDetailMenu(); | 395 ClickSpokenFeedbackOnDetailMenu(); |
380 EXPECT_TRUE(accessibility::IsSpokenFeedbackEnabled()); | 396 EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
381 | 397 |
382 EXPECT_TRUE(CreateDetailedMenu()); | 398 EXPECT_TRUE(CreateDetailedMenu()); |
383 ClickSpokenFeedbackOnDetailMenu(); | 399 ClickSpokenFeedbackOnDetailMenu(); |
384 EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled()); | 400 EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled()); |
385 | 401 |
386 // Confirms that the check item toggles the high contrast. | 402 // Confirms that the check item toggles the high contrast. |
387 EXPECT_FALSE(accessibility::IsHighContrastEnabled()); | 403 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
388 | 404 |
389 EXPECT_TRUE(CreateDetailedMenu()); | 405 EXPECT_TRUE(CreateDetailedMenu()); |
390 ClickHighContrastOnDetailMenu(); | 406 ClickHighContrastOnDetailMenu(); |
391 EXPECT_TRUE(accessibility::IsHighContrastEnabled()); | 407 EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
392 | 408 |
393 EXPECT_TRUE(CreateDetailedMenu()); | 409 EXPECT_TRUE(CreateDetailedMenu()); |
394 ClickHighContrastOnDetailMenu(); | 410 ClickHighContrastOnDetailMenu(); |
395 EXPECT_FALSE(accessibility::IsHighContrastEnabled()); | 411 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
396 | 412 |
397 // Confirms that the check item toggles the magnifier. | 413 // Confirms that the check item toggles the magnifier. |
398 EXPECT_FALSE(accessibility::IsHighContrastEnabled()); | 414 EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled()); |
399 | 415 |
400 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); | 416 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
401 EXPECT_TRUE(CreateDetailedMenu()); | 417 EXPECT_TRUE(CreateDetailedMenu()); |
402 ClickScreenMagnifierOnDetailMenu(); | 418 ClickScreenMagnifierOnDetailMenu(); |
403 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); | 419 EXPECT_TRUE(MagnificationManager::Get()->IsMagnifierEnabled()); |
404 | 420 |
405 EXPECT_TRUE(CreateDetailedMenu()); | 421 EXPECT_TRUE(CreateDetailedMenu()); |
406 ClickScreenMagnifierOnDetailMenu(); | 422 ClickScreenMagnifierOnDetailMenu(); |
407 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); | 423 EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled()); |
408 } | 424 } |
409 | 425 |
410 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { | 426 IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) { |
411 // At first, all of the check is unchecked. | 427 // At first, all of the check is unchecked. |
412 EXPECT_TRUE(CreateDetailedMenu()); | 428 EXPECT_TRUE(CreateDetailedMenu()); |
413 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 429 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
414 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 430 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
415 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 431 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
416 CloseDetailMenu(); | 432 CloseDetailMenu(); |
417 | 433 |
418 // Enabling spoken feedback. | 434 // Enabling spoken feedback. |
419 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 435 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 436 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
420 EXPECT_TRUE(CreateDetailedMenu()); | 437 EXPECT_TRUE(CreateDetailedMenu()); |
421 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); | 438 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
422 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 439 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
423 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 440 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
424 CloseDetailMenu(); | 441 CloseDetailMenu(); |
425 | 442 |
426 // Disabling spoken feedback. | 443 // Disabling spoken feedback. |
427 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 444 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 445 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
428 EXPECT_TRUE(CreateDetailedMenu()); | 446 EXPECT_TRUE(CreateDetailedMenu()); |
429 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 447 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
430 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 448 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
431 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 449 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
432 CloseDetailMenu(); | 450 CloseDetailMenu(); |
433 | 451 |
434 // Enabling high contrast. | 452 // Enabling high contrast. |
435 accessibility::EnableHighContrast(true); | 453 AccessibilityManager::Get()->EnableHighContrast(true); |
436 EXPECT_TRUE(CreateDetailedMenu()); | 454 EXPECT_TRUE(CreateDetailedMenu()); |
437 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 455 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
438 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); | 456 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
439 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 457 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
440 CloseDetailMenu(); | 458 CloseDetailMenu(); |
441 | 459 |
442 // Disabling high contrast. | 460 // Disabling high contrast. |
443 accessibility::EnableHighContrast(false); | 461 AccessibilityManager::Get()->EnableHighContrast(false); |
444 EXPECT_TRUE(CreateDetailedMenu()); | 462 EXPECT_TRUE(CreateDetailedMenu()); |
445 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 463 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
446 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 464 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
447 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 465 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
448 CloseDetailMenu(); | 466 CloseDetailMenu(); |
449 | 467 |
450 // Enabling full screen magnifier. | 468 // Enabling full screen magnifier. |
451 SetMagnifierEnabled(true); | 469 SetMagnifierEnabled(true); |
452 EXPECT_TRUE(CreateDetailedMenu()); | 470 EXPECT_TRUE(CreateDetailedMenu()); |
453 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 471 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
454 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 472 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
455 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); | 473 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
456 CloseDetailMenu(); | 474 CloseDetailMenu(); |
457 | 475 |
458 // Disabling screen magnifier. | 476 // Disabling screen magnifier. |
459 SetMagnifierEnabled(false); | 477 SetMagnifierEnabled(false); |
460 EXPECT_TRUE(CreateDetailedMenu()); | 478 EXPECT_TRUE(CreateDetailedMenu()); |
461 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 479 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
462 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 480 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
463 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 481 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
464 CloseDetailMenu(); | 482 CloseDetailMenu(); |
465 | 483 |
466 // Enabling all of the a11y features. | 484 // Enabling all of the a11y features. |
467 accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE); | 485 AccessibilityManager::Get()->EnableSpokenFeedback( |
468 accessibility::EnableHighContrast(true); | 486 true, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 487 AccessibilityManager::Get()->EnableHighContrast(true); |
469 SetMagnifierEnabled(true); | 488 SetMagnifierEnabled(true); |
470 EXPECT_TRUE(CreateDetailedMenu()); | 489 EXPECT_TRUE(CreateDetailedMenu()); |
471 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); | 490 EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu()); |
472 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); | 491 EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu()); |
473 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); | 492 EXPECT_TRUE(IsScreenMagnifierEnabledOnDetailMenu()); |
474 CloseDetailMenu(); | 493 CloseDetailMenu(); |
475 | 494 |
476 // Disabling all of the a11y features. | 495 // Disabling all of the a11y features. |
477 accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE); | 496 AccessibilityManager::Get()->EnableSpokenFeedback( |
478 accessibility::EnableHighContrast(false); | 497 false, NULL, ash::A11Y_NOTIFICATION_NONE); |
| 498 AccessibilityManager::Get()->EnableHighContrast(false); |
479 SetMagnifierEnabled(false); | 499 SetMagnifierEnabled(false); |
480 EXPECT_TRUE(CreateDetailedMenu()); | 500 EXPECT_TRUE(CreateDetailedMenu()); |
481 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); | 501 EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu()); |
482 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); | 502 EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu()); |
483 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); | 503 EXPECT_FALSE(IsScreenMagnifierEnabledOnDetailMenu()); |
484 CloseDetailMenu(); | 504 CloseDetailMenu(); |
485 } | 505 } |
486 | 506 |
487 } // namespace chromeos | 507 } // namespace chromeos |
OLD | NEW |