| 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, | 50 bool is_folder, |
| 45 ModelType model_type, | 51 ModelType model_type, |
| 46 int64* metahandle_out); | 52 int64* metahandle_out); |
| 47 | 53 |
| 48 // Creates an item that is both unsynced an an unapplied update. Returns the | 54 // Creates a bookmark that is both unsynced an an unapplied update. Returns |
| 49 // metahandle of the created item. | 55 // the metahandle of the created item. |
| 50 int64 CreateUnappliedAndUnsyncedItem(const std::string& name, | 56 int64 CreateUnappliedAndUnsyncedBookmarkItem(const std::string& name); |
| 51 ModelType model_type); | |
| 52 | 57 |
| 53 // Creates an item that has neither IS_UNSYNED or IS_UNAPPLIED_UPDATE. The | 58 // Creates a unique_client_tag item that has neither IS_UNSYNED or |
| 54 // item is known to both the server and client. Returns the metahandle of | 59 // IS_UNAPPLIED_UPDATE. The item is known to both the server and client. |
| 55 // the created item. | 60 // Returns the metahandle of the created item. |
| 56 int64 CreateSyncedItem(const std::string& name, | 61 int64 CreateSyncedItem(const std::string& name, |
| 57 ModelType model_type, bool is_folder); | 62 ModelType model_type, bool is_folder); |
| 58 | 63 |
| 59 // Creates a root node that IS_UNAPPLIED. Smiilar to what one would find in | 64 // 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 | 65 // the database between the ProcessUpdates of an initial datatype configure |
| 61 // cycle and the ApplyUpdates step of the same sync cycle. | 66 // cycle and the ApplyUpdates step of the same sync cycle. |
| 62 int64 CreateUnappliedRootNode(ModelType model_type); | 67 int64 CreateUnappliedRootNode(ModelType model_type); |
| 63 | 68 |
| 64 // Looks up the item referenced by |meta_handle|. If successful, overwrites | 69 // Looks up the item referenced by |meta_handle|. If successful, overwrites |
| 65 // the server specifics with |specifics|, sets | 70 // the server specifics with |specifics|, sets |
| (...skipping 28 matching lines...) Expand all Loading... |
| 94 private: | 99 private: |
| 95 syncable::Directory* directory_; | 100 syncable::Directory* directory_; |
| 96 int64 next_revision_; | 101 int64 next_revision_; |
| 97 | 102 |
| 98 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); | 103 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); |
| 99 }; | 104 }; |
| 100 | 105 |
| 101 } // namespace syncer | 106 } // namespace syncer |
| 102 | 107 |
| 103 #endif // SYNC_TEST_TEST_ENTRY_FACTORY_H_ | 108 #endif // SYNC_TEST_TEST_ENTRY_FACTORY_H_ |
| OLD | NEW |