[email protected] | 74379bc5 | 2010-07-21 13:54:08 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 5 | #include <string> |
| 6 | |
[email protected] | 3184cba4 | 2009-05-15 01:25:29 | [diff] [blame] | 7 | #include "app/test/data/resource.h" |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 8 | #include "base/scoped_ptr.h" |
| 9 | #include "base/values.h" |
[email protected] | 37858e5 | 2010-08-26 00:22:02 | [diff] [blame] | 10 | #include "chrome/browser/prefs/dummy_pref_store.h" |
| 11 | #include "chrome/browser/prefs/pref_value_store.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 12 | #include "chrome/common/chrome_paths.h" |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 13 | #include "chrome/common/notification_observer_mock.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 14 | #include "chrome/common/notification_service.h" |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 15 | #include "chrome/common/notification_type.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 16 | #include "chrome/common/pref_names.h" |
[email protected] | 74379bc5 | 2010-07-21 13:54:08 | [diff] [blame] | 17 | #include "chrome/test/testing_pref_service.h" |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 18 | #include "testing/gmock/include/gmock/gmock.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 19 | #include "testing/gtest/include/gtest/gtest.h" |
| 20 | |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 21 | using testing::_; |
| 22 | using testing::Mock; |
| 23 | using testing::Pointee; |
| 24 | using testing::Property; |
| 25 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 26 | class TestPrefObserver : public NotificationObserver { |
| 27 | public: |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 28 | TestPrefObserver(const PrefService* prefs, |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 29 | const std::string& pref_name, |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 30 | const std::string& new_pref_value) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 31 | : observer_fired_(false), |
| 32 | prefs_(prefs), |
| 33 | pref_name_(pref_name), |
| 34 | new_pref_value_(new_pref_value) { |
| 35 | } |
| 36 | virtual ~TestPrefObserver() {} |
| 37 | |
| 38 | virtual void Observe(NotificationType type, |
| 39 | const NotificationSource& source, |
| 40 | const NotificationDetails& details) { |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 41 | EXPECT_EQ(type.value, NotificationType::PREF_CHANGED); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 42 | PrefService* prefs_in = Source<PrefService>(source).ptr(); |
| 43 | EXPECT_EQ(prefs_in, prefs_); |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 44 | std::string* pref_name_in = Details<std::string>(details).ptr(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 45 | EXPECT_EQ(*pref_name_in, pref_name_); |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 46 | EXPECT_EQ(new_pref_value_, prefs_in->GetString("homepage")); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 47 | observer_fired_ = true; |
| 48 | } |
| 49 | |
| 50 | bool observer_fired() { return observer_fired_; } |
| 51 | |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 52 | void Reset(const std::string& new_pref_value) { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 53 | observer_fired_ = false; |
| 54 | new_pref_value_ = new_pref_value; |
| 55 | } |
| 56 | |
| 57 | private: |
| 58 | bool observer_fired_; |
| 59 | const PrefService* prefs_; |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 60 | const std::string pref_name_; |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 61 | std::string new_pref_value_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 62 | }; |
| 63 | |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 64 | // TODO(port): port this test to POSIX. |
| 65 | #if defined(OS_WIN) |
[email protected] | 277404c2 | 2010-04-22 13:09:45 | [diff] [blame] | 66 | TEST(PrefServiceTest, LocalizedPrefs) { |
[email protected] | 74379bc5 | 2010-07-21 13:54:08 | [diff] [blame] | 67 | TestingPrefService prefs; |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 68 | const char kBoolean[] = "boolean"; |
| 69 | const char kInteger[] = "integer"; |
| 70 | const char kString[] = "string"; |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 71 | prefs.RegisterLocalizedBooleanPref(kBoolean, IDS_LOCALE_BOOL); |
| 72 | prefs.RegisterLocalizedIntegerPref(kInteger, IDS_LOCALE_INT); |
| 73 | prefs.RegisterLocalizedStringPref(kString, IDS_LOCALE_STRING); |
| 74 | |
| 75 | // The locale default should take preference over the user default. |
| 76 | EXPECT_FALSE(prefs.GetBoolean(kBoolean)); |
| 77 | EXPECT_EQ(1, prefs.GetInteger(kInteger)); |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 78 | EXPECT_EQ("hello", prefs.GetString(kString)); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 79 | |
| 80 | prefs.SetBoolean(kBoolean, true); |
| 81 | EXPECT_TRUE(prefs.GetBoolean(kBoolean)); |
| 82 | prefs.SetInteger(kInteger, 5); |
| 83 | EXPECT_EQ(5, prefs.GetInteger(kInteger)); |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 84 | prefs.SetString(kString, "foo"); |
| 85 | EXPECT_EQ("foo", prefs.GetString(kString)); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 86 | } |
| 87 | #endif |
| 88 | |
[email protected] | 277404c2 | 2010-04-22 13:09:45 | [diff] [blame] | 89 | TEST(PrefServiceTest, NoObserverFire) { |
[email protected] | 74379bc5 | 2010-07-21 13:54:08 | [diff] [blame] | 90 | TestingPrefService prefs; |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 91 | |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 92 | const char pref_name[] = "homepage"; |
[email protected] | 20ce516d | 2010-06-18 02:20:04 | [diff] [blame] | 93 | prefs.RegisterStringPref(pref_name, ""); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 94 | |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 95 | const std::string new_pref_value("http://www.google.com/"); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 96 | TestPrefObserver obs(&prefs, pref_name, new_pref_value); |
| 97 | prefs.AddPrefObserver(pref_name, &obs); |
| 98 | // This should fire the checks in TestPrefObserver::Observe. |
| 99 | prefs.SetString(pref_name, new_pref_value); |
| 100 | |
| 101 | // Make sure the observer was actually fired. |
| 102 | EXPECT_TRUE(obs.observer_fired()); |
| 103 | |
| 104 | // Setting the pref to the same value should not set the pref value a second |
| 105 | // time. |
| 106 | obs.Reset(new_pref_value); |
| 107 | prefs.SetString(pref_name, new_pref_value); |
[email protected] | 40a47c16 | 2010-09-09 11:14:01 | [diff] [blame] | 108 | EXPECT_FALSE(obs.observer_fired()); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 109 | |
| 110 | // Clearing the pref should cause the pref to fire. |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 111 | obs.Reset(""); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 112 | prefs.ClearPref(pref_name); |
| 113 | EXPECT_TRUE(obs.observer_fired()); |
| 114 | |
| 115 | // Clearing the pref again should not cause the pref to fire. |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 116 | obs.Reset(""); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 117 | prefs.ClearPref(pref_name); |
[email protected] | 40a47c16 | 2010-09-09 11:14:01 | [diff] [blame] | 118 | EXPECT_FALSE(obs.observer_fired()); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 119 | |
| 120 | // Ok, clean up. |
| 121 | prefs.RemovePrefObserver(pref_name, &obs); |
| 122 | } |
| 123 | |
[email protected] | 277404c2 | 2010-04-22 13:09:45 | [diff] [blame] | 124 | TEST(PrefServiceTest, HasPrefPath) { |
[email protected] | 74379bc5 | 2010-07-21 13:54:08 | [diff] [blame] | 125 | TestingPrefService prefs; |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 126 | |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 127 | const char path[] = "fake.path"; |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 128 | |
| 129 | // Shouldn't initially have a path. |
| 130 | EXPECT_FALSE(prefs.HasPrefPath(path)); |
| 131 | |
| 132 | // Register the path. This doesn't set a value, so the path still shouldn't |
| 133 | // exist. |
[email protected] | 20ce516d | 2010-06-18 02:20:04 | [diff] [blame] | 134 | prefs.RegisterStringPref(path, std::string()); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 135 | EXPECT_FALSE(prefs.HasPrefPath(path)); |
| 136 | |
| 137 | // Set a value and make sure we have a path. |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 138 | prefs.SetString(path, "blah"); |
[email protected] | 7aa0a96 | 2010-04-21 17:24:42 | [diff] [blame] | 139 | EXPECT_TRUE(prefs.HasPrefPath(path)); |
| 140 | } |
| 141 | |
[email protected] | 277404c2 | 2010-04-22 13:09:45 | [diff] [blame] | 142 | TEST(PrefServiceTest, Observers) { |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 143 | const char pref_name[] = "homepage"; |
[email protected] | 277404c2 | 2010-04-22 13:09:45 | [diff] [blame] | 144 | |
[email protected] | 74379bc5 | 2010-07-21 13:54:08 | [diff] [blame] | 145 | TestingPrefService prefs; |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 146 | prefs.SetUserPref(pref_name, Value::CreateStringValue("http://www.cnn.com")); |
[email protected] | 20ce516d | 2010-06-18 02:20:04 | [diff] [blame] | 147 | prefs.RegisterStringPref(pref_name, ""); |
[email protected] | 277404c2 | 2010-04-22 13:09:45 | [diff] [blame] | 148 | |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 149 | const std::string new_pref_value("http://www.google.com/"); |
[email protected] | 277404c2 | 2010-04-22 13:09:45 | [diff] [blame] | 150 | TestPrefObserver obs(&prefs, pref_name, new_pref_value); |
| 151 | prefs.AddPrefObserver(pref_name, &obs); |
| 152 | // This should fire the checks in TestPrefObserver::Observe. |
| 153 | prefs.SetString(pref_name, new_pref_value); |
| 154 | |
| 155 | // Make sure the tests were actually run. |
| 156 | EXPECT_TRUE(obs.observer_fired()); |
| 157 | |
| 158 | // Now try adding a second pref observer. |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 159 | const std::string new_pref_value2("http://www.youtube.com/"); |
[email protected] | 277404c2 | 2010-04-22 13:09:45 | [diff] [blame] | 160 | obs.Reset(new_pref_value2); |
| 161 | TestPrefObserver obs2(&prefs, pref_name, new_pref_value2); |
| 162 | prefs.AddPrefObserver(pref_name, &obs2); |
| 163 | // This should fire the checks in obs and obs2. |
| 164 | prefs.SetString(pref_name, new_pref_value2); |
| 165 | EXPECT_TRUE(obs.observer_fired()); |
| 166 | EXPECT_TRUE(obs2.observer_fired()); |
| 167 | |
| 168 | // Make sure obs2 still works after removing obs. |
| 169 | prefs.RemovePrefObserver(pref_name, &obs); |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 170 | obs.Reset(""); |
[email protected] | 277404c2 | 2010-04-22 13:09:45 | [diff] [blame] | 171 | obs2.Reset(new_pref_value); |
| 172 | // This should only fire the observer in obs2. |
| 173 | prefs.SetString(pref_name, new_pref_value); |
| 174 | EXPECT_FALSE(obs.observer_fired()); |
| 175 | EXPECT_TRUE(obs2.observer_fired()); |
| 176 | |
| 177 | // Ok, clean up. |
| 178 | prefs.RemovePrefObserver(pref_name, &obs2); |
| 179 | } |
| 180 | |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 181 | class PrefServiceSetValueTest : public testing::Test { |
| 182 | protected: |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 183 | static const char name_[]; |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 184 | static const char value_[]; |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 185 | |
| 186 | PrefServiceSetValueTest() |
[email protected] | 74379bc5 | 2010-07-21 13:54:08 | [diff] [blame] | 187 | : name_string_(name_), |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 188 | null_value_(Value::CreateNullValue()) {} |
| 189 | |
| 190 | void SetExpectNoNotification() { |
| 191 | EXPECT_CALL(observer_, Observe(_, _, _)).Times(0); |
| 192 | } |
| 193 | |
| 194 | void SetExpectPrefChanged() { |
| 195 | EXPECT_CALL(observer_, |
| 196 | Observe(NotificationType(NotificationType::PREF_CHANGED), _, |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 197 | Property(&Details<std::string>::ptr, |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 198 | Pointee(name_string_)))); |
| 199 | } |
| 200 | |
[email protected] | 74379bc5 | 2010-07-21 13:54:08 | [diff] [blame] | 201 | TestingPrefService prefs_; |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 202 | std::string name_string_; |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 203 | scoped_ptr<Value> null_value_; |
| 204 | NotificationObserverMock observer_; |
| 205 | }; |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 206 | |
[email protected] | 57ecc4b | 2010-08-11 03:02:51 | [diff] [blame] | 207 | const char PrefServiceSetValueTest::name_[] = "name"; |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 208 | const char PrefServiceSetValueTest::value_[] = "value"; |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 209 | |
| 210 | TEST_F(PrefServiceSetValueTest, SetStringValue) { |
[email protected] | 20ce516d | 2010-06-18 02:20:04 | [diff] [blame] | 211 | const char default_string[] = "default"; |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 212 | scoped_ptr<Value> default_value(Value::CreateStringValue(default_string)); |
| 213 | prefs_.RegisterStringPref(name_, default_string); |
| 214 | prefs_.AddPrefObserver(name_, &observer_); |
[email protected] | c3b54f37 | 2010-09-14 08:25:07 | [diff] [blame^] | 215 | // Changing the controlling store from default to user triggers notification. |
| 216 | SetExpectPrefChanged(); |
| 217 | prefs_.Set(name_, *default_value); |
| 218 | Mock::VerifyAndClearExpectations(&observer_); |
| 219 | |
[email protected] | 40a47c16 | 2010-09-09 11:14:01 | [diff] [blame] | 220 | SetExpectNoNotification(); |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 221 | prefs_.Set(name_, *default_value); |
| 222 | Mock::VerifyAndClearExpectations(&observer_); |
| 223 | |
| 224 | scoped_ptr<Value> new_value(Value::CreateStringValue(value_)); |
| 225 | SetExpectPrefChanged(); |
| 226 | prefs_.Set(name_, *new_value); |
| 227 | EXPECT_EQ(value_, prefs_.GetString(name_)); |
| 228 | |
| 229 | prefs_.RemovePrefObserver(name_, &observer_); |
| 230 | } |
| 231 | |
| 232 | TEST_F(PrefServiceSetValueTest, SetDictionaryValue) { |
| 233 | prefs_.RegisterDictionaryPref(name_); |
| 234 | prefs_.AddPrefObserver(name_, &observer_); |
| 235 | |
[email protected] | c3b54f37 | 2010-09-14 08:25:07 | [diff] [blame^] | 236 | // Dictionary values are special: setting one to NULL is the same as clearing |
| 237 | // the user value, allowing the NULL default to take (or keep) control. |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 238 | SetExpectNoNotification(); |
| 239 | prefs_.Set(name_, *null_value_); |
| 240 | Mock::VerifyAndClearExpectations(&observer_); |
| 241 | |
| 242 | DictionaryValue new_value; |
| 243 | new_value.SetString(name_, value_); |
| 244 | SetExpectPrefChanged(); |
| 245 | prefs_.Set(name_, new_value); |
| 246 | Mock::VerifyAndClearExpectations(&observer_); |
| 247 | DictionaryValue* dict = prefs_.GetMutableDictionary(name_); |
| 248 | EXPECT_EQ(1U, dict->size()); |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 249 | std::string out_value; |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 250 | dict->GetString(name_, &out_value); |
| 251 | EXPECT_EQ(value_, out_value); |
| 252 | |
[email protected] | 40a47c16 | 2010-09-09 11:14:01 | [diff] [blame] | 253 | SetExpectNoNotification(); |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 254 | prefs_.Set(name_, new_value); |
| 255 | Mock::VerifyAndClearExpectations(&observer_); |
| 256 | |
| 257 | SetExpectPrefChanged(); |
| 258 | prefs_.Set(name_, *null_value_); |
| 259 | Mock::VerifyAndClearExpectations(&observer_); |
| 260 | dict = prefs_.GetMutableDictionary(name_); |
| 261 | EXPECT_EQ(0U, dict->size()); |
| 262 | |
| 263 | prefs_.RemovePrefObserver(name_, &observer_); |
| 264 | } |
| 265 | |
| 266 | TEST_F(PrefServiceSetValueTest, SetListValue) { |
| 267 | prefs_.RegisterListPref(name_); |
| 268 | prefs_.AddPrefObserver(name_, &observer_); |
| 269 | |
[email protected] | c3b54f37 | 2010-09-14 08:25:07 | [diff] [blame^] | 270 | // List values are special: setting one to NULL is the same as clearing the |
| 271 | // user value, allowing the NULL default to take (or keep) control. |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 272 | SetExpectNoNotification(); |
| 273 | prefs_.Set(name_, *null_value_); |
| 274 | Mock::VerifyAndClearExpectations(&observer_); |
| 275 | |
| 276 | ListValue new_value; |
| 277 | new_value.Append(Value::CreateStringValue(value_)); |
| 278 | SetExpectPrefChanged(); |
| 279 | prefs_.Set(name_, new_value); |
| 280 | Mock::VerifyAndClearExpectations(&observer_); |
| 281 | ListValue* list = prefs_.GetMutableList(name_); |
| 282 | ASSERT_EQ(1U, list->GetSize()); |
[email protected] | ddd231e | 2010-06-29 20:35:19 | [diff] [blame] | 283 | std::string out_value; |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 284 | list->GetString(0, &out_value); |
| 285 | EXPECT_EQ(value_, out_value); |
| 286 | |
[email protected] | 40a47c16 | 2010-09-09 11:14:01 | [diff] [blame] | 287 | SetExpectNoNotification(); |
[email protected] | ecde274 | 2010-04-02 17:36:18 | [diff] [blame] | 288 | prefs_.Set(name_, new_value); |
| 289 | Mock::VerifyAndClearExpectations(&observer_); |
| 290 | |
| 291 | SetExpectPrefChanged(); |
| 292 | prefs_.Set(name_, *null_value_); |
| 293 | Mock::VerifyAndClearExpectations(&observer_); |
| 294 | list = prefs_.GetMutableList(name_); |
| 295 | EXPECT_EQ(0U, list->GetSize()); |
| 296 | |
| 297 | prefs_.RemovePrefObserver(name_, &observer_); |
| 298 | } |