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

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

Issue 10909160: sync: Process client commands on commit response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Inline client command processing Created 8 years, 3 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
« no previous file with comments | « sync/engine/syncer_unittest.cc ('k') | sync/test/engine/mock_connection_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
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); 125 void SetKeystoreKey(const std::string& key);
126 126
127 void FailNonPeriodicGetUpdates() { fail_non_periodic_get_updates_ = true; } 127 void FailNonPeriodicGetUpdates() { fail_non_periodic_get_updates_ = true; }
128 128
129 // Simple inspectors. 129 // Simple inspectors.
130 bool client_stuck() const { return client_stuck_; } 130 bool client_stuck() const { return client_stuck_; }
131 131
132 sync_pb::ClientCommand* GetNextClientCommand(); 132 // warning: These take ownership of their input.
133 void SetGUClientCommand(sync_pb::ClientCommand* command);
134 void SetCommitClientCommand(sync_pb::ClientCommand* command);
133 135
134 const std::vector<syncable::Id>& committed_ids() const { 136 const std::vector<syncable::Id>& committed_ids() const {
135 return committed_ids_; 137 return committed_ids_;
136 } 138 }
137 const std::vector<sync_pb::CommitMessage*>& commit_messages() const { 139 const std::vector<sync_pb::CommitMessage*>& commit_messages() const {
138 return commit_messages_.get(); 140 return commit_messages_.get();
139 } 141 }
140 const std::vector<sync_pb::CommitResponse*>& commit_responses() const { 142 const std::vector<sync_pb::CommitResponse*>& commit_responses() const {
141 return commit_responses_.get(); 143 return commit_responses_.get();
142 } 144 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // Whether we are failing all requests by returning 321 // Whether we are failing all requests by returning
320 // ClientToServerResponse::AUTH_INVALID. 322 // ClientToServerResponse::AUTH_INVALID.
321 // Protected by |response_code_override_lock_|. 323 // Protected by |response_code_override_lock_|.
322 bool fail_with_auth_invalid_; 324 bool fail_with_auth_invalid_;
323 325
324 base::Lock response_code_override_lock_; 326 base::Lock response_code_override_lock_;
325 327
326 // True if we are only accepting GetUpdatesCallerInfo::PERIODIC requests. 328 // True if we are only accepting GetUpdatesCallerInfo::PERIODIC requests.
327 bool fail_non_periodic_get_updates_; 329 bool fail_non_periodic_get_updates_;
328 330
329 scoped_ptr<sync_pb::ClientCommand> client_command_; 331 scoped_ptr<sync_pb::ClientCommand> gu_client_command_;
332 scoped_ptr<sync_pb::ClientCommand> commit_client_command_;
330 333
331 // The next value to use for the position_in_parent property. 334 // The next value to use for the position_in_parent property.
332 int64 next_position_in_parent_; 335 int64 next_position_in_parent_;
333 336
334 // The default is to use the newer sync_pb::BookmarkSpecifics-style protocol. 337 // The default is to use the newer sync_pb::BookmarkSpecifics-style protocol.
335 // If this option is set to true, then the MockConnectionManager will 338 // If this option is set to true, then the MockConnectionManager will
336 // use the older sync_pb::SyncEntity_BookmarkData-style protocol. 339 // use the older sync_pb::SyncEntity_BookmarkData-style protocol.
337 bool use_legacy_bookmarks_protocol_; 340 bool use_legacy_bookmarks_protocol_;
338 341
339 ModelTypeSet expected_filter_; 342 ModelTypeSet expected_filter_;
340 343
341 ModelTypeStateMap expected_states_; 344 ModelTypeStateMap expected_states_;
342 345
343 int num_get_updates_requests_; 346 int num_get_updates_requests_;
344 347
345 std::string next_token_; 348 std::string next_token_;
346 349
347 sync_pb::ClientToServerMessage last_request_; 350 sync_pb::ClientToServerMessage last_request_;
348 351
349 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); 352 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager);
350 }; 353 };
351 354
352 } // namespace syncer 355 } // namespace syncer
353 356
354 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ 357 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_
OLDNEW
« no previous file with comments | « sync/engine/syncer_unittest.cc ('k') | sync/test/engine/mock_connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698