Index: chrome/test/live_sync/profile_sync_service_test_harness.cc |
diff --git a/chrome/test/live_sync/profile_sync_service_test_harness.cc b/chrome/test/live_sync/profile_sync_service_test_harness.cc |
index bd9ceab48688934e045ec0f19f7db698b86f3fe0..081b0d85440a16efed06faf505a5cc08b152f64a 100644 |
--- a/chrome/test/live_sync/profile_sync_service_test_harness.cc |
+++ b/chrome/test/live_sync/profile_sync_service_test_harness.cc |
@@ -140,7 +140,6 @@ bool ProfileSyncServiceTestHarness::RunStateChangeMachine() { |
if (snap->has_more_to_sync || snap->unsynced_count != 0) { |
break; |
} |
- |
EXPECT_LE(last_timestamp_, snap->max_local_timestamp); |
last_timestamp_ = snap->max_local_timestamp; |
SignalStateCompleteWithNextState(FULLY_SYNCED); |
@@ -149,9 +148,11 @@ bool ProfileSyncServiceTestHarness::RunStateChangeMachine() { |
case WAITING_FOR_UPDATES: { |
const SyncSessionSnapshot* snap = GetLastSessionSnapshot(); |
DCHECK(snap) << "Should have been at least one sync session by now"; |
- if (snap->max_local_timestamp < min_timestamp_needed_) |
+ if (snap->max_local_timestamp < min_timestamp_needed_) { |
break; |
- |
+ } |
+ EXPECT_LE(last_timestamp_, snap->max_local_timestamp); |
+ last_timestamp_ = snap->max_local_timestamp; |
SignalStateCompleteWithNextState(FULLY_SYNCED); |
break; |
} |
@@ -171,10 +172,18 @@ void ProfileSyncServiceTestHarness::OnStateChanged() { |
bool ProfileSyncServiceTestHarness::AwaitSyncCycleCompletion( |
const std::string& reason) { |
- if (service()->backend()->HasUnsyncedItems()) { |
+ const SyncSessionSnapshot* snap = GetLastSessionSnapshot(); |
+ DCHECK(snap) << "Should have been at least one sync session by now"; |
+ // TODO(rsimha): Remove additional checks of snap->has_more_to_sync and |
+ // snap->unsynced_count once http://crbug.com/48989 is fixed. |
+ if (service()->backend()->HasUnsyncedItems() || |
+ snap->has_more_to_sync || |
+ snap->unsynced_count != 0) { |
wait_state_ = WAITING_FOR_SYNC_TO_FINISH; |
return AwaitStatusChangeWithTimeout(60, reason); |
} else { |
+ EXPECT_LE(last_timestamp_, snap->max_local_timestamp); |
+ last_timestamp_ = snap->max_local_timestamp; |
return true; |
} |
} |