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

Side by Side Diff: chrome/browser/sync/test/integration/quiesce_status_change_checker.h

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698