OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "sync/engine/directory_commit_contribution.h" | 5 #include "sync/engine/directory_commit_contribution.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "sync/sessions/status_controller.h" | 8 #include "sync/sessions/status_controller.h" |
9 #include "sync/syncable/entry.h" | 9 #include "sync/syncable/entry.h" |
10 #include "sync/syncable/mutable_entry.h" | 10 #include "sync/syncable/mutable_entry.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 virtual void TearDown() OVERRIDE { | 31 virtual void TearDown() OVERRIDE { |
32 dir_maker_.TearDown(); | 32 dir_maker_.TearDown(); |
33 } | 33 } |
34 | 34 |
35 protected: | 35 protected: |
36 int64 CreateUnsyncedItem(syncable::WriteTransaction* trans, | 36 int64 CreateUnsyncedItem(syncable::WriteTransaction* trans, |
37 ModelType type, | 37 ModelType type, |
38 const std::string& tag) { | 38 const std::string& tag) { |
39 syncable::Entry parent_entry( | 39 syncable::Entry parent_entry(trans, syncable::GET_TYPE_ROOT, type); |
40 trans, | |
41 syncable::GET_BY_SERVER_TAG, | |
42 ModelTypeToRootTag(type)); | |
43 syncable::MutableEntry entry( | 40 syncable::MutableEntry entry( |
44 trans, | 41 trans, |
45 syncable::CREATE, | 42 syncable::CREATE, |
46 type, | 43 type, |
47 parent_entry.GetId(), | 44 parent_entry.GetId(), |
48 tag); | 45 tag); |
49 entry.PutIsUnsynced(true); | 46 entry.PutIsUnsynced(true); |
50 return entry.GetMetahandle(); | 47 return entry.GetMetahandle(); |
51 } | 48 } |
52 | 49 |
53 int64 CreateSyncedItem(syncable::WriteTransaction* trans, | 50 int64 CreateSyncedItem(syncable::WriteTransaction* trans, |
54 ModelType type, | 51 ModelType type, |
55 const std::string& tag) { | 52 const std::string& tag) { |
56 syncable::Entry parent_entry( | 53 syncable::Entry parent_entry(trans, syncable::GET_TYPE_ROOT, type); |
57 trans, | |
58 syncable::GET_BY_SERVER_TAG, | |
59 ModelTypeToRootTag(type)); | |
60 syncable::MutableEntry entry( | 54 syncable::MutableEntry entry( |
61 trans, | 55 trans, |
62 syncable::CREATE, | 56 syncable::CREATE, |
63 type, | 57 type, |
64 parent_entry.GetId(), | 58 parent_entry.GetId(), |
65 tag); | 59 tag); |
66 | 60 |
67 entry.PutId(syncable::Id::CreateFromServerId( | 61 entry.PutId(syncable::Id::CreateFromServerId( |
68 id_factory_.NewServerId().GetServerId())); | 62 id_factory_.NewServerId().GetServerId())); |
69 entry.PutBaseVersion(10); | 63 entry.PutBaseVersion(10); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 EXPECT_TRUE(e1.GetId().ServerKnows()); | 332 EXPECT_TRUE(e1.GetId().ServerKnows()); |
339 EXPECT_FALSE(e1.GetSyncing()); | 333 EXPECT_FALSE(e1.GetSyncing()); |
340 EXPECT_LT(0, e1.GetServerVersion()); | 334 EXPECT_LT(0, e1.GetServerVersion()); |
341 } | 335 } |
342 | 336 |
343 pref_cc->CleanUp(); | 337 pref_cc->CleanUp(); |
344 ext_cc->CleanUp(); | 338 ext_cc->CleanUp(); |
345 } | 339 } |
346 | 340 |
347 } // namespace syncer | 341 } // namespace syncer |
OLD | NEW |