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