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.h" |
9 #include "chrome/browser/chromeos/language_preferences.h" | 9 #include "chrome/browser/chromeos/language_preferences.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const std::string& preferred_keyboard_layout) { | 53 const std::string& preferred_keyboard_layout) { |
54 EXPECT_EQ(current_input_method, | 54 EXPECT_EQ(current_input_method, |
55 mock_user_prefs_->GetString(prefs::kLanguageCurrentInputMethod)); | 55 mock_user_prefs_->GetString(prefs::kLanguageCurrentInputMethod)); |
56 EXPECT_EQ(previous_input_method, | 56 EXPECT_EQ(previous_input_method, |
57 mock_user_prefs_->GetString(prefs::kLanguagePreviousInputMethod)); | 57 mock_user_prefs_->GetString(prefs::kLanguagePreviousInputMethod)); |
58 EXPECT_EQ(preferred_keyboard_layout, | 58 EXPECT_EQ(preferred_keyboard_layout, |
59 g_browser_process->local_state()->GetString( | 59 g_browser_process->local_state()->GetString( |
60 language_prefs::kPreferredKeyboardLayout)); | 60 language_prefs::kPreferredKeyboardLayout)); |
61 } | 61 } |
62 | 62 |
63 TestingPrefService* mock_user_prefs_; | 63 TestingPrefServiceSyncable* mock_user_prefs_; |
64 MockInputMethodManager mock_manager_; | 64 MockInputMethodManager mock_manager_; |
65 TestingProfileManager mock_profile_manager_; | 65 TestingProfileManager mock_profile_manager_; |
66 }; | 66 }; |
67 | 67 |
68 TEST_F(InputMethodPersistenceTest, TestLifetime) { | 68 TEST_F(InputMethodPersistenceTest, TestLifetime) { |
69 { | 69 { |
70 InputMethodPersistence persistence(&mock_manager_); | 70 InputMethodPersistence persistence(&mock_manager_); |
71 EXPECT_EQ(1, mock_manager_.add_observer_count_); | 71 EXPECT_EQ(1, mock_manager_.add_observer_count_); |
72 } | 72 } |
73 EXPECT_EQ(1, mock_manager_.remove_observer_count_); | 73 EXPECT_EQ(1, mock_manager_.remove_observer_count_); |
(...skipping 28 matching lines...) Expand all Loading... |
102 VerifyPrefs(kInputId2, "", kInputId2); | 102 VerifyPrefs(kInputId2, "", kInputId2); |
103 | 103 |
104 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN); | 104 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN); |
105 mock_manager_.SetCurrentInputMethodId(kInputId1); | 105 mock_manager_.SetCurrentInputMethodId(kInputId1); |
106 persistence.InputMethodChanged(&mock_manager_, false); | 106 persistence.InputMethodChanged(&mock_manager_, false); |
107 VerifyPrefs(kInputId1, kInputId2, kInputId2); | 107 VerifyPrefs(kInputId1, kInputId2, kInputId2); |
108 } | 108 } |
109 | 109 |
110 } // namespace input_method | 110 } // namespace input_method |
111 } // namespace chromeos | 111 } // namespace chromeos |
OLD | NEW |