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/prefs/scoped_user_pref_update.h" | 6 #include "base/prefs/scoped_user_pref_update.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/prefs/pref_model_associator.h" | 8 #include "chrome/browser/prefs/pref_model_associator.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 int setting) { | 22 int setting) { |
23 base::DictionaryValue* expression_dict; | 23 base::DictionaryValue* expression_dict; |
24 bool found = | 24 bool found = |
25 patterns_dict->GetDictionaryWithoutPathExpansion(expression, | 25 patterns_dict->GetDictionaryWithoutPathExpansion(expression, |
26 &expression_dict); | 26 &expression_dict); |
27 if (!found) { | 27 if (!found) { |
28 expression_dict = new base::DictionaryValue; | 28 expression_dict = new base::DictionaryValue; |
29 patterns_dict->SetWithoutPathExpansion(expression, expression_dict); | 29 patterns_dict->SetWithoutPathExpansion(expression, expression_dict); |
30 } | 30 } |
31 expression_dict->SetWithoutPathExpansion( | 31 expression_dict->SetWithoutPathExpansion( |
32 content_type, | 32 content_type, new base::FundamentalValue(setting)); |
33 base::Value::CreateIntegerValue(setting)); | |
34 } | 33 } |
35 | 34 |
36 void SetPrefToEmpty(const std::string& pref_name) { | 35 void SetPrefToEmpty(const std::string& pref_name) { |
37 scoped_ptr<base::Value> empty_value; | 36 scoped_ptr<base::Value> empty_value; |
38 const PrefService::Preference* pref = | 37 const PrefService::Preference* pref = |
39 pref_service_->FindPreference(pref_name.c_str()); | 38 pref_service_->FindPreference(pref_name.c_str()); |
40 ASSERT_TRUE(pref); | 39 ASSERT_TRUE(pref); |
41 base::Value::Type type = pref->GetType(); | 40 base::Value::Type type = pref->GetType(); |
42 if (type == base::Value::TYPE_DICTIONARY) | 41 if (type == base::Value::TYPE_DICTIONARY) |
43 empty_value.reset(new base::DictionaryValue); | 42 empty_value.reset(new base::DictionaryValue); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 std::string expression0_; | 412 std::string expression0_; |
414 std::string expression1_; | 413 std::string expression1_; |
415 std::string content_type0_; | 414 std::string content_type0_; |
416 base::ListValue server_url_list_; | 415 base::ListValue server_url_list_; |
417 base::DictionaryValue server_patterns_; | 416 base::DictionaryValue server_patterns_; |
418 }; | 417 }; |
419 | 418 |
420 TEST_F(IndividualPreferenceMergeTest, URLsToRestoreOnStartup) { | 419 TEST_F(IndividualPreferenceMergeTest, URLsToRestoreOnStartup) { |
421 EXPECT_TRUE(MergeListPreference(prefs::kURLsToRestoreOnStartup)); | 420 EXPECT_TRUE(MergeListPreference(prefs::kURLsToRestoreOnStartup)); |
422 } | 421 } |
OLD | NEW |