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

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

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 8 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
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/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"
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 void SetUp() override { pref_service_ = profile_.GetPrefs(); } 16 void SetUp() override { pref_service_ = profile_.GetPrefs(); }
16 17
17 void SetContentPattern(base::DictionaryValue* patterns_dict, 18 void SetContentPattern(base::DictionaryValue* patterns_dict,
18 const std::string& expression, 19 const std::string& expression,
19 const std::string& content_type, 20 const std::string& content_type,
20 int setting) { 21 int setting) {
(...skipping 17 matching lines...) Expand all
38 base::Value::Type type = pref->GetType(); 39 base::Value::Type type = pref->GetType();
39 if (type == base::Value::TYPE_DICTIONARY) 40 if (type == base::Value::TYPE_DICTIONARY)
40 empty_value.reset(new base::DictionaryValue); 41 empty_value.reset(new base::DictionaryValue);
41 else if (type == base::Value::TYPE_LIST) 42 else if (type == base::Value::TYPE_LIST)
42 empty_value.reset(new base::ListValue); 43 empty_value.reset(new base::ListValue);
43 else 44 else
44 FAIL(); 45 FAIL();
45 pref_service_->Set(pref_name.c_str(), *empty_value); 46 pref_service_->Set(pref_name.c_str(), *empty_value);
46 } 47 }
47 48
49 content::TestBrowserThreadBundle thread_bundle_;
48 TestingProfile profile_; 50 TestingProfile profile_;
49 PrefService* pref_service_; 51 PrefService* pref_service_;
50 }; 52 };
51 53
52 class ListPreferenceMergeTest : public AbstractPreferenceMergeTest { 54 class ListPreferenceMergeTest : public AbstractPreferenceMergeTest {
53 protected: 55 protected:
54 ListPreferenceMergeTest() : 56 ListPreferenceMergeTest() :
55 server_url0_("http://example.com/server0"), 57 server_url0_("http://example.com/server0"),
56 server_url1_("http://example.com/server1"), 58 server_url1_("http://example.com/server1"),
57 local_url0_("http://example.com/local0"), 59 local_url0_("http://example.com/local0"),
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 std::string expression0_; 412 std::string expression0_;
411 std::string expression1_; 413 std::string expression1_;
412 std::string content_type0_; 414 std::string content_type0_;
413 base::ListValue server_url_list_; 415 base::ListValue server_url_list_;
414 base::DictionaryValue server_patterns_; 416 base::DictionaryValue server_patterns_;
415 }; 417 };
416 418
417 TEST_F(IndividualPreferenceMergeTest, URLsToRestoreOnStartup) { 419 TEST_F(IndividualPreferenceMergeTest, URLsToRestoreOnStartup) {
418 EXPECT_TRUE(MergeListPreference(prefs::kURLsToRestoreOnStartup)); 420 EXPECT_TRUE(MergeListPreference(prefs::kURLsToRestoreOnStartup));
419 } 421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698