| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_TEST_SYNC_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 7 #ifndef CHROME_TEST_SYNC_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
| 8 #define CHROME_TEST_SYNC_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 8 #define CHROME_TEST_SYNC_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
| 9 | 9 |
| 10 #include <bitset> | 10 #include <bitset> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void SetCommitTimeRename(string prepend); | 54 void SetCommitTimeRename(string prepend); |
| 55 | 55 |
| 56 // Control of get updates response. All updates set will only be returned | 56 // Control of get updates response. All updates set will only be returned |
| 57 // once. This mock object doesn't simulate a changelist, it simulates server | 57 // once. This mock object doesn't simulate a changelist, it simulates server |
| 58 // responses. | 58 // responses. |
| 59 void ResetUpdates(); | 59 void ResetUpdates(); |
| 60 // Generic versions of AddUpdate functions. Tests using these function should | 60 // Generic versions of AddUpdate functions. Tests using these function should |
| 61 // compile for both the int64 and string id based versions of the server. | 61 // compile for both the int64 and string id based versions of the server. |
| 62 // The SyncEntity returned is only valid until the Sync is completed | 62 // The SyncEntity returned is only valid until the Sync is completed |
| 63 // (e.g. with SyncShare.) It allows to add further entity properties before | 63 // (e.g. with SyncShare.) It allows to add further entity properties before |
| 64 // sync, using AddUpdateExtendedAttributes. | 64 // sync, using SetLastXXX() methods and/or GetMutableLastUpdate(). |
| 65 sync_pb::SyncEntity* AddUpdateDirectory(syncable::Id id, | 65 sync_pb::SyncEntity* AddUpdateDirectory(syncable::Id id, |
| 66 syncable::Id parent_id, | 66 syncable::Id parent_id, |
| 67 string name, | 67 string name, |
| 68 int64 version, | 68 int64 version, |
| 69 int64 sync_ts); | 69 int64 sync_ts); |
| 70 sync_pb::SyncEntity* AddUpdateBookmark(syncable::Id id, | 70 sync_pb::SyncEntity* AddUpdateBookmark(syncable::Id id, |
| 71 syncable::Id parent_id, | 71 syncable::Id parent_id, |
| 72 string name, | 72 string name, |
| 73 int64 version, | 73 int64 version, |
| 74 int64 sync_ts); | 74 int64 sync_ts); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 87 sync_pb::SyncEntity* AddUpdateDirectory(string id, | 87 sync_pb::SyncEntity* AddUpdateDirectory(string id, |
| 88 string parent_id, | 88 string parent_id, |
| 89 string name, | 89 string name, |
| 90 int64 version, | 90 int64 version, |
| 91 int64 sync_ts); | 91 int64 sync_ts); |
| 92 sync_pb::SyncEntity* AddUpdateBookmark(string id, | 92 sync_pb::SyncEntity* AddUpdateBookmark(string id, |
| 93 string parent_id, | 93 string parent_id, |
| 94 string name, | 94 string name, |
| 95 int64 version, | 95 int64 version, |
| 96 int64 sync_ts); | 96 int64 sync_ts); |
| 97 void AddUpdateExtendedAttributes(sync_pb::SyncEntity* ent, | |
| 98 std::string* xattr_key, | |
| 99 syncable::Blob* xattr_value, | |
| 100 int xattr_count); | |
| 101 | |
| 102 void SetLastUpdateDeleted(); | 97 void SetLastUpdateDeleted(); |
| 103 void SetLastUpdateServerTag(const string& tag); | 98 void SetLastUpdateServerTag(const string& tag); |
| 104 void SetLastUpdateClientTag(const string& tag); | 99 void SetLastUpdateClientTag(const string& tag); |
| 105 void SetLastUpdateOriginatorFields(const string& client_id, | 100 void SetLastUpdateOriginatorFields(const string& client_id, |
| 106 const string& entry_id); | 101 const string& entry_id); |
| 107 void SetLastUpdatePosition(int64 position_in_parent); | 102 void SetLastUpdatePosition(int64 position_in_parent); |
| 108 void SetNewTimestamp(int64 ts); | 103 void SetNewTimestamp(int64 ts); |
| 109 void SetChangesRemaining(int64 timestamp); | 104 void SetChangesRemaining(int64 timestamp); |
| 110 | 105 |
| 111 // For AUTHENTICATE responses. | 106 // For AUTHENTICATE responses. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 std::bitset<syncable::MODEL_TYPE_COUNT> expected_filter_; | 276 std::bitset<syncable::MODEL_TYPE_COUNT> expected_filter_; |
| 282 | 277 |
| 283 int num_get_updates_requests_; | 278 int num_get_updates_requests_; |
| 284 | 279 |
| 285 sync_pb::ClientToServerMessage last_request_; | 280 sync_pb::ClientToServerMessage last_request_; |
| 286 | 281 |
| 287 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); | 282 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); |
| 288 }; | 283 }; |
| 289 | 284 |
| 290 #endif // CHROME_TEST_SYNC_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 285 #endif // CHROME_TEST_SYNC_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
| OLD | NEW |