diff options
author | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-16 19:50:49 +0000 |
---|---|---|
committer | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-16 19:50:49 +0000 |
commit | 4047caec63b2d650d056c70b4ca683ca1ee507a1 (patch) | |
tree | a68930a6f47cf32a12f0d2626e3c659def426ee6 | |
parent | f495b62fa9ed8969d38fb3f401e1b65949474cc9 (diff) | |
download | chromium_src-4047caec63b2d650d056c70b4ca683ca1ee507a1.zip chromium_src-4047caec63b2d650d056c70b4ca683ca1ee507a1.tar.gz chromium_src-4047caec63b2d650d056c70b4ca683ca1ee507a1.tar.bz2 |
[sync] Remove is_sync_disabled_ flag from ProfileSyncServiceHarness
ProfileSyncServiceHarness implements a bunch of Await* methods that let
you wait for various sync events. However, these waits will block and
timeout if a sync client is disabled. We used to use a boolean flag to
determine if sync was disabled on a client.
This CL gets rid of the boolean flag and inspects the actual disabled
state of the internal ProfileSyncService object. Only the subset of sync
integration tests that call DisableSync should be affected.
BUG=323380
TEST=sync_integration_tests:*DisableSync
R=rlarocque@chromium.org
Review URL: https://codereview.chromium.org/113893006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240983 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/test/integration/profile_sync_service_harness.cc | 28 | ||||
-rw-r--r-- | chrome/browser/sync/test/integration/profile_sync_service_harness.h | 5 |
2 files changed, 11 insertions, 22 deletions
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc index bc2f52a..17b8ccf 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc @@ -239,7 +239,6 @@ ProfileSyncServiceHarness::ProfileSyncServiceHarness( password_(password), oauth2_refesh_token_number_(0), profile_debug_name_(profile->GetDebugName()), - is_sync_disabled_(false), status_change_checker_(NULL) { } @@ -278,10 +277,6 @@ bool ProfileSyncServiceHarness::SetupSync( if (!service()->HasObserver(this)) service()->AddObserver(this); - // Set the boolean flag which indicates that sync is now being enabled. - if (is_sync_disabled_) - is_sync_disabled_ = false; - // Tell the sync service that setup is in progress so we don't start syncing // until we've finished configuration. service()->SetSetupInProgress(true); @@ -443,7 +438,7 @@ void ProfileSyncServiceHarness::OnMigrationStateChange() { bool ProfileSyncServiceHarness::AwaitPassphraseRequired() { DVLOG(1) << GetClientInfoString("AwaitPassphraseRequired"); - if (is_sync_disabled_) { + if (IsSyncDisabled()) { LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; return false; } @@ -462,7 +457,7 @@ bool ProfileSyncServiceHarness::AwaitPassphraseRequired() { bool ProfileSyncServiceHarness::AwaitPassphraseAccepted() { DVLOG(1) << GetClientInfoString("AwaitPassphraseAccepted"); - if (is_sync_disabled_) { + if (IsSyncDisabled()) { LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; return false; } @@ -503,7 +498,7 @@ bool ProfileSyncServiceHarness::AwaitDataSyncCompletion() { DVLOG(1) << GetClientInfoString("AwaitDataSyncCompletion"); DCHECK(service()->sync_initialized()); - DCHECK(!is_sync_disabled_); + DCHECK(!IsSyncDisabled()); if (IsDataSynced()) { // Client is already synced; don't wait. @@ -519,7 +514,7 @@ bool ProfileSyncServiceHarness::AwaitDataSyncCompletion() { bool ProfileSyncServiceHarness::AwaitFullSyncCompletion() { DVLOG(1) << GetClientInfoString("AwaitFullSyncCompletion"); - if (is_sync_disabled_) { + if (IsSyncDisabled()) { LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; return false; } @@ -539,7 +534,7 @@ bool ProfileSyncServiceHarness::AwaitFullSyncCompletion() { bool ProfileSyncServiceHarness::AwaitSyncDisabled() { DCHECK(service()->HasSyncSetupCompleted()); - DCHECK(!is_sync_disabled_); + DCHECK(!IsSyncDisabled()); StatusChangeChecker sync_disabled_checker( base::Bind(&ProfileSyncServiceHarness::IsSyncDisabled, base::Unretained(this)), @@ -634,7 +629,7 @@ bool ProfileSyncServiceHarness::AwaitGroupSyncCycleCompletion( bool return_value = true; for (std::vector<ProfileSyncServiceHarness*>::iterator it = partners.begin(); it != partners.end(); ++it) { - if ((this != *it) && (!(*it)->is_sync_disabled_)) { + if ((this != *it) && (!(*it)->IsSyncDisabled())) { return_value = return_value && (*it)->WaitUntilProgressMarkersMatch(this); } @@ -649,7 +644,7 @@ bool ProfileSyncServiceHarness::AwaitQuiescence( bool return_value = true; for (std::vector<ProfileSyncServiceHarness*>::iterator it = clients.begin(); it != clients.end(); ++it) { - if (!(*it)->is_sync_disabled_) { + if (!(*it)->IsSyncDisabled()) { return_value = return_value && (*it)->AwaitGroupSyncCycleCompletion(clients); } @@ -660,7 +655,7 @@ bool ProfileSyncServiceHarness::AwaitQuiescence( bool ProfileSyncServiceHarness::WaitUntilProgressMarkersMatch( ProfileSyncServiceHarness* partner) { DVLOG(1) << GetClientInfoString("WaitUntilProgressMarkersMatch"); - if (is_sync_disabled_) { + if (IsSyncDisabled()) { LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; return false; } @@ -691,7 +686,7 @@ bool ProfileSyncServiceHarness::AwaitStatusChange( StatusChangeChecker* checker, const std::string& source) { DVLOG(1) << GetClientInfoString("AwaitStatusChange"); - if (is_sync_disabled_) { + if (IsSyncDisabled()) { LOG(ERROR) << "Sync disabled for " << profile_debug_name_ << "."; return false; } @@ -874,7 +869,7 @@ bool ProfileSyncServiceHarness::EnableSyncForDatatype( "EnableSyncForDatatype(" + std::string(syncer::ModelTypeToString(datatype)) + ")"); - if (is_sync_disabled_) + if (IsSyncDisabled()) return SetupSync(syncer::ModelTypeSet(datatype)); if (service() == NULL) { @@ -939,7 +934,7 @@ bool ProfileSyncServiceHarness::DisableSyncForDatatype( bool ProfileSyncServiceHarness::EnableSyncForAllDatatypes() { DVLOG(1) << GetClientInfoString("EnableSyncForAllDatatypes"); - if (is_sync_disabled_) + if (IsSyncDisabled()) return SetupSync(); if (service() == NULL) { @@ -967,7 +962,6 @@ bool ProfileSyncServiceHarness::DisableSyncForAllDatatypes() { } service()->DisableForUser(); - is_sync_disabled_ = true; DVLOG(1) << "DisableSyncForAllDatatypes(): Disabled sync for all " << "datatypes on " << profile_debug_name_; diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.h b/chrome/browser/sync/test/integration/profile_sync_service_harness.h index 9ff5d79..6f82b1a 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.h +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.h @@ -299,11 +299,6 @@ class ProfileSyncServiceHarness // Used for logging. const std::string profile_debug_name_; - // Flag indicating if sync was disabled. - // TODO(rsimha): This is temporary, and must be replaced by a check of the - // actual disabled state of ProfileSyncService. - bool is_sync_disabled_; - // Keeps track of the state change on which we are waiting. PSSHarness can // wait on only one status change at a time. StatusChangeChecker* status_change_checker_; |