OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" | 5 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" |
6 | 6 |
7 #include "components/browser_sync/profile_sync_service.h" | 7 #include "components/browser_sync/profile_sync_service.h" |
8 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" | 8 #include "components/sync/engine/cycle/sync_cycle_snapshot.h" |
9 | 9 |
10 UpdatedProgressMarkerChecker::UpdatedProgressMarkerChecker( | 10 UpdatedProgressMarkerChecker::UpdatedProgressMarkerChecker( |
11 browser_sync::ProfileSyncService* service) | 11 browser_sync::ProfileSyncService* service) |
12 : SingleClientStatusChangeChecker(service) {} | 12 : SingleClientStatusChangeChecker(service) {} |
13 | 13 |
14 UpdatedProgressMarkerChecker::~UpdatedProgressMarkerChecker() {} | |
15 | |
16 bool UpdatedProgressMarkerChecker::IsExitConditionSatisfied() { | 14 bool UpdatedProgressMarkerChecker::IsExitConditionSatisfied() { |
17 // Checks to see if our self-notify sync cycle has completed and | 15 // Checks to see if our self-notify sync cycle has completed and |
18 // there's nothing to commit. | 16 // there's nothing to commit. |
19 // | 17 // |
20 // If we assume that no one else is committing at this time and that the | 18 // If we assume that no one else is committing at this time and that the |
21 // current client did not commit anything in its previous sync cycle, then | 19 // current client did not commit anything in its previous sync cycle, then |
22 // this client has the latest progress markers. | 20 // this client has the latest progress markers. |
23 // | 21 // |
24 // The !service()->HasUnsyncedItems() check makes sure that we have nothing to | 22 // The !service()->HasUnsyncedItems() check makes sure that we have nothing to |
25 // commit. | 23 // commit. |
(...skipping 11 matching lines...) Expand all Loading... |
37 // ProfileSyncService. If we're calling this right after the sync session | 35 // ProfileSyncService. If we're calling this right after the sync session |
38 // completes, then the snapshot is much more likely to be up to date. | 36 // completes, then the snapshot is much more likely to be up to date. |
39 const syncer::SyncCycleSnapshot& snap = service()->GetLastCycleSnapshot(); | 37 const syncer::SyncCycleSnapshot& snap = service()->GetLastCycleSnapshot(); |
40 return snap.model_neutral_state().num_successful_commits == 0 && | 38 return snap.model_neutral_state().num_successful_commits == 0 && |
41 service()->IsSyncActive() && !service()->HasUnsyncedItems(); | 39 service()->IsSyncActive() && !service()->HasUnsyncedItems(); |
42 } | 40 } |
43 | 41 |
44 std::string UpdatedProgressMarkerChecker::GetDebugMessage() const { | 42 std::string UpdatedProgressMarkerChecker::GetDebugMessage() const { |
45 return "Waiting for progress markers"; | 43 return "Waiting for progress markers"; |
46 } | 44 } |
OLD | NEW |