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

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

Issue 10795018: [Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fiix indent 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/write_transaction_info.h ('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>
11 #include <list> 11 #include <list>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
18 #include "sync/engine/net/server_connection_manager.h" 18 #include "sync/engine/net/server_connection_manager.h"
19 #include "sync/internal_api/public/base/model_type.h" 19 #include "sync/internal_api/public/base/model_type.h"
20 #include "sync/internal_api/public/base/model_type_payload_map.h" 20 #include "sync/internal_api/public/base/model_type_payload_map.h"
21 #include "sync/protocol/sync.pb.h" 21 #include "sync/protocol/sync.pb.h"
22 22
23 namespace syncer { 23 namespace syncer {
24 24
25 class MockConnectionManager : public syncer::ServerConnectionManager { 25 class MockConnectionManager : public ServerConnectionManager {
26 public: 26 public:
27 class MidCommitObserver { 27 class MidCommitObserver {
28 public: 28 public:
29 virtual void Observe() = 0; 29 virtual void Observe() = 0;
30 30
31 protected: 31 protected:
32 virtual ~MidCommitObserver() {} 32 virtual ~MidCommitObserver() {}
33 }; 33 };
34 34
35 explicit MockConnectionManager(syncable::Directory*); 35 explicit MockConnectionManager(syncable::Directory*);
36 virtual ~MockConnectionManager(); 36 virtual ~MockConnectionManager();
37 37
38 // Overridden ServerConnectionManager functions. 38 // Overridden ServerConnectionManager functions.
39 virtual bool PostBufferToPath( 39 virtual bool PostBufferToPath(
40 PostBufferParams*, 40 PostBufferParams*,
41 const std::string& path, 41 const std::string& path,
42 const std::string& auth_token, 42 const std::string& auth_token,
43 syncer::ScopedServerStatusWatcher* watcher) OVERRIDE; 43 ScopedServerStatusWatcher* watcher) OVERRIDE;
44 44
45 // Control of commit response. 45 // Control of commit response.
46 // NOTE: Commit callback is invoked only once then reset. 46 // NOTE: Commit callback is invoked only once then reset.
47 void SetMidCommitCallback(const base::Closure& callback); 47 void SetMidCommitCallback(const base::Closure& callback);
48 void SetMidCommitObserver(MidCommitObserver* observer); 48 void SetMidCommitObserver(MidCommitObserver* observer);
49 49
50 // Set this if you want commit to perform commit time rename. Will request 50 // Set this if you want commit to perform commit time rename. Will request
51 // that the client renames all commited entries, prepending this string. 51 // that the client renames all commited entries, prepending this string.
52 void SetCommitTimeRename(std::string prepend); 52 void SetCommitTimeRename(std::string prepend);
53 53
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // verify that a GetUpdates actually did or did not happen after running 175 // verify that a GetUpdates actually did or did not happen after running
176 // the syncer. 176 // the syncer.
177 int GetAndClearNumGetUpdatesRequests() { 177 int GetAndClearNumGetUpdatesRequests() {
178 int result = num_get_updates_requests_; 178 int result = num_get_updates_requests_;
179 num_get_updates_requests_ = 0; 179 num_get_updates_requests_ = 0;
180 return result; 180 return result;
181 } 181 }
182 182
183 // Expect that GetUpdates will request exactly the types indicated in 183 // Expect that GetUpdates will request exactly the types indicated in
184 // the bitset. 184 // the bitset.
185 void ExpectGetUpdatesRequestTypes( 185 void ExpectGetUpdatesRequestTypes(ModelTypeSet expected_filter) {
186 syncer::ModelTypeSet expected_filter) {
187 expected_filter_ = expected_filter; 186 expected_filter_ = expected_filter;
188 } 187 }
189 188
190 void ExpectGetUpdatesRequestPayloads( 189 void ExpectGetUpdatesRequestPayloads(const ModelTypePayloadMap& payloads) {
191 const syncer::ModelTypePayloadMap& payloads) {
192 expected_payloads_ = payloads; 190 expected_payloads_ = payloads;
193 } 191 }
194 192
195 void SetServerReachable(); 193 void SetServerReachable();
196 194
197 void SetServerNotReachable(); 195 void SetServerNotReachable();
198 196
199 // Updates our internal state as if we had attempted a connection. Does not 197 // Updates our internal state as if we had attempted a connection. Does not
200 // send notifications as a real connection attempt would. This is useful in 198 // send notifications as a real connection attempt would. This is useful in
201 // cases where we're mocking out most of the code that performs network 199 // 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
252 // client. 250 // client.
253 sync_pb::GetUpdatesResponse* GetUpdateResponse(); 251 sync_pb::GetUpdatesResponse* GetUpdateResponse();
254 void ApplyToken(); 252 void ApplyToken();
255 253
256 // Determine whether an progress marker array (like that sent in 254 // Determine whether an progress marker array (like that sent in
257 // GetUpdates.from_progress_marker) indicates that a particular ModelType 255 // GetUpdates.from_progress_marker) indicates that a particular ModelType
258 // should be included. 256 // should be included.
259 bool IsModelTypePresentInSpecifics( 257 bool IsModelTypePresentInSpecifics(
260 const google::protobuf::RepeatedPtrField< 258 const google::protobuf::RepeatedPtrField<
261 sync_pb::DataTypeProgressMarker>& filter, 259 sync_pb::DataTypeProgressMarker>& filter,
262 syncer::ModelType value); 260 ModelType value);
263 261
264 sync_pb::DataTypeProgressMarker const* GetProgressMarkerForType( 262 sync_pb::DataTypeProgressMarker const* GetProgressMarkerForType(
265 const google::protobuf::RepeatedPtrField< 263 const google::protobuf::RepeatedPtrField<
266 sync_pb::DataTypeProgressMarker>& filter, 264 sync_pb::DataTypeProgressMarker>& filter,
267 syncer::ModelType value); 265 ModelType value);
268 266
269 // When false, we pretend to have network connectivity issues. 267 // When false, we pretend to have network connectivity issues.
270 bool server_reachable_; 268 bool server_reachable_;
271 269
272 // All IDs that have been committed. 270 // All IDs that have been committed.
273 std::vector<syncable::Id> committed_ids_; 271 std::vector<syncable::Id> committed_ids_;
274 272
275 // Control of when/if we return conflicts. 273 // Control of when/if we return conflicts.
276 bool conflict_all_commits_; 274 bool conflict_all_commits_;
277 int conflict_n_commits_; 275 int conflict_n_commits_;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 scoped_ptr<sync_pb::ClientCommand> client_command_; 327 scoped_ptr<sync_pb::ClientCommand> client_command_;
330 328
331 // The next value to use for the position_in_parent property. 329 // The next value to use for the position_in_parent property.
332 int64 next_position_in_parent_; 330 int64 next_position_in_parent_;
333 331
334 // The default is to use the newer sync_pb::BookmarkSpecifics-style protocol. 332 // The default is to use the newer sync_pb::BookmarkSpecifics-style protocol.
335 // If this option is set to true, then the MockConnectionManager will 333 // If this option is set to true, then the MockConnectionManager will
336 // use the older sync_pb::SyncEntity_BookmarkData-style protocol. 334 // use the older sync_pb::SyncEntity_BookmarkData-style protocol.
337 bool use_legacy_bookmarks_protocol_; 335 bool use_legacy_bookmarks_protocol_;
338 336
339 syncer::ModelTypeSet expected_filter_; 337 ModelTypeSet expected_filter_;
340 338
341 syncer::ModelTypePayloadMap expected_payloads_; 339 ModelTypePayloadMap expected_payloads_;
342 340
343 int num_get_updates_requests_; 341 int num_get_updates_requests_;
344 342
345 std::string next_token_; 343 std::string next_token_;
346 344
347 sync_pb::ClientToServerMessage last_request_; 345 sync_pb::ClientToServerMessage last_request_;
348 346
349 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); 347 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager);
350 }; 348 };
351 349
352 } // namespace syncer 350 } // namespace syncer
353 351
354 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ 352 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_
OLDNEW
« no previous file with comments | « sync/syncable/write_transaction_info.h ('k') | sync/test/engine/mock_connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698