Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: chrome/browser/prefs/pref_model_associator_unittest.cc

Issue 7647026: base: Add three helper functions to Values API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a typo Ceate -> Create Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/values.h" 6 #include "base/values.h"
7 #include "chrome/browser/prefs/pref_model_associator.h" 7 #include "chrome/browser/prefs/pref_model_associator.h"
8 #include "chrome/browser/prefs/scoped_user_pref_update.h" 8 #include "chrome/browser/prefs/scoped_user_pref_update.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "chrome/test/base/testing_browser_process_test.h" 10 #include "chrome/test/base/testing_browser_process_test.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 TEST_F(ListPreferenceMergeTest, LocalEmpty) { 87 TEST_F(ListPreferenceMergeTest, LocalEmpty) {
88 SetPrefToEmpty(prefs::kURLsToRestoreOnStartup); 88 SetPrefToEmpty(prefs::kURLsToRestoreOnStartup);
89 const PrefService::Preference* pref = 89 const PrefService::Preference* pref =
90 pref_service_->FindPreference(prefs::kURLsToRestoreOnStartup); 90 pref_service_->FindPreference(prefs::kURLsToRestoreOnStartup);
91 scoped_ptr<Value> merged_value( 91 scoped_ptr<Value> merged_value(
92 PrefModelAssociator::MergePreference(*pref, server_url_list_)); 92 PrefModelAssociator::MergePreference(*pref, server_url_list_));
93 EXPECT_TRUE(merged_value->Equals(&server_url_list_)); 93 EXPECT_TRUE(merged_value->Equals(&server_url_list_));
94 } 94 }
95 95
96 TEST_F(ListPreferenceMergeTest, ServerNull) { 96 TEST_F(ListPreferenceMergeTest, ServerNull) {
97 scoped_ptr<Value> null_value(Value::CreateNullValue()); 97 scoped_ptr<Value> null_value(base::NullValue());
98 { 98 {
99 ListPrefUpdate update(pref_service_, prefs::kURLsToRestoreOnStartup); 99 ListPrefUpdate update(pref_service_, prefs::kURLsToRestoreOnStartup);
100 ListValue* local_list_value = update.Get(); 100 ListValue* local_list_value = update.Get();
101 local_list_value->Append(Value::CreateStringValue(local_url0_)); 101 local_list_value->Append(Value::CreateStringValue(local_url0_));
102 } 102 }
103 103
104 const PrefService::Preference* pref = 104 const PrefService::Preference* pref =
105 pref_service_->FindPreference(prefs::kURLsToRestoreOnStartup); 105 pref_service_->FindPreference(prefs::kURLsToRestoreOnStartup);
106 scoped_ptr<Value> merged_value( 106 scoped_ptr<Value> merged_value(
107 PrefModelAssociator::MergePreference(*pref, *null_value)); 107 PrefModelAssociator::MergePreference(*pref, *null_value));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 TEST_F(DictionaryPreferenceMergeTest, LocalEmpty) { 212 TEST_F(DictionaryPreferenceMergeTest, LocalEmpty) {
213 SetPrefToEmpty(prefs::kContentSettingsPatterns); 213 SetPrefToEmpty(prefs::kContentSettingsPatterns);
214 const PrefService::Preference* pref = 214 const PrefService::Preference* pref =
215 pref_service_->FindPreference(prefs::kContentSettingsPatterns); 215 pref_service_->FindPreference(prefs::kContentSettingsPatterns);
216 scoped_ptr<Value> merged_value( 216 scoped_ptr<Value> merged_value(
217 PrefModelAssociator::MergePreference(*pref, server_patterns_)); 217 PrefModelAssociator::MergePreference(*pref, server_patterns_));
218 EXPECT_TRUE(merged_value->Equals(&server_patterns_)); 218 EXPECT_TRUE(merged_value->Equals(&server_patterns_));
219 } 219 }
220 220
221 TEST_F(DictionaryPreferenceMergeTest, ServerNull) { 221 TEST_F(DictionaryPreferenceMergeTest, ServerNull) {
222 scoped_ptr<Value> null_value(Value::CreateNullValue()); 222 scoped_ptr<Value> null_value(base::NullValue());
223 { 223 {
224 DictionaryPrefUpdate update(pref_service_, prefs::kContentSettingsPatterns); 224 DictionaryPrefUpdate update(pref_service_, prefs::kContentSettingsPatterns);
225 DictionaryValue* local_dict_value = update.Get(); 225 DictionaryValue* local_dict_value = update.Get();
226 SetContentPattern(local_dict_value, expression2_, content_type0_, 1); 226 SetContentPattern(local_dict_value, expression2_, content_type0_, 1);
227 } 227 }
228 228
229 const PrefService::Preference* pref = 229 const PrefService::Preference* pref =
230 pref_service_->FindPreference(prefs::kContentSettingsPatterns); 230 pref_service_->FindPreference(prefs::kContentSettingsPatterns);
231 scoped_ptr<Value> merged_value( 231 scoped_ptr<Value> merged_value(
232 PrefModelAssociator::MergePreference(*pref, *null_value)); 232 PrefModelAssociator::MergePreference(*pref, *null_value));
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 EXPECT_TRUE(MergeListPreference(prefs::kDesktopNotificationDeniedOrigins)); 394 EXPECT_TRUE(MergeListPreference(prefs::kDesktopNotificationDeniedOrigins));
395 } 395 }
396 396
397 TEST_F(IndividualPreferenceMergeTest, ContentSettingsPatterns) { 397 TEST_F(IndividualPreferenceMergeTest, ContentSettingsPatterns) {
398 EXPECT_TRUE(MergeDictionaryPreference(prefs::kContentSettingsPatterns)); 398 EXPECT_TRUE(MergeDictionaryPreference(prefs::kContentSettingsPatterns));
399 } 399 }
400 400
401 TEST_F(IndividualPreferenceMergeTest, GeolocationContentSettings) { 401 TEST_F(IndividualPreferenceMergeTest, GeolocationContentSettings) {
402 EXPECT_TRUE(MergeDictionaryPreference(prefs::kGeolocationContentSettings)); 402 EXPECT_TRUE(MergeDictionaryPreference(prefs::kGeolocationContentSettings));
403 } 403 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/user_policy_cache_unittest.cc ('k') | chrome/browser/prefs/pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698