OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/preferences/public/cpp/pref_client_store.h" | 5 #include "services/preferences/public/cpp/pref_client_store.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 keys.insert(key1); | 203 keys.insert(key1); |
204 keys.insert(key2); | 204 keys.insert(key2); |
205 store()->Subscribe(keys); | 205 store()->Subscribe(keys); |
206 | 206 |
207 EXPECT_FALSE(Initialized()); | 207 EXPECT_FALSE(Initialized()); |
208 EXPECT_FALSE(observer()->initialized); | 208 EXPECT_FALSE(observer()->initialized); |
209 | 209 |
210 const int kValue = 42; | 210 const int kValue = 42; |
211 base::Value pref1(kValue); | 211 base::Value pref1(kValue); |
212 const std::string kStringValue("look"); | 212 const std::string kStringValue("look"); |
213 base::StringValue pref2(kStringValue); | 213 base::Value pref2(kStringValue); |
214 | 214 |
215 base::DictionaryValue prefs; | 215 base::DictionaryValue prefs; |
216 prefs.Set(key1, pref1.CreateDeepCopy()); | 216 prefs.Set(key1, pref1.CreateDeepCopy()); |
217 prefs.Set(key2, pref2.CreateDeepCopy()); | 217 prefs.Set(key2, pref2.CreateDeepCopy()); |
218 | 218 |
219 // The observer should be notified of all keys set. | 219 // The observer should be notified of all keys set. |
220 OnPreferencesChanged(prefs); | 220 OnPreferencesChanged(prefs); |
221 EXPECT_TRUE(Initialized()); | 221 EXPECT_TRUE(Initialized()); |
222 EXPECT_TRUE(observer()->initialized); | 222 EXPECT_TRUE(observer()->initialized); |
223 EXPECT_EQ(2u, observer()->changed_keys.size()); | 223 EXPECT_EQ(2u, observer()->changed_keys.size()); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 EXPECT_TRUE(observer2.initialized); | 401 EXPECT_TRUE(observer2.initialized); |
402 EXPECT_TRUE(observer()->initialization_success); | 402 EXPECT_TRUE(observer()->initialization_success); |
403 EXPECT_TRUE(observer2.initialization_success); | 403 EXPECT_TRUE(observer2.initialization_success); |
404 observer()->VerifyAndResetChangedKey(key); | 404 observer()->VerifyAndResetChangedKey(key); |
405 observer2.VerifyAndResetChangedKey(key); | 405 observer2.VerifyAndResetChangedKey(key); |
406 | 406 |
407 store()->RemoveObserver(&observer2); | 407 store()->RemoveObserver(&observer2); |
408 } | 408 } |
409 | 409 |
410 } // namespace preferences | 410 } // namespace preferences |
OLD | NEW |