OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
8 | 8 |
9 #include <cstddef> | 9 #include <cstddef> |
10 #include <map> | 10 #include <map> |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 FROM_HERE, syncable::UNITTEST, share->directory.get()); | 148 FROM_HERE, syncable::UNITTEST, share->directory.get()); |
149 // Attempt to lookup by nigori tag. | 149 // Attempt to lookup by nigori tag. |
150 std::string type_tag = ModelTypeToRootTag(model_type); | 150 std::string type_tag = ModelTypeToRootTag(model_type); |
151 syncable::Id node_id = syncable::Id::CreateFromServerId(type_tag); | 151 syncable::Id node_id = syncable::Id::CreateFromServerId(type_tag); |
152 syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, | 152 syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, |
153 node_id); | 153 node_id); |
154 EXPECT_TRUE(entry.good()); | 154 EXPECT_TRUE(entry.good()); |
155 entry.PutBaseVersion(1); | 155 entry.PutBaseVersion(1); |
156 entry.PutServerVersion(1); | 156 entry.PutServerVersion(1); |
157 entry.PutIsUnappliedUpdate(false); | 157 entry.PutIsUnappliedUpdate(false); |
158 entry.PutServerParentId(syncable::GetNullId()); | 158 // TODO(stanisc): setting parent ID might be unnecessary once |
| 159 // empty parent ID is supported. |
| 160 entry.PutParentId(syncable::Id::GetRoot()); |
| 161 entry.PutServerParentId(syncable::Id::GetRoot()); |
159 entry.PutServerIsDir(true); | 162 entry.PutServerIsDir(true); |
160 entry.PutIsDir(true); | 163 entry.PutIsDir(true); |
161 entry.PutServerSpecifics(specifics); | 164 entry.PutServerSpecifics(specifics); |
162 entry.PutUniqueServerTag(type_tag); | 165 entry.PutUniqueServerTag(type_tag); |
163 entry.PutNonUniqueName(type_tag); | 166 entry.PutNonUniqueName(type_tag); |
164 entry.PutIsDel(false); | 167 entry.PutIsDel(false); |
165 entry.PutSpecifics(specifics); | 168 entry.PutSpecifics(specifics); |
166 return entry.GetMetahandle(); | 169 return entry.GetMetahandle(); |
167 } | 170 } |
168 | 171 |
(...skipping 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3174 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3177 // SyncManagerInitInvalidStorageTest::GetFactory will return |
3175 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3178 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. |
3176 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3179 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's |
3177 // task is to ensure that SyncManagerImpl reported initialization failure in | 3180 // task is to ensure that SyncManagerImpl reported initialization failure in |
3178 // OnInitializationComplete callback. | 3181 // OnInitializationComplete callback. |
3179 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3182 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { |
3180 EXPECT_FALSE(initialization_succeeded_); | 3183 EXPECT_FALSE(initialization_succeeded_); |
3181 } | 3184 } |
3182 | 3185 |
3183 } // namespace syncer | 3186 } // namespace syncer |
OLD | NEW |