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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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/syncable/syncable_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 #pragma once 9 #pragma once
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // the syncer. 177 // the syncer.
178 int GetAndClearNumGetUpdatesRequests() { 178 int GetAndClearNumGetUpdatesRequests() {
179 int result = num_get_updates_requests_; 179 int result = num_get_updates_requests_;
180 num_get_updates_requests_ = 0; 180 num_get_updates_requests_ = 0;
181 return result; 181 return result;
182 } 182 }
183 183
184 // Expect that GetUpdates will request exactly the types indicated in 184 // Expect that GetUpdates will request exactly the types indicated in
185 // the bitset. 185 // the bitset.
186 void ExpectGetUpdatesRequestTypes( 186 void ExpectGetUpdatesRequestTypes(
187 syncable::ModelTypeSet expected_filter) { 187 syncer::ModelTypeSet expected_filter) {
188 expected_filter_ = expected_filter; 188 expected_filter_ = expected_filter;
189 } 189 }
190 190
191 void ExpectGetUpdatesRequestPayloads( 191 void ExpectGetUpdatesRequestPayloads(
192 const syncable::ModelTypePayloadMap& payloads) { 192 const syncer::ModelTypePayloadMap& payloads) {
193 expected_payloads_ = payloads; 193 expected_payloads_ = payloads;
194 } 194 }
195 195
196 void SetServerReachable(); 196 void SetServerReachable();
197 197
198 void SetServerNotReachable(); 198 void SetServerNotReachable();
199 199
200 // Updates our internal state as if we had attempted a connection. Does not 200 // Updates our internal state as if we had attempted a connection. Does not
201 // send notifications as a real connection attempt would. This is useful in 201 // send notifications as a real connection attempt would. This is useful in
202 // cases where we're mocking out most of the code that performs network 202 // cases where we're mocking out most of the code that performs network
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // client. 253 // client.
254 sync_pb::GetUpdatesResponse* GetUpdateResponse(); 254 sync_pb::GetUpdatesResponse* GetUpdateResponse();
255 void ApplyToken(); 255 void ApplyToken();
256 256
257 // Determine whether an progress marker array (like that sent in 257 // Determine whether an progress marker array (like that sent in
258 // GetUpdates.from_progress_marker) indicates that a particular ModelType 258 // GetUpdates.from_progress_marker) indicates that a particular ModelType
259 // should be included. 259 // should be included.
260 bool IsModelTypePresentInSpecifics( 260 bool IsModelTypePresentInSpecifics(
261 const google::protobuf::RepeatedPtrField< 261 const google::protobuf::RepeatedPtrField<
262 sync_pb::DataTypeProgressMarker>& filter, 262 sync_pb::DataTypeProgressMarker>& filter,
263 syncable::ModelType value); 263 syncer::ModelType value);
264 264
265 sync_pb::DataTypeProgressMarker const* GetProgressMarkerForType( 265 sync_pb::DataTypeProgressMarker const* GetProgressMarkerForType(
266 const google::protobuf::RepeatedPtrField< 266 const google::protobuf::RepeatedPtrField<
267 sync_pb::DataTypeProgressMarker>& filter, 267 sync_pb::DataTypeProgressMarker>& filter,
268 syncable::ModelType value); 268 syncer::ModelType value);
269 269
270 // When false, we pretend to have network connectivity issues. 270 // When false, we pretend to have network connectivity issues.
271 bool server_reachable_; 271 bool server_reachable_;
272 272
273 // All IDs that have been committed. 273 // All IDs that have been committed.
274 std::vector<syncable::Id> committed_ids_; 274 std::vector<syncable::Id> committed_ids_;
275 275
276 // Control of when/if we return conflicts. 276 // Control of when/if we return conflicts.
277 bool conflict_all_commits_; 277 bool conflict_all_commits_;
278 int conflict_n_commits_; 278 int conflict_n_commits_;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 scoped_ptr<sync_pb::ClientCommand> client_command_; 330 scoped_ptr<sync_pb::ClientCommand> client_command_;
331 331
332 // The next value to use for the position_in_parent property. 332 // The next value to use for the position_in_parent property.
333 int64 next_position_in_parent_; 333 int64 next_position_in_parent_;
334 334
335 // The default is to use the newer sync_pb::BookmarkSpecifics-style protocol. 335 // The default is to use the newer sync_pb::BookmarkSpecifics-style protocol.
336 // If this option is set to true, then the MockConnectionManager will 336 // If this option is set to true, then the MockConnectionManager will
337 // use the older sync_pb::SyncEntity_BookmarkData-style protocol. 337 // use the older sync_pb::SyncEntity_BookmarkData-style protocol.
338 bool use_legacy_bookmarks_protocol_; 338 bool use_legacy_bookmarks_protocol_;
339 339
340 syncable::ModelTypeSet expected_filter_; 340 syncer::ModelTypeSet expected_filter_;
341 341
342 syncable::ModelTypePayloadMap expected_payloads_; 342 syncer::ModelTypePayloadMap expected_payloads_;
343 343
344 int num_get_updates_requests_; 344 int num_get_updates_requests_;
345 345
346 std::string next_token_; 346 std::string next_token_;
347 347
348 sync_pb::ClientToServerMessage last_request_; 348 sync_pb::ClientToServerMessage last_request_;
349 349
350 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); 350 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager);
351 }; 351 };
352 352
353 } // namespace syncer 353 } // namespace syncer
354 354
355 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ 355 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_
OLDNEW
« no previous file with comments | « sync/syncable/syncable_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