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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void SetContentPattern(base::DictionaryValue* patterns_dict, | 64 void SetContentPattern(base::DictionaryValue* patterns_dict, |
65 const std::string& expression, | 65 const std::string& expression, |
66 int setting) { | 66 int setting) { |
67 base::DictionaryValue* expression_dict; | 67 base::DictionaryValue* expression_dict; |
68 bool found = patterns_dict->GetDictionaryWithoutPathExpansion( | 68 bool found = patterns_dict->GetDictionaryWithoutPathExpansion( |
69 expression, &expression_dict); | 69 expression, &expression_dict); |
70 if (!found) { | 70 if (!found) { |
71 expression_dict = new base::DictionaryValue; | 71 expression_dict = new base::DictionaryValue; |
72 patterns_dict->SetWithoutPathExpansion(expression, expression_dict); | 72 patterns_dict->SetWithoutPathExpansion(expression, expression_dict); |
73 } | 73 } |
74 expression_dict->SetWithoutPathExpansion( | 74 expression_dict->SetWithoutPathExpansion("setting", |
75 "setting", new base::FundamentalValue(setting)); | 75 new base::Value(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); |
(...skipping 346 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 |