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

Side by Side Diff: chrome/browser/search_engines/template_url_service_sync_unittest.cc

Issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile Created 8 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 | Annotate | Revision Log
OLDNEW
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/string_util.h" 6 #include "base/string_util.h"
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/search_engines/template_url.h" 9 #include "chrome/browser/search_engines/template_url.h"
10 #include "chrome/browser/search_engines/template_url_service.h" 10 #include "chrome/browser/search_engines/template_url_service.h"
11 #include "chrome/browser/search_engines/template_url_service_factory.h" 11 #include "chrome/browser/search_engines/template_url_service_factory.h"
12 #include "chrome/browser/search_engines/template_url_service_test_util.h" 12 #include "chrome/browser/search_engines/template_url_service_test_util.h"
13 #include "chrome/browser/webdata/web_data_service_factory.h"
13 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "chrome/test/base/testing_pref_service.h" 16 #include "chrome/test/base/testing_pref_service.h"
16 #include "chrome/test/base/testing_profile.h" 17 #include "chrome/test/base/testing_profile.h"
17 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
18 #include "sync/protocol/search_engine_specifics.pb.h" 19 #include "sync/protocol/search_engine_specifics.pb.h"
19 #include "sync/protocol/sync.pb.h" 20 #include "sync/protocol/sync.pb.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 using base::Time; 23 using base::Time;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // Our dummy ChangeProcessor used to inspect changes pushed to Sync. 221 // Our dummy ChangeProcessor used to inspect changes pushed to Sync.
221 scoped_ptr<TestChangeProcessor> sync_processor_; 222 scoped_ptr<TestChangeProcessor> sync_processor_;
222 scoped_ptr<SyncChangeProcessorDelegate> sync_processor_delegate_; 223 scoped_ptr<SyncChangeProcessorDelegate> sync_processor_delegate_;
223 224
224 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceSyncTest); 225 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceSyncTest);
225 }; 226 };
226 227
227 TemplateURLServiceSyncTest::TemplateURLServiceSyncTest() 228 TemplateURLServiceSyncTest::TemplateURLServiceSyncTest()
228 : sync_processor_(new TestChangeProcessor), 229 : sync_processor_(new TestChangeProcessor),
229 sync_processor_delegate_(new SyncChangeProcessorDelegate( 230 sync_processor_delegate_(new SyncChangeProcessorDelegate(
230 sync_processor_.get())) { 231 sync_processor_.get())) {}
231 }
232 232
233 void TemplateURLServiceSyncTest::SetUp() { 233 void TemplateURLServiceSyncTest::SetUp() {
234 test_util_a_.SetUp(); 234 test_util_a_.SetUp();
235 // Use ChangeToLoadState() instead of VerifyLoad() so we don't actually pull 235 // Use ChangeToLoadState() instead of VerifyLoad() so we don't actually pull
236 // in the prepopulate data, which the sync tests don't care about (and would 236 // in the prepopulate data, which the sync tests don't care about (and would
237 // just foul them up). 237 // just foul them up).
238 test_util_a_.ChangeModelToLoadState(); 238 test_util_a_.ChangeModelToLoadState();
239 profile_b_.reset(new TestingProfile); 239 profile_b_.reset(new TestingProfile);
240 WebDataServiceFactory::GetInstance()->SetTestingFactory(profile_b_.get(),
241 NULL);
240 TemplateURLServiceFactory::GetInstance()->RegisterUserPrefsOnProfile( 242 TemplateURLServiceFactory::GetInstance()->RegisterUserPrefsOnProfile(
241 profile_b_.get()); 243 profile_b_.get());
242 model_b_.reset(new TemplateURLService(profile_b_.get())); 244 model_b_.reset(new TemplateURLService(profile_b_.get()));
243 model_b_->Load(); 245 model_b_->Load();
244 } 246 }
245 247
246 void TemplateURLServiceSyncTest::TearDown() { 248 void TemplateURLServiceSyncTest::TearDown() {
247 test_util_a_.TearDown(); 249 test_util_a_.TearDown();
248 } 250 }
249 251
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 // deletion. 1317 // deletion.
1316 EXPECT_EQ(0U, model()->GetTemplateURLs().size()); 1318 EXPECT_EQ(0U, model()->GetTemplateURLs().size());
1317 EXPECT_EQ(2U, processor()->change_list_size()); 1319 EXPECT_EQ(2U, processor()->change_list_size());
1318 ASSERT_TRUE(processor()->contains_guid("key1")); 1320 ASSERT_TRUE(processor()->contains_guid("key1"));
1319 EXPECT_EQ(SyncChange::ACTION_DELETE, 1321 EXPECT_EQ(SyncChange::ACTION_DELETE,
1320 processor()->change_for_guid("key1").change_type()); 1322 processor()->change_for_guid("key1").change_type());
1321 ASSERT_TRUE(processor()->contains_guid(std::string())); 1323 ASSERT_TRUE(processor()->contains_guid(std::string()));
1322 EXPECT_EQ(SyncChange::ACTION_DELETE, 1324 EXPECT_EQ(SyncChange::ACTION_DELETE,
1323 processor()->change_for_guid(std::string()).change_type()); 1325 processor()->change_for_guid(std::string()).change_type());
1324 } 1326 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698