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 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WAITER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WAITER_H_ |
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WAITER_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WAITER_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "chrome/browser/sync/test/integration/status_change_checker.h" | 11 #include "chrome/browser/sync/test/integration/status_change_checker.h" |
10 #include "components/sync/base/model_type.h" | 12 #include "components/sync/base/model_type.h" |
11 | 13 |
12 class MigrationWatcher; | 14 class MigrationWatcher; |
13 | 15 |
14 // Helper class that checks if the sync backend has successfully completed | 16 // Helper class that checks if the sync backend has successfully completed |
15 // migration for a set of data types. | 17 // migration for a set of data types. |
16 // | 18 // |
17 // Collaborates with the MigrationWatcher, defined above. | 19 // Collaborates with the MigrationWatcher, defined above. |
18 class MigrationWaiter : public StatusChangeChecker { | 20 class MigrationWaiter : public StatusChangeChecker { |
19 public: | 21 public: |
20 // Initialize a waiter that will wait until |watcher|'s migrated types | 22 // Initialize a waiter that will wait until |watcher|'s migrated types |
21 // match the provided |exptected_types|. | 23 // match the provided |exptected_types|. |
22 MigrationWaiter(syncer::ModelTypeSet expected_types, | 24 MigrationWaiter(syncer::ModelTypeSet expected_types, |
23 MigrationWatcher* watcher); | 25 MigrationWatcher* watcher); |
24 | 26 |
25 ~MigrationWaiter() override; | 27 ~MigrationWaiter() override; |
26 | 28 |
27 // Implementation of StatusChangeChecker. | 29 // StatusChangeChecker implementation . |
28 bool IsExitConditionSatisfied() override; | 30 bool IsExitConditionSatisfied() override; |
29 std::string GetDebugMessage() const override; | 31 std::string GetDebugMessage() const override; |
30 | 32 |
31 // Function to trigger the waiting. | |
32 void Wait(); | |
33 | |
34 // Callback invoked by our associated waiter when migration state changes. | 33 // Callback invoked by our associated waiter when migration state changes. |
35 void OnMigrationStateChange(); | 34 void OnMigrationStateChange(); |
36 | 35 |
37 private: | 36 private: |
38 // The MigrationWatcher we're observering. | 37 // The MigrationWatcher we're observering. |
39 MigrationWatcher* const watcher_; | 38 MigrationWatcher* const watcher_; |
40 | 39 |
41 // The set of data types that are expected to eventually undergo migration. | 40 // The set of data types that are expected to eventually undergo migration. |
42 const syncer::ModelTypeSet expected_types_; | 41 const syncer::ModelTypeSet expected_types_; |
43 | 42 |
44 DISALLOW_COPY_AND_ASSIGN(MigrationWaiter); | 43 DISALLOW_COPY_AND_ASSIGN(MigrationWaiter); |
45 }; | 44 }; |
46 | 45 |
47 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WAITER_H_ | 46 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WAITER_H_ |
OLD | NEW |