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

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

Issue 10382071: Notify sync observers whenever preferred types change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback. Created 8 years, 7 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
« no previous file with comments | « chrome/browser/sync/profile_sync_service_harness.h ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service_harness.cc
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc
index 50eac128a2e697e50ef7a7c9d0c5a23053269d32..a2e3276e3fce042d3f8e5cd544a82dd9c9a0ec2c 100644
--- a/chrome/browser/sync/profile_sync_service_harness.cc
+++ b/chrome/browser/sync/profile_sync_service_harness.cc
@@ -108,7 +108,8 @@ ProfileSyncServiceHarness::ProfileSyncServiceHarness(
timestamp_match_partner_(NULL),
username_(username),
password_(password),
- profile_debug_name_(profile->GetDebugName()) {
+ profile_debug_name_(profile->GetDebugName()),
+ waiting_for_status_change_(false) {
if (IsSyncAlreadySetup()) {
service_ = ProfileSyncServiceFactory::GetInstance()->GetForProfile(
profile_);
@@ -262,7 +263,8 @@ void ProfileSyncServiceHarness::SignalStateCompleteWithNextState(
}
void ProfileSyncServiceHarness::SignalStateComplete() {
- MessageLoop::current()->Quit();
+ if (waiting_for_status_change_)
+ MessageLoop::current()->Quit();
}
bool ProfileSyncServiceHarness::RunStateChangeMachine() {
@@ -730,6 +732,9 @@ bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout(
scoped_refptr<StateChangeTimeoutEvent> timeout_signal(
new StateChangeTimeoutEvent(this, reason));
{
+ // Set the flag to tell SignalStateComplete() that it's OK to quit out of
+ // the MessageLoop if we hit a state transition.
+ waiting_for_status_change_ = true;
MessageLoop* loop = MessageLoop::current();
MessageLoop::ScopedNestableTaskAllower allow(loop);
loop->PostDelayedTask(
@@ -738,6 +743,7 @@ bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout(
timeout_signal.get()),
base::TimeDelta::FromMilliseconds(timeout_milliseconds));
loop->Run();
+ waiting_for_status_change_ = false;
}
if (timeout_signal->Abort()) {
@@ -991,7 +997,7 @@ std::string ProfileSyncServiceHarness::GetClientInfoString(
os << "has_more_to_sync: "
<< snap.has_more_to_sync()
<< ", has_unsynced_items: "
- << service()->HasUnsyncedItems()
+ << (service()->sync_initialized() ? service()->HasUnsyncedItems() : 0)
<< ", unsynced_count: "
<< snap.unsynced_count()
<< ", encryption conflicts: "
« no previous file with comments | « chrome/browser/sync/profile_sync_service_harness.h ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698