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

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

Issue 184993006: sync: Change progress marker checking in tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_vector.h"
13 #include "chrome/browser/sync/test/integration/status_change_checker.h"
14
15 class ProfileSyncService;
16 class ProgressMarkerWatcher;
17 class ProfileSyncServiceHarness;
18
19 // Waits until all provided clients have finished committing any unsynced items
20 // and downloading each others' udpates.
21 //
22 // This requires that "self-notifications" be enabled. Otherwise the clients
23 // will not fetch the latest progress markers on their own, and the latest
24 // progress markers are needed to confirm that clients are in sync.
25 //
26 // There is a race condition here. If we manage to perform the check at
27 // precisely the wrong time, we could end up seeing stale snapshot state
28 // (crbug.com/95742), which would make us think that the client has finished
29 // syncing when it hasn't. In practice, this race is rare enough that it
30 // doesn't cause test failures.
31 class QuiesceStatusChangeChecker : public StatusChangeChecker {
32 public:
33 explicit QuiesceStatusChangeChecker(
34 std::vector<ProfileSyncService*> services);
35 virtual ~QuiesceStatusChangeChecker();
36
37 virtual bool IsExitConditionSatisfied() OVERRIDE;
38 virtual std::string GetDebugMessage() const OVERRIDE;
39 virtual void InitObserver(ProfileSyncServiceHarness* harness) OVERRIDE;
40 virtual void UninitObserver(ProfileSyncServiceHarness* harness) OVERRIDE;
41
42 void OnServiceStateChanged(ProfileSyncService* service);
43
44 private:
45 std::vector<ProfileSyncService*> services_;
46 ScopedVector<ProgressMarkerWatcher> observers_;
47 ProfileSyncServiceHarness* harness_;
48
49 DISALLOW_COPY_AND_ASSIGN(QuiesceStatusChangeChecker);
50 };
51
52 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698