| 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 #include "chrome/browser/sync/test/integration/migration_waiter.h" | 5 #include "chrome/browser/sync/test/integration/migration_waiter.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/sync/test/integration/migration_watcher.h" | 8 #include "chrome/browser/sync/test/integration/migration_watcher.h" |
| 9 | 9 |
| 10 MigrationWaiter::MigrationWaiter(syncer::ModelTypeSet expected_types, | 10 MigrationWaiter::MigrationWaiter(syncer::ModelTypeSet expected_types, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 return watcher_->GetMigratedTypes().HasAll(expected_types_) && | 24 return watcher_->GetMigratedTypes().HasAll(expected_types_) && |
| 25 !watcher_->HasPendingBackendMigration(); | 25 !watcher_->HasPendingBackendMigration(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 std::string MigrationWaiter::GetDebugMessage() const { | 28 std::string MigrationWaiter::GetDebugMessage() const { |
| 29 return "Waiting to migrate (" + ModelTypeSetToString(expected_types_) + | 29 return "Waiting to migrate (" + ModelTypeSetToString(expected_types_) + |
| 30 "); " + "Currently migrated: (" + | 30 "); " + "Currently migrated: (" + |
| 31 ModelTypeSetToString(watcher_->GetMigratedTypes()) + ")"; | 31 ModelTypeSetToString(watcher_->GetMigratedTypes()) + ")"; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void MigrationWaiter::Wait() { | |
| 35 if (IsExitConditionSatisfied()) { | |
| 36 DVLOG(1) << "Skipping wait: " << GetDebugMessage(); | |
| 37 return; | |
| 38 } | |
| 39 | |
| 40 StartBlockingWait(); | |
| 41 } | |
| 42 | |
| 43 void MigrationWaiter::OnMigrationStateChange() { | 34 void MigrationWaiter::OnMigrationStateChange() { |
| 44 CheckExitCondition(); | 35 CheckExitCondition(); |
| 45 } | 36 } |
| OLD | NEW |