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/pref_member.h" | 7 #include "base/prefs/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 private: | 50 private: |
51 StringPrefMember* previous_; | 51 StringPrefMember* previous_; |
52 StringPrefMember* current_; | 52 StringPrefMember* current_; |
53 }; | 53 }; |
54 | 54 |
55 } // anonymous namespace | 55 } // anonymous namespace |
56 | 56 |
57 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { | 57 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { |
58 TestingPrefServiceSyncable prefs; | 58 TestingPrefServiceSyncable prefs; |
59 Preferences::RegisterUserPrefs(prefs.registry()); | 59 Preferences::RegisterProfilePrefs(prefs.registry()); |
60 DownloadPrefs::RegisterUserPrefs(prefs.registry()); | 60 DownloadPrefs::RegisterProfilePrefs(prefs.registry()); |
61 // kSelectFileLastDirectory is registered for Profile. Here we register it for | 61 // kSelectFileLastDirectory is registered for Profile. Here we register it for |
62 // testing. | 62 // testing. |
63 prefs.registry()->RegisterStringPref( | 63 prefs.registry()->RegisterStringPref( |
64 prefs::kSelectFileLastDirectory, | 64 prefs::kSelectFileLastDirectory, |
65 std::string(), | 65 std::string(), |
66 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 66 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
67 | 67 |
68 StringPrefMember previous; | 68 StringPrefMember previous; |
69 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs); | 69 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs); |
70 previous.SetValue("KeyboardA"); | 70 previous.SetValue("KeyboardA"); |
71 StringPrefMember current; | 71 StringPrefMember current; |
72 current.Init(prefs::kLanguageCurrentInputMethod, &prefs); | 72 current.Init(prefs::kLanguageCurrentInputMethod, &prefs); |
73 current.SetValue("KeyboardB"); | 73 current.SetValue("KeyboardB"); |
74 | 74 |
75 MyMockInputMethodManager mock_manager(&previous, ¤t); | 75 MyMockInputMethodManager mock_manager(&previous, ¤t); |
76 Preferences testee(&mock_manager); | 76 Preferences testee(&mock_manager); |
77 testee.InitUserPrefsForTesting(&prefs); | 77 testee.InitUserPrefsForTesting(&prefs); |
78 testee.SetInputMethodListForTesting(); | 78 testee.SetInputMethodListForTesting(); |
79 | 79 |
80 // Confirm they're unchanged. | 80 // Confirm they're unchanged. |
81 EXPECT_EQ("KeyboardA", previous.GetValue()); | 81 EXPECT_EQ("KeyboardA", previous.GetValue()); |
82 EXPECT_EQ("KeyboardB", current.GetValue()); | 82 EXPECT_EQ("KeyboardB", current.GetValue()); |
83 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_); | 83 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_); |
84 } | 84 } |
85 | 85 |
86 } // namespace chromeos | 86 } // namespace chromeos |
OLD | NEW |