OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceSyncTest); | 222 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceSyncTest); |
223 }; | 223 }; |
224 | 224 |
225 TemplateURLServiceSyncTest::TemplateURLServiceSyncTest() | 225 TemplateURLServiceSyncTest::TemplateURLServiceSyncTest() |
226 : sync_processor_(new TestChangeProcessor), | 226 : sync_processor_(new TestChangeProcessor), |
227 sync_processor_wrapper_(new syncer::SyncChangeProcessorWrapperForTest( | 227 sync_processor_wrapper_(new syncer::SyncChangeProcessorWrapperForTest( |
228 sync_processor_.get())) {} | 228 sync_processor_.get())) {} |
229 | 229 |
230 void TemplateURLServiceSyncTest::SetUp() { | 230 void TemplateURLServiceSyncTest::SetUp() { |
231 TemplateURLService::set_fallback_search_engines_disabled(true); | 231 DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting(true); |
232 test_util_a_.SetUp(); | 232 test_util_a_.SetUp(); |
233 // Use ChangeToLoadState() instead of VerifyLoad() so we don't actually pull | 233 // Use ChangeToLoadState() instead of VerifyLoad() so we don't actually pull |
234 // in the prepopulate data, which the sync tests don't care about (and would | 234 // in the prepopulate data, which the sync tests don't care about (and would |
235 // just foul them up). | 235 // just foul them up). |
236 test_util_a_.ChangeModelToLoadState(); | 236 test_util_a_.ChangeModelToLoadState(); |
237 profile_b_.reset(new TestingProfile); | 237 profile_b_.reset(new TestingProfile); |
238 TemplateURLServiceFactory::GetInstance()-> | 238 TemplateURLServiceFactory::GetInstance()-> |
239 RegisterUserPrefsOnBrowserContextForTest(profile_b_.get()); | 239 RegisterUserPrefsOnBrowserContextForTest(profile_b_.get()); |
240 model_b_.reset(new TemplateURLService(profile_b_.get())); | 240 model_b_.reset(new TemplateURLService(profile_b_.get())); |
241 model_b_->Load(); | 241 model_b_->Load(); |
242 } | 242 } |
243 | 243 |
244 void TemplateURLServiceSyncTest::TearDown() { | 244 void TemplateURLServiceSyncTest::TearDown() { |
245 test_util_a_.TearDown(); | 245 test_util_a_.TearDown(); |
246 TemplateURLService::set_fallback_search_engines_disabled(false); | 246 DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting(false); |
247 } | 247 } |
248 | 248 |
249 scoped_ptr<syncer::SyncChangeProcessor> | 249 scoped_ptr<syncer::SyncChangeProcessor> |
250 TemplateURLServiceSyncTest::PassProcessor() { | 250 TemplateURLServiceSyncTest::PassProcessor() { |
251 return sync_processor_wrapper_.PassAs<syncer::SyncChangeProcessor>(); | 251 return sync_processor_wrapper_.PassAs<syncer::SyncChangeProcessor>(); |
252 } | 252 } |
253 | 253 |
254 scoped_ptr<syncer::SyncErrorFactory> TemplateURLServiceSyncTest:: | 254 scoped_ptr<syncer::SyncErrorFactory> TemplateURLServiceSyncTest:: |
255 CreateAndPassSyncErrorFactory() { | 255 CreateAndPassSyncErrorFactory() { |
256 return scoped_ptr<syncer::SyncErrorFactory>( | 256 return scoped_ptr<syncer::SyncErrorFactory>( |
(...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 const char kNewGUID[] = "newdefault"; | 2229 const char kNewGUID[] = "newdefault"; |
2230 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("what"), | 2230 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("what"), |
2231 "http://thewhat.com/{searchTerms}", | 2231 "http://thewhat.com/{searchTerms}", |
2232 kNewGUID)); | 2232 kNewGUID)); |
2233 model()->SetUserSelectedDefaultSearchProvider( | 2233 model()->SetUserSelectedDefaultSearchProvider( |
2234 model()->GetTemplateURLForGUID(kNewGUID)); | 2234 model()->GetTemplateURLForGUID(kNewGUID)); |
2235 | 2235 |
2236 EXPECT_EQ(kNewGUID, profile_a()->GetTestingPrefService()->GetString( | 2236 EXPECT_EQ(kNewGUID, profile_a()->GetTestingPrefService()->GetString( |
2237 prefs::kSyncedDefaultSearchProviderGUID)); | 2237 prefs::kSyncedDefaultSearchProviderGUID)); |
2238 } | 2238 } |
OLD | NEW |