| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/input_method/input_method_persistence.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_persistence.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" | 9 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" |
| 10 #include "chrome/browser/chromeos/language_preferences.h" | 10 #include "chrome/browser/chromeos/language_preferences.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const char kInputId2[] = "xkb:us:colemak:eng"; | 31 const char kInputId2[] = "xkb:us:colemak:eng"; |
| 32 } | 32 } |
| 33 | 33 |
| 34 class InputMethodPersistenceTest : public testing::Test { | 34 class InputMethodPersistenceTest : public testing::Test { |
| 35 protected: | 35 protected: |
| 36 InputMethodPersistenceTest() | 36 InputMethodPersistenceTest() |
| 37 : mock_profile_manager_(TestingBrowserProcess::GetGlobal()), | 37 : mock_profile_manager_(TestingBrowserProcess::GetGlobal()), |
| 38 fake_user_manager_(new chromeos::FakeUserManager()), | 38 fake_user_manager_(new chromeos::FakeUserManager()), |
| 39 user_manager_enabler_(fake_user_manager_) {} | 39 user_manager_enabler_(fake_user_manager_) {} |
| 40 | 40 |
| 41 virtual void SetUp() OVERRIDE { | 41 virtual void SetUp() override { |
| 42 ASSERT_TRUE(mock_profile_manager_.SetUp()); | 42 ASSERT_TRUE(mock_profile_manager_.SetUp()); |
| 43 | 43 |
| 44 // Add a user. | 44 // Add a user. |
| 45 const char kTestUserName[] = "test-user@example.com"; | 45 const char kTestUserName[] = "test-user@example.com"; |
| 46 fake_user_manager_->AddUser(kTestUserName); | 46 fake_user_manager_->AddUser(kTestUserName); |
| 47 fake_user_manager_->LoginUser(kTestUserName); | 47 fake_user_manager_->LoginUser(kTestUserName); |
| 48 | 48 |
| 49 // Create a valid profile for the user. | 49 // Create a valid profile for the user. |
| 50 TestingProfile* mock_profile = | 50 TestingProfile* mock_profile = |
| 51 mock_profile_manager_.CreateTestingProfile(kTestUserName); | 51 mock_profile_manager_.CreateTestingProfile(kTestUserName); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 VerifyPrefs(kInputId2, "", kInputId2); | 112 VerifyPrefs(kInputId2, "", kInputId2); |
| 113 | 113 |
| 114 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN); | 114 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN); |
| 115 mock_manager_.SetCurrentInputMethodId(kInputId1); | 115 mock_manager_.SetCurrentInputMethodId(kInputId1); |
| 116 persistence.InputMethodChanged(&mock_manager_, false); | 116 persistence.InputMethodChanged(&mock_manager_, false); |
| 117 VerifyPrefs(kInputId1, kInputId2, kInputId2); | 117 VerifyPrefs(kInputId1, kInputId2, kInputId2); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace input_method | 120 } // namespace input_method |
| 121 } // namespace chromeos | 121 } // namespace chromeos |
| OLD | NEW |