OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "components/sync_preferences/pref_model_associator.h" | 5 #include "components/sync_preferences/pref_model_associator.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 expression_dict->SetWithoutPathExpansion( | 74 expression_dict->SetWithoutPathExpansion( |
75 "setting", new base::FundamentalValue(setting)); | 75 "setting", new base::FundamentalValue(setting)); |
76 } | 76 } |
77 | 77 |
78 void SetPrefToEmpty(const std::string& pref_name) { | 78 void SetPrefToEmpty(const std::string& pref_name) { |
79 std::unique_ptr<base::Value> empty_value; | 79 std::unique_ptr<base::Value> empty_value; |
80 const PrefService::Preference* pref = | 80 const PrefService::Preference* pref = |
81 pref_service_->FindPreference(pref_name.c_str()); | 81 pref_service_->FindPreference(pref_name.c_str()); |
82 ASSERT_TRUE(pref); | 82 ASSERT_TRUE(pref); |
83 base::Value::Type type = pref->GetType(); | 83 base::Value::Type type = pref->GetType(); |
84 if (type == base::Value::TYPE_DICTIONARY) | 84 if (type == base::Value::Type::DICTIONARY) |
85 empty_value.reset(new base::DictionaryValue); | 85 empty_value.reset(new base::DictionaryValue); |
86 else if (type == base::Value::TYPE_LIST) | 86 else if (type == base::Value::Type::LIST) |
87 empty_value.reset(new base::ListValue); | 87 empty_value.reset(new base::ListValue); |
88 else | 88 else |
89 FAIL(); | 89 FAIL(); |
90 pref_service_->Set(pref_name.c_str(), *empty_value); | 90 pref_service_->Set(pref_name.c_str(), *empty_value); |
91 } | 91 } |
92 | 92 |
93 TestPrefModelAssociatorClient client_; | 93 TestPrefModelAssociatorClient client_; |
94 std::unique_ptr<PrefServiceSyncable> pref_service_; | 94 std::unique_ptr<PrefServiceSyncable> pref_service_; |
95 PrefModelAssociator* pref_sync_service_; | 95 PrefModelAssociator* pref_sync_service_; |
96 }; | 96 }; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 base::DictionaryValue server_patterns_; | 432 base::DictionaryValue server_patterns_; |
433 }; | 433 }; |
434 | 434 |
435 TEST_F(IndividualPreferenceMergeTest, ListPreference) { | 435 TEST_F(IndividualPreferenceMergeTest, ListPreference) { |
436 EXPECT_TRUE(MergeListPreference(kListPrefName)); | 436 EXPECT_TRUE(MergeListPreference(kListPrefName)); |
437 } | 437 } |
438 | 438 |
439 } // namespace | 439 } // namespace |
440 | 440 |
441 } // namespace sync_preferences | 441 } // namespace sync_preferences |
OLD | NEW |