Index: chrome/browser/sync/test/integration/profile_sync_service_harness.cc |
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 c311344c52b3fc291a93eccbfe40e5482250ab4b..d095602132e429b4ad7b3ef55bd5ed80aa3ad35e 100644 |
--- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc |
+++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc |
@@ -61,9 +61,9 @@ namespace { |
class CallbackStatusChecker : public StatusChangeChecker { |
public: |
CallbackStatusChecker(base::Callback<bool()> callback, |
- const std::string& source) |
- : StatusChangeChecker(source), |
- callback_(callback) { |
+ const std::string& debug_message) |
+ : callback_(callback), |
+ debug_message_(debug_message) { |
} |
virtual ~CallbackStatusChecker() { |
@@ -73,11 +73,17 @@ class CallbackStatusChecker : public StatusChangeChecker { |
return callback_.Run(); |
} |
+ virtual std::string GetDebugMessage() const OVERRIDE { |
+ return debug_message_; |
+ } |
+ |
private: |
// Callback that evaluates whether the condition we are waiting on has been |
// satisfied. |
base::Callback<bool()> callback_; |
+ const std::string debug_message_; |
+ |
DISALLOW_COPY_AND_ASSIGN(CallbackStatusChecker); |
}; |
@@ -305,7 +311,7 @@ void ProfileSyncServiceHarness::OnStateChanged() { |
if (!status_change_checker_) |
return; |
- DVLOG(1) << GetClientInfoString(status_change_checker_->source()); |
+ DVLOG(1) << GetClientInfoString(status_change_checker_->GetDebugMessage()); |
if (status_change_checker_->IsExitConditionSatisfied()) |
QuitMessageLoop(); |
} |
@@ -329,16 +335,14 @@ bool ProfileSyncServiceHarness::AwaitPassphraseRequired() { |
CallbackStatusChecker passphrase_required_checker( |
base::Bind(&::IsPassphraseRequired, base::Unretained(this)), |
"IsPassphraseRequired"); |
- return AwaitStatusChange(&passphrase_required_checker, |
- "AwaitPassphraseRequired"); |
+ return AwaitStatusChange(&passphrase_required_checker); |
} |
bool ProfileSyncServiceHarness::AwaitPassphraseAccepted() { |
CallbackStatusChecker passphrase_accepted_checker( |
base::Bind(&::IsPassphraseAccepted, base::Unretained(this)), |
"IsPassphraseAccepted"); |
- bool return_value = AwaitStatusChange(&passphrase_accepted_checker, |
- "AwaitPassphraseAccepted"); |
+ bool return_value = AwaitStatusChange(&passphrase_accepted_checker); |
if (return_value) |
FinishSyncSetup(); |
return return_value; |
@@ -350,7 +354,7 @@ bool ProfileSyncServiceHarness::AwaitBackendInitialized() { |
base::Bind(&DoneWaitingForBackendInitialization, |
base::Unretained(this)), |
"DoneWaitingForBackendInitialization"); |
- AwaitStatusChange(&backend_initialized_checker, "AwaitBackendInitialized"); |
+ AwaitStatusChange(&backend_initialized_checker); |
return service()->sync_initialized(); |
} |
@@ -364,8 +368,7 @@ bool ProfileSyncServiceHarness::AwaitCommitActivityCompletion() { |
base::Bind(&ProfileSyncServiceHarness::HasLatestProgressMarkers, |
base::Unretained(this)), |
"HasLatestProgressMarkers"); |
- AwaitStatusChange(&latest_progress_markers_checker, |
- "AwaitCommitActivityCompletion"); |
+ AwaitStatusChange(&latest_progress_markers_checker); |
return HasLatestProgressMarkers(); |
} |
@@ -376,15 +379,14 @@ bool ProfileSyncServiceHarness::AwaitSyncDisabled() { |
base::Bind(&ProfileSyncServiceHarness::IsSyncDisabled, |
base::Unretained(this)), |
"IsSyncDisabled"); |
- return AwaitStatusChange(&sync_disabled_checker, "AwaitSyncDisabled"); |
+ return AwaitStatusChange(&sync_disabled_checker); |
} |
bool ProfileSyncServiceHarness::AwaitSyncSetupCompletion() { |
CallbackStatusChecker sync_setup_complete_checker( |
base::Bind(&DoneWaitingForSyncSetup, base::Unretained(this)), |
"DoneWaitingForSyncSetup"); |
- return AwaitStatusChange(&sync_setup_complete_checker, |
- "AwaitSyncSetupCompletion"); |
+ return AwaitStatusChange(&sync_setup_complete_checker); |
} |
bool ProfileSyncServiceHarness::AwaitMutualSyncCycleCompletion( |
@@ -444,8 +446,7 @@ bool ProfileSyncServiceHarness::WaitUntilProgressMarkersMatch( |
base::Bind(&ProfileSyncServiceHarness::MatchesPartnerClient, |
base::Unretained(this)), |
"MatchesPartnerClient"); |
- return_value = AwaitStatusChange(&matches_other_client_checker, |
- "WaitUntilProgressMarkersMatch"); |
+ return_value = AwaitStatusChange(&matches_other_client_checker); |
partner->service()->RemoveObserver(this); |
} |
progress_marker_partner_ = NULL; |
@@ -453,7 +454,7 @@ bool ProfileSyncServiceHarness::WaitUntilProgressMarkersMatch( |
} |
bool ProfileSyncServiceHarness::AwaitStatusChange( |
- StatusChangeChecker* checker, const std::string& source) { |
+ StatusChangeChecker* checker) { |
DVLOG(1) << GetClientInfoString("AwaitStatusChange"); |
if (IsSyncDisabled()) { |
@@ -489,7 +490,8 @@ bool ProfileSyncServiceHarness::AwaitStatusChange( |
return true; |
} else { |
LOG(ERROR) << GetClientInfoString(base::StringPrintf( |
- "AwaitStatusChange called from %s timed out", source.c_str())); |
+ "AwaitStatusChange called from %s timed out", |
+ checker->GetDebugMessage().c_str())); |
CHECK(false) << "Ending test because of timeout."; |
return false; |
} |
@@ -762,7 +764,7 @@ bool ProfileSyncServiceHarness::WaitForEncryption() { |
base::Bind(&ProfileSyncServiceHarness::IsEncryptionComplete, |
base::Unretained(this)), |
"IsEncryptionComplete"); |
- return AwaitStatusChange(&encryption_complete_checker, "WaitForEncryption"); |
+ return AwaitStatusChange(&encryption_complete_checker); |
} |
bool ProfileSyncServiceHarness::IsEncryptionComplete() const { |