| OLD | NEW |
| 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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 13 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 14 #include "chrome/browser/chromeos/login/helper.h" | 14 #include "chrome/browser/chromeos/login/helper.h" |
| 15 #include "chrome/browser/chromeos/login/login_utils.h" | 15 #include "chrome/browser/chromeos/login/login_utils.h" |
| 16 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 17 #include "chrome/browser/chromeos/preferences.h" | 16 #include "chrome/browser/chromeos/preferences.h" |
| 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 19 #include "chrome/browser/extensions/api/braille_display_private/mock_braille_con
troller.h" | 18 #include "chrome/browser/extensions/api/braille_display_private/mock_braille_con
troller.h" |
| 20 #include "chrome/browser/prefs/pref_service_syncable.h" | 19 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/common/extensions/extension_constants.h" | 22 #include "chrome/common/extensions/extension_constants.h" |
| 24 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/test/base/in_process_browser_test.h" | 24 #include "chrome/test/base/in_process_browser_test.h" |
| 26 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
| 27 #include "chromeos/chromeos_switches.h" | 26 #include "chromeos/chromeos_switches.h" |
| 28 #include "chromeos/ime/component_extension_ime_manager.h" | 27 #include "chromeos/ime/component_extension_ime_manager.h" |
| 29 #include "chromeos/ime/input_method_manager.h" | 28 #include "chromeos/ime/input_method_manager.h" |
| 30 #include "chromeos/login/user_names.h" | 29 #include "chromeos/login/user_names.h" |
| 30 #include "components/user_manager/user_manager.h" |
| 31 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
| 32 #include "content/public/test/test_utils.h" | 32 #include "content/public/test/test_utils.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
| 34 | 34 |
| 35 using chromeos::input_method::InputMethodManager; | 35 using chromeos::input_method::InputMethodManager; |
| 36 using chromeos::input_method::InputMethodUtil; | 36 using chromeos::input_method::InputMethodUtil; |
| 37 using chromeos::input_method::InputMethodDescriptors; | 37 using chromeos::input_method::InputMethodDescriptors; |
| 38 using content::BrowserThread; | 38 using content::BrowserThread; |
| 39 using extensions::api::braille_display_private::BrailleObserver; | 39 using extensions::api::braille_display_private::BrailleObserver; |
| 40 using extensions::api::braille_display_private::DisplayState; | 40 using extensions::api::braille_display_private::DisplayState; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, Login) { | 265 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, Login) { |
| 266 // Confirms that a11y features are disabled on the login screen. | 266 // Confirms that a11y features are disabled on the login screen. |
| 267 EXPECT_FALSE(IsLargeCursorEnabled()); | 267 EXPECT_FALSE(IsLargeCursorEnabled()); |
| 268 EXPECT_FALSE(IsSpokenFeedbackEnabled()); | 268 EXPECT_FALSE(IsSpokenFeedbackEnabled()); |
| 269 EXPECT_FALSE(IsHighContrastEnabled()); | 269 EXPECT_FALSE(IsHighContrastEnabled()); |
| 270 EXPECT_FALSE(IsAutoclickEnabled()); | 270 EXPECT_FALSE(IsAutoclickEnabled()); |
| 271 EXPECT_FALSE(IsVirtualKeyboardEnabled()); | 271 EXPECT_FALSE(IsVirtualKeyboardEnabled()); |
| 272 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); | 272 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); |
| 273 | 273 |
| 274 // Logs in. | 274 // Logs in. |
| 275 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 275 user_manager::UserManager::Get()->UserLoggedIn( |
| 276 kTestUserName, kTestUserName, true); |
| 276 | 277 |
| 277 // Confirms that the features still disabled just after login. | 278 // Confirms that the features still disabled just after login. |
| 278 EXPECT_FALSE(IsLargeCursorEnabled()); | 279 EXPECT_FALSE(IsLargeCursorEnabled()); |
| 279 EXPECT_FALSE(IsSpokenFeedbackEnabled()); | 280 EXPECT_FALSE(IsSpokenFeedbackEnabled()); |
| 280 EXPECT_FALSE(IsHighContrastEnabled()); | 281 EXPECT_FALSE(IsHighContrastEnabled()); |
| 281 EXPECT_FALSE(IsAutoclickEnabled()); | 282 EXPECT_FALSE(IsAutoclickEnabled()); |
| 282 EXPECT_FALSE(IsVirtualKeyboardEnabled()); | 283 EXPECT_FALSE(IsVirtualKeyboardEnabled()); |
| 283 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); | 284 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); |
| 284 | 285 |
| 285 UserManager::Get()->SessionStarted(); | 286 user_manager::UserManager::Get()->SessionStarted(); |
| 286 | 287 |
| 287 // Confirms that the features are still disabled just after login. | 288 // Confirms that the features are still disabled just after login. |
| 288 EXPECT_FALSE(IsLargeCursorEnabled()); | 289 EXPECT_FALSE(IsLargeCursorEnabled()); |
| 289 EXPECT_FALSE(IsSpokenFeedbackEnabled()); | 290 EXPECT_FALSE(IsSpokenFeedbackEnabled()); |
| 290 EXPECT_FALSE(IsHighContrastEnabled()); | 291 EXPECT_FALSE(IsHighContrastEnabled()); |
| 291 EXPECT_FALSE(IsAutoclickEnabled()); | 292 EXPECT_FALSE(IsAutoclickEnabled()); |
| 292 EXPECT_FALSE(IsVirtualKeyboardEnabled()); | 293 EXPECT_FALSE(IsVirtualKeyboardEnabled()); |
| 293 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); | 294 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); |
| 294 | 295 |
| 295 // Enables large cursor. | 296 // Enables large cursor. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 326 EXPECT_FALSE(IsSpokenFeedbackEnabled()); | 327 EXPECT_FALSE(IsSpokenFeedbackEnabled()); |
| 327 | 328 |
| 328 // Signal the accessibility manager that a braille display was connected. | 329 // Signal the accessibility manager that a braille display was connected. |
| 329 SetBrailleDisplayAvailability(true); | 330 SetBrailleDisplayAvailability(true); |
| 330 // Confirms that the spoken feedback is enabled. | 331 // Confirms that the spoken feedback is enabled. |
| 331 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 332 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| 332 } | 333 } |
| 333 | 334 |
| 334 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, TypePref) { | 335 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, TypePref) { |
| 335 // Logs in. | 336 // Logs in. |
| 336 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 337 user_manager::UserManager::Get()->UserLoggedIn( |
| 337 UserManager::Get()->SessionStarted(); | 338 kTestUserName, kTestUserName, true); |
| 339 user_manager::UserManager::Get()->SessionStarted(); |
| 338 | 340 |
| 339 // Confirms that the features are disabled just after login. | 341 // Confirms that the features are disabled just after login. |
| 340 EXPECT_FALSE(IsLargeCursorEnabled()); | 342 EXPECT_FALSE(IsLargeCursorEnabled()); |
| 341 EXPECT_FALSE(IsSpokenFeedbackEnabled()); | 343 EXPECT_FALSE(IsSpokenFeedbackEnabled()); |
| 342 EXPECT_FALSE(IsHighContrastEnabled()); | 344 EXPECT_FALSE(IsHighContrastEnabled()); |
| 343 EXPECT_FALSE(IsAutoclickEnabled()); | 345 EXPECT_FALSE(IsAutoclickEnabled()); |
| 344 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); | 346 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); |
| 345 EXPECT_FALSE(IsVirtualKeyboardEnabled()); | 347 EXPECT_FALSE(IsVirtualKeyboardEnabled()); |
| 346 | 348 |
| 347 // Sets the pref as true to enable the large cursor. | 349 // Sets the pref as true to enable the large cursor. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 387 |
| 386 SetAutoclickEnabledPref(false); | 388 SetAutoclickEnabledPref(false); |
| 387 EXPECT_FALSE(IsAutoclickEnabled()); | 389 EXPECT_FALSE(IsAutoclickEnabled()); |
| 388 | 390 |
| 389 SetVirtualKeyboardEnabledPref(false); | 391 SetVirtualKeyboardEnabledPref(false); |
| 390 EXPECT_FALSE(IsVirtualKeyboardEnabled()); | 392 EXPECT_FALSE(IsVirtualKeyboardEnabled()); |
| 391 } | 393 } |
| 392 | 394 |
| 393 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, ResumeSavedPref) { | 395 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, ResumeSavedPref) { |
| 394 // Loads the profile of the user. | 396 // Loads the profile of the user. |
| 395 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 397 user_manager::UserManager::Get()->UserLoggedIn( |
| 398 kTestUserName, kTestUserName, true); |
| 396 | 399 |
| 397 // Sets the pref to enable large cursor before login. | 400 // Sets the pref to enable large cursor before login. |
| 398 SetLargeCursorEnabledPref(true); | 401 SetLargeCursorEnabledPref(true); |
| 399 EXPECT_FALSE(IsLargeCursorEnabled()); | 402 EXPECT_FALSE(IsLargeCursorEnabled()); |
| 400 | 403 |
| 401 // Sets the pref to enable spoken feedback before login. | 404 // Sets the pref to enable spoken feedback before login. |
| 402 SetSpokenFeedbackEnabledPref(true); | 405 SetSpokenFeedbackEnabledPref(true); |
| 403 EXPECT_FALSE(IsSpokenFeedbackEnabled()); | 406 EXPECT_FALSE(IsSpokenFeedbackEnabled()); |
| 404 | 407 |
| 405 // Sets the pref to enable high contrast before login. | 408 // Sets the pref to enable high contrast before login. |
| 406 SetHighContrastEnabledPref(true); | 409 SetHighContrastEnabledPref(true); |
| 407 EXPECT_FALSE(IsHighContrastEnabled()); | 410 EXPECT_FALSE(IsHighContrastEnabled()); |
| 408 | 411 |
| 409 // Sets the pref to enable autoclick before login. | 412 // Sets the pref to enable autoclick before login. |
| 410 SetAutoclickEnabledPref(true); | 413 SetAutoclickEnabledPref(true); |
| 411 EXPECT_FALSE(IsAutoclickEnabled()); | 414 EXPECT_FALSE(IsAutoclickEnabled()); |
| 412 | 415 |
| 413 // Sets the autoclick delay pref before login but the | 416 // Sets the autoclick delay pref before login but the |
| 414 // initial value should not change. | 417 // initial value should not change. |
| 415 SetAutoclickDelayPref(kTestAutoclickDelayMs); | 418 SetAutoclickDelayPref(kTestAutoclickDelayMs); |
| 416 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); | 419 EXPECT_EQ(default_autoclick_delay(), GetAutoclickDelay()); |
| 417 | 420 |
| 418 // Sets the pref to enable the on-screen keyboard before login. | 421 // Sets the pref to enable the on-screen keyboard before login. |
| 419 SetVirtualKeyboardEnabledPref(true); | 422 SetVirtualKeyboardEnabledPref(true); |
| 420 EXPECT_FALSE(IsVirtualKeyboardEnabled()); | 423 EXPECT_FALSE(IsVirtualKeyboardEnabled()); |
| 421 | 424 |
| 422 // Logs in. | 425 // Logs in. |
| 423 UserManager::Get()->SessionStarted(); | 426 user_manager::UserManager::Get()->SessionStarted(); |
| 424 | 427 |
| 425 // Confirms that features are enabled by restoring from pref just after login. | 428 // Confirms that features are enabled by restoring from pref just after login. |
| 426 EXPECT_TRUE(IsLargeCursorEnabled()); | 429 EXPECT_TRUE(IsLargeCursorEnabled()); |
| 427 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 430 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| 428 EXPECT_TRUE(IsHighContrastEnabled()); | 431 EXPECT_TRUE(IsHighContrastEnabled()); |
| 429 EXPECT_TRUE(IsAutoclickEnabled()); | 432 EXPECT_TRUE(IsAutoclickEnabled()); |
| 430 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); | 433 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); |
| 431 EXPECT_TRUE(IsVirtualKeyboardEnabled()); | 434 EXPECT_TRUE(IsVirtualKeyboardEnabled()); |
| 432 } | 435 } |
| 433 | 436 |
| 434 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, | 437 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, |
| 435 ChangingTypeInvokesNotification) { | 438 ChangingTypeInvokesNotification) { |
| 436 MockAccessibilityObserver observer; | 439 MockAccessibilityObserver observer; |
| 437 | 440 |
| 438 // Logs in. | 441 // Logs in. |
| 439 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 442 user_manager::UserManager::Get()->UserLoggedIn( |
| 440 UserManager::Get()->SessionStarted(); | 443 kTestUserName, kTestUserName, true); |
| 444 user_manager::UserManager::Get()->SessionStarted(); |
| 441 | 445 |
| 442 EXPECT_FALSE(observer.observed()); | 446 EXPECT_FALSE(observer.observed()); |
| 443 observer.reset(); | 447 observer.reset(); |
| 444 | 448 |
| 445 SetSpokenFeedbackEnabled(true); | 449 SetSpokenFeedbackEnabled(true); |
| 446 EXPECT_TRUE(observer.observed()); | 450 EXPECT_TRUE(observer.observed()); |
| 447 EXPECT_TRUE(observer.observed_enabled()); | 451 EXPECT_TRUE(observer.observed_enabled()); |
| 448 EXPECT_EQ(observer.observed_type(), | 452 EXPECT_EQ(observer.observed_type(), |
| 449 ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK); | 453 ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK); |
| 450 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 454 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 EXPECT_EQ(observer.observed_type(), | 492 EXPECT_EQ(observer.observed_type(), |
| 489 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD); | 493 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD); |
| 490 EXPECT_FALSE(IsVirtualKeyboardEnabled()); | 494 EXPECT_FALSE(IsVirtualKeyboardEnabled()); |
| 491 } | 495 } |
| 492 | 496 |
| 493 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, | 497 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, |
| 494 ChangingTypePrefInvokesNotification) { | 498 ChangingTypePrefInvokesNotification) { |
| 495 MockAccessibilityObserver observer; | 499 MockAccessibilityObserver observer; |
| 496 | 500 |
| 497 // Logs in. | 501 // Logs in. |
| 498 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 502 user_manager::UserManager::Get()->UserLoggedIn( |
| 499 UserManager::Get()->SessionStarted(); | 503 kTestUserName, kTestUserName, true); |
| 504 user_manager::UserManager::Get()->SessionStarted(); |
| 500 | 505 |
| 501 EXPECT_FALSE(observer.observed()); | 506 EXPECT_FALSE(observer.observed()); |
| 502 observer.reset(); | 507 observer.reset(); |
| 503 | 508 |
| 504 SetSpokenFeedbackEnabledPref(true); | 509 SetSpokenFeedbackEnabledPref(true); |
| 505 EXPECT_TRUE(observer.observed()); | 510 EXPECT_TRUE(observer.observed()); |
| 506 EXPECT_TRUE(observer.observed_enabled()); | 511 EXPECT_TRUE(observer.observed_enabled()); |
| 507 EXPECT_EQ(observer.observed_type(), | 512 EXPECT_EQ(observer.observed_type(), |
| 508 ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK); | 513 ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK); |
| 509 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 514 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 EXPECT_TRUE(IsHighContrastEnabled()); | 586 EXPECT_TRUE(IsHighContrastEnabled()); |
| 582 // Enables autoclick. | 587 // Enables autoclick. |
| 583 SetAutoclickEnabled(true); | 588 SetAutoclickEnabled(true); |
| 584 EXPECT_TRUE(IsAutoclickEnabled()); | 589 EXPECT_TRUE(IsAutoclickEnabled()); |
| 585 // Set autoclick delay. | 590 // Set autoclick delay. |
| 586 SetAutoclickDelay(kTestAutoclickDelayMs); | 591 SetAutoclickDelay(kTestAutoclickDelayMs); |
| 587 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); | 592 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); |
| 588 | 593 |
| 589 // Logs in. | 594 // Logs in. |
| 590 const char* user_name = GetParam(); | 595 const char* user_name = GetParam(); |
| 591 UserManager::Get()->UserLoggedIn(user_name, user_name, true); | 596 user_manager::UserManager::Get()->UserLoggedIn(user_name, user_name, true); |
| 592 | 597 |
| 593 // Confirms that the features are still enabled just after login. | 598 // Confirms that the features are still enabled just after login. |
| 594 EXPECT_TRUE(IsLargeCursorEnabled()); | 599 EXPECT_TRUE(IsLargeCursorEnabled()); |
| 595 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 600 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| 596 EXPECT_TRUE(IsHighContrastEnabled()); | 601 EXPECT_TRUE(IsHighContrastEnabled()); |
| 597 EXPECT_TRUE(IsAutoclickEnabled()); | 602 EXPECT_TRUE(IsAutoclickEnabled()); |
| 598 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); | 603 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); |
| 599 | 604 |
| 600 UserManager::Get()->SessionStarted(); | 605 user_manager::UserManager::Get()->SessionStarted(); |
| 601 | 606 |
| 602 // Confirms that the features keep enabled after session starts. | 607 // Confirms that the features keep enabled after session starts. |
| 603 EXPECT_TRUE(IsLargeCursorEnabled()); | 608 EXPECT_TRUE(IsLargeCursorEnabled()); |
| 604 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 609 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| 605 EXPECT_TRUE(IsHighContrastEnabled()); | 610 EXPECT_TRUE(IsHighContrastEnabled()); |
| 606 EXPECT_TRUE(IsAutoclickEnabled()); | 611 EXPECT_TRUE(IsAutoclickEnabled()); |
| 607 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); | 612 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); |
| 608 | 613 |
| 609 // Confirms that the prefs have been copied to the user's profile. | 614 // Confirms that the prefs have been copied to the user's profile. |
| 610 EXPECT_TRUE(GetLargeCursorEnabledFromPref()); | 615 EXPECT_TRUE(GetLargeCursorEnabledFromPref()); |
| 611 EXPECT_TRUE(GetSpokenFeedbackEnabledFromPref()); | 616 EXPECT_TRUE(GetSpokenFeedbackEnabledFromPref()); |
| 612 EXPECT_TRUE(GetHighContrastEnabledFromPref()); | 617 EXPECT_TRUE(GetHighContrastEnabledFromPref()); |
| 613 EXPECT_TRUE(GetAutoclickEnabledFromPref()); | 618 EXPECT_TRUE(GetAutoclickEnabledFromPref()); |
| 614 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelayFromPref()); | 619 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelayFromPref()); |
| 615 } | 620 } |
| 616 | 621 |
| 617 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, BrailleWhenLoggedIn) { | 622 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, BrailleWhenLoggedIn) { |
| 618 // Logs in. | 623 // Logs in. |
| 619 const char* user_name = GetParam(); | 624 const char* user_name = GetParam(); |
| 620 UserManager::Get()->UserLoggedIn(user_name, user_name, true); | 625 user_manager::UserManager::Get()->UserLoggedIn(user_name, user_name, true); |
| 621 UserManager::Get()->SessionStarted(); | 626 user_manager::UserManager::Get()->SessionStarted(); |
| 622 // This object watches for IME preference changes and reflects those in | 627 // This object watches for IME preference changes and reflects those in |
| 623 // the IME framework state. | 628 // the IME framework state. |
| 624 chromeos::Preferences prefs; | 629 chromeos::Preferences prefs; |
| 625 prefs.InitUserPrefsForTesting(PrefServiceSyncable::FromProfile(GetProfile()), | 630 prefs.InitUserPrefsForTesting( |
| 626 UserManager::Get()->GetActiveUser()); | 631 PrefServiceSyncable::FromProfile(GetProfile()), |
| 632 user_manager::UserManager::Get()->GetActiveUser()); |
| 627 | 633 |
| 628 // Make sure we start in the expected state. | 634 // Make sure we start in the expected state. |
| 629 EXPECT_FALSE(IsBrailleImeActive()); | 635 EXPECT_FALSE(IsBrailleImeActive()); |
| 630 EXPECT_FALSE(IsSpokenFeedbackEnabled()); | 636 EXPECT_FALSE(IsSpokenFeedbackEnabled()); |
| 631 | 637 |
| 632 // Signal the accessibility manager that a braille display was connected. | 638 // Signal the accessibility manager that a braille display was connected. |
| 633 SetBrailleDisplayAvailability(true); | 639 SetBrailleDisplayAvailability(true); |
| 634 | 640 |
| 635 // Now, both spoken feedback and the Braille IME should be enabled. | 641 // Now, both spoken feedback and the Braille IME should be enabled. |
| 636 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 642 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 653 | 659 |
| 654 // Plugging in a display while spoken feedback is enabled should activate | 660 // Plugging in a display while spoken feedback is enabled should activate |
| 655 // the Braille IME. | 661 // the Braille IME. |
| 656 SetBrailleDisplayAvailability(true); | 662 SetBrailleDisplayAvailability(true); |
| 657 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 663 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| 658 EXPECT_TRUE(IsBrailleImeActive()); | 664 EXPECT_TRUE(IsBrailleImeActive()); |
| 659 } | 665 } |
| 660 | 666 |
| 661 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, AcessibilityMenuVisibility) { | 667 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, AcessibilityMenuVisibility) { |
| 662 // Log in. | 668 // Log in. |
| 663 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 669 user_manager::UserManager::Get()->UserLoggedIn( |
| 664 UserManager::Get()->SessionStarted(); | 670 kTestUserName, kTestUserName, true); |
| 671 user_manager::UserManager::Get()->SessionStarted(); |
| 665 | 672 |
| 666 // Confirms that the features are disabled. | 673 // Confirms that the features are disabled. |
| 667 EXPECT_FALSE(IsLargeCursorEnabled()); | 674 EXPECT_FALSE(IsLargeCursorEnabled()); |
| 668 EXPECT_FALSE(IsSpokenFeedbackEnabled()); | 675 EXPECT_FALSE(IsSpokenFeedbackEnabled()); |
| 669 EXPECT_FALSE(IsHighContrastEnabled()); | 676 EXPECT_FALSE(IsHighContrastEnabled()); |
| 670 EXPECT_FALSE(IsAutoclickEnabled()); | 677 EXPECT_FALSE(IsAutoclickEnabled()); |
| 671 EXPECT_FALSE(ShouldShowAccessibilityMenu()); | 678 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 672 EXPECT_FALSE(IsVirtualKeyboardEnabled()); | 679 EXPECT_FALSE(IsVirtualKeyboardEnabled()); |
| 673 | 680 |
| 674 // Check large cursor. | 681 // Check large cursor. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 696 EXPECT_FALSE(ShouldShowAccessibilityMenu()); | 703 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 697 | 704 |
| 698 // Check on-screen keyboard. | 705 // Check on-screen keyboard. |
| 699 SetVirtualKeyboardEnabled(true); | 706 SetVirtualKeyboardEnabled(true); |
| 700 EXPECT_TRUE(ShouldShowAccessibilityMenu()); | 707 EXPECT_TRUE(ShouldShowAccessibilityMenu()); |
| 701 SetVirtualKeyboardEnabled(false); | 708 SetVirtualKeyboardEnabled(false); |
| 702 EXPECT_FALSE(ShouldShowAccessibilityMenu()); | 709 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 703 } | 710 } |
| 704 | 711 |
| 705 } // namespace chromeos | 712 } // namespace chromeos |
| OLD | NEW |