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 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 explicit TestEntryFactory(syncable::Directory* dir); | 23 explicit TestEntryFactory(syncable::Directory* dir); |
24 ~TestEntryFactory(); | 24 ~TestEntryFactory(); |
25 | 25 |
26 // Create a new unapplied folder node with a parent. | 26 // Create a new unapplied folder node with a parent. |
27 int64 CreateUnappliedNewItemWithParent( | 27 int64 CreateUnappliedNewItemWithParent( |
28 const std::string& item_id, | 28 const std::string& item_id, |
29 const sync_pb::EntitySpecifics& specifics, | 29 const sync_pb::EntitySpecifics& specifics, |
30 const std::string& parent_id); | 30 const std::string& parent_id); |
31 | 31 |
| 32 int64 CreateUnappliedNewBookmarkItemWithParent( |
| 33 const std::string& item_id, |
| 34 const sync_pb::EntitySpecifics& specifics, |
| 35 const std::string& parent_id); |
| 36 |
32 // Create a new unapplied update without a parent. | 37 // Create a new unapplied update without a parent. |
33 int64 CreateUnappliedNewItem(const std::string& item_id, | 38 int64 CreateUnappliedNewItem(const std::string& item_id, |
34 const sync_pb::EntitySpecifics& specifics, | 39 const sync_pb::EntitySpecifics& specifics, |
35 bool is_unique); | 40 bool is_unique); |
36 | 41 |
37 // Create an unsynced item in the database. If item_id is a local ID, it will | 42 // Create an unsynced unique_client_tag item in the database. If item_id is a |
38 // be treated as a create-new. Otherwise, if it's a server ID, we'll fake the | 43 // local ID, it will be treated as a create-new. Otherwise, if it's a server |
39 // server data so that it looks like it exists on the server. Returns the | 44 // ID, we'll fake the server data so that it looks like it exists on the |
40 // methandle of the created item in |metahandle_out| if not NULL. | 45 // server. Returns the methandle of the created item in |metahandle_out| if |
| 46 // not NULL. |
41 void CreateUnsyncedItem(const syncable::Id& item_id, | 47 void CreateUnsyncedItem(const syncable::Id& item_id, |
42 const syncable::Id& parent_id, | 48 const syncable::Id& parent_id, |
43 const std::string& name, | 49 const std::string& name, |
44 bool is_folder, | |
45 ModelType model_type, | 50 ModelType model_type, |
46 int64* metahandle_out); | 51 int64* metahandle_out); |
47 | 52 |
48 // Creates an item that is both unsynced an an unapplied update. Returns the | 53 // Creates an unsynced bookarm item in the database. If the item_id is a |
49 // metahandle of the created item. | 54 // lcoal ID, it will be treated as a create-new. Otherwise, if it's a server |
50 int64 CreateUnappliedAndUnsyncedItem(const std::string& name, | 55 // ID, we'll fake the server data so that it looks like it exists on the |
51 ModelType model_type); | 56 // server. Returns the metahandle of te created item in |metahandle_out| if |
| 57 // not NULL. |
| 58 void CreateUnsyncedBookmarkItem(const syncable::Id& item_id, |
| 59 const syncable::Id& parent_id, |
| 60 const std::string& name, |
| 61 bool is_folder, |
| 62 int64* metahandle_out); |
52 | 63 |
53 // Creates an item that has neither IS_UNSYNED or IS_UNAPPLIED_UPDATE. The | 64 |
54 // item is known to both the server and client. Returns the metahandle of | 65 // Creates a bookmark that is both unsynced an an unapplied update. Returns |
55 // the created item. | 66 // the metahandle of the created item. |
| 67 int64 CreateUnappliedAndUnsyncedBookmarkItem(const std::string& name); |
| 68 |
| 69 // Creates a unique_client_tag item that has neither IS_UNSYNED or |
| 70 // IS_UNAPPLIED_UPDATE. The item is known to both the server and client. |
| 71 // Returns the metahandle of the created item. |
56 int64 CreateSyncedItem(const std::string& name, | 72 int64 CreateSyncedItem(const std::string& name, |
57 ModelType model_type, bool is_folder); | 73 ModelType model_type, bool is_folder); |
58 | 74 |
| 75 // Creates a bookmark that has neither IS_UNSYNED or IS_UNAPPLIED_UPDATE. The |
| 76 // item is known to both the server and client. Returns the metahandle of the |
| 77 // created item. |
| 78 int64 CreateSyncedBookmarkItem(const std::string& name, bool is_folder); |
| 79 |
59 // Creates a root node that IS_UNAPPLIED. Smiilar to what one would find in | 80 // Creates a root node that IS_UNAPPLIED. Smiilar to what one would find in |
60 // the database between the ProcessUpdates of an initial datatype configure | 81 // the database between the ProcessUpdates of an initial datatype configure |
61 // cycle and the ApplyUpdates step of the same sync cycle. | 82 // cycle and the ApplyUpdates step of the same sync cycle. |
62 int64 CreateUnappliedRootNode(ModelType model_type); | 83 int64 CreateUnappliedRootNode(ModelType model_type); |
63 | 84 |
64 // Looks up the item referenced by |meta_handle|. If successful, overwrites | 85 // Looks up the item referenced by |meta_handle|. If successful, overwrites |
65 // the server specifics with |specifics|, sets | 86 // the server specifics with |specifics|, sets |
66 // IS_UNAPPLIED_UPDATES/IS_UNSYNCED appropriately, and returns true. | 87 // IS_UNAPPLIED_UPDATES/IS_UNSYNCED appropriately, and returns true. |
67 // Else, return false. | 88 // Else, return false. |
68 bool SetServerSpecificsForItem(int64 meta_handle, | 89 bool SetServerSpecificsForItem(int64 meta_handle, |
(...skipping 25 matching lines...) Expand all Loading... |
94 private: | 115 private: |
95 syncable::Directory* directory_; | 116 syncable::Directory* directory_; |
96 int64 next_revision_; | 117 int64 next_revision_; |
97 | 118 |
98 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); | 119 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); |
99 }; | 120 }; |
100 | 121 |
101 } // namespace syncer | 122 } // namespace syncer |
102 | 123 |
103 #endif // SYNC_TEST_TEST_ENTRY_FACTORY_H_ | 124 #endif // SYNC_TEST_TEST_ENTRY_FACTORY_H_ |
OLD | NEW |