| 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_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| 11 #include "content/public/test/test_browser_thread_bundle.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 class AbstractPreferenceMergeTest : public testing::Test { | 14 class AbstractPreferenceMergeTest : public testing::Test { |
| 14 protected: | 15 protected: |
| 15 virtual void SetUp() { | 16 virtual void SetUp() { |
| 16 pref_service_ = profile_.GetPrefs(); | 17 pref_service_ = profile_.GetPrefs(); |
| 17 } | 18 } |
| 18 | 19 |
| 19 void SetContentPattern(DictionaryValue* patterns_dict, | 20 void SetContentPattern(DictionaryValue* patterns_dict, |
| 20 const std::string& expression, | 21 const std::string& expression, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 base::Value::Type type = pref->GetType(); | 42 base::Value::Type type = pref->GetType(); |
| 42 if (type == Value::TYPE_DICTIONARY) | 43 if (type == Value::TYPE_DICTIONARY) |
| 43 empty_value.reset(new DictionaryValue); | 44 empty_value.reset(new DictionaryValue); |
| 44 else if (type == Value::TYPE_LIST) | 45 else if (type == Value::TYPE_LIST) |
| 45 empty_value.reset(new ListValue); | 46 empty_value.reset(new ListValue); |
| 46 else | 47 else |
| 47 FAIL(); | 48 FAIL(); |
| 48 pref_service_->Set(pref_name.c_str(), *empty_value); | 49 pref_service_->Set(pref_name.c_str(), *empty_value); |
| 49 } | 50 } |
| 50 | 51 |
| 52 content::TestBrowserThreadBundle thread_bundle_; |
| 51 TestingProfile profile_; | 53 TestingProfile profile_; |
| 52 PrefService* pref_service_; | 54 PrefService* pref_service_; |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 class ListPreferenceMergeTest : public AbstractPreferenceMergeTest { | 57 class ListPreferenceMergeTest : public AbstractPreferenceMergeTest { |
| 56 protected: | 58 protected: |
| 57 ListPreferenceMergeTest() : | 59 ListPreferenceMergeTest() : |
| 58 server_url0_("http://example.com/server0"), | 60 server_url0_("http://example.com/server0"), |
| 59 server_url1_("http://example.com/server1"), | 61 server_url1_("http://example.com/server1"), |
| 60 local_url0_("http://example.com/local0"), | 62 local_url0_("http://example.com/local0"), |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 std::string expression0_; | 415 std::string expression0_; |
| 414 std::string expression1_; | 416 std::string expression1_; |
| 415 std::string content_type0_; | 417 std::string content_type0_; |
| 416 ListValue server_url_list_; | 418 ListValue server_url_list_; |
| 417 DictionaryValue server_patterns_; | 419 DictionaryValue server_patterns_; |
| 418 }; | 420 }; |
| 419 | 421 |
| 420 TEST_F(IndividualPreferenceMergeTest, URLsToRestoreOnStartup) { | 422 TEST_F(IndividualPreferenceMergeTest, URLsToRestoreOnStartup) { |
| 421 EXPECT_TRUE(MergeListPreference(prefs::kURLsToRestoreOnStartup)); | 423 EXPECT_TRUE(MergeListPreference(prefs::kURLsToRestoreOnStartup)); |
| 422 } | 424 } |
| OLD | NEW |