Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / sync / test / integration / multi_client_status_change_checker.cc
blob9821967924fa4a20cb1af91873fbda7c9e5daa02
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.
5 #include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h"
7 #include "base/logging.h"
8 #include "base/scoped_observer.h"
9 #include "chrome/browser/sync/profile_sync_service.h"
11 MultiClientStatusChangeChecker::MultiClientStatusChangeChecker(
12 std::vector<ProfileSyncService*> services)
13 : services_(services) {}
15 MultiClientStatusChangeChecker::~MultiClientStatusChangeChecker() {}
17 void MultiClientStatusChangeChecker::Wait() {
18 DVLOG(1) << "Await: " << GetDebugMessage();
20 if (IsExitConditionSatisfied()) {
21 DVLOG(1) << "Await -> Exit before waiting: " << GetDebugMessage();
22 return;
25 ScopedObserver<ProfileSyncService, MultiClientStatusChangeChecker> obs(this);
26 for (std::vector<ProfileSyncService*>::iterator it = services_.begin();
27 it != services_.end(); ++it) {
28 obs.Add(*it);
31 StartBlockingWait();
34 void MultiClientStatusChangeChecker::OnStateChanged() {
35 CheckExitCondition();