| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SYNC_TEST_TEST_ENTRY_FACTORY_H_ |
| 6 #define SYNC_TEST_TEST_ENTRY_FACTORY_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "sync/internal_api/public/base/model_type.h" |
| 12 #include "sync/protocol/sync.pb.h" |
| 13 |
| 14 namespace syncer { |
| 15 |
| 16 namespace syncable { |
| 17 class Directory; |
| 18 class Id; |
| 19 } |
| 20 |
| 21 class TestEntryFactory { |
| 22 public: |
| 23 TestEntryFactory(syncable::Directory* dir); |
| 24 ~TestEntryFactory(); |
| 25 |
| 26 // Create a new unapplied folder node with a parent. |
| 27 void CreateUnappliedNewItemWithParent( |
| 28 const std::string& item_id, |
| 29 const sync_pb::EntitySpecifics& specifics, |
| 30 const std::string& parent_id); |
| 31 |
| 32 // Create a new unapplied update without a parent. |
| 33 void CreateUnappliedNewItem(const std::string& item_id, |
| 34 const sync_pb::EntitySpecifics& specifics, |
| 35 bool is_unique); |
| 36 |
| 37 // Create an unsynced item in the database. If item_id is a local ID, it will |
| 38 // be treated as a create-new. Otherwise, if it's a server ID, we'll fake the |
| 39 // server data so that it looks like it exists on the server. Returns the |
| 40 // methandle of the created item in |metahandle_out| if not NULL. |
| 41 void CreateUnsyncedItem(const syncable::Id& item_id, |
| 42 const syncable::Id& parent_id, |
| 43 const std::string& name, |
| 44 bool is_folder, |
| 45 syncer::ModelType model_type, |
| 46 int64* metahandle_out); |
| 47 |
| 48 // Creates an item that is both unsynced an an unapplied update. Returns the |
| 49 // metahandle of the created item. |
| 50 int64 CreateUnappliedAndUnsyncedItem(const std::string& name, |
| 51 syncer::ModelType model_type); |
| 52 |
| 53 // Creates an item that has neither IS_UNSYNED or IS_UNAPPLIED_UPDATE. The |
| 54 // item is known to both the server and client. Returns the metahandle of |
| 55 // the created item. |
| 56 int64 CreateSyncedItem(const std::string& name, syncer::ModelType |
| 57 model_type, bool is_folder); |
| 58 |
| 59 int64 GetNextRevision(); |
| 60 |
| 61 private: |
| 62 syncable::Directory* directory(); |
| 63 |
| 64 syncable::Directory* directory_; |
| 65 int64 next_revision_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); |
| 68 }; |
| 69 |
| 70 } // namespace syncer |
| 71 |
| 72 #endif // SYNC_TEST_TEST_ENTRY_FACTORY_H_ |
| OLD | NEW |