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

Unified Diff: chrome/browser/sync/profile_sync_service_startup_unittest.cc

Issue 9232011: sync: Make ProfileSyncService a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 11 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/sync/profile_sync_service_startup_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc
index 118527ddb2bb92b6881c3b1c344de9c3407a2667..784cf3055745b72d3a3fd9707f725b46396ac832 100644
--- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,27 +69,31 @@ class ProfileSyncServiceStartupTest : public testing::Test {
protected:
// Overridden below by ProfileSyncServiceStartupCrosTest.
virtual void CreateSyncService() {
- service_.reset(new TestProfileSyncService(&factory_,
- profile_.get(),
- new FakeSigninManager(),
- ProfileSyncService::MANUAL_START,
- true,
- base::Closure()));
+ service_.reset(new TestProfileSyncService(
+ new ProfileSyncComponentsFactoryMock(),
+ profile_.get(),
+ new FakeSigninManager(),
+ ProfileSyncService::MANUAL_START,
+ true,
+ base::Closure()));
}
DataTypeManagerMock* SetUpDataTypeManager() {
DataTypeManagerMock* data_type_manager = new DataTypeManagerMock();
- EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).
+ EXPECT_CALL(*factory_mock(), CreateDataTypeManager(_, _)).
WillOnce(Return(data_type_manager));
return data_type_manager;
}
+ ProfileSyncComponentsFactoryMock* factory_mock() {
+ return static_cast<ProfileSyncComponentsFactoryMock*>(service_->factory());
+ }
+
MessageLoop ui_loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
content::TestBrowserThread io_thread_;
scoped_ptr<TestingProfile> profile_;
- ProfileSyncComponentsFactoryMock factory_;
scoped_ptr<TestProfileSyncService> service_;
ProfileSyncServiceObserverMock observer_;
};
@@ -99,12 +103,13 @@ class ProfileSyncServiceStartupCrosTest : public ProfileSyncServiceStartupTest {
virtual void CreateSyncService() {
SigninManager* signin = new SigninManager();
signin->SetAuthenticatedUsername("test_user");
- service_.reset(new TestProfileSyncService(&factory_,
- profile_.get(),
- signin,
- ProfileSyncService::AUTO_START,
- true,
- base::Closure()));
+ service_.reset(new TestProfileSyncService(
+ new ProfileSyncComponentsFactoryMock(),
+ profile_.get(),
+ signin,
+ ProfileSyncService::AUTO_START,
+ true,
+ base::Closure()));
}
};
@@ -181,7 +186,7 @@ TEST_F(ProfileSyncServiceStartupTest, ManagedStartup) {
// Disable sync through policy.
profile_->GetPrefs()->SetBoolean(prefs::kSyncManaged, true);
- EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).Times(0);
+ EXPECT_CALL(*factory_mock(), CreateDataTypeManager(_, _)).Times(0);
EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
// Service should not be started by Initialize() since it's managed.
@@ -212,7 +217,7 @@ TEST_F(ProfileSyncServiceStartupTest, SwitchManaged) {
// When switching back to unmanaged, the state should change, but the service
// should not start up automatically (kSyncSetupCompleted will be false).
Mock::VerifyAndClearExpectations(data_type_manager);
- EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).Times(0);
+ EXPECT_CALL(*factory_mock(), CreateDataTypeManager(_, _)).Times(0);
EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
profile_->GetPrefs()->ClearPref(prefs::kSyncManaged);
}

Powered by Google App Engine
This is Rietveld 408576698