Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: chrome/browser/sync/test/integration/profile_sync_service_harness.h

Issue 2716413003: Initial clear server data impl (Closed)
Patch Set: Adding confirmationuiclosed to prevent timeouts, addressing some naming concerns, and removing logg… Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 // Sets the GAIA credentials with which to sign in to sync. 49 // Sets the GAIA credentials with which to sign in to sync.
50 void SetCredentials(const std::string& username, const std::string& password); 50 void SetCredentials(const std::string& username, const std::string& password);
51 51
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 // Setup sync without the authenticating through the passphrase encryption.
59 // Use this method when you need to setup a client that you're going to call
60 // RestartSyncService() directly after.
61 bool SetupSyncForClearingServerData();
62
63 // Both SetupSync and SetupSyncForClear call into this method.
58 // Same as the above method, but enables sync only for the datatypes contained 64 // Same as the above method, but enables sync only for the datatypes contained
59 // in |synced_datatypes|. 65 // in |synced_datatypes|.
60 bool SetupSync(syncer::ModelTypeSet synced_datatypes); 66 bool SetupSync(syncer::ModelTypeSet synced_datatypes,
67 bool skip_passphrase_verification = false);
68
69 // Restart sync service to simulate a sign-in/sign-out. This is useful
70 // to recover from a lost birthday. Use directly after a clear server data
71 // command to start from clean slate.
72 bool RestartSyncService();
61 73
62 // Calling this acts as a barrier and blocks the caller until |this| and 74 // 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, 75 // |partner| have both completed a sync cycle. When calling this method,
64 // the |partner| should be the passive responder who responds to the actions 76 // the |partner| should be the passive responder who responds to the actions
65 // of |this|. This method relies upon the synchronization of callbacks 77 // of |this|. This method relies upon the synchronization of callbacks
66 // from the message queue. Returns true if two sync cycles have completed. 78 // 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 79 // Note: Use this method when exactly one client makes local change(s), and
68 // exactly one client is waiting to receive those changes. 80 // exactly one client is waiting to receive those changes.
69 bool AwaitMutualSyncCycleCompletion(ProfileSyncServiceHarness* partner); 81 bool AwaitMutualSyncCycleCompletion(ProfileSyncServiceHarness* partner);
70 82
71 // Blocks the caller until |this| completes its ongoing sync cycle and every 83 // Blocks the caller until |this| completes its ongoing sync cycle and every
72 // other client in |partners| have achieved identical download progresses. 84 // other client in |partners| have achieved identical download progresses.
73 // Note: Use this method when exactly one client makes local change(s), 85 // Note: Use this method when exactly one client makes local change(s),
74 // and more than one client is waiting to receive those changes. 86 // and more than one client is waiting to receive those changes.
75 bool AwaitGroupSyncCycleCompletion( 87 bool AwaitGroupSyncCycleCompletion(
76 const std::vector<ProfileSyncServiceHarness*>& partners); 88 const std::vector<ProfileSyncServiceHarness*>& partners);
77 89
78 // Blocks the caller until every client in |clients| completes its ongoing 90 // Blocks the caller until every client in |clients| completes its ongoing
79 // sync cycle and all the clients' progress markers match. Note: Use this 91 // 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 92 // method when more than one client makes local change(s), and more than one
81 // client is waiting to receive those changes. 93 // client is waiting to receive those changes.
82 static bool AwaitQuiescence( 94 static bool AwaitQuiescence(
83 const std::vector<ProfileSyncServiceHarness*>& clients); 95 const std::vector<ProfileSyncServiceHarness*>& clients);
84 96
85 // Blocks the caller until the sync engine is initialized or some end state 97 // 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 98 // (e.g., auth error) is reached. Returns true if and only if the engine
87 // initialized successfully. See ProfileSyncService's IsEngineInitialized() 99 // initialized successfully. See ProfileSyncService's IsEngineInitialized()
88 // method for the definition of engine initialization. 100 // method for the definition of engine initialization.
89 bool AwaitEngineInitialization(); 101 bool AwaitEngineInitialization(bool skip_passphrase_verification = false);
90 102
91 // Blocks the caller until sync setup is complete. Returns true if and only 103 // Blocks the caller until sync setup is complete. Returns true if and only
92 // if sync setup completed successfully. See syncer::SyncService's 104 // if sync setup completed successfully. See syncer::SyncService's
93 // IsSyncActive() method for the definition of what successful means here. 105 // IsSyncActive() method for the definition of what successful means here.
94 bool AwaitSyncSetupCompletion(); 106 bool AwaitSyncSetupCompletion(bool skip_passphrase_verification = false);
95 107
96 // Returns the ProfileSyncService member of the sync client. 108 // Returns the ProfileSyncService member of the sync client.
97 browser_sync::ProfileSyncService* service() const { return service_; } 109 browser_sync::ProfileSyncService* service() const { return service_; }
98 110
99 // Returns the debug name for this profile. Used for logging. 111 // Returns the debug name for this profile. Used for logging.
100 const std::string& profile_debug_name() const { return profile_debug_name_; } 112 const std::string& profile_debug_name() const { return profile_debug_name_; }
101 113
102 // Enables sync for a particular sync datatype. Returns true on success. 114 // Enables sync for a particular sync datatype. Returns true on success.
103 bool EnableSyncForDatatype(syncer::ModelType datatype); 115 bool EnableSyncForDatatype(syncer::ModelType datatype);
104 116
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // all refresh tokens used in the tests are different. 174 // all refresh tokens used in the tests are different.
163 int oauth2_refesh_token_number_; 175 int oauth2_refesh_token_number_;
164 176
165 // Used for logging. 177 // Used for logging.
166 const std::string profile_debug_name_; 178 const std::string profile_debug_name_;
167 179
168 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness); 180 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceHarness);
169 }; 181 };
170 182
171 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_ 183 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_PROFILE_SYNC_SERVICE_HARNESS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698