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 "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 21 matching lines...) Expand all Loading... |
32 expression_dict->SetWithoutPathExpansion( | 32 expression_dict->SetWithoutPathExpansion( |
33 content_type, | 33 content_type, |
34 Value::CreateIntegerValue(setting)); | 34 Value::CreateIntegerValue(setting)); |
35 } | 35 } |
36 | 36 |
37 void SetPrefToEmpty(const std::string& pref_name) { | 37 void SetPrefToEmpty(const std::string& pref_name) { |
38 scoped_ptr<Value> empty_value; | 38 scoped_ptr<Value> empty_value; |
39 const PrefService::Preference* pref = | 39 const PrefService::Preference* pref = |
40 pref_service_->FindPreference(pref_name.c_str()); | 40 pref_service_->FindPreference(pref_name.c_str()); |
41 ASSERT_TRUE(pref); | 41 ASSERT_TRUE(pref); |
42 Value::ValueType type = pref->GetType(); | 42 base::Value::Type type = pref->GetType(); |
43 if (type == Value::TYPE_DICTIONARY) | 43 if (type == Value::TYPE_DICTIONARY) |
44 empty_value.reset(new DictionaryValue); | 44 empty_value.reset(new DictionaryValue); |
45 else if (type == Value::TYPE_LIST) | 45 else if (type == Value::TYPE_LIST) |
46 empty_value.reset(new ListValue); | 46 empty_value.reset(new ListValue); |
47 else | 47 else |
48 FAIL(); | 48 FAIL(); |
49 pref_service_->Set(pref_name.c_str(), *empty_value); | 49 pref_service_->Set(pref_name.c_str(), *empty_value); |
50 } | 50 } |
51 | 51 |
52 TestingProfile profile_; | 52 TestingProfile profile_; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |