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

Side by Side Diff: sync/test/engine/mock_connection_manager.h

Issue 10455012: [Sync] Add support for performing a GetKey on startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move GetEncryptionKey logic into GetUpdates Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Mock ServerConnectionManager class for use in client unit tests. 5 // Mock ServerConnectionManager class for use in client unit tests.
6 6
7 #ifndef SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ 7 #ifndef SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_
8 #define SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ 8 #define SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_
9 9
10 #include <bitset> 10 #include <bitset>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void SetChangesRemaining(int64 count); 115 void SetChangesRemaining(int64 count);
116 116
117 // Add a new batch of updates after the current one. Allows multiple 117 // Add a new batch of updates after the current one. Allows multiple
118 // GetUpdates responses to be buffered up, since the syncer may 118 // GetUpdates responses to be buffered up, since the syncer may
119 // issue multiple requests during a sync cycle. 119 // issue multiple requests during a sync cycle.
120 void NextUpdateBatch(); 120 void NextUpdateBatch();
121 121
122 void FailNextPostBufferToPathCall() { countdown_to_postbuffer_fail_ = 1; } 122 void FailNextPostBufferToPathCall() { countdown_to_postbuffer_fail_ = 1; }
123 void FailNthPostBufferToPathCall(int n) { countdown_to_postbuffer_fail_ = n; } 123 void FailNthPostBufferToPathCall(int n) { countdown_to_postbuffer_fail_ = n; }
124 124
125 void SetKeystoreKey(const std::string& key);
126
125 void FailNonPeriodicGetUpdates() { fail_non_periodic_get_updates_ = true; } 127 void FailNonPeriodicGetUpdates() { fail_non_periodic_get_updates_ = true; }
126 128
127 // Simple inspectors. 129 // Simple inspectors.
128 bool client_stuck() const { return client_stuck_; } 130 bool client_stuck() const { return client_stuck_; }
129 131
130 sync_pb::ClientCommand* GetNextClientCommand(); 132 sync_pb::ClientCommand* GetNextClientCommand();
131 133
132 const std::vector<syncable::Id>& committed_ids() const { 134 const std::vector<syncable::Id>& committed_ids() const {
133 return committed_ids_; 135 return committed_ids_;
134 } 136 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // Our directory. Used only to ensure that we are not holding the transaction 299 // Our directory. Used only to ensure that we are not holding the transaction
298 // lock when performing network I/O. Can be NULL if the test author is 300 // lock when performing network I/O. Can be NULL if the test author is
299 // confident this can't happen. 301 // confident this can't happen.
300 syncable::Directory* directory_; 302 syncable::Directory* directory_;
301 303
302 // The updates we'll return to the next request. 304 // The updates we'll return to the next request.
303 std::list<sync_pb::GetUpdatesResponse> update_queue_; 305 std::list<sync_pb::GetUpdatesResponse> update_queue_;
304 base::Closure mid_commit_callback_; 306 base::Closure mid_commit_callback_;
305 MidCommitObserver* mid_commit_observer_; 307 MidCommitObserver* mid_commit_observer_;
306 308
307 // The clear data response we'll return in the next response 309 // The keystore key we return for a GetUpdates with need_encryption_key set.
308 sync_pb::SyncEnums::ErrorType clear_user_data_response_errortype_; 310 std::string keystore_key_;
309 311
310 // The AUTHENTICATE response we'll return for auth requests. 312 // The AUTHENTICATE response we'll return for auth requests.
311 sync_pb::AuthenticateResponse auth_response_; 313 sync_pb::AuthenticateResponse auth_response_;
312 // What we use to determine if we should return SUCCESS or BAD_AUTH_TOKEN. 314 // What we use to determine if we should return SUCCESS or BAD_AUTH_TOKEN.
313 std::string valid_auth_token_; 315 std::string valid_auth_token_;
314 316
315 // Whether we are faking a server mandating clients to throttle requests. 317 // Whether we are faking a server mandating clients to throttle requests.
316 // Protected by |response_code_override_lock_|. 318 // Protected by |response_code_override_lock_|.
317 bool throttling_; 319 bool throttling_;
318 320
(...skipping 26 matching lines...) Expand all
345 std::string next_token_; 347 std::string next_token_;
346 348
347 sync_pb::ClientToServerMessage last_request_; 349 sync_pb::ClientToServerMessage last_request_;
348 350
349 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); 351 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager);
350 }; 352 };
351 353
352 } // namespace syncer 354 } // namespace syncer
353 355
354 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ 356 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698