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

Unified Diff: chrome/browser/search_engines/template_url_service_sync_unittest.cc

Issue 376413002: Stop using TemplateURLServiceTestUtil to initialize TemplateURLServiceFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TemplateURLServiceWithoutFallbackTest Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url_service_sync_unittest.cc
diff --git a/chrome/browser/search_engines/template_url_service_sync_unittest.cc b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
index 61b0502fe4415aeabf4638e2f031dcffb62af30d..aad5815a2f1cde6c999ad535e3c391f20aff0cd0 100644
--- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
@@ -157,12 +157,12 @@ class TemplateURLServiceSyncTest : public testing::Test {
virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE;
- TemplateURLService* model() { return test_util_a_.model(); }
+ TemplateURLService* model() { return test_util_a_->model(); }
// For readability, we redefine an accessor for Model A for use in tests that
// involve syncing two models.
- TemplateURLService* model_a() { return test_util_a_.model(); }
+ TemplateURLService* model_a() { return test_util_a_->model(); }
TemplateURLService* model_b() { return model_b_.get(); }
- TestingProfile* profile_a() { return test_util_a_.profile(); }
+ TestingProfile* profile_a() { return test_util_a_->profile(); }
TestChangeProcessor* processor() { return sync_processor_.get(); }
scoped_ptr<syncer::SyncChangeProcessor> PassProcessor();
scoped_ptr<syncer::SyncErrorFactory> CreateAndPassSyncErrorFactory();
@@ -210,7 +210,7 @@ class TemplateURLServiceSyncTest : public testing::Test {
protected:
// We keep two TemplateURLServices to test syncing between them.
- TemplateURLServiceTestUtil test_util_a_;
+ scoped_ptr<TemplateURLServiceTestUtil> test_util_a_;
scoped_ptr<TestingProfile> profile_b_;
scoped_ptr<TemplateURLService> model_b_;
@@ -228,11 +228,11 @@ TemplateURLServiceSyncTest::TemplateURLServiceSyncTest()
void TemplateURLServiceSyncTest::SetUp() {
DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting(true);
- test_util_a_.SetUp();
+ test_util_a_.reset(new TemplateURLServiceTestUtil);
// Use ChangeToLoadState() instead of VerifyLoad() so we don't actually pull
// in the prepopulate data, which the sync tests don't care about (and would
// just foul them up).
- test_util_a_.ChangeModelToLoadState();
+ test_util_a_->ChangeModelToLoadState();
profile_b_.reset(new TestingProfile);
TemplateURLServiceFactory::GetInstance()->
RegisterUserPrefsOnBrowserContextForTest(profile_b_.get());
@@ -244,7 +244,7 @@ void TemplateURLServiceSyncTest::SetUp() {
}
void TemplateURLServiceSyncTest::TearDown() {
- test_util_a_.TearDown();
+ test_util_a_.reset();
DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting(false);
}
@@ -1661,7 +1661,7 @@ TEST_F(TemplateURLServiceSyncTest, SyncWithManagedDefaultSearch) {
const char kAlternateURL[] =
"http://manageddefault.com/search#t={searchTerms}";
const char kSearchTermsReplacementKey[] = "espv";
- test_util_a_.SetManagedDefaultSearchPreferences(true, kName, kName,
+ test_util_a_->SetManagedDefaultSearchPreferences(true, kName, kName,
kSearchURL, std::string(), kIconURL, kEncodings, kAlternateURL,
kSearchTermsReplacementKey);
const TemplateURL* dsp_turl = model()->GetDefaultSearchProvider();
@@ -1692,7 +1692,7 @@ TEST_F(TemplateURLServiceSyncTest, SyncWithManagedDefaultSearch) {
// from Sync.
const TemplateURL* expected_default =
model()->GetTemplateURLForGUID("newdefault");
- test_util_a_.RemoveManagedDefaultSearchPreferences();
+ test_util_a_->RemoveManagedDefaultSearchPreferences();
EXPECT_EQ(expected_default, model()->GetDefaultSearchProvider());
}
@@ -1846,7 +1846,7 @@ TEST_F(TemplateURLServiceSyncTest, PreSyncUpdates) {
// Merge the prepopulate search engines.
base::Time pre_merge_time = base::Time::Now();
base::RunLoop().RunUntilIdle();
- test_util_a_.ResetModel(true);
+ test_util_a_->ResetModel(true);
// The newly added search engine should have been safely merged, with an
// updated time.
@@ -1895,7 +1895,7 @@ TEST_F(TemplateURLServiceSyncTest, PreSyncUpdates) {
TEST_F(TemplateURLServiceSyncTest, SyncBaseURLs) {
// Verify that bringing in a remote TemplateURL that uses Google base URLs
// causes it to get a local keyword that matches the local base URL.
- test_util_a_.SetGoogleBaseURL(GURL("http://google.com/"));
+ test_util_a_->SetGoogleBaseURL(GURL("http://google.com/"));
syncer::SyncDataList initial_data;
scoped_ptr<TemplateURL> turl(CreateTestTemplateURL(
ASCIIToUTF16("google.co.uk"), "{google:baseURL}search?q={searchTerms}",
@@ -1920,7 +1920,7 @@ TEST_F(TemplateURLServiceSyncTest, SyncBaseURLs) {
// A local change to the Google base URL should update the keyword and
// generate a sync change.
- test_util_a_.SetGoogleBaseURL(GURL("http://google.co.in/"));
+ test_util_a_->SetGoogleBaseURL(GURL("http://google.co.in/"));
EXPECT_EQ(ASCIIToUTF16("google.co.in"), synced_turl->keyword());
EXPECT_EQ(1U, processor()->change_list_size());
ASSERT_TRUE(processor()->contains_guid("guid"));

Powered by Google App Engine
This is Rietveld 408576698