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/quiesce_status_change_checker.h" | 5 #include "chrome/browser/sync/test/integration/quiesce_status_change_checker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/scoped_observer.h" | 10 #include "base/scoped_observer.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // This is a work-around for the HasLatestProgressMarkers check's inherent | 61 // This is a work-around for the HasLatestProgressMarkers check's inherent |
62 // flakiness. It's not safe to check that condition whenever we want. The | 62 // flakiness. It's not safe to check that condition whenever we want. The |
63 // safest time to check it is when the ProfileSyncService emits an | 63 // safest time to check it is when the ProfileSyncService emits an |
64 // OnStateChanged() event. This class waits for those events and updates its | 64 // OnStateChanged() event. This class waits for those events and updates its |
65 // cached HasLatestProgressMarkers state every time that event occurs. | 65 // cached HasLatestProgressMarkers state every time that event occurs. |
66 // | 66 // |
67 // See the comments in UpdatedProgressMarkerChecker for more details. | 67 // See the comments in UpdatedProgressMarkerChecker for more details. |
68 // | 68 // |
69 // The long-term plan is to deprecate this hack by replacing all its usees with | 69 // The long-term plan is to deprecate this hack by replacing all its usees with |
70 // more reliable status checkers. | 70 // more reliable status checkers. |
71 class ProgressMarkerWatcher : public syncer::SyncServiceObserver { | 71 class ProgressMarkerWatcher : public sync_driver::SyncServiceObserver { |
72 public: | 72 public: |
73 ProgressMarkerWatcher(browser_sync::ProfileSyncService* service, | 73 ProgressMarkerWatcher(browser_sync::ProfileSyncService* service, |
74 QuiesceStatusChangeChecker* quiesce_checker); | 74 QuiesceStatusChangeChecker* quiesce_checker); |
75 ~ProgressMarkerWatcher() override; | 75 ~ProgressMarkerWatcher() override; |
76 void OnStateChanged() override; | 76 void OnStateChanged() override; |
77 | 77 |
78 bool HasLatestProgressMarkers(); | 78 bool HasLatestProgressMarkers(); |
79 bool IsSyncDisabled(); | 79 bool IsSyncDisabled(); |
80 | 80 |
81 private: | 81 private: |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 std::string QuiesceStatusChangeChecker::GetDebugMessage() const { | 214 std::string QuiesceStatusChangeChecker::GetDebugMessage() const { |
215 return base::StringPrintf("Waiting for quiescence of %" PRIuS " clients", | 215 return base::StringPrintf("Waiting for quiescence of %" PRIuS " clients", |
216 services_.size()); | 216 services_.size()); |
217 } | 217 } |
218 | 218 |
219 void QuiesceStatusChangeChecker::OnServiceStateChanged( | 219 void QuiesceStatusChangeChecker::OnServiceStateChanged( |
220 browser_sync::ProfileSyncService* service) { | 220 browser_sync::ProfileSyncService* service) { |
221 CheckExitCondition(); | 221 CheckExitCondition(); |
222 } | 222 } |
OLD | NEW |