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/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
6 | 6 |
7 #include "base/prefs/public/pref_member.h" | 7 #include "base/prefs/public/pref_member.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/download/download_prefs.h" | 9 #include "chrome/browser/download/download_prefs.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 std::string last_input_method_id_; | 47 std::string last_input_method_id_; |
48 | 48 |
49 private: | 49 private: |
50 StringPrefMember* previous_; | 50 StringPrefMember* previous_; |
51 StringPrefMember* current_; | 51 StringPrefMember* current_; |
52 }; | 52 }; |
53 | 53 |
54 } // anonymous namespace | 54 } // anonymous namespace |
55 | 55 |
56 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { | 56 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { |
57 TestingPrefService prefs; | 57 TestingPrefServiceSyncable prefs; |
58 Preferences::RegisterUserPrefs(&prefs); | 58 Preferences::RegisterUserPrefs(&prefs); |
59 DownloadPrefs::RegisterUserPrefs(&prefs); | 59 DownloadPrefs::RegisterUserPrefs(&prefs); |
60 | 60 |
61 StringPrefMember previous; | 61 StringPrefMember previous; |
62 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs); | 62 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs); |
63 previous.SetValue("KeyboardA"); | 63 previous.SetValue("KeyboardA"); |
64 StringPrefMember current; | 64 StringPrefMember current; |
65 current.Init(prefs::kLanguageCurrentInputMethod, &prefs); | 65 current.Init(prefs::kLanguageCurrentInputMethod, &prefs); |
66 current.SetValue("KeyboardB"); | 66 current.SetValue("KeyboardB"); |
67 | 67 |
68 MyMockInputMethodManager mock_manager(&previous, ¤t); | 68 MyMockInputMethodManager mock_manager(&previous, ¤t); |
69 Preferences testee(&mock_manager); | 69 Preferences testee(&mock_manager); |
70 testee.InitUserPrefsForTesting(&prefs); | 70 testee.InitUserPrefsForTesting(&prefs); |
71 testee.SetInputMethodListForTesting(); | 71 testee.SetInputMethodListForTesting(); |
72 | 72 |
73 // Confirm they're unchanged. | 73 // Confirm they're unchanged. |
74 EXPECT_EQ("KeyboardA", previous.GetValue()); | 74 EXPECT_EQ("KeyboardA", previous.GetValue()); |
75 EXPECT_EQ("KeyboardB", current.GetValue()); | 75 EXPECT_EQ("KeyboardB", current.GetValue()); |
76 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_); | 76 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_); |
77 } | 77 } |
78 | 78 |
79 } // namespace chromeos | 79 } // namespace chromeos |
OLD | NEW |