OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_TEST_LIVE_SYNC_PROFILE_SYNC_SERVICE_TEST_HARNESS_H_ | 5 #ifndef CHROME_TEST_LIVE_SYNC_PROFILE_SYNC_SERVICE_TEST_HARNESS_H_ |
6 #define CHROME_TEST_LIVE_SYNC_PROFILE_SYNC_SERVICE_TEST_HARNESS_H_ | 6 #define CHROME_TEST_LIVE_SYNC_PROFILE_SYNC_SERVICE_TEST_HARNESS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "chrome/browser/sync/profile_sync_service.h" | 11 #include "chrome/browser/sync/profile_sync_service.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 ProfileSyncService* service() { return service_; } | 48 ProfileSyncService* service() { return service_; } |
49 | 49 |
50 // See ProfileSyncService::ShouldPushChanges(). | 50 // See ProfileSyncService::ShouldPushChanges(). |
51 bool ServiceIsPushingChanges() { return service_->ShouldPushChanges(); } | 51 bool ServiceIsPushingChanges() { return service_->ShouldPushChanges(); } |
52 | 52 |
53 private: | 53 private: |
54 friend class StateChangeTimeoutEvent; | 54 friend class StateChangeTimeoutEvent; |
55 | 55 |
56 enum WaitState { | 56 enum WaitState { |
57 WAITING_FOR_INITIAL_CALLBACK = 0, | 57 // The sync client awaits the OnAuthError() callback. |
58 WAITING_FOR_READY_TO_PROCESS_CHANGES, | 58 WAITING_FOR_ON_AUTH_ERROR = 0, |
| 59 // The sync client is waiting for notifications_enabled to become true. |
| 60 WAITING_FOR_NOTIFICATIONS_ENABLED, |
| 61 // The sync client is waiting for an ongoing sync cycle to complete. |
59 WAITING_FOR_SYNC_TO_FINISH, | 62 WAITING_FOR_SYNC_TO_FINISH, |
| 63 // The sync client anticipates incoming updates leading to a new sync cycle. |
60 WAITING_FOR_UPDATES, | 64 WAITING_FOR_UPDATES, |
61 WAITING_FOR_NOTHING, | 65 // The sync client is fully synced and there are no pending updates. |
| 66 FULLY_SYNCED, |
62 NUMBER_OF_STATES | 67 NUMBER_OF_STATES |
63 }; | 68 }; |
64 | 69 |
65 // Called from the observer when the current wait state has been completed. | 70 // Called from the observer when the current wait state has been completed. |
66 void SignalStateCompleteWithNextState(WaitState next_state); | 71 void SignalStateCompleteWithNextState(WaitState next_state); |
67 void SignalStateComplete(); | 72 void SignalStateComplete(); |
68 | 73 |
69 // Finite state machine for controlling state. Returns true only if a state | 74 // Finite state machine for controlling state. Returns true only if a state |
70 // change has taken place. | 75 // change has taken place. |
71 bool RunStateChangeMachine(); | 76 bool RunStateChangeMachine(); |
(...skipping 24 matching lines...) Expand all Loading... |
96 int64 min_timestamp_needed_; | 101 int64 min_timestamp_needed_; |
97 | 102 |
98 // Credentials used for GAIA authentication. | 103 // Credentials used for GAIA authentication. |
99 std::string username_; | 104 std::string username_; |
100 std::string password_; | 105 std::string password_; |
101 | 106 |
102 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceTestHarness); | 107 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceTestHarness); |
103 }; | 108 }; |
104 | 109 |
105 #endif // CHROME_TEST_LIVE_SYNC_PROFILE_SYNC_SERVICE_TEST_HARNESS_H_ | 110 #endif // CHROME_TEST_LIVE_SYNC_PROFILE_SYNC_SERVICE_TEST_HARNESS_H_ |
OLD | NEW |