Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc

Issue 1840913002: A11y setting: mono audio UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/accessibility/accessibility_manager.h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
6 6
7 #include "ash/magnifier/magnification_controller.h" 7 #include "ash/magnifier/magnification_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 void SetVirtualKeyboardEnabled(bool enabled) { 144 void SetVirtualKeyboardEnabled(bool enabled) {
145 return AccessibilityManager::Get()->EnableVirtualKeyboard(enabled); 145 return AccessibilityManager::Get()->EnableVirtualKeyboard(enabled);
146 } 146 }
147 147
148 bool IsVirtualKeyboardEnabled() { 148 bool IsVirtualKeyboardEnabled() {
149 return AccessibilityManager::Get()->IsVirtualKeyboardEnabled(); 149 return AccessibilityManager::Get()->IsVirtualKeyboardEnabled();
150 } 150 }
151 151
152 void SetMonoAudioEnabled(bool enabled) {
153 return AccessibilityManager::Get()->EnableMonoAudio(enabled);
154 }
155
156 bool IsMonoAudioEnabled() {
157 return AccessibilityManager::Get()->IsMonoAudioEnabled();
158 }
159
152 Profile* GetProfile() { 160 Profile* GetProfile() {
153 Profile* profile = ProfileManager::GetActiveUserProfile(); 161 Profile* profile = ProfileManager::GetActiveUserProfile();
154 DCHECK(profile); 162 DCHECK(profile);
155 return profile; 163 return profile;
156 } 164 }
157 165
158 PrefService* GetPrefs() { 166 PrefService* GetPrefs() {
159 return GetProfile()->GetPrefs(); 167 return GetProfile()->GetPrefs();
160 } 168 }
161 169
(...skipping 14 matching lines...) Expand all
176 } 184 }
177 185
178 void SetAutoclickDelayPref(int delay_ms) { 186 void SetAutoclickDelayPref(int delay_ms) {
179 GetPrefs()->SetInteger(prefs::kAccessibilityAutoclickDelayMs, delay_ms); 187 GetPrefs()->SetInteger(prefs::kAccessibilityAutoclickDelayMs, delay_ms);
180 } 188 }
181 189
182 void SetVirtualKeyboardEnabledPref(bool enabled) { 190 void SetVirtualKeyboardEnabledPref(bool enabled) {
183 GetPrefs()->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, enabled); 191 GetPrefs()->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, enabled);
184 } 192 }
185 193
194 void SetMonoAudioEnabledPref(bool enabled) {
195 GetPrefs()->SetBoolean(prefs::kAccessibilityMonoAudioEnabled, enabled);
196 }
197
186 bool GetLargeCursorEnabledFromPref() { 198 bool GetLargeCursorEnabledFromPref() {
187 return GetPrefs()->GetBoolean(prefs::kAccessibilityLargeCursorEnabled); 199 return GetPrefs()->GetBoolean(prefs::kAccessibilityLargeCursorEnabled);
188 } 200 }
189 201
190 bool GetHighContrastEnabledFromPref() { 202 bool GetHighContrastEnabledFromPref() {
191 return GetPrefs()->GetBoolean(prefs::kAccessibilityHighContrastEnabled); 203 return GetPrefs()->GetBoolean(prefs::kAccessibilityHighContrastEnabled);
192 } 204 }
193 205
194 bool GetSpokenFeedbackEnabledFromPref() { 206 bool GetSpokenFeedbackEnabledFromPref() {
195 return GetPrefs()->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled); 207 return GetPrefs()->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled);
196 } 208 }
197 209
198 bool GetAutoclickEnabledFromPref() { 210 bool GetAutoclickEnabledFromPref() {
199 return GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled); 211 return GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled);
200 } 212 }
201 213
202 int GetAutoclickDelayFromPref() { 214 int GetAutoclickDelayFromPref() {
203 return GetPrefs()->GetInteger(prefs::kAccessibilityAutoclickDelayMs); 215 return GetPrefs()->GetInteger(prefs::kAccessibilityAutoclickDelayMs);
204 } 216 }
205 217
218 bool GetMonoAudioEnabledFromPref() {
219 return GetPrefs()->GetBoolean(prefs::kAccessibilityMonoAudioEnabled);
220 }
221
206 bool IsBrailleImeActive() { 222 bool IsBrailleImeActive() {
207 InputMethodManager* imm = InputMethodManager::Get(); 223 InputMethodManager* imm = InputMethodManager::Get();
208 scoped_ptr<InputMethodDescriptors> descriptors = 224 scoped_ptr<InputMethodDescriptors> descriptors =
209 imm->GetActiveIMEState()->GetActiveInputMethods(); 225 imm->GetActiveIMEState()->GetActiveInputMethods();
210 for (InputMethodDescriptors::const_iterator i = descriptors->begin(); 226 for (InputMethodDescriptors::const_iterator i = descriptors->begin();
211 i != descriptors->end(); 227 i != descriptors->end();
212 ++i) { 228 ++i) {
213 if (i->id() == extension_misc::kBrailleImeEngineId) 229 if (i->id() == extension_misc::kBrailleImeEngineId)
214 return true; 230 return true;
215 } 231 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerTest); 284 DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerTest);
269 }; 285 };
270 286
271 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, Login) { 287 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, Login) {
272 // Confirms that a11y features are disabled on the login screen. 288 // Confirms that a11y features are disabled on the login screen.
273 EXPECT_FALSE(IsLargeCursorEnabled()); 289 EXPECT_FALSE(IsLargeCursorEnabled());
274 EXPECT_FALSE(IsSpokenFeedbackEnabled()); 290 EXPECT_FALSE(IsSpokenFeedbackEnabled());
275 EXPECT_FALSE(IsHighContrastEnabled()); 291 EXPECT_FALSE(IsHighContrastEnabled());
276 EXPECT_FALSE(IsAutoclickEnabled()); 292 EXPECT_FALSE(IsAutoclickEnabled());
277 EXPECT_FALSE(IsVirtualKeyboardEnabled()); 293 EXPECT_FALSE(IsVirtualKeyboardEnabled());
294 EXPECT_FALSE(IsMonoAudioEnabled());
278 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); 295 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay());
279 296
280 // Logs in. 297 // Logs in.
281 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 298 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_,
282 kTestUserName, true); 299 kTestUserName, true);
283 300
284 // Confirms that the features still disabled just after login. 301 // Confirms that the features still disabled just after login.
285 EXPECT_FALSE(IsLargeCursorEnabled()); 302 EXPECT_FALSE(IsLargeCursorEnabled());
286 EXPECT_FALSE(IsSpokenFeedbackEnabled()); 303 EXPECT_FALSE(IsSpokenFeedbackEnabled());
287 EXPECT_FALSE(IsHighContrastEnabled()); 304 EXPECT_FALSE(IsHighContrastEnabled());
288 EXPECT_FALSE(IsAutoclickEnabled()); 305 EXPECT_FALSE(IsAutoclickEnabled());
289 EXPECT_FALSE(IsVirtualKeyboardEnabled()); 306 EXPECT_FALSE(IsVirtualKeyboardEnabled());
307 EXPECT_FALSE(IsMonoAudioEnabled());
290 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); 308 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay());
291 309
292 user_manager::UserManager::Get()->SessionStarted(); 310 user_manager::UserManager::Get()->SessionStarted();
293 311
294 // Confirms that the features are still disabled just after login. 312 // Confirms that the features are still disabled just after login.
295 EXPECT_FALSE(IsLargeCursorEnabled()); 313 EXPECT_FALSE(IsLargeCursorEnabled());
296 EXPECT_FALSE(IsSpokenFeedbackEnabled()); 314 EXPECT_FALSE(IsSpokenFeedbackEnabled());
297 EXPECT_FALSE(IsHighContrastEnabled()); 315 EXPECT_FALSE(IsHighContrastEnabled());
298 EXPECT_FALSE(IsAutoclickEnabled()); 316 EXPECT_FALSE(IsAutoclickEnabled());
299 EXPECT_FALSE(IsVirtualKeyboardEnabled()); 317 EXPECT_FALSE(IsVirtualKeyboardEnabled());
318 EXPECT_FALSE(IsMonoAudioEnabled());
300 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); 319 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay());
301 320
302 // Enables large cursor. 321 // Enables large cursor.
303 SetLargeCursorEnabled(true); 322 SetLargeCursorEnabled(true);
304 // Confirms that large cursor is enabled. 323 // Confirms that large cursor is enabled.
305 EXPECT_TRUE(IsLargeCursorEnabled()); 324 EXPECT_TRUE(IsLargeCursorEnabled());
306 325
307 // Enables spoken feedback. 326 // Enables spoken feedback.
308 SetSpokenFeedbackEnabled(true); 327 SetSpokenFeedbackEnabled(true);
309 // Confirms that the spoken feedback is enabled. 328 // Confirms that the spoken feedback is enabled.
(...skipping 10 matching lines...) Expand all
320 EXPECT_TRUE(IsAutoclickEnabled()); 339 EXPECT_TRUE(IsAutoclickEnabled());
321 340
322 // Test that autoclick delay is set properly. 341 // Test that autoclick delay is set properly.
323 SetAutoclickDelay(kTestAutoclickDelayMs); 342 SetAutoclickDelay(kTestAutoclickDelayMs);
324 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); 343 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay());
325 344
326 // Enable on-screen keyboard 345 // Enable on-screen keyboard
327 SetVirtualKeyboardEnabled(true); 346 SetVirtualKeyboardEnabled(true);
328 // Confirm that the on-screen keyboard option is enabled. 347 // Confirm that the on-screen keyboard option is enabled.
329 EXPECT_TRUE(IsVirtualKeyboardEnabled()); 348 EXPECT_TRUE(IsVirtualKeyboardEnabled());
349
350 // Enable mono audio output
351 SetMonoAudioEnabled(true);
352 // Confirm that mono audio output option is enabled.
353 EXPECT_TRUE(IsMonoAudioEnabled());
330 } 354 }
331 355
332 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, BrailleOnLoginScreen) { 356 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, BrailleOnLoginScreen) {
333 EXPECT_FALSE(IsSpokenFeedbackEnabled()); 357 EXPECT_FALSE(IsSpokenFeedbackEnabled());
334 358
335 // Signal the accessibility manager that a braille display was connected. 359 // Signal the accessibility manager that a braille display was connected.
336 SetBrailleDisplayAvailability(true); 360 SetBrailleDisplayAvailability(true);
337 // Confirms that the spoken feedback is enabled. 361 // Confirms that the spoken feedback is enabled.
338 EXPECT_TRUE(IsSpokenFeedbackEnabled()); 362 EXPECT_TRUE(IsSpokenFeedbackEnabled());
339 } 363 }
340 364
341 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, TypePref) { 365 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, TypePref) {
342 // Logs in. 366 // Logs in.
343 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 367 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_,
344 kTestUserName, true); 368 kTestUserName, true);
345 user_manager::UserManager::Get()->SessionStarted(); 369 user_manager::UserManager::Get()->SessionStarted();
346 370
347 // Confirms that the features are disabled just after login. 371 // Confirms that the features are disabled just after login.
348 EXPECT_FALSE(IsLargeCursorEnabled()); 372 EXPECT_FALSE(IsLargeCursorEnabled());
349 EXPECT_FALSE(IsSpokenFeedbackEnabled()); 373 EXPECT_FALSE(IsSpokenFeedbackEnabled());
350 EXPECT_FALSE(IsHighContrastEnabled()); 374 EXPECT_FALSE(IsHighContrastEnabled());
351 EXPECT_FALSE(IsAutoclickEnabled()); 375 EXPECT_FALSE(IsAutoclickEnabled());
352 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); 376 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay());
353 EXPECT_FALSE(IsVirtualKeyboardEnabled()); 377 EXPECT_FALSE(IsVirtualKeyboardEnabled());
378 EXPECT_FALSE(IsMonoAudioEnabled());
354 379
355 // Sets the pref as true to enable the large cursor. 380 // Sets the pref as true to enable the large cursor.
356 SetLargeCursorEnabledPref(true); 381 SetLargeCursorEnabledPref(true);
357 // Confirms that the large cursor is enabled. 382 // Confirms that the large cursor is enabled.
358 EXPECT_TRUE(IsLargeCursorEnabled()); 383 EXPECT_TRUE(IsLargeCursorEnabled());
359 384
360 // Sets the pref as true to enable the spoken feedback. 385 // Sets the pref as true to enable the spoken feedback.
361 SetSpokenFeedbackEnabledPref(true); 386 SetSpokenFeedbackEnabledPref(true);
362 // Confirms that the spoken feedback is enabled. 387 // Confirms that the spoken feedback is enabled.
363 EXPECT_TRUE(IsSpokenFeedbackEnabled()); 388 EXPECT_TRUE(IsSpokenFeedbackEnabled());
(...skipping 11 matching lines...) Expand all
375 // Set autoclick delay pref. 400 // Set autoclick delay pref.
376 SetAutoclickDelayPref(kTestAutoclickDelayMs); 401 SetAutoclickDelayPref(kTestAutoclickDelayMs);
377 // Confirm that the correct value is set. 402 // Confirm that the correct value is set.
378 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); 403 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay());
379 404
380 // Sets the on-screen keyboard pref. 405 // Sets the on-screen keyboard pref.
381 SetVirtualKeyboardEnabledPref(true); 406 SetVirtualKeyboardEnabledPref(true);
382 // Confirm that the on-screen keyboard option is enabled. 407 // Confirm that the on-screen keyboard option is enabled.
383 EXPECT_TRUE(IsVirtualKeyboardEnabled()); 408 EXPECT_TRUE(IsVirtualKeyboardEnabled());
384 409
410 // Sets mono audio output pref.
411 SetMonoAudioEnabledPref(true);
412 // Confirm that mono audio output is enabled.
413 EXPECT_TRUE(IsMonoAudioEnabled());
414
385 SetLargeCursorEnabledPref(false); 415 SetLargeCursorEnabledPref(false);
386 EXPECT_FALSE(IsLargeCursorEnabled()); 416 EXPECT_FALSE(IsLargeCursorEnabled());
387 417
388 SetSpokenFeedbackEnabledPref(false); 418 SetSpokenFeedbackEnabledPref(false);
389 EXPECT_FALSE(IsSpokenFeedbackEnabled()); 419 EXPECT_FALSE(IsSpokenFeedbackEnabled());
390 420
391 SetHighContrastEnabledPref(false); 421 SetHighContrastEnabledPref(false);
392 EXPECT_FALSE(IsHighContrastEnabled()); 422 EXPECT_FALSE(IsHighContrastEnabled());
393 423
394 SetAutoclickEnabledPref(false); 424 SetAutoclickEnabledPref(false);
395 EXPECT_FALSE(IsAutoclickEnabled()); 425 EXPECT_FALSE(IsAutoclickEnabled());
396 426
397 SetVirtualKeyboardEnabledPref(false); 427 SetVirtualKeyboardEnabledPref(false);
398 EXPECT_FALSE(IsVirtualKeyboardEnabled()); 428 EXPECT_FALSE(IsVirtualKeyboardEnabled());
429
430 SetMonoAudioEnabledPref(false);
431 EXPECT_FALSE(IsMonoAudioEnabled());
399 } 432 }
400 433
401 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, ResumeSavedPref) { 434 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, ResumeSavedPref) {
402 // Loads the profile of the user. 435 // Loads the profile of the user.
403 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 436 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_,
404 kTestUserName, true); 437 kTestUserName, true);
405 438
406 // Sets the pref to enable large cursor before login. 439 // Sets the pref to enable large cursor before login.
407 SetLargeCursorEnabledPref(true); 440 SetLargeCursorEnabledPref(true);
408 EXPECT_FALSE(IsLargeCursorEnabled()); 441 EXPECT_FALSE(IsLargeCursorEnabled());
(...skipping 12 matching lines...) Expand all
421 454
422 // Sets the autoclick delay pref before login but the 455 // Sets the autoclick delay pref before login but the
423 // initial value should not change. 456 // initial value should not change.
424 SetAutoclickDelayPref(kTestAutoclickDelayMs); 457 SetAutoclickDelayPref(kTestAutoclickDelayMs);
425 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); 458 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay());
426 459
427 // Sets the pref to enable the on-screen keyboard before login. 460 // Sets the pref to enable the on-screen keyboard before login.
428 SetVirtualKeyboardEnabledPref(true); 461 SetVirtualKeyboardEnabledPref(true);
429 EXPECT_FALSE(IsVirtualKeyboardEnabled()); 462 EXPECT_FALSE(IsVirtualKeyboardEnabled());
430 463
464 // Sets the pref to enable mono audio output before login.
465 SetMonoAudioEnabledPref(true);
466 EXPECT_FALSE(IsMonoAudioEnabled());
467
431 // Logs in. 468 // Logs in.
432 user_manager::UserManager::Get()->SessionStarted(); 469 user_manager::UserManager::Get()->SessionStarted();
433 470
434 // Confirms that features are enabled by restoring from pref just after login. 471 // Confirms that features are enabled by restoring from pref just after login.
435 EXPECT_TRUE(IsLargeCursorEnabled()); 472 EXPECT_TRUE(IsLargeCursorEnabled());
436 EXPECT_TRUE(IsSpokenFeedbackEnabled()); 473 EXPECT_TRUE(IsSpokenFeedbackEnabled());
437 EXPECT_TRUE(IsHighContrastEnabled()); 474 EXPECT_TRUE(IsHighContrastEnabled());
438 EXPECT_TRUE(IsAutoclickEnabled()); 475 EXPECT_TRUE(IsAutoclickEnabled());
439 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); 476 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay());
440 EXPECT_TRUE(IsVirtualKeyboardEnabled()); 477 EXPECT_TRUE(IsVirtualKeyboardEnabled());
478 EXPECT_TRUE(IsMonoAudioEnabled());
441 } 479 }
442 480
443 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, 481 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest,
444 ChangingTypeInvokesNotification) { 482 ChangingTypeInvokesNotification) {
445 MockAccessibilityObserver observer; 483 MockAccessibilityObserver observer;
446 484
447 // Logs in. 485 // Logs in.
448 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 486 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_,
449 kTestUserName, true); 487 kTestUserName, true);
450 user_manager::UserManager::Get()->SessionStarted(); 488 user_manager::UserManager::Get()->SessionStarted();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD); 529 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD);
492 EXPECT_TRUE(IsVirtualKeyboardEnabled()); 530 EXPECT_TRUE(IsVirtualKeyboardEnabled());
493 531
494 observer.reset(); 532 observer.reset();
495 SetVirtualKeyboardEnabled(false); 533 SetVirtualKeyboardEnabled(false);
496 EXPECT_TRUE(observer.observed()); 534 EXPECT_TRUE(observer.observed());
497 EXPECT_FALSE(observer.observed_enabled()); 535 EXPECT_FALSE(observer.observed_enabled());
498 EXPECT_EQ(observer.observed_type(), 536 EXPECT_EQ(observer.observed_type(),
499 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD); 537 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD);
500 EXPECT_FALSE(IsVirtualKeyboardEnabled()); 538 EXPECT_FALSE(IsVirtualKeyboardEnabled());
539
540 observer.reset();
541 SetMonoAudioEnabled(true);
542 EXPECT_TRUE(observer.observed());
543 EXPECT_TRUE(observer.observed_enabled());
544 EXPECT_EQ(observer.observed_type(),
545 ACCESSIBILITY_TOGGLE_MONO_AUDIO);
546 EXPECT_TRUE(IsMonoAudioEnabled());
547
548 observer.reset();
549 SetMonoAudioEnabled(false);
550 EXPECT_TRUE(observer.observed());
551 EXPECT_FALSE(observer.observed_enabled());
552 EXPECT_EQ(observer.observed_type(),
553 ACCESSIBILITY_TOGGLE_MONO_AUDIO);
554 EXPECT_FALSE(IsMonoAudioEnabled());
501 } 555 }
502 556
503 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, 557 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest,
504 ChangingTypePrefInvokesNotification) { 558 ChangingTypePrefInvokesNotification) {
505 MockAccessibilityObserver observer; 559 MockAccessibilityObserver observer;
506 560
507 // Logs in. 561 // Logs in.
508 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 562 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_,
509 kTestUserName, true); 563 kTestUserName, true);
510 user_manager::UserManager::Get()->SessionStarted(); 564 user_manager::UserManager::Get()->SessionStarted();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD); 605 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD);
552 EXPECT_TRUE(IsVirtualKeyboardEnabled()); 606 EXPECT_TRUE(IsVirtualKeyboardEnabled());
553 607
554 observer.reset(); 608 observer.reset();
555 SetVirtualKeyboardEnabledPref(false); 609 SetVirtualKeyboardEnabledPref(false);
556 EXPECT_TRUE(observer.observed()); 610 EXPECT_TRUE(observer.observed());
557 EXPECT_FALSE(observer.observed_enabled()); 611 EXPECT_FALSE(observer.observed_enabled());
558 EXPECT_EQ(observer.observed_type(), 612 EXPECT_EQ(observer.observed_type(),
559 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD); 613 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD);
560 EXPECT_FALSE(IsVirtualKeyboardEnabled()); 614 EXPECT_FALSE(IsVirtualKeyboardEnabled());
615
616 observer.reset();
617 SetMonoAudioEnabledPref(true);
618 EXPECT_TRUE(observer.observed());
619 EXPECT_TRUE(observer.observed_enabled());
620 EXPECT_EQ(observer.observed_type(),
621 ACCESSIBILITY_TOGGLE_MONO_AUDIO);
622 EXPECT_TRUE(IsMonoAudioEnabled());
623
624 observer.reset();
625 SetMonoAudioEnabledPref(false);
626 EXPECT_TRUE(observer.observed());
627 EXPECT_FALSE(observer.observed_enabled());
628 EXPECT_EQ(observer.observed_type(),
629 ACCESSIBILITY_TOGGLE_MONO_AUDIO);
630 EXPECT_FALSE(IsMonoAudioEnabled());
561 } 631 }
562 632
563 class AccessibilityManagerUserTypeTest 633 class AccessibilityManagerUserTypeTest
564 : public AccessibilityManagerTest, 634 : public AccessibilityManagerTest,
565 public ::testing::WithParamInterface<const char*> { 635 public ::testing::WithParamInterface<const char*> {
566 protected: 636 protected:
567 AccessibilityManagerUserTypeTest() {} 637 AccessibilityManagerUserTypeTest() {}
568 virtual ~AccessibilityManagerUserTypeTest() {} 638 virtual ~AccessibilityManagerUserTypeTest() {}
569 639
570 DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerUserTypeTest); 640 DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerUserTypeTest);
(...skipping 17 matching lines...) Expand all
588 EXPECT_TRUE(IsSpokenFeedbackEnabled()); 658 EXPECT_TRUE(IsSpokenFeedbackEnabled());
589 // Enables high contrast. 659 // Enables high contrast.
590 SetHighContrastEnabled(true); 660 SetHighContrastEnabled(true);
591 EXPECT_TRUE(IsHighContrastEnabled()); 661 EXPECT_TRUE(IsHighContrastEnabled());
592 // Enables autoclick. 662 // Enables autoclick.
593 SetAutoclickEnabled(true); 663 SetAutoclickEnabled(true);
594 EXPECT_TRUE(IsAutoclickEnabled()); 664 EXPECT_TRUE(IsAutoclickEnabled());
595 // Set autoclick delay. 665 // Set autoclick delay.
596 SetAutoclickDelay(kTestAutoclickDelayMs); 666 SetAutoclickDelay(kTestAutoclickDelayMs);
597 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); 667 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay());
668 // Enables mono audio output.
669 SetMonoAudioEnabled(true);
670 EXPECT_TRUE(IsMonoAudioEnabled());
598 671
599 // Logs in. 672 // Logs in.
600 const AccountId account_id = AccountId::FromUserEmail(GetParam()); 673 const AccountId account_id = AccountId::FromUserEmail(GetParam());
601 user_manager::UserManager::Get()->UserLoggedIn( 674 user_manager::UserManager::Get()->UserLoggedIn(
602 account_id, account_id.GetUserEmail(), true); 675 account_id, account_id.GetUserEmail(), true);
603 676
604 // Confirms that the features are still enabled just after login. 677 // Confirms that the features are still enabled just after login.
605 EXPECT_TRUE(IsLargeCursorEnabled()); 678 EXPECT_TRUE(IsLargeCursorEnabled());
606 EXPECT_TRUE(IsSpokenFeedbackEnabled()); 679 EXPECT_TRUE(IsSpokenFeedbackEnabled());
607 EXPECT_TRUE(IsHighContrastEnabled()); 680 EXPECT_TRUE(IsHighContrastEnabled());
608 EXPECT_TRUE(IsAutoclickEnabled()); 681 EXPECT_TRUE(IsAutoclickEnabled());
609 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); 682 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay());
683 EXPECT_TRUE(IsMonoAudioEnabled());
610 684
611 user_manager::UserManager::Get()->SessionStarted(); 685 user_manager::UserManager::Get()->SessionStarted();
612 686
613 // Confirms that the features keep enabled after session starts. 687 // Confirms that the features keep enabled after session starts.
614 EXPECT_TRUE(IsLargeCursorEnabled()); 688 EXPECT_TRUE(IsLargeCursorEnabled());
615 EXPECT_TRUE(IsSpokenFeedbackEnabled()); 689 EXPECT_TRUE(IsSpokenFeedbackEnabled());
616 EXPECT_TRUE(IsHighContrastEnabled()); 690 EXPECT_TRUE(IsHighContrastEnabled());
617 EXPECT_TRUE(IsAutoclickEnabled()); 691 EXPECT_TRUE(IsAutoclickEnabled());
618 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); 692 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay());
693 EXPECT_TRUE(IsMonoAudioEnabled());
619 694
620 // Confirms that the prefs have been copied to the user's profile. 695 // Confirms that the prefs have been copied to the user's profile.
621 EXPECT_TRUE(GetLargeCursorEnabledFromPref()); 696 EXPECT_TRUE(GetLargeCursorEnabledFromPref());
622 EXPECT_TRUE(GetSpokenFeedbackEnabledFromPref()); 697 EXPECT_TRUE(GetSpokenFeedbackEnabledFromPref());
623 EXPECT_TRUE(GetHighContrastEnabledFromPref()); 698 EXPECT_TRUE(GetHighContrastEnabledFromPref());
624 EXPECT_TRUE(GetAutoclickEnabledFromPref()); 699 EXPECT_TRUE(GetAutoclickEnabledFromPref());
625 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelayFromPref()); 700 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelayFromPref());
701 EXPECT_TRUE(GetMonoAudioEnabledFromPref());
626 } 702 }
627 703
628 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, BrailleWhenLoggedIn) { 704 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, BrailleWhenLoggedIn) {
629 // Logs in. 705 // Logs in.
630 const AccountId account_id = AccountId::FromUserEmail(GetParam()); 706 const AccountId account_id = AccountId::FromUserEmail(GetParam());
631 user_manager::UserManager::Get()->UserLoggedIn( 707 user_manager::UserManager::Get()->UserLoggedIn(
632 account_id, account_id.GetUserEmail(), true); 708 account_id, account_id.GetUserEmail(), true);
633 user_manager::UserManager::Get()->SessionStarted(); 709 user_manager::UserManager::Get()->SessionStarted();
634 // This object watches for IME preference changes and reflects those in 710 // This object watches for IME preference changes and reflects those in
635 // the IME framework state. 711 // the IME framework state.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 kTestUserName, true); 754 kTestUserName, true);
679 user_manager::UserManager::Get()->SessionStarted(); 755 user_manager::UserManager::Get()->SessionStarted();
680 756
681 // Confirms that the features are disabled. 757 // Confirms that the features are disabled.
682 EXPECT_FALSE(IsLargeCursorEnabled()); 758 EXPECT_FALSE(IsLargeCursorEnabled());
683 EXPECT_FALSE(IsSpokenFeedbackEnabled()); 759 EXPECT_FALSE(IsSpokenFeedbackEnabled());
684 EXPECT_FALSE(IsHighContrastEnabled()); 760 EXPECT_FALSE(IsHighContrastEnabled());
685 EXPECT_FALSE(IsAutoclickEnabled()); 761 EXPECT_FALSE(IsAutoclickEnabled());
686 EXPECT_FALSE(ShouldShowAccessibilityMenu()); 762 EXPECT_FALSE(ShouldShowAccessibilityMenu());
687 EXPECT_FALSE(IsVirtualKeyboardEnabled()); 763 EXPECT_FALSE(IsVirtualKeyboardEnabled());
764 EXPECT_FALSE(IsMonoAudioEnabled());
688 765
689 // Check large cursor. 766 // Check large cursor.
690 SetLargeCursorEnabled(true); 767 SetLargeCursorEnabled(true);
691 EXPECT_TRUE(ShouldShowAccessibilityMenu()); 768 EXPECT_TRUE(ShouldShowAccessibilityMenu());
692 SetLargeCursorEnabled(false); 769 SetLargeCursorEnabled(false);
693 EXPECT_FALSE(ShouldShowAccessibilityMenu()); 770 EXPECT_FALSE(ShouldShowAccessibilityMenu());
694 771
695 // Check spoken feedback. 772 // Check spoken feedback.
696 SetSpokenFeedbackEnabled(true); 773 SetSpokenFeedbackEnabled(true);
697 EXPECT_TRUE(ShouldShowAccessibilityMenu()); 774 EXPECT_TRUE(ShouldShowAccessibilityMenu());
(...skipping 10 matching lines...) Expand all
708 SetAutoclickEnabled(true); 785 SetAutoclickEnabled(true);
709 EXPECT_TRUE(ShouldShowAccessibilityMenu()); 786 EXPECT_TRUE(ShouldShowAccessibilityMenu());
710 SetAutoclickEnabled(false); 787 SetAutoclickEnabled(false);
711 EXPECT_FALSE(ShouldShowAccessibilityMenu()); 788 EXPECT_FALSE(ShouldShowAccessibilityMenu());
712 789
713 // Check on-screen keyboard. 790 // Check on-screen keyboard.
714 SetVirtualKeyboardEnabled(true); 791 SetVirtualKeyboardEnabled(true);
715 EXPECT_TRUE(ShouldShowAccessibilityMenu()); 792 EXPECT_TRUE(ShouldShowAccessibilityMenu());
716 SetVirtualKeyboardEnabled(false); 793 SetVirtualKeyboardEnabled(false);
717 EXPECT_FALSE(ShouldShowAccessibilityMenu()); 794 EXPECT_FALSE(ShouldShowAccessibilityMenu());
795
796 // Check mono audio output.
797 SetMonoAudioEnabled(true);
798 EXPECT_TRUE(ShouldShowAccessibilityMenu());
799 SetMonoAudioEnabled(false);
800 EXPECT_FALSE(ShouldShowAccessibilityMenu());
718 } 801 }
719 802
720 } // namespace chromeos 803 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698