| 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/common/accessibility_types.h" | 7 #include "ash/common/accessibility_types.h" |
| 8 #include "ash/magnifier/magnification_controller.h" | 8 #include "ash/magnifier/magnification_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 15 #include "chrome/browser/chromeos/login/helper.h" | 15 #include "chrome/browser/chromeos/login/helper.h" |
| 16 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 16 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 17 #include "chrome/browser/chromeos/preferences.h" | 17 #include "chrome/browser/chromeos/preferences.h" |
| 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 19 #include "chrome/browser/extensions/api/braille_display_private/mock_braille_con
troller.h" | 19 #include "chrome/browser/extensions/api/braille_display_private/mock_braille_con
troller.h" |
| 20 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 20 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/common/extensions/extension_constants.h" | 23 #include "chrome/common/extensions/extension_constants.h" |
| 24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/test/base/in_process_browser_test.h" | 25 #include "chrome/test/base/in_process_browser_test.h" |
| 26 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| 27 #include "chromeos/chromeos_switches.h" | 27 #include "chromeos/chromeos_switches.h" |
| 28 #include "chromeos/login/user_names.h" | |
| 29 #include "components/prefs/pref_service.h" | 28 #include "components/prefs/pref_service.h" |
| 30 #include "components/session_manager/core/session_manager.h" | 29 #include "components/session_manager/core/session_manager.h" |
| 31 #include "components/signin/core/account_id/account_id.h" | 30 #include "components/signin/core/account_id/account_id.h" |
| 32 #include "components/syncable_prefs/pref_service_syncable.h" | 31 #include "components/syncable_prefs/pref_service_syncable.h" |
| 33 #include "components/user_manager/user_manager.h" | 32 #include "components/user_manager/user_manager.h" |
| 33 #include "components/user_manager/user_names.h" |
| 34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/test/test_utils.h" | 35 #include "content/public/test/test_utils.h" |
| 36 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
| 37 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" | 37 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" |
| 38 #include "ui/base/ime/chromeos/input_method_manager.h" | 38 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 39 | 39 |
| 40 using chromeos::input_method::InputMethodManager; | 40 using chromeos::input_method::InputMethodManager; |
| 41 using chromeos::input_method::InputMethodUtil; | 41 using chromeos::input_method::InputMethodUtil; |
| 42 using chromeos::input_method::InputMethodDescriptors; | 42 using chromeos::input_method::InputMethodDescriptors; |
| 43 using content::BrowserThread; | 43 using content::BrowserThread; |
| 44 using extensions::api::braille_display_private::BrailleObserver; | 44 using extensions::api::braille_display_private::BrailleObserver; |
| 45 using extensions::api::braille_display_private::DisplayState; | 45 using extensions::api::braille_display_private::DisplayState; |
| 46 using extensions::api::braille_display_private::KeyEvent; | 46 using extensions::api::braille_display_private::KeyEvent; |
| 47 using extensions::api::braille_display_private::MockBrailleController; | 47 using extensions::api::braille_display_private::MockBrailleController; |
| 48 | 48 |
| 49 namespace chromeos { | 49 namespace chromeos { |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 const char kTestUserName[] = "owner@invalid.domain"; | 53 const char kTestUserName[] = "owner@invalid.domain"; |
| 54 | 54 |
| 55 const int kTestAutoclickDelayMs = 2000; | 55 const int kTestAutoclickDelayMs = 2000; |
| 56 | 56 |
| 57 // Test user name for supervised user. The domain part must be matched with | 57 // Test user name for supervised user. The domain part must be matched with |
| 58 // chromeos::login::kSupervisedUserDomain. | 58 // user_manager::kSupervisedUserDomain. |
| 59 const char kTestSupervisedUserName[] = "test@locally-managed.localhost"; | 59 const char kTestSupervisedUserName[] = "test@locally-managed.localhost"; |
| 60 | 60 |
| 61 class MockAccessibilityObserver { | 61 class MockAccessibilityObserver { |
| 62 public: | 62 public: |
| 63 MockAccessibilityObserver() : observed_(false), | 63 MockAccessibilityObserver() : observed_(false), |
| 64 observed_enabled_(false), | 64 observed_enabled_(false), |
| 65 observed_type_(-1) | 65 observed_type_(-1) |
| 66 { | 66 { |
| 67 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); | 67 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); |
| 68 CHECK(accessibility_manager); | 68 CHECK(accessibility_manager); |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 virtual ~AccessibilityManagerUserTypeTest() {} | 640 virtual ~AccessibilityManagerUserTypeTest() {} |
| 641 | 641 |
| 642 DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerUserTypeTest); | 642 DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerUserTypeTest); |
| 643 }; | 643 }; |
| 644 | 644 |
| 645 // TODO(yoshiki): Enable a test for retail mode (i.e. RetailAccountId). | 645 // TODO(yoshiki): Enable a test for retail mode (i.e. RetailAccountId). |
| 646 INSTANTIATE_TEST_CASE_P( | 646 INSTANTIATE_TEST_CASE_P( |
| 647 UserTypeInstantiation, | 647 UserTypeInstantiation, |
| 648 AccessibilityManagerUserTypeTest, | 648 AccessibilityManagerUserTypeTest, |
| 649 ::testing::Values(kTestUserName, | 649 ::testing::Values(kTestUserName, |
| 650 login::GuestAccountId().GetUserEmail().c_str(), | 650 user_manager::GuestAccountId().GetUserEmail().c_str(), |
| 651 kTestSupervisedUserName)); | 651 kTestSupervisedUserName)); |
| 652 | 652 |
| 653 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, | 653 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, |
| 654 EnableOnLoginScreenAndLogin) { | 654 EnableOnLoginScreenAndLogin) { |
| 655 // Enables large cursor. | 655 // Enables large cursor. |
| 656 SetLargeCursorEnabled(true); | 656 SetLargeCursorEnabled(true); |
| 657 EXPECT_TRUE(IsLargeCursorEnabled()); | 657 EXPECT_TRUE(IsLargeCursorEnabled()); |
| 658 // Enables spoken feedback. | 658 // Enables spoken feedback. |
| 659 SetSpokenFeedbackEnabled(true); | 659 SetSpokenFeedbackEnabled(true); |
| 660 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 660 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 EXPECT_FALSE(ShouldShowAccessibilityMenu()); | 796 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 797 | 797 |
| 798 // Check mono audio output. | 798 // Check mono audio output. |
| 799 SetMonoAudioEnabled(true); | 799 SetMonoAudioEnabled(true); |
| 800 EXPECT_TRUE(ShouldShowAccessibilityMenu()); | 800 EXPECT_TRUE(ShouldShowAccessibilityMenu()); |
| 801 SetMonoAudioEnabled(false); | 801 SetMonoAudioEnabled(false); |
| 802 EXPECT_FALSE(ShouldShowAccessibilityMenu()); | 802 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 803 } | 803 } |
| 804 | 804 |
| 805 } // namespace chromeos | 805 } // namespace chromeos |
| OLD | NEW |