| OLD | NEW |
| 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 #ifndef SYNC_TEST_TEST_ENTRY_FACTORY_H_ | 5 #ifndef SYNC_TEST_TEST_ENTRY_FACTORY_H_ |
| 6 #define SYNC_TEST_TEST_ENTRY_FACTORY_H_ | 6 #define SYNC_TEST_TEST_ENTRY_FACTORY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Creates a bookmark that is both unsynced an an unapplied update. Returns | 54 // Creates a bookmark that is both unsynced an an unapplied update. Returns |
| 55 // the metahandle of the created item. | 55 // the metahandle of the created item. |
| 56 int64 CreateUnappliedAndUnsyncedBookmarkItem(const std::string& name); | 56 int64 CreateUnappliedAndUnsyncedBookmarkItem(const std::string& name); |
| 57 | 57 |
| 58 // Creates a unique_client_tag item that has neither IS_UNSYNED or | 58 // Creates a unique_client_tag item that has neither IS_UNSYNED or |
| 59 // IS_UNAPPLIED_UPDATE. The item is known to both the server and client. | 59 // IS_UNAPPLIED_UPDATE. The item is known to both the server and client. |
| 60 // Returns the metahandle of the created item. | 60 // Returns the metahandle of the created item. |
| 61 int64 CreateSyncedItem(const std::string& name, | 61 int64 CreateSyncedItem(const std::string& name, |
| 62 ModelType model_type, bool is_folder); | 62 ModelType model_type, bool is_folder); |
| 63 | 63 |
| 64 // Creates a root node that IS_UNAPPLIED. Smiilar to what one would find in | 64 // Creates a root node that IS_UNAPPLIED. Similar to what one would find in |
| 65 // the database between the ProcessUpdates of an initial datatype configure | 65 // the database between the ProcessUpdates of an initial datatype configure |
| 66 // cycle and the ApplyUpdates step of the same sync cycle. | 66 // cycle and the ApplyUpdates step of the same sync cycle. |
| 67 int64 CreateUnappliedRootNode(ModelType model_type); | 67 int64 CreateUnappliedRootNode(ModelType model_type); |
| 68 | 68 |
| 69 // Looks up the item referenced by |meta_handle|. If successful, overwrites | 69 // Looks up the item referenced by |meta_handle|. If successful, overwrites |
| 70 // the server specifics with |specifics|, sets | 70 // the server specifics with |specifics|, sets |
| 71 // IS_UNAPPLIED_UPDATES/IS_UNSYNCED appropriately, and returns true. | 71 // IS_UNAPPLIED_UPDATES/IS_UNSYNCED appropriately, and returns true. |
| 72 // Else, return false. | 72 // Else, return false. |
| 73 bool SetServerSpecificsForItem(int64 meta_handle, | 73 bool SetServerSpecificsForItem(int64 meta_handle, |
| 74 const sync_pb::EntitySpecifics specifics); | 74 const sync_pb::EntitySpecifics specifics); |
| 75 | 75 |
| 76 // Looks up the item referenced by |meta_handle|. If successful, overwrites | 76 // Looks up the item referenced by |meta_handle|. If successful, overwrites |
| 77 // the local specifics with |specifics|, sets | 77 // the local specifics with |specifics|, sets |
| 78 // IS_UNAPPLIED_UPDATES/IS_UNSYNCED appropriately, and returns true. | 78 // IS_UNAPPLIED_UPDATES/IS_UNSYNCED appropriately, and returns true. |
| 79 // Else, return false. | 79 // Else, return false. |
| 80 bool SetLocalSpecificsForItem(int64 meta_handle, | 80 bool SetLocalSpecificsForItem(int64 meta_handle, |
| 81 const sync_pb::EntitySpecifics specifics); | 81 const sync_pb::EntitySpecifics specifics); |
| 82 | 82 |
| 83 // Looks up the item referenced by |meta_handle|. If successful, stores | 83 // Looks up the item referenced by |meta_handle| and returns its server |
| 84 // the server specifics into |specifics| and returns true. Else, return false. | 84 // specifics. |
| 85 const sync_pb::EntitySpecifics& GetServerSpecificsForItem( | 85 const sync_pb::EntitySpecifics& GetServerSpecificsForItem( |
| 86 int64 meta_handle) const; | 86 int64 meta_handle) const; |
| 87 | 87 |
| 88 // Looks up the item referenced by |meta_handle|. If successful, stores | 88 // Looks up the item referenced by |meta_handle| and returns its specifics. |
| 89 // the local specifics into |specifics| and returns true. Else, return false. | |
| 90 const sync_pb::EntitySpecifics& GetLocalSpecificsForItem( | 89 const sync_pb::EntitySpecifics& GetLocalSpecificsForItem( |
| 91 int64 meta_handle) const; | 90 int64 meta_handle) const; |
| 92 | 91 |
| 92 // Looks up the item referenced by |meta_handle|. If successful, overwrites |
| 93 // the server attachment metadata with |metadata|, sets |
| 94 // IS_UNAPPLIED_UPDATES/IS_UNSYNCED appropriately, and returns true. |
| 95 // Else, return false. |
| 96 bool SetServerAttachmentMetadataForItem( |
| 97 int64 meta_handle, |
| 98 const sync_pb::AttachmentMetadata metadata); |
| 99 |
| 100 // Looks up the item referenced by |meta_handle|. If successful, overwrites |
| 101 // the local attachment metadata with |metadata|, sets |
| 102 // IS_UNAPPLIED_UPDATES/IS_UNSYNCED appropriately, and returns true. |
| 103 // Else, return false. |
| 104 bool SetLocalAttachmentMetadataForItem( |
| 105 int64 meta_handle, |
| 106 const sync_pb::AttachmentMetadata metadata); |
| 107 |
| 108 // Looks up the item referenced by |meta_handle| and returns its server |
| 109 // attachment metadata. |
| 110 const sync_pb::AttachmentMetadata& GetServerAttachmentMetadataForItem( |
| 111 int64 meta_handle) const; |
| 112 |
| 113 // Looks up the item referenced by |meta_handle| and returns its attachment |
| 114 // metadata. |
| 115 const sync_pb::AttachmentMetadata& GetLocalAttachmentMetadataForItem( |
| 116 int64 meta_handle) const; |
| 117 |
| 93 // Getters for IS_UNSYNCED and IS_UNAPPLIED_UPDATE bit fields. | 118 // Getters for IS_UNSYNCED and IS_UNAPPLIED_UPDATE bit fields. |
| 94 bool GetIsUnsyncedForItem(int64 meta_handle) const; | 119 bool GetIsUnsyncedForItem(int64 meta_handle) const; |
| 95 bool GetIsUnappliedForItem(int64 meta_handle) const; | 120 bool GetIsUnappliedForItem(int64 meta_handle) const; |
| 96 | 121 |
| 97 int64 GetNextRevision(); | 122 int64 GetNextRevision(); |
| 98 | 123 |
| 99 private: | 124 private: |
| 100 syncable::Directory* directory_; | 125 syncable::Directory* directory_; |
| 101 int64 next_revision_; | 126 int64 next_revision_; |
| 102 | 127 |
| 103 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); | 128 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); |
| 104 }; | 129 }; |
| 105 | 130 |
| 106 } // namespace syncer | 131 } // namespace syncer |
| 107 | 132 |
| 108 #endif // SYNC_TEST_TEST_ENTRY_FACTORY_H_ | 133 #endif // SYNC_TEST_TEST_ENTRY_FACTORY_H_ |
| OLD | NEW |