OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 7 #ifndef CHROME_BROWSER_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
8 #define CHROME_BROWSER_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 8 #define CHROME_BROWSER_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 sync_pb::SyncEntity* AddUpdateDirectory(std::string id, | 88 sync_pb::SyncEntity* AddUpdateDirectory(std::string id, |
89 std::string parent_id, | 89 std::string parent_id, |
90 std::string name, | 90 std::string name, |
91 int64 version, | 91 int64 version, |
92 int64 sync_ts); | 92 int64 sync_ts); |
93 sync_pb::SyncEntity* AddUpdateBookmark(std::string id, | 93 sync_pb::SyncEntity* AddUpdateBookmark(std::string id, |
94 std::string parent_id, | 94 std::string parent_id, |
95 std::string name, | 95 std::string name, |
96 int64 version, | 96 int64 version, |
97 int64 sync_ts); | 97 int64 sync_ts); |
| 98 // Versions of the AddUpdate function that accept specifics. |
| 99 sync_pb::SyncEntity* AddUpdateSpecifics(int id, int parent_id, |
| 100 std::string name,int64 version, int64 sync_ts, bool is_dir, |
| 101 int64 position, const sync_pb::EntitySpecifics& specifics); |
| 102 sync_pb::SyncEntity* SetNigori(int id, int64 version, int64 sync_ts, |
| 103 const sync_pb::EntitySpecifics& specifics); |
98 | 104 |
99 // Find the last commit sent by the client, and replay it for the next get | 105 // Find the last commit sent by the client, and replay it for the next get |
100 // updates command. This can be used to simulate the GetUpdates that happens | 106 // updates command. This can be used to simulate the GetUpdates that happens |
101 // immediately after a successful commit. | 107 // immediately after a successful commit. |
102 sync_pb::SyncEntity* AddUpdateFromLastCommit(); | 108 sync_pb::SyncEntity* AddUpdateFromLastCommit(); |
103 | 109 |
104 // Add a deleted item. Deletion records typically contain no | 110 // Add a deleted item. Deletion records typically contain no |
105 // additional information beyond the deletion, and no specifics. | 111 // additional information beyond the deletion, and no specifics. |
106 // The server may send the originator fields. | 112 // The server may send the originator fields. |
107 void AddUpdateTombstone(const syncable::Id& id); | 113 void AddUpdateTombstone(const syncable::Id& id); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 237 |
232 private: | 238 private: |
233 sync_pb::SyncEntity* AddUpdateFull(syncable::Id id, syncable::Id parentid, | 239 sync_pb::SyncEntity* AddUpdateFull(syncable::Id id, syncable::Id parentid, |
234 std::string name, int64 version, | 240 std::string name, int64 version, |
235 int64 sync_ts, | 241 int64 sync_ts, |
236 bool is_dir); | 242 bool is_dir); |
237 sync_pb::SyncEntity* AddUpdateFull(std::string id, | 243 sync_pb::SyncEntity* AddUpdateFull(std::string id, |
238 std::string parentid, std::string name, | 244 std::string parentid, std::string name, |
239 int64 version, int64 sync_ts, | 245 int64 version, int64 sync_ts, |
240 bool is_dir); | 246 bool is_dir); |
| 247 sync_pb::SyncEntity* AddUpdateMeta(std::string id, std::string parentid, |
| 248 std::string name, int64 version, |
| 249 int64 sync_ts); |
| 250 |
241 // Functions to handle the various types of server request. | 251 // Functions to handle the various types of server request. |
242 void ProcessGetUpdates(sync_pb::ClientToServerMessage* csm, | 252 void ProcessGetUpdates(sync_pb::ClientToServerMessage* csm, |
243 sync_pb::ClientToServerResponse* response); | 253 sync_pb::ClientToServerResponse* response); |
244 void ProcessAuthenticate(sync_pb::ClientToServerMessage* csm, | 254 void ProcessAuthenticate(sync_pb::ClientToServerMessage* csm, |
245 sync_pb::ClientToServerResponse* response, | 255 sync_pb::ClientToServerResponse* response, |
246 const std::string& auth_token); | 256 const std::string& auth_token); |
247 void ProcessCommit(sync_pb::ClientToServerMessage* csm, | 257 void ProcessCommit(sync_pb::ClientToServerMessage* csm, |
248 sync_pb::ClientToServerResponse* response_buffer); | 258 sync_pb::ClientToServerResponse* response_buffer); |
249 void ProcessClearData(sync_pb::ClientToServerMessage* csm, | 259 void ProcessClearData(sync_pb::ClientToServerMessage* csm, |
250 sync_pb::ClientToServerResponse* response); | 260 sync_pb::ClientToServerResponse* response); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 int num_get_updates_requests_; | 361 int num_get_updates_requests_; |
352 | 362 |
353 std::string next_token_; | 363 std::string next_token_; |
354 | 364 |
355 sync_pb::ClientToServerMessage last_request_; | 365 sync_pb::ClientToServerMessage last_request_; |
356 | 366 |
357 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); | 367 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); |
358 }; | 368 }; |
359 | 369 |
360 #endif // CHROME_BROWSER_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 370 #endif // CHROME_BROWSER_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
OLD | NEW |