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 | |
37 // Create a new unapplied update without a parent. | 32 // Create a new unapplied update without a parent. |
38 int64 CreateUnappliedNewItem(const std::string& item_id, | 33 int64 CreateUnappliedNewItem(const std::string& item_id, |
39 const sync_pb::EntitySpecifics& specifics, | 34 const sync_pb::EntitySpecifics& specifics, |
40 bool is_unique); | 35 bool is_unique); |
41 | 36 |
42 // Create an unsynced unique_client_tag item in the database. If item_id is a | 37 // Create an unsynced item in the database. If item_id is a local ID, it will |
43 // local ID, it will be treated as a create-new. Otherwise, if it's a server | 38 // be treated as a create-new. Otherwise, if it's a server ID, we'll fake the |
44 // ID, we'll fake the server data so that it looks like it exists on the | 39 // server data so that it looks like it exists on the server. Returns the |
45 // server. Returns the methandle of the created item in |metahandle_out| if | 40 // methandle of the created item in |metahandle_out| if not NULL. |
46 // not NULL. | |
47 void CreateUnsyncedItem(const syncable::Id& item_id, | 41 void CreateUnsyncedItem(const syncable::Id& item_id, |
48 const syncable::Id& parent_id, | 42 const syncable::Id& parent_id, |
49 const std::string& name, | 43 const std::string& name, |
50 bool is_folder, | 44 bool is_folder, |
51 ModelType model_type, | 45 ModelType model_type, |
52 int64* metahandle_out); | 46 int64* metahandle_out); |
53 | 47 |
54 // Creates a bookmark that is both unsynced an an unapplied update. Returns | 48 // Creates an item that is both unsynced an an unapplied update. Returns the |
55 // the metahandle of the created item. | 49 // metahandle of the created item. |
56 int64 CreateUnappliedAndUnsyncedBookmarkItem(const std::string& name); | 50 int64 CreateUnappliedAndUnsyncedItem(const std::string& name, |
| 51 ModelType model_type); |
57 | 52 |
58 // Creates a unique_client_tag item that has neither IS_UNSYNED or | 53 // Creates an item that has neither IS_UNSYNED or IS_UNAPPLIED_UPDATE. The |
59 // IS_UNAPPLIED_UPDATE. The item is known to both the server and client. | 54 // item is known to both the server and client. Returns the metahandle of |
60 // Returns the metahandle of the created item. | 55 // the created item. |
61 int64 CreateSyncedItem(const std::string& name, | 56 int64 CreateSyncedItem(const std::string& name, |
62 ModelType model_type, bool is_folder); | 57 ModelType model_type, bool is_folder); |
63 | 58 |
64 // Creates a root node that IS_UNAPPLIED. Smiilar to what one would find in | 59 // Creates a root node that IS_UNAPPLIED. Smiilar to what one would find in |
65 // the database between the ProcessUpdates of an initial datatype configure | 60 // the database between the ProcessUpdates of an initial datatype configure |
66 // cycle and the ApplyUpdates step of the same sync cycle. | 61 // cycle and the ApplyUpdates step of the same sync cycle. |
67 int64 CreateUnappliedRootNode(ModelType model_type); | 62 int64 CreateUnappliedRootNode(ModelType model_type); |
68 | 63 |
69 // Looks up the item referenced by |meta_handle|. If successful, overwrites | 64 // Looks up the item referenced by |meta_handle|. If successful, overwrites |
70 // the server specifics with |specifics|, sets | 65 // the server specifics with |specifics|, sets |
(...skipping 28 matching lines...) Expand all Loading... |
99 private: | 94 private: |
100 syncable::Directory* directory_; | 95 syncable::Directory* directory_; |
101 int64 next_revision_; | 96 int64 next_revision_; |
102 | 97 |
103 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); | 98 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); |
104 }; | 99 }; |
105 | 100 |
106 } // namespace syncer | 101 } // namespace syncer |
107 | 102 |
108 #endif // SYNC_TEST_TEST_ENTRY_FACTORY_H_ | 103 #endif // SYNC_TEST_TEST_ENTRY_FACTORY_H_ |
OLD | NEW |