BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / sync / test / integration / migration_waiter.cc
blob565b3ccc89112e8062a7ae673f5cbd9ca1a29018
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/migration_waiter.h"
7 #include "base/logging.h"
8 #include "chrome/browser/sync/test/integration/migration_watcher.h"
10 MigrationWaiter::MigrationWaiter(syncer::ModelTypeSet expected_types,
11 MigrationWatcher* watcher)
12 : watcher_(watcher), expected_types_(expected_types) {
13 DCHECK(!expected_types_.Empty());
14 watcher_->set_migration_waiter(this);
17 MigrationWaiter::~MigrationWaiter() {
18 watcher_->clear_migration_waiter();
21 // Returns true when sync reports that there is no pending migration, and
22 // migration is complete for all data types in |expected_types_|.
23 bool MigrationWaiter::IsExitConditionSatisfied() {
24 return watcher_->GetMigratedTypes().HasAll(expected_types_) &&
25 !watcher_->HasPendingBackendMigration();
28 std::string MigrationWaiter::GetDebugMessage() const {
29 return "Waiting to migrate (" + ModelTypeSetToString(expected_types_) +
30 "); " + "Currently migrated: (" +
31 ModelTypeSetToString(watcher_->GetMigratedTypes()) + ")";
34 void MigrationWaiter::Wait() {
35 if (IsExitConditionSatisfied()) {
36 DVLOG(1) << "Skipping wait: " << GetDebugMessage();
37 return;
40 StartBlockingWait();
43 void MigrationWaiter::OnMigrationStateChange() {
44 CheckExitCondition();