OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PROFILE_SYNC_SERVICE_HARNESS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ |
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 // Creates a ProfileSyncService for the profile passed at construction and | 52 // Creates a ProfileSyncService for the profile passed at construction and |
53 // enables sync for all available datatypes. Returns true only after sync has | 53 // enables sync for all available datatypes. Returns true only after sync has |
54 // been fully initialized and authenticated, and we are ready to process | 54 // been fully initialized and authenticated, and we are ready to process |
55 // changes. | 55 // changes. |
56 bool SetupSync(); | 56 bool SetupSync(); |
57 | 57 |
58 // Same as the above method, but enables sync only for the datatypes contained | 58 // Same as the above method, but enables sync only for the datatypes contained |
59 // in |synced_datatypes|. | 59 // in |synced_datatypes|. |
60 bool SetupSync(syncer::ModelTypeSet synced_datatypes); | 60 bool SetupSync(syncer::ModelTypeSet synced_datatypes); |
61 | 61 |
62 // Setup sync without the authenticating through the passphrase encryption. | |
63 // Use this method when you need to setup a client that you're going to cal | |
skym
2017/03/07 18:38:22
cal should be call
wylieb
2017/03/07 19:52:23
Done.
| |
64 // RestartSyncService() directly after. | |
65 bool SetupSyncForClear(); | |
66 | |
67 // Same as above, but allows specification of datatypes. | |
68 bool SetupSyncForClear(syncer::ModelTypeSet synced_datatypes); | |
69 | |
70 // Restart sync service to simulate a sign-in/sign-out. This is useful | |
71 // to recover from a lost birthday. Use directly after a clear server data | |
72 // command to start from clean slate. | |
73 bool RestartSyncService(); | |
74 | |
62 // Calling this acts as a barrier and blocks the caller until |this| and | 75 // Calling this acts as a barrier and blocks the caller until |this| and |
63 // |partner| have both completed a sync cycle. When calling this method, | 76 // |partner| have both completed a sync cycle. When calling this method, |
64 // the |partner| should be the passive responder who responds to the actions | 77 // the |partner| should be the passive responder who responds to the actions |
65 // of |this|. This method relies upon the synchronization of callbacks | 78 // of |this|. This method relies upon the synchronization of callbacks |
66 // from the message queue. Returns true if two sync cycles have completed. | 79 // from the message queue. Returns true if two sync cycles have completed. |
67 // Note: Use this method when exactly one client makes local change(s), and | 80 // Note: Use this method when exactly one client makes local change(s), and |
68 // exactly one client is waiting to receive those changes. | 81 // exactly one client is waiting to receive those changes. |
69 bool AwaitMutualSyncCycleCompletion(ProfileSyncServiceHarness* partner); | 82 bool AwaitMutualSyncCycleCompletion(ProfileSyncServiceHarness* partner); |
70 | 83 |
71 // Blocks the caller until |this| completes its ongoing sync cycle and every | 84 // Blocks the caller until |this| completes its ongoing sync cycle and every |
72 // other client in |partners| have achieved identical download progresses. | 85 // other client in |partners| have achieved identical download progresses. |
73 // Note: Use this method when exactly one client makes local change(s), | 86 // Note: Use this method when exactly one client makes local change(s), |
74 // and more than one client is waiting to receive those changes. | 87 // and more than one client is waiting to receive those changes. |
75 bool AwaitGroupSyncCycleCompletion( | 88 bool AwaitGroupSyncCycleCompletion( |
76 const std::vector<ProfileSyncServiceHarness*>& partners); | 89 const std::vector<ProfileSyncServiceHarness*>& partners); |
77 | 90 |
78 // Blocks the caller until every client in |clients| completes its ongoing | 91 // Blocks the caller until every client in |clients| completes its ongoing |
79 // sync cycle and all the clients' progress markers match. Note: Use this | 92 // sync cycle and all the clients' progress markers match. Note: Use this |
80 // method when more than one client makes local change(s), and more than one | 93 // method when more than one client makes local change(s), and more than one |
81 // client is waiting to receive those changes. | 94 // client is waiting to receive those changes. |
82 static bool AwaitQuiescence( | 95 static bool AwaitQuiescence( |
83 const std::vector<ProfileSyncServiceHarness*>& clients); | 96 const std::vector<ProfileSyncServiceHarness*>& clients); |
84 | 97 |
85 // Blocks the caller until the sync engine is initialized or some end state | 98 // Blocks the caller until the sync engine is initialized or some end state |
86 // (e.g., auth error) is reached. Returns true if and only if the engine | 99 // (e.g., auth error) is reached. Returns true if and only if the engine |
87 // initialized successfully. See ProfileSyncService's IsEngineInitialized() | 100 // initialized successfully. See ProfileSyncService's IsEngineInitialized() |
88 // method for the definition of engine initialization. | 101 // method for the definition of engine initialization. |
89 bool AwaitEngineInitialization(); | 102 bool AwaitEngineInitialization(); |
90 | 103 |
104 // Same as above, but without checks for passphrase decryption. | |
pavely
2017/03/07 07:26:16
Could you explain in CL description/comment why co
wylieb
2017/03/07 19:52:23
Done.
| |
105 bool AwaitEngineInitializationForClear(); | |
106 | |
91 // Blocks the caller until sync setup is complete. Returns true if and only | 107 // Blocks the caller until sync setup is complete. Returns true if and only |
92 // if sync setup completed successfully. See syncer::SyncService's | 108 // if sync setup completed successfully. See syncer::SyncService's |
93 // IsSyncActive() method for the definition of what successful means here. | 109 // IsSyncActive() method for the definition of what successful means here. |
94 bool AwaitSyncSetupCompletion(); | 110 bool AwaitSyncSetupCompletion(); |
95 | 111 |
112 // Saem as above, but without checks for passphrase decryption. | |
skym
2017/03/07 18:38:22
Saem should be Same
wylieb
2017/03/07 19:52:23
Done.
| |
113 bool AwaitSyncSetupCompletionForClear(); | |
114 | |
96 // Returns the ProfileSyncService member of the sync client. | 115 // Returns the ProfileSyncService member of the sync client. |
97 browser_sync::ProfileSyncService* service() const { return service_; } | 116 browser_sync::ProfileSyncService* service() const { return service_; } |
98 | 117 |
99 // Returns the debug name for this profile. Used for logging. | 118 // Returns the debug name for this profile. Used for logging. |
100 const std::string& profile_debug_name() const { return profile_debug_name_; } | 119 const std::string& profile_debug_name() const { return profile_debug_name_; } |
101 | 120 |
102 // Enables sync for a particular sync datatype. Returns true on success. | 121 // Enables sync for a particular sync datatype. Returns true on success. |
103 bool EnableSyncForDatatype(syncer::ModelType datatype); | 122 bool EnableSyncForDatatype(syncer::ModelType datatype); |
104 | 123 |
105 // Disables sync for a particular sync datatype. Returns true on success. | 124 // Disables sync for a particular sync datatype. Returns true on success. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 // all refresh tokens used in the tests are different. | 181 // all refresh tokens used in the tests are different. |
163 int oauth2_refesh_token_number_; | 182 int oauth2_refesh_token_number_; |
164 | 183 |
165 // Used for logging. | 184 // Used for logging. |
166 const std::string profile_debug_name_; | 185 const std::string profile_debug_name_; |
167 | 186 |
168 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); | 187 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); |
169 }; | 188 }; |
170 | 189 |
171 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ | 190 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ |
OLD | NEW |