| 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 "chrome/browser/chromeos/input_method/mock_input_method_manager.h" | 8 #include "chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h" |
| 9 #include "chrome/browser/chromeos/language_preferences.h" | 9 #include "chrome/browser/chromeos/language_preferences.h" |
| 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 11 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 11 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 12 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 12 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 mock_user_prefs_->GetString(prefs::kLanguageCurrentInputMethod)); | 65 mock_user_prefs_->GetString(prefs::kLanguageCurrentInputMethod)); |
| 66 EXPECT_EQ(previous_input_method, | 66 EXPECT_EQ(previous_input_method, |
| 67 mock_user_prefs_->GetString(prefs::kLanguagePreviousInputMethod)); | 67 mock_user_prefs_->GetString(prefs::kLanguagePreviousInputMethod)); |
| 68 EXPECT_EQ(preferred_keyboard_layout, | 68 EXPECT_EQ(preferred_keyboard_layout, |
| 69 g_browser_process->local_state()->GetString( | 69 g_browser_process->local_state()->GetString( |
| 70 language_prefs::kPreferredKeyboardLayout)); | 70 language_prefs::kPreferredKeyboardLayout)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 content::TestBrowserThreadBundle thread_bundle_; | 73 content::TestBrowserThreadBundle thread_bundle_; |
| 74 sync_preferences::TestingPrefServiceSyncable* mock_user_prefs_; | 74 sync_preferences::TestingPrefServiceSyncable* mock_user_prefs_; |
| 75 MockInputMethodManager mock_manager_; | 75 MockInputMethodManagerImpl mock_manager_; |
| 76 TestingProfileManager mock_profile_manager_; | 76 TestingProfileManager mock_profile_manager_; |
| 77 chromeos::FakeChromeUserManager* fake_user_manager_; | 77 chromeos::FakeChromeUserManager* fake_user_manager_; |
| 78 chromeos::ScopedUserManagerEnabler user_manager_enabler_; | 78 chromeos::ScopedUserManagerEnabler user_manager_enabler_; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 TEST_F(InputMethodPersistenceTest, TestLifetime) { | 81 TEST_F(InputMethodPersistenceTest, TestLifetime) { |
| 82 { | 82 { |
| 83 InputMethodPersistence persistence(&mock_manager_); | 83 InputMethodPersistence persistence(&mock_manager_); |
| 84 EXPECT_EQ(1, mock_manager_.add_observer_count_); | 84 EXPECT_EQ(1, mock_manager_.add_observer_count_); |
| 85 } | 85 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN); | 122 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN); |
| 123 mock_manager_.SetCurrentInputMethodId(kInputId1); | 123 mock_manager_.SetCurrentInputMethodId(kInputId1); |
| 124 persistence.InputMethodChanged(&mock_manager_, | 124 persistence.InputMethodChanged(&mock_manager_, |
| 125 ProfileManager::GetActiveUserProfile(), false); | 125 ProfileManager::GetActiveUserProfile(), false); |
| 126 VerifyPrefs(kInputId1, kInputId2, kInputId2); | 126 VerifyPrefs(kInputId1, kInputId2, kInputId2); |
| 127 } | 127 } |
| 128 | 128 |
| 129 } // namespace input_method | 129 } // namespace input_method |
| 130 } // namespace chromeos | 130 } // namespace chromeos |
| OLD | NEW |