| 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/signin/core/account_id/account_id.h" | 29 #include "components/signin/core/account_id/account_id.h" |
| 31 #include "components/syncable_prefs/pref_service_syncable.h" | 30 #include "components/syncable_prefs/pref_service_syncable.h" |
| 32 #include "components/user_manager/user_manager.h" | 31 #include "components/user_manager/user_manager.h" |
| 32 #include "components/user_manager/user_names.h" |
| 33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 34 #include "content/public/test/test_utils.h" | 34 #include "content/public/test/test_utils.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" | 36 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" |
| 37 #include "ui/base/ime/chromeos/input_method_manager.h" | 37 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 38 | 38 |
| 39 using chromeos::input_method::InputMethodManager; | 39 using chromeos::input_method::InputMethodManager; |
| 40 using chromeos::input_method::InputMethodUtil; | 40 using chromeos::input_method::InputMethodUtil; |
| 41 using chromeos::input_method::InputMethodDescriptors; | 41 using chromeos::input_method::InputMethodDescriptors; |
| 42 using content::BrowserThread; | 42 using content::BrowserThread; |
| 43 using extensions::api::braille_display_private::BrailleObserver; | 43 using extensions::api::braille_display_private::BrailleObserver; |
| 44 using extensions::api::braille_display_private::DisplayState; | 44 using extensions::api::braille_display_private::DisplayState; |
| 45 using extensions::api::braille_display_private::KeyEvent; | 45 using extensions::api::braille_display_private::KeyEvent; |
| 46 using extensions::api::braille_display_private::MockBrailleController; | 46 using extensions::api::braille_display_private::MockBrailleController; |
| 47 | 47 |
| 48 namespace chromeos { | 48 namespace chromeos { |
| 49 | 49 |
| 50 namespace { | 50 namespace { |
| 51 | 51 |
| 52 const char kTestUserName[] = "owner@invalid.domain"; | 52 const char kTestUserName[] = "owner@invalid.domain"; |
| 53 | 53 |
| 54 const int kTestAutoclickDelayMs = 2000; | 54 const int kTestAutoclickDelayMs = 2000; |
| 55 | 55 |
| 56 // Test user name for supervised user. The domain part must be matched with | 56 // Test user name for supervised user. The domain part must be matched with |
| 57 // chromeos::login::kSupervisedUserDomain. | 57 // user_manager::kSupervisedUserDomain. |
| 58 const char kTestSupervisedUserName[] = "test@locally-managed.localhost"; | 58 const char kTestSupervisedUserName[] = "test@locally-managed.localhost"; |
| 59 | 59 |
| 60 class MockAccessibilityObserver { | 60 class MockAccessibilityObserver { |
| 61 public: | 61 public: |
| 62 MockAccessibilityObserver() : observed_(false), | 62 MockAccessibilityObserver() : observed_(false), |
| 63 observed_enabled_(false), | 63 observed_enabled_(false), |
| 64 observed_type_(-1) | 64 observed_type_(-1) |
| 65 { | 65 { |
| 66 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); | 66 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); |
| 67 CHECK(accessibility_manager); | 67 CHECK(accessibility_manager); |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 virtual ~AccessibilityManagerUserTypeTest() {} | 639 virtual ~AccessibilityManagerUserTypeTest() {} |
| 640 | 640 |
| 641 DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerUserTypeTest); | 641 DISALLOW_COPY_AND_ASSIGN(AccessibilityManagerUserTypeTest); |
| 642 }; | 642 }; |
| 643 | 643 |
| 644 // TODO(yoshiki): Enable a test for retail mode (i.e. RetailAccountId). | 644 // TODO(yoshiki): Enable a test for retail mode (i.e. RetailAccountId). |
| 645 INSTANTIATE_TEST_CASE_P( | 645 INSTANTIATE_TEST_CASE_P( |
| 646 UserTypeInstantiation, | 646 UserTypeInstantiation, |
| 647 AccessibilityManagerUserTypeTest, | 647 AccessibilityManagerUserTypeTest, |
| 648 ::testing::Values(kTestUserName, | 648 ::testing::Values(kTestUserName, |
| 649 login::GuestAccountId().GetUserEmail().c_str(), | 649 user_manager::GuestAccountId().GetUserEmail().c_str(), |
| 650 kTestSupervisedUserName)); | 650 kTestSupervisedUserName)); |
| 651 | 651 |
| 652 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, | 652 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, |
| 653 EnableOnLoginScreenAndLogin) { | 653 EnableOnLoginScreenAndLogin) { |
| 654 // Enables large cursor. | 654 // Enables large cursor. |
| 655 SetLargeCursorEnabled(true); | 655 SetLargeCursorEnabled(true); |
| 656 EXPECT_TRUE(IsLargeCursorEnabled()); | 656 EXPECT_TRUE(IsLargeCursorEnabled()); |
| 657 // Enables spoken feedback. | 657 // Enables spoken feedback. |
| 658 SetSpokenFeedbackEnabled(true); | 658 SetSpokenFeedbackEnabled(true); |
| 659 EXPECT_TRUE(IsSpokenFeedbackEnabled()); | 659 EXPECT_TRUE(IsSpokenFeedbackEnabled()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 EXPECT_FALSE(ShouldShowAccessibilityMenu()); | 795 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 796 | 796 |
| 797 // Check mono audio output. | 797 // Check mono audio output. |
| 798 SetMonoAudioEnabled(true); | 798 SetMonoAudioEnabled(true); |
| 799 EXPECT_TRUE(ShouldShowAccessibilityMenu()); | 799 EXPECT_TRUE(ShouldShowAccessibilityMenu()); |
| 800 SetMonoAudioEnabled(false); | 800 SetMonoAudioEnabled(false); |
| 801 EXPECT_FALSE(ShouldShowAccessibilityMenu()); | 801 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 802 } | 802 } |
| 803 | 803 |
| 804 } // namespace chromeos | 804 } // namespace chromeos |
| OLD | NEW |