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_observer_store.h" | 5 #include "services/preferences/public/cpp/pref_observer_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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 EXPECT_NE(observer()->changed_keys.end(), | 260 EXPECT_NE(observer()->changed_keys.end(), |
261 std::find(observer()->changed_keys.begin(), | 261 std::find(observer()->changed_keys.begin(), |
262 observer()->changed_keys.end(), key1)); | 262 observer()->changed_keys.end(), key1)); |
263 EXPECT_NE(observer()->changed_keys.end(), | 263 EXPECT_NE(observer()->changed_keys.end(), |
264 std::find(observer()->changed_keys.begin(), | 264 std::find(observer()->changed_keys.begin(), |
265 observer()->changed_keys.end(), key2)); | 265 observer()->changed_keys.end(), key2)); |
266 | 266 |
267 // Change an item within the nested dictionary | 267 // Change an item within the nested dictionary |
268 base::Value* result = nullptr; | 268 base::Value* result = nullptr; |
269 store()->GetMutableValue(key1, &result); | 269 store()->GetMutableValue(key1, &result); |
270 EXPECT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); | 270 EXPECT_EQ(base::Value::Type::DICTIONARY, result->GetType()); |
271 EXPECT_TRUE(result->Equals(&sub_dictionary1)); | 271 EXPECT_TRUE(result->Equals(&sub_dictionary1)); |
272 | 272 |
273 base::DictionaryValue* dictionary_result = nullptr; | 273 base::DictionaryValue* dictionary_result = nullptr; |
274 result->GetAsDictionary(&dictionary_result); | 274 result->GetAsDictionary(&dictionary_result); |
275 EXPECT_NE(nullptr, dictionary_result); | 275 EXPECT_NE(nullptr, dictionary_result); |
276 | 276 |
277 const std::string sub_key3("????"); | 277 const std::string sub_key3("????"); |
278 const int kValue3 = 9001; | 278 const int kValue3 = 9001; |
279 base::FundamentalValue pref3(kValue3); | 279 base::FundamentalValue pref3(kValue3); |
280 dictionary_result->Set(sub_key3, pref3.CreateDeepCopy()); | 280 dictionary_result->Set(sub_key3, pref3.CreateDeepCopy()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 observer()->changed_keys.end(), key2)); | 326 observer()->changed_keys.end(), key2)); |
327 | 327 |
328 observer()->changed_keys.clear(); | 328 observer()->changed_keys.clear(); |
329 const int kValue3 = 9001; | 329 const int kValue3 = 9001; |
330 base::FundamentalValue pref3(kValue3); | 330 base::FundamentalValue pref3(kValue3); |
331 store()->SetValue(key1, pref3.CreateDeepCopy(), 0); | 331 store()->SetValue(key1, pref3.CreateDeepCopy(), 0); |
332 base::RunLoop().RunUntilIdle(); | 332 base::RunLoop().RunUntilIdle(); |
333 EXPECT_EQ(1u, observer()->changed_keys.size()); | 333 EXPECT_EQ(1u, observer()->changed_keys.size()); |
334 EXPECT_TRUE(manager()->set_preferences_called()); | 334 EXPECT_TRUE(manager()->set_preferences_called()); |
335 } | 335 } |
OLD | NEW |