| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <sys/types.h> | 6 #include <sys/types.h> |
| 7 | 7 |
| 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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 const char* const kTestUsers[] = {"test-user1@gmail.com", | 37 const char* const kTestUsers[] = {"test-user1@gmail.com", |
| 38 "test-user2@gmail.com"}; | 38 "test-user2@gmail.com"}; |
| 39 | 39 |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 class PreferencesTest : public LoginManagerTest { | 42 class PreferencesTest : public LoginManagerTest { |
| 43 public: | 43 public: |
| 44 PreferencesTest() | 44 PreferencesTest() |
| 45 : LoginManagerTest(true), input_settings_(NULL), keyboard_(NULL) { | 45 : LoginManagerTest(true), input_settings_(nullptr), keyboard_(nullptr) { |
| 46 for (size_t i = 0; i < arraysize(kTestUsers); ++i) { | 46 for (size_t i = 0; i < arraysize(kTestUsers); ++i) { |
| 47 test_users_.push_back(AccountId::FromUserEmail(kTestUsers[i])); | 47 test_users_.push_back(AccountId::FromUserEmail(kTestUsers[i])); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 void SetUpCommandLine(base::CommandLine* command_line) override { | 51 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 52 LoginManagerTest::SetUpCommandLine(command_line); | 52 LoginManagerTest::SetUpCommandLine(command_line); |
| 53 command_line->AppendSwitch(switches::kStubCrosSettings); | 53 command_line->AppendSwitch(switches::kStubCrosSettings); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void SetUpOnMainThread() override { | 56 void SetUpOnMainThread() override { |
| 57 LoginManagerTest::SetUpOnMainThread(); | 57 LoginManagerTest::SetUpOnMainThread(); |
| 58 input_settings_ = new system::FakeInputDeviceSettings(); | 58 input_settings_ = system::InputDeviceSettings::Get()->GetFakeInterface(); |
| 59 system::InputDeviceSettings::SetSettingsForTesting(input_settings_); | 59 EXPECT_NE(nullptr, input_settings_); |
| 60 keyboard_ = new input_method::FakeImeKeyboard(); | 60 keyboard_ = new input_method::FakeImeKeyboard(); |
| 61 static_cast<input_method::InputMethodManagerImpl*>( | 61 static_cast<input_method::InputMethodManagerImpl*>( |
| 62 input_method::InputMethodManager::Get()) | 62 input_method::InputMethodManager::Get()) |
| 63 ->SetImeKeyboardForTesting(keyboard_); | 63 ->SetImeKeyboardForTesting(keyboard_); |
| 64 CrosSettings::Get()->SetString(kDeviceOwner, test_users_[0].GetUserEmail()); | 64 CrosSettings::Get()->SetString(kDeviceOwner, test_users_[0].GetUserEmail()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Sets set of preferences in given |prefs|. Value of prefernece depends of | 67 // Sets set of preferences in given |prefs|. Value of prefernece depends of |
| 68 // |variant| value. For opposite |variant| values all preferences receive | 68 // |variant| value. For opposite |variant| values all preferences receive |
| 69 // different values. | 69 // different values. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 chrome::MultiUserWindowManagerChromeOS* manager = | 128 chrome::MultiUserWindowManagerChromeOS* manager = |
| 129 static_cast<chrome::MultiUserWindowManagerChromeOS*>( | 129 static_cast<chrome::MultiUserWindowManagerChromeOS*>( |
| 130 chrome::MultiUserWindowManager::GetInstance()); | 130 chrome::MultiUserWindowManager::GetInstance()); |
| 131 manager->SetAnimationSpeedForTest( | 131 manager->SetAnimationSpeedForTest( |
| 132 chrome::MultiUserWindowManagerChromeOS::ANIMATION_SPEED_DISABLED); | 132 chrome::MultiUserWindowManagerChromeOS::ANIMATION_SPEED_DISABLED); |
| 133 } | 133 } |
| 134 | 134 |
| 135 std::vector<AccountId> test_users_; | 135 std::vector<AccountId> test_users_; |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 system::FakeInputDeviceSettings* input_settings_; | 138 system::InputDeviceSettings::FakeInterface* input_settings_; |
| 139 input_method::FakeImeKeyboard* keyboard_; | 139 input_method::FakeImeKeyboard* keyboard_; |
| 140 | 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(PreferencesTest); | 141 DISALLOW_COPY_AND_ASSIGN(PreferencesTest); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 IN_PROC_BROWSER_TEST_F(PreferencesTest, PRE_MultiProfiles) { | 144 IN_PROC_BROWSER_TEST_F(PreferencesTest, PRE_MultiProfiles) { |
| 145 RegisterUser(test_users_[0].GetUserEmail()); | 145 RegisterUser(test_users_[0].GetUserEmail()); |
| 146 RegisterUser(test_users_[1].GetUserEmail()); | 146 RegisterUser(test_users_[1].GetUserEmail()); |
| 147 chromeos::StartupUtils::MarkOobeCompleted(); | 147 chromeos::StartupUtils::MarkOobeCompleted(); |
| 148 } | 148 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); | 208 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); |
| 209 CheckLocalStateCorrespondsToPrefs(prefs1); | 209 CheckLocalStateCorrespondsToPrefs(prefs1); |
| 210 | 210 |
| 211 // Switch user back. | 211 // Switch user back. |
| 212 user_manager->SwitchActiveUser(test_users_[0]); | 212 user_manager->SwitchActiveUser(test_users_[0]); |
| 213 CheckSettingsCorrespondToPrefs(prefs1); | 213 CheckSettingsCorrespondToPrefs(prefs1); |
| 214 CheckLocalStateCorrespondsToPrefs(prefs1); | 214 CheckLocalStateCorrespondsToPrefs(prefs1); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace chromeos | 217 } // namespace chromeos |
| OLD | NEW |