| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 syncable::WriteTransaction trans(FROM_HERE, syncable::UNITTEST, dir); | 148 syncable::WriteTransaction trans(FROM_HERE, syncable::UNITTEST, dir); |
| 149 // Attempt to lookup by nigori tag. | 149 // Attempt to lookup by nigori tag. |
| 150 std::string type_tag = syncable::ModelTypeToRootTag(model_type); | 150 std::string type_tag = syncable::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.Put(syncable::BASE_VERSION, 1); | 155 entry.Put(syncable::BASE_VERSION, 1); |
| 156 entry.Put(syncable::SERVER_VERSION, 1); | 156 entry.Put(syncable::SERVER_VERSION, 1); |
| 157 entry.Put(syncable::IS_UNAPPLIED_UPDATE, false); | 157 entry.Put(syncable::IS_UNAPPLIED_UPDATE, false); |
| 158 entry.Put(syncable::SERVER_PARENT_ID, syncable::kNullId); | 158 entry.Put(syncable::SERVER_PARENT_ID, syncable::GetNullId()); |
| 159 entry.Put(syncable::SERVER_IS_DIR, true); | 159 entry.Put(syncable::SERVER_IS_DIR, true); |
| 160 entry.Put(syncable::IS_DIR, true); | 160 entry.Put(syncable::IS_DIR, true); |
| 161 entry.Put(syncable::SERVER_SPECIFICS, specifics); | 161 entry.Put(syncable::SERVER_SPECIFICS, specifics); |
| 162 entry.Put(syncable::UNIQUE_SERVER_TAG, type_tag); | 162 entry.Put(syncable::UNIQUE_SERVER_TAG, type_tag); |
| 163 entry.Put(syncable::NON_UNIQUE_NAME, type_tag); | 163 entry.Put(syncable::NON_UNIQUE_NAME, type_tag); |
| 164 entry.Put(syncable::IS_DEL, false); | 164 entry.Put(syncable::IS_DEL, false); |
| 165 entry.Put(syncable::SPECIFICS, specifics); | 165 entry.Put(syncable::SPECIFICS, specifics); |
| 166 return entry.Get(syncable::META_HANDLE); | 166 return entry.Get(syncable::META_HANDLE); |
| 167 } | 167 } |
| 168 | 168 |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 ReadNode node(&trans); | 1492 ReadNode node(&trans); |
| 1493 EXPECT_TRUE(node.InitByIdLookup(node1)); | 1493 EXPECT_TRUE(node.InitByIdLookup(node1)); |
| 1494 EXPECT_EQ(syncable::BOOKMARKS, node.GetModelType()); | 1494 EXPECT_EQ(syncable::BOOKMARKS, node.GetModelType()); |
| 1495 EXPECT_EQ(title, node.GetTitle()); | 1495 EXPECT_EQ(title, node.GetTitle()); |
| 1496 EXPECT_EQ(title, node.GetBookmarkSpecifics().title()); | 1496 EXPECT_EQ(title, node.GetBookmarkSpecifics().title()); |
| 1497 EXPECT_EQ(url, node.GetBookmarkSpecifics().url()); | 1497 EXPECT_EQ(url, node.GetBookmarkSpecifics().url()); |
| 1498 } | 1498 } |
| 1499 } | 1499 } |
| 1500 | 1500 |
| 1501 } // namespace browser_sync | 1501 } // namespace browser_sync |
| OLD | NEW |