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