Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: components/sync/engine_impl/test_entry_factory.h

Issue 2630613002: [Sync] USS: Filter out tombstones for initial sync. (Closed)
Patch Set: Fix TestEntryFactory for realz. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/sync/engine_impl/test_entry_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 COMPONENTS_SYNC_ENGINE_IMPL_TEST_ENTRY_FACTORY_H_ 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_TEST_ENTRY_FACTORY_H_
6 #define COMPONENTS_SYNC_ENGINE_IMPL_TEST_ENTRY_FACTORY_H_ 6 #define COMPONENTS_SYNC_ENGINE_IMPL_TEST_ENTRY_FACTORY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/sync/base/model_type.h" 13 #include "components/sync/base/model_type.h"
14 #include "components/sync/protocol/sync.pb.h" 14 #include "components/sync/protocol/sync.pb.h"
15 15
16 namespace syncer { 16 namespace syncer {
17 17
18 namespace syncable { 18 namespace syncable {
19 class Directory; 19 class Directory;
20 class Id; 20 class Id;
21 class MutableEntry;
21 } 22 }
22 23
23 class TestEntryFactory { 24 class TestEntryFactory {
24 public: 25 public:
25 explicit TestEntryFactory(syncable::Directory* dir); 26 explicit TestEntryFactory(syncable::Directory* dir);
26 ~TestEntryFactory(); 27 ~TestEntryFactory();
27 28
28 // Create a new unapplied folder node with a parent. 29 // Create a new unapplied folder node with a parent.
29 int64_t CreateUnappliedNewItemWithParent( 30 int64_t CreateUnappliedNewItemWithParent(
30 const std::string& item_id, 31 const std::string& item_id,
(...skipping 19 matching lines...) Expand all
50 const syncable::Id& parent_id, 51 const syncable::Id& parent_id,
51 const std::string& name, 52 const std::string& name,
52 bool is_folder, 53 bool is_folder,
53 ModelType model_type, 54 ModelType model_type,
54 int64_t* metahandle_out); 55 int64_t* metahandle_out);
55 56
56 // Creates a bookmark that is both unsynced an an unapplied update. Returns 57 // Creates a bookmark that is both unsynced an an unapplied update. Returns
57 // the metahandle of the created item. 58 // the metahandle of the created item.
58 int64_t CreateUnappliedAndUnsyncedBookmarkItem(const std::string& name); 59 int64_t CreateUnappliedAndUnsyncedBookmarkItem(const std::string& name);
59 60
60 // Creates a unique_client_tag item that has neither IS_UNSYNED or 61 // Creates a unique_client_tag item that has neither IS_UNSYNCED or
61 // IS_UNAPPLIED_UPDATE. The item is known to both the server and client. 62 // IS_UNAPPLIED_UPDATE. The item is known to both the server and client.
62 // Returns the metahandle of the created item. |specifics| is optional. 63 // Returns the metahandle of the created item. |specifics| is optional.
63 int64_t CreateSyncedItem(const std::string& name, 64 int64_t CreateSyncedItem(const std::string& name,
64 ModelType model_type, 65 ModelType model_type,
65 bool is_folder); 66 bool is_folder);
66 int64_t CreateSyncedItem(const std::string& name, 67 int64_t CreateSyncedItem(const std::string& name,
67 ModelType model_type, 68 ModelType model_type,
68 bool is_folder, 69 bool is_folder,
69 const sync_pb::EntitySpecifics& specifics); 70 const sync_pb::EntitySpecifics& specifics);
70 71
72 // Create a tombstone for |name|; returns the metahandle of the entry.
73 int64_t CreateTombstone(const std::string& name, ModelType model_type);
74
71 // Creates a root node for |model_type|. 75 // Creates a root node for |model_type|.
72 int64_t CreateTypeRootNode(ModelType model_type); 76 int64_t CreateTypeRootNode(ModelType model_type);
73 77
74 // Creates a root node that IS_UNAPPLIED. Similar to what one would find in 78 // Creates a root node that IS_UNAPPLIED. Similar to what one would find in
75 // the database between the ProcessUpdates of an initial datatype configure 79 // the database between the ProcessUpdates of an initial datatype configure
76 // cycle and the ApplyUpdates step of the same sync cycle. 80 // cycle and the ApplyUpdates step of the same sync cycle.
77 int64_t CreateUnappliedRootNode(ModelType model_type); 81 int64_t CreateUnappliedRootNode(ModelType model_type);
78 82
79 // Looks up the item referenced by |meta_handle|. If successful, overwrites 83 // Looks up the item referenced by |meta_handle|. If successful, overwrites
80 // the server specifics with |specifics|, sets 84 // the server specifics with |specifics|, sets
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 const sync_pb::AttachmentMetadata& GetLocalAttachmentMetadataForItem( 129 const sync_pb::AttachmentMetadata& GetLocalAttachmentMetadataForItem(
126 int64_t meta_handle) const; 130 int64_t meta_handle) const;
127 131
128 // Getters for IS_UNSYNCED and IS_UNAPPLIED_UPDATE bit fields. 132 // Getters for IS_UNSYNCED and IS_UNAPPLIED_UPDATE bit fields.
129 bool GetIsUnsyncedForItem(int64_t meta_handle) const; 133 bool GetIsUnsyncedForItem(int64_t meta_handle) const;
130 bool GetIsUnappliedForItem(int64_t meta_handle) const; 134 bool GetIsUnappliedForItem(int64_t meta_handle) const;
131 135
132 int64_t GetNextRevision(); 136 int64_t GetNextRevision();
133 137
134 private: 138 private:
139 // Populate an entry with a bunch of default values.
140 void PopulateEntry(const syncable::Id& parent_id,
141 const std::string& name,
142 ModelType model_type,
143 syncable::MutableEntry* entry);
144
135 syncable::Directory* directory_; 145 syncable::Directory* directory_;
136 int64_t next_revision_; 146 int64_t next_revision_;
137 147
138 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory); 148 DISALLOW_COPY_AND_ASSIGN(TestEntryFactory);
139 }; 149 };
140 150
141 } // namespace syncer 151 } // namespace syncer
142 152
143 #endif // COMPONENTS_SYNC_ENGINE_IMPL_TEST_ENTRY_FACTORY_H_ 153 #endif // COMPONENTS_SYNC_ENGINE_IMPL_TEST_ENTRY_FACTORY_H_
OLDNEW
« no previous file with comments | « no previous file | components/sync/engine_impl/test_entry_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698