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 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_ |
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_ |
7 | 7 |
| 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "chrome/browser/sync/test/integration/status_change_checker.h" | 15 #include "chrome/browser/sync/test/integration/status_change_checker.h" |
15 | 16 |
16 class ProgressMarkerWatcher; | 17 class ProgressMarkerWatcher; |
17 | 18 |
(...skipping 12 matching lines...) Expand all Loading... |
30 // precisely the wrong time, we could end up seeing stale snapshot state | 31 // precisely the wrong time, we could end up seeing stale snapshot state |
31 // (crbug.com/95742), which would make us think that the client has finished | 32 // (crbug.com/95742), which would make us think that the client has finished |
32 // syncing when it hasn't. In practice, this race is rare enough that it | 33 // syncing when it hasn't. In practice, this race is rare enough that it |
33 // doesn't cause test failures. | 34 // doesn't cause test failures. |
34 class QuiesceStatusChangeChecker : public StatusChangeChecker { | 35 class QuiesceStatusChangeChecker : public StatusChangeChecker { |
35 public: | 36 public: |
36 explicit QuiesceStatusChangeChecker( | 37 explicit QuiesceStatusChangeChecker( |
37 std::vector<browser_sync::ProfileSyncService*> services); | 38 std::vector<browser_sync::ProfileSyncService*> services); |
38 ~QuiesceStatusChangeChecker() override; | 39 ~QuiesceStatusChangeChecker() override; |
39 | 40 |
40 // Blocks until all clients have quiesced or we time out. | |
41 void Wait(); | |
42 | |
43 // A callback function for some helper objects. | 41 // A callback function for some helper objects. |
44 void OnServiceStateChanged(browser_sync::ProfileSyncService* service); | 42 void OnServiceStateChanged(browser_sync::ProfileSyncService* service); |
45 | 43 |
46 // Implementation of StatusChangeChecker. | 44 // Implementation of StatusChangeChecker. |
47 bool IsExitConditionSatisfied() override; | 45 bool IsExitConditionSatisfied() override; |
48 std::string GetDebugMessage() const override; | 46 std::string GetDebugMessage() const override; |
49 | 47 |
50 private: | 48 private: |
51 std::vector<browser_sync::ProfileSyncService*> services_; | 49 std::vector<browser_sync::ProfileSyncService*> services_; |
52 ScopedVector<ProgressMarkerWatcher> observers_; | 50 ScopedVector<ProgressMarkerWatcher> observers_; |
53 | 51 |
54 DISALLOW_COPY_AND_ASSIGN(QuiesceStatusChangeChecker); | 52 DISALLOW_COPY_AND_ASSIGN(QuiesceStatusChangeChecker); |
55 }; | 53 }; |
56 | 54 |
57 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_ | 55 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_ |
OLD | NEW |