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

Unified Diff: components/browser_sync/profile_sync_service_startup_unittest.cc

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Use parameter Created 3 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: components/browser_sync/profile_sync_service_startup_unittest.cc
diff --git a/components/browser_sync/profile_sync_service_startup_unittest.cc b/components/browser_sync/profile_sync_service_startup_unittest.cc
index dae10f171f10febab39c461f91a3ae4c5158bad7..1a0476aab5564479dc6e4808ae62f0a0197b48a3 100644
--- a/components/browser_sync/profile_sync_service_startup_unittest.cc
+++ b/components/browser_sync/profile_sync_service_startup_unittest.cc
@@ -50,7 +50,7 @@ class SyncServiceObserverMock : public syncer::SyncServiceObserver {
SyncServiceObserverMock();
virtual ~SyncServiceObserverMock();
- MOCK_METHOD0(OnStateChanged, void());
+ MOCK_METHOD1(OnStateChanged, void(syncer::SyncService*));
};
SyncServiceObserverMock::SyncServiceObserverMock() {}
@@ -175,7 +175,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) {
// Should not actually start, rather just clean things up and wait
// to be enabled.
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
sync_service_->Initialize();
// Preferences should be back to defaults.
@@ -190,7 +190,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) {
.WillOnce(Return(DataTypeManager::CONFIGURED))
.WillOnce(Return(DataTypeManager::CONFIGURED));
EXPECT_CALL(*data_type_manager, Stop()).Times(1);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
auto sync_blocker = sync_service_->GetSetupInProgressHandle();
@@ -215,7 +215,7 @@ TEST_F(ProfileSyncServiceStartupTest, DISABLED_StartNoCredentials) {
// to be enabled.
EXPECT_CALL(*component_factory_, CreateDataTypeManager(_, _, _, _, _, _))
.Times(0);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
sync_service_->Initialize();
// Preferences should be back to defaults.
@@ -252,7 +252,7 @@ TEST_F(ProfileSyncServiceStartupTest, DISABLED_StartInvalidCredentials) {
DataTypeManagerMock* data_type_manager = SetUpDataTypeManager();
EXPECT_CALL(*data_type_manager, Configure(_, _)).Times(0);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
sync_service_->Initialize();
EXPECT_FALSE(sync_service_->IsSyncActive());
Mock::VerifyAndClearExpectations(data_type_manager);
@@ -262,7 +262,7 @@ TEST_F(ProfileSyncServiceStartupTest, DISABLED_StartInvalidCredentials) {
EXPECT_CALL(*data_type_manager, state())
.WillRepeatedly(Return(DataTypeManager::CONFIGURED));
EXPECT_CALL(*data_type_manager, Stop()).Times(1);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
auto sync_blocker = sync_service_->GetSetupInProgressHandle();
// Simulate successful signin.
@@ -279,7 +279,7 @@ TEST_F(ProfileSyncServiceStartupCrosTest, StartCrosNoCredentials) {
.Times(0);
EXPECT_CALL(*component_factory_, CreateSyncEngine(_, _, _, _)).Times(0);
pref_service()->ClearPref(syncer::prefs::kSyncFirstSetupComplete);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
sync_service_->Initialize();
// Sync should not start because there are no tokens yet.
@@ -298,7 +298,7 @@ TEST_F(ProfileSyncServiceStartupCrosTest, StartFirstTime) {
EXPECT_CALL(*data_type_manager, state())
.WillRepeatedly(Return(DataTypeManager::CONFIGURED));
EXPECT_CALL(*data_type_manager, Stop());
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
IssueTestTokens(
profile_sync_service_bundle_.account_tracker()->PickAccountIdForAccount(
@@ -318,7 +318,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartNormal) {
EXPECT_CALL(*data_type_manager, state())
.WillRepeatedly(Return(DataTypeManager::CONFIGURED));
EXPECT_CALL(*data_type_manager, Stop()).Times(1);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
IssueTestTokens(account_id);
@@ -348,7 +348,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartRecoverDatatypePrefs) {
EXPECT_CALL(*data_type_manager, state())
.WillRepeatedly(Return(DataTypeManager::CONFIGURED));
EXPECT_CALL(*data_type_manager, Stop()).Times(1);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
IssueTestTokens(account_id);
sync_service_->Initialize();
@@ -374,7 +374,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartDontRecoverDatatypePrefs) {
EXPECT_CALL(*data_type_manager, state())
.WillRepeatedly(Return(DataTypeManager::CONFIGURED));
EXPECT_CALL(*data_type_manager, Stop()).Times(1);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
IssueTestTokens(account_id);
sync_service_->Initialize();
@@ -391,7 +391,7 @@ TEST_F(ProfileSyncServiceStartupTest, ManagedStartup) {
pref_service()->SetBoolean(syncer::prefs::kSyncManaged, true);
EXPECT_CALL(*component_factory_, CreateDataTypeManager(_, _, _, _, _, _))
.Times(0);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
sync_service_->Initialize();
}
@@ -405,7 +405,7 @@ TEST_F(ProfileSyncServiceStartupTest, SwitchManaged) {
EXPECT_CALL(*data_type_manager, Configure(_, _));
EXPECT_CALL(*data_type_manager, state())
.WillRepeatedly(Return(DataTypeManager::CONFIGURED));
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
IssueTestTokens(account_id);
sync_service_->Initialize();
EXPECT_TRUE(sync_service_->IsEngineInitialized());
@@ -449,7 +449,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartFailure) {
result)));
EXPECT_CALL(*data_type_manager, state())
.WillOnce(Return(DataTypeManager::STOPPED));
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
IssueTestTokens(account_id);
sync_service_->Initialize();
EXPECT_TRUE(sync_service_->HasUnrecoverableError());
@@ -464,7 +464,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartDownloadFailed) {
pref_service()->ClearPref(syncer::prefs::kSyncFirstSetupComplete);
- EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
+ EXPECT_CALL(observer_, OnStateChanged(_)).Times(AnyNumber());
sync_service_->Initialize();
auto sync_blocker = sync_service_->GetSetupInProgressHandle();

Powered by Google App Engine
This is Rietveld 408576698