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
3 // found in the LICENSE file.
5 #include "base/files/file_util.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/prefs/pref_service_syncable.h"
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
11 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
12 #include "chrome/browser/signin/fake_signin_manager.h"
13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
14 #include "chrome/browser/signin/signin_manager_factory.h"
15 #include "chrome/browser/sync/glue/sync_backend_host_mock.h"
16 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
17 #include "chrome/browser/sync/profile_sync_service_factory.h"
18 #include "chrome/browser/sync/profile_sync_test_util.h"
19 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h"
20 #include "chrome/common/pref_names.h"
21 #include "chrome/test/base/testing_browser_process.h"
22 #include "chrome/test/base/testing_profile.h"
23 #include "chrome/test/base/testing_profile_manager.h"
24 #include "components/signin/core/browser/profile_oauth2_token_service.h"
25 #include "components/signin/core/browser/signin_manager.h"
26 #include "components/sync_driver/data_type_manager.h"
27 #include "components/sync_driver/data_type_manager_mock.h"
28 #include "components/sync_driver/pref_names.h"
29 #include "components/sync_driver/sync_prefs.h"
30 #include "content/public/test/test_browser_thread_bundle.h"
31 #include "content/public/test/test_utils.h"
32 #include "google_apis/gaia/gaia_auth_consumer.h"
33 #include "google_apis/gaia/gaia_constants.h"
34 #include "google_apis/gaia/oauth2_token_service.h"
35 #include "testing/gmock/include/gmock/gmock.h"
36 #include "testing/gtest/include/gtest/gtest.h"
38 using browser_sync::SyncBackendHostMock
;
39 using content::BrowserThread
;
40 using sync_driver::DataTypeManager
;
41 using sync_driver::DataTypeManagerMock
;
43 using testing::AnyNumber
;
45 using testing::InvokeArgument
;
47 using testing::Return
;
48 using testing::SaveArg
;
50 ACTION_P(InvokeOnConfigureStart
, pss
) {
51 ProfileSyncService
* service
=
52 static_cast<ProfileSyncService
*>(pss
);
53 service
->OnConfigureStart();
56 ACTION_P3(InvokeOnConfigureDone
, pss
, error_callback
, result
) {
57 ProfileSyncService
* service
=
58 static_cast<ProfileSyncService
*>(pss
);
59 DataTypeManager::ConfigureResult configure_result
=
60 static_cast<DataTypeManager::ConfigureResult
>(result
);
61 if (result
.status
== sync_driver::DataTypeManager::ABORTED
)
62 error_callback
.Run(&configure_result
);
63 service
->OnConfigureDone(configure_result
);
66 class TestProfileSyncServiceNoBackup
: public ProfileSyncService
{
68 TestProfileSyncServiceNoBackup(
69 scoped_ptr
<ProfileSyncComponentsFactory
> factory
,
71 scoped_ptr
<SupervisedUserSigninManagerWrapper
> signin_wrapper
,
72 ProfileOAuth2TokenService
* oauth2_token_service
,
73 browser_sync::ProfileSyncServiceStartBehavior start_behavior
)
74 : ProfileSyncService(factory
.Pass(), profile
, signin_wrapper
.Pass(),
75 oauth2_token_service
, start_behavior
) {}
78 bool NeedBackup() const override
{ return false; }
81 class ProfileSyncServiceStartupTest
: public testing::Test
{
83 ProfileSyncServiceStartupTest()
84 : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD
|
85 content::TestBrowserThreadBundle::REAL_FILE_THREAD
|
86 content::TestBrowserThreadBundle::REAL_IO_THREAD
),
87 profile_manager_(TestingBrowserProcess::GetGlobal()),
90 ~ProfileSyncServiceStartupTest() override
{}
92 void SetUp() override
{
93 CHECK(profile_manager_
.SetUp());
95 TestingProfile::TestingFactories testing_facotries
;
96 testing_facotries
.push_back(
97 std::make_pair(SigninManagerFactory::GetInstance(),
98 FakeSigninManagerBase::Build
));
99 testing_facotries
.push_back(
100 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(),
101 BuildAutoIssuingFakeProfileOAuth2TokenService
));
102 testing_facotries
.push_back(
103 std::make_pair(ProfileSyncServiceFactory::GetInstance(),
106 profile_
= profile_manager_
.CreateTestingProfile(
107 "sync-startup-test", scoped_ptr
<PrefServiceSyncable
>(),
108 base::UTF8ToUTF16("sync-startup-test"), 0, std::string(),
112 void TearDown() override
{ sync_
->RemoveObserver(&observer_
); }
114 static KeyedService
* BuildService(content::BrowserContext
* browser_context
) {
115 Profile
* profile
= static_cast<Profile
*>(browser_context
);
116 return new TestProfileSyncServiceNoBackup(
117 scoped_ptr
<ProfileSyncComponentsFactory
>(
118 new ProfileSyncComponentsFactoryMock()),
120 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(
121 profile
, SigninManagerFactory::GetForProfile(profile
))),
122 ProfileOAuth2TokenServiceFactory::GetForProfile(profile
),
123 browser_sync::MANUAL_START
);
126 void CreateSyncService() {
127 sync_
= static_cast<ProfileSyncService
*>(
128 ProfileSyncServiceFactory::GetForProfile(profile_
));
129 sync_
->AddObserver(&observer_
);
132 void IssueTestTokens() {
133 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_
)
134 ->UpdateCredentials("test_user@gmail.com", "oauth2_login_token");
137 ProfileSyncComponentsFactoryMock
* components_factory_mock() {
138 return static_cast<ProfileSyncComponentsFactoryMock
*>(sync_
->factory());
141 FakeSigninManagerForTesting
* fake_signin() {
142 return static_cast<FakeSigninManagerForTesting
*>(sync_
->signin());
145 void SetError(DataTypeManager::ConfigureResult
* result
) {
146 sync_driver::DataTypeStatusTable::TypeErrorMap errors
;
147 errors
[syncer::BOOKMARKS
] =
148 syncer::SyncError(FROM_HERE
,
149 syncer::SyncError::UNRECOVERABLE_ERROR
,
152 result
->data_type_status_table
.UpdateFailedDataTypes(errors
);
156 void SimulateTestUserSignin() {
157 #if !defined(OS_CHROMEOS)
158 fake_signin()->SignIn("test_user@gmail.com", "");
160 fake_signin()->SetAuthenticatedUsername("test_user@gmail.com");
161 sync_
->GoogleSigninSucceeded("test_user@gmail.com",
162 "test_user@gmail.com",
167 DataTypeManagerMock
* SetUpDataTypeManager() {
168 DataTypeManagerMock
* data_type_manager
= new DataTypeManagerMock();
169 EXPECT_CALL(*components_factory_mock(),
170 CreateDataTypeManager(_
, _
, _
, _
, _
)).
171 WillOnce(Return(data_type_manager
));
172 return data_type_manager
;
175 browser_sync::SyncBackendHostMock
* SetUpSyncBackendHost() {
176 browser_sync::SyncBackendHostMock
* sync_backend_host
=
177 new browser_sync::SyncBackendHostMock();
178 EXPECT_CALL(*components_factory_mock(),
179 CreateSyncBackendHost(_
, _
, _
, _
, _
)).
180 WillOnce(Return(sync_backend_host
));
181 return sync_backend_host
;
184 content::TestBrowserThreadBundle thread_bundle_
;
185 TestingProfileManager profile_manager_
;
186 TestingProfile
* profile_
;
187 ProfileSyncService
* sync_
;
188 ProfileSyncServiceObserverMock observer_
;
189 sync_driver::DataTypeStatusTable data_type_status_table_
;
192 class ProfileSyncServiceStartupCrosTest
: public ProfileSyncServiceStartupTest
{
194 void SetUp() override
{
195 ProfileSyncServiceStartupTest::SetUp();
196 sync_
= static_cast<ProfileSyncService
*>(
197 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
198 profile_
, BuildCrosService
));
199 sync_
->AddObserver(&observer_
);
202 static KeyedService
* BuildCrosService(content::BrowserContext
* context
) {
203 Profile
* profile
= static_cast<Profile
*>(context
);
204 SigninManagerBase
* signin
=
205 SigninManagerFactory::GetForProfile(profile
);
206 signin
->SetAuthenticatedUsername("test_user@gmail.com");
207 ProfileOAuth2TokenService
* oauth2_token_service
=
208 ProfileOAuth2TokenServiceFactory::GetForProfile(profile
);
209 EXPECT_TRUE(signin
->IsAuthenticated());
210 return new TestProfileSyncServiceNoBackup(
211 scoped_ptr
<ProfileSyncComponentsFactory
>(
212 new ProfileSyncComponentsFactoryMock()),
214 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(profile
,
216 oauth2_token_service
,
217 browser_sync::AUTO_START
);
221 TEST_F(ProfileSyncServiceStartupTest
, StartFirstTime
) {
222 // We've never completed startup.
223 profile_
->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted
);
225 SetUpSyncBackendHost();
226 DataTypeManagerMock
* data_type_manager
= SetUpDataTypeManager();
227 EXPECT_CALL(*data_type_manager
, Configure(_
, _
)).Times(0);
229 // Should not actually start, rather just clean things up and wait
231 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
234 // Preferences should be back to defaults.
237 profile_
->GetPrefs()->GetInt64(sync_driver::prefs::kSyncLastSyncedTime
));
238 EXPECT_FALSE(profile_
->GetPrefs()->GetBoolean(
239 sync_driver::prefs::kSyncHasSetupCompleted
));
240 Mock::VerifyAndClearExpectations(data_type_manager
);
242 // Then start things up.
243 EXPECT_CALL(*data_type_manager
, Configure(_
, _
)).Times(1);
244 EXPECT_CALL(*data_type_manager
, state()).
245 WillOnce(Return(DataTypeManager::CONFIGURED
)).
246 WillOnce(Return(DataTypeManager::CONFIGURED
));
247 EXPECT_CALL(*data_type_manager
, Stop()).Times(1);
248 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
250 sync_
->SetSetupInProgress(true);
252 // Simulate successful signin as test_user.
253 SimulateTestUserSignin();
254 // Create some tokens in the token service.
257 // Simulate the UI telling sync it has finished setting up.
258 sync_
->SetSetupInProgress(false);
259 EXPECT_TRUE(sync_
->SyncActive());
262 // TODO(pavely): Reenable test once android is switched to oauth2.
263 TEST_F(ProfileSyncServiceStartupTest
, DISABLED_StartNoCredentials
) {
264 // We've never completed startup.
265 profile_
->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted
);
268 // Should not actually start, rather just clean things up and wait
270 EXPECT_CALL(*components_factory_mock(),
271 CreateDataTypeManager(_
, _
, _
, _
, _
)).Times(0);
272 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
275 // Preferences should be back to defaults.
278 profile_
->GetPrefs()->GetInt64(sync_driver::prefs::kSyncLastSyncedTime
));
279 EXPECT_FALSE(profile_
->GetPrefs()->GetBoolean(
280 sync_driver::prefs::kSyncHasSetupCompleted
));
282 // Then start things up.
283 sync_
->SetSetupInProgress(true);
285 // Simulate successful signin as test_user.
286 SimulateTestUserSignin();
288 ProfileOAuth2TokenService
* token_service
=
289 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_
);
290 token_service
->LoadCredentials("test_user@gmail.com");
292 sync_
->SetSetupInProgress(false);
293 // ProfileSyncService should try to start by requesting access token.
294 // This request should fail as login token was not issued.
295 EXPECT_FALSE(sync_
->SyncActive());
296 EXPECT_EQ(GoogleServiceAuthError::USER_NOT_SIGNED_UP
,
297 sync_
->GetAuthError().state());
300 // TODO(pavely): Reenable test once android is switched to oauth2.
301 TEST_F(ProfileSyncServiceStartupTest
, DISABLED_StartInvalidCredentials
) {
302 sync_
->signin()->SetAuthenticatedUsername("test_user@gmail.com");
304 SyncBackendHostMock
* mock_sbh
= SetUpSyncBackendHost();
306 // Tell the backend to stall while downloading control types (simulating an
308 mock_sbh
->set_fail_initial_download(true);
310 DataTypeManagerMock
* data_type_manager
= SetUpDataTypeManager();
311 EXPECT_CALL(*data_type_manager
, Configure(_
, _
)).Times(0);
313 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
315 EXPECT_FALSE(sync_
->SyncActive());
316 Mock::VerifyAndClearExpectations(data_type_manager
);
318 // Update the credentials, unstalling the backend.
319 EXPECT_CALL(*data_type_manager
, Configure(_
, _
));
320 EXPECT_CALL(*data_type_manager
, state()).
321 WillRepeatedly(Return(DataTypeManager::CONFIGURED
));
322 EXPECT_CALL(*data_type_manager
, Stop()).Times(1);
323 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
324 sync_
->SetSetupInProgress(true);
326 // Simulate successful signin.
327 SimulateTestUserSignin();
329 sync_
->SetSetupInProgress(false);
331 // Verify we successfully finish startup and configuration.
332 EXPECT_TRUE(sync_
->SyncActive());
336 // http://crbug.com/396402
337 #define MAYBE_StartCrosNoCredentials DISABLED_StartCrosNoCredentials
339 #define MAYBE_StartCrosNoCredentials StartCrosNoCredentials
341 TEST_F(ProfileSyncServiceStartupCrosTest
, MAYBE_StartCrosNoCredentials
) {
342 EXPECT_CALL(*components_factory_mock(),
343 CreateDataTypeManager(_
, _
, _
, _
, _
)).Times(0);
344 EXPECT_CALL(*components_factory_mock(),
345 CreateSyncBackendHost(_
, _
, _
, _
, _
)).Times(0);
346 profile_
->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted
);
347 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
350 // Sync should not start because there are no tokens yet.
351 EXPECT_FALSE(sync_
->SyncActive());
352 sync_
->SetSetupInProgress(false);
354 // Sync should not start because there are still no tokens.
355 EXPECT_FALSE(sync_
->SyncActive());
358 TEST_F(ProfileSyncServiceStartupCrosTest
, StartFirstTime
) {
359 SetUpSyncBackendHost();
360 DataTypeManagerMock
* data_type_manager
= SetUpDataTypeManager();
361 profile_
->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted
);
362 EXPECT_CALL(*data_type_manager
, Configure(_
, _
));
363 EXPECT_CALL(*data_type_manager
, state()).
364 WillRepeatedly(Return(DataTypeManager::CONFIGURED
));
365 EXPECT_CALL(*data_type_manager
, Stop()).Times(1);
366 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
370 EXPECT_TRUE(sync_
->SyncActive());
374 // http://crbug.com/396402
375 #define MAYBE_StartNormal DISABLED_StartNormal
377 #define MAYBE_StartNormal StartNormal
379 TEST_F(ProfileSyncServiceStartupTest
, MAYBE_StartNormal
) {
380 // Pre load the tokens
381 SigninManagerFactory::GetForProfile(profile_
)
382 ->SetAuthenticatedUsername("test_user@gmail.com");
384 sync_
->SetSyncSetupCompleted();
385 SetUpSyncBackendHost();
386 DataTypeManagerMock
* data_type_manager
= SetUpDataTypeManager();
387 EXPECT_CALL(*data_type_manager
, Configure(_
, _
));
388 EXPECT_CALL(*data_type_manager
, state()).
389 WillRepeatedly(Return(DataTypeManager::CONFIGURED
));
390 EXPECT_CALL(*data_type_manager
, Stop()).Times(1);
391 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
398 // Test that we can recover from a case where a bug in the code resulted in
399 // OnUserChoseDatatypes not being properly called and datatype preferences
400 // therefore being left unset.
401 TEST_F(ProfileSyncServiceStartupTest
, StartRecoverDatatypePrefs
) {
402 // Clear the datatype preference fields (simulating bug 154940).
403 profile_
->GetPrefs()->ClearPref(
404 sync_driver::prefs::kSyncKeepEverythingSynced
);
405 syncer::ModelTypeSet user_types
= syncer::UserTypes();
406 for (syncer::ModelTypeSet::Iterator iter
= user_types
.First();
407 iter
.Good(); iter
.Inc()) {
408 profile_
->GetPrefs()->ClearPref(
409 sync_driver::SyncPrefs::GetPrefNameForDataType(iter
.Get()));
412 // Pre load the tokens
413 SigninManagerFactory::GetForProfile(profile_
)
414 ->SetAuthenticatedUsername("test_user@gmail.com");
416 sync_
->SetSyncSetupCompleted();
417 SetUpSyncBackendHost();
418 DataTypeManagerMock
* data_type_manager
= SetUpDataTypeManager();
419 EXPECT_CALL(*data_type_manager
, Configure(_
, _
));
420 EXPECT_CALL(*data_type_manager
, state()).
421 WillRepeatedly(Return(DataTypeManager::CONFIGURED
));
422 EXPECT_CALL(*data_type_manager
, Stop()).Times(1);
423 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
428 EXPECT_TRUE(profile_
->GetPrefs()->GetBoolean(
429 sync_driver::prefs::kSyncKeepEverythingSynced
));
432 // Verify that the recovery of datatype preferences doesn't overwrite a valid
433 // case where only bookmarks are enabled.
435 // http://crbug.com/396402
436 #define MAYBE_StartDontRecoverDatatypePrefs DISABLED_StartDontRecoverDatatypePrefs
438 #define MAYBE_StartDontRecoverDatatypePrefs StartDontRecoverDatatypePrefs
440 TEST_F(ProfileSyncServiceStartupTest
, MAYBE_StartDontRecoverDatatypePrefs
) {
441 // Explicitly set Keep Everything Synced to false and have only bookmarks
443 profile_
->GetPrefs()->SetBoolean(
444 sync_driver::prefs::kSyncKeepEverythingSynced
, false);
446 // Pre load the tokens
447 SigninManagerFactory::GetForProfile(profile_
)
448 ->SetAuthenticatedUsername("test_user@gmail.com");
450 sync_
->SetSyncSetupCompleted();
451 SetUpSyncBackendHost();
452 DataTypeManagerMock
* data_type_manager
= SetUpDataTypeManager();
453 EXPECT_CALL(*data_type_manager
, Configure(_
, _
));
454 EXPECT_CALL(*data_type_manager
, state()).
455 WillRepeatedly(Return(DataTypeManager::CONFIGURED
));
456 EXPECT_CALL(*data_type_manager
, Stop()).Times(1);
457 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
461 EXPECT_FALSE(profile_
->GetPrefs()->GetBoolean(
462 sync_driver::prefs::kSyncKeepEverythingSynced
));
466 // http://crbug.com/396402
467 #define MAYBE_ManagedStartup DISABLED_ManagedStartup
469 #define MAYBE_ManagedStartup ManagedStartup
471 TEST_F(ProfileSyncServiceStartupTest
, MAYBE_ManagedStartup
) {
472 // Service should not be started by Initialize() since it's managed.
473 profile_
->GetPrefs()->SetString(prefs::kGoogleServicesUsername
,
474 "test_user@gmail.com");
477 // Disable sync through policy.
478 profile_
->GetPrefs()->SetBoolean(sync_driver::prefs::kSyncManaged
, true);
479 EXPECT_CALL(*components_factory_mock(),
480 CreateDataTypeManager(_
, _
, _
, _
, _
)).Times(0);
481 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
486 TEST_F(ProfileSyncServiceStartupTest
, SwitchManaged
) {
487 SigninManagerFactory::GetForProfile(profile_
)
488 ->SetAuthenticatedUsername("test_user@gmail.com");
490 sync_
->SetSyncSetupCompleted();
491 SetUpSyncBackendHost();
492 DataTypeManagerMock
* data_type_manager
= SetUpDataTypeManager();
493 EXPECT_CALL(*data_type_manager
, Configure(_
, _
));
494 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
498 // The service should stop when switching to managed mode.
499 Mock::VerifyAndClearExpectations(data_type_manager
);
500 EXPECT_CALL(*data_type_manager
, state()).
501 WillOnce(Return(DataTypeManager::CONFIGURED
));
502 EXPECT_CALL(*data_type_manager
, Stop()).Times(1);
503 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
504 profile_
->GetPrefs()->SetBoolean(sync_driver::prefs::kSyncManaged
, true);
506 // When switching back to unmanaged, the state should change, but the service
507 // should not start up automatically (kSyncSetupCompleted will be false).
508 Mock::VerifyAndClearExpectations(data_type_manager
);
509 EXPECT_CALL(*components_factory_mock(),
510 CreateDataTypeManager(_
, _
, _
, _
, _
)).Times(0);
511 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
512 profile_
->GetPrefs()->ClearPref(sync_driver::prefs::kSyncManaged
);
515 TEST_F(ProfileSyncServiceStartupTest
, StartFailure
) {
516 SigninManagerFactory::GetForProfile(profile_
)
517 ->SetAuthenticatedUsername("test_user@gmail.com");
519 sync_
->SetSyncSetupCompleted();
520 SetUpSyncBackendHost();
521 DataTypeManagerMock
* data_type_manager
= SetUpDataTypeManager();
522 DataTypeManager::ConfigureStatus status
= DataTypeManager::ABORTED
;
523 DataTypeManager::ConfigureResult
result(
525 syncer::ModelTypeSet());
526 EXPECT_CALL(*data_type_manager
, Configure(_
, _
)).WillRepeatedly(
527 DoAll(InvokeOnConfigureStart(sync_
),
528 InvokeOnConfigureDone(
530 base::Bind(&ProfileSyncServiceStartupTest::SetError
,
531 base::Unretained(this)),
533 EXPECT_CALL(*data_type_manager
, state()).
534 WillOnce(Return(DataTypeManager::STOPPED
));
535 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
538 EXPECT_TRUE(sync_
->HasUnrecoverableError());
541 TEST_F(ProfileSyncServiceStartupTest
, StartDownloadFailed
) {
542 // Pre load the tokens
543 SigninManagerFactory::GetForProfile(profile_
)
544 ->SetAuthenticatedUsername("test_user@gmail.com");
546 SyncBackendHostMock
* mock_sbh
= SetUpSyncBackendHost();
547 mock_sbh
->set_fail_initial_download(true);
549 profile_
->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted
);
551 EXPECT_CALL(observer_
, OnStateChanged()).Times(AnyNumber());
554 sync_
->SetSetupInProgress(true);
556 sync_
->SetSetupInProgress(false);
557 EXPECT_FALSE(sync_
->SyncActive());