| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return entry.GetMetahandle(); | 167 return entry.GetMetahandle(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Simulates creating a "synced" node as a child of the root datatype node. | 170 // Simulates creating a "synced" node as a child of the root datatype node. |
| 171 int64 MakeServerNode(UserShare* share, ModelType model_type, | 171 int64 MakeServerNode(UserShare* share, ModelType model_type, |
| 172 const std::string& client_tag, | 172 const std::string& client_tag, |
| 173 const std::string& hashed_tag, | 173 const std::string& hashed_tag, |
| 174 const sync_pb::EntitySpecifics& specifics) { | 174 const sync_pb::EntitySpecifics& specifics) { |
| 175 syncable::WriteTransaction trans( | 175 syncable::WriteTransaction trans( |
| 176 FROM_HERE, syncable::UNITTEST, share->directory.get()); | 176 FROM_HERE, syncable::UNITTEST, share->directory.get()); |
| 177 syncable::Entry root_entry(&trans, syncable::GET_BY_SERVER_TAG, | 177 syncable::Entry root_entry(&trans, syncable::GET_TYPE_ROOT, model_type); |
| 178 ModelTypeToRootTag(model_type)); | |
| 179 EXPECT_TRUE(root_entry.good()); | 178 EXPECT_TRUE(root_entry.good()); |
| 180 syncable::Id root_id = root_entry.GetId(); | 179 syncable::Id root_id = root_entry.GetId(); |
| 181 syncable::Id node_id = syncable::Id::CreateFromServerId(client_tag); | 180 syncable::Id node_id = syncable::Id::CreateFromServerId(client_tag); |
| 182 syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, | 181 syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, |
| 183 node_id); | 182 node_id); |
| 184 EXPECT_TRUE(entry.good()); | 183 EXPECT_TRUE(entry.good()); |
| 185 entry.PutBaseVersion(1); | 184 entry.PutBaseVersion(1); |
| 186 entry.PutServerVersion(1); | 185 entry.PutServerVersion(1); |
| 187 entry.PutIsUnappliedUpdate(false); | 186 entry.PutIsUnappliedUpdate(false); |
| 188 entry.PutServerParentId(root_id); | 187 entry.PutServerParentId(root_id); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 TEST_F(SyncApiTest, EmptyTags) { | 575 TEST_F(SyncApiTest, EmptyTags) { |
| 577 WriteTransaction trans(FROM_HERE, user_share()); | 576 WriteTransaction trans(FROM_HERE, user_share()); |
| 578 ReadNode root_node(&trans); | 577 ReadNode root_node(&trans); |
| 579 root_node.InitByRootLookup(); | 578 root_node.InitByRootLookup(); |
| 580 WriteNode node(&trans); | 579 WriteNode node(&trans); |
| 581 std::string empty_tag; | 580 std::string empty_tag; |
| 582 WriteNode::InitUniqueByCreationResult result = | 581 WriteNode::InitUniqueByCreationResult result = |
| 583 node.InitUniqueByCreation(TYPED_URLS, root_node, empty_tag); | 582 node.InitUniqueByCreation(TYPED_URLS, root_node, empty_tag); |
| 584 EXPECT_NE(WriteNode::INIT_SUCCESS, result); | 583 EXPECT_NE(WriteNode::INIT_SUCCESS, result); |
| 585 EXPECT_EQ(BaseNode::INIT_FAILED_PRECONDITION, | 584 EXPECT_EQ(BaseNode::INIT_FAILED_PRECONDITION, |
| 586 node.InitByTagLookup(empty_tag)); | 585 node.InitByClientTagLookup(TYPED_URLS, empty_tag)); |
| 587 } | 586 } |
| 588 | 587 |
| 589 // Test counting nodes when the type's root node has no children. | 588 // Test counting nodes when the type's root node has no children. |
| 590 TEST_F(SyncApiTest, GetTotalNodeCountEmpty) { | 589 TEST_F(SyncApiTest, GetTotalNodeCountEmpty) { |
| 591 int64 type_root = MakeServerNodeForType(user_share(), BOOKMARKS); | 590 int64 type_root = MakeServerNodeForType(user_share(), BOOKMARKS); |
| 592 { | 591 { |
| 593 ReadTransaction trans(FROM_HERE, user_share()); | 592 ReadTransaction trans(FROM_HERE, user_share()); |
| 594 ReadNode type_root_node(&trans); | 593 ReadNode type_root_node(&trans); |
| 595 EXPECT_EQ(BaseNode::INIT_OK, | 594 EXPECT_EQ(BaseNode::INIT_OK, |
| 596 type_root_node.InitByIdLookup(type_root)); | 595 type_root_node.InitByIdLookup(type_root)); |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_)); | 1240 EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_)); |
| 1242 sync_manager_.GetEncryptionHandler()->SetEncryptionPassphrase( | 1241 sync_manager_.GetEncryptionHandler()->SetEncryptionPassphrase( |
| 1243 "new_passphrase", | 1242 "new_passphrase", |
| 1244 false); | 1243 false); |
| 1245 EXPECT_EQ(IMPLICIT_PASSPHRASE, | 1244 EXPECT_EQ(IMPLICIT_PASSPHRASE, |
| 1246 sync_manager_.GetEncryptionHandler()->GetPassphraseType()); | 1245 sync_manager_.GetEncryptionHandler()->GetPassphraseType()); |
| 1247 EXPECT_FALSE(EncryptEverythingEnabledForTest()); | 1246 EXPECT_FALSE(EncryptEverythingEnabledForTest()); |
| 1248 { | 1247 { |
| 1249 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 1248 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
| 1250 ReadNode node(&trans); | 1249 ReadNode node(&trans); |
| 1251 EXPECT_EQ(BaseNode::INIT_OK, node.InitByTagLookup(kNigoriTag)); | 1250 EXPECT_EQ(BaseNode::INIT_OK, node.InitTypeRoot(NIGORI)); |
| 1252 sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics(); | 1251 sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics(); |
| 1253 Cryptographer* cryptographer = trans.GetCryptographer(); | 1252 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1254 EXPECT_TRUE(cryptographer->is_ready()); | 1253 EXPECT_TRUE(cryptographer->is_ready()); |
| 1255 EXPECT_TRUE(cryptographer->CanDecrypt(nigori.encryption_keybag())); | 1254 EXPECT_TRUE(cryptographer->CanDecrypt(nigori.encryption_keybag())); |
| 1256 } | 1255 } |
| 1257 } | 1256 } |
| 1258 | 1257 |
| 1259 // Test that when there are no pending keys and we have on the old GAIA | 1258 // Test that when there are no pending keys and we have on the old GAIA |
| 1260 // password, we update and re-encrypt everything with the new GAIA password. | 1259 // password, we update and re-encrypt everything with the new GAIA password. |
| 1261 // (case 1 in SyncManager::SyncInternal::SetEncryptionPassphrase) | 1260 // (case 1 in SyncManager::SyncInternal::SetEncryptionPassphrase) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 Cryptographer* cryptographer = trans.GetCryptographer(); | 1360 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1362 std::string bootstrap_token; | 1361 std::string bootstrap_token; |
| 1363 cryptographer->GetBootstrapToken(&bootstrap_token); | 1362 cryptographer->GetBootstrapToken(&bootstrap_token); |
| 1364 other_cryptographer.Bootstrap(bootstrap_token); | 1363 other_cryptographer.Bootstrap(bootstrap_token); |
| 1365 | 1364 |
| 1366 // Now update the nigori to reflect the new keys, and update the | 1365 // Now update the nigori to reflect the new keys, and update the |
| 1367 // cryptographer to have pending keys. | 1366 // cryptographer to have pending keys. |
| 1368 KeyParams params = {"localhost", "dummy", "passphrase2"}; | 1367 KeyParams params = {"localhost", "dummy", "passphrase2"}; |
| 1369 other_cryptographer.AddKey(params); | 1368 other_cryptographer.AddKey(params); |
| 1370 WriteNode node(&trans); | 1369 WriteNode node(&trans); |
| 1371 EXPECT_EQ(BaseNode::INIT_OK, node.InitByTagLookup(kNigoriTag)); | 1370 EXPECT_EQ(BaseNode::INIT_OK, node.InitTypeRoot(NIGORI)); |
| 1372 sync_pb::NigoriSpecifics nigori; | 1371 sync_pb::NigoriSpecifics nigori; |
| 1373 other_cryptographer.GetKeys(nigori.mutable_encryption_keybag()); | 1372 other_cryptographer.GetKeys(nigori.mutable_encryption_keybag()); |
| 1374 cryptographer->SetPendingKeys(nigori.encryption_keybag()); | 1373 cryptographer->SetPendingKeys(nigori.encryption_keybag()); |
| 1375 EXPECT_TRUE(cryptographer->has_pending_keys()); | 1374 EXPECT_TRUE(cryptographer->has_pending_keys()); |
| 1376 node.SetNigoriSpecifics(nigori); | 1375 node.SetNigoriSpecifics(nigori); |
| 1377 } | 1376 } |
| 1378 EXPECT_CALL(encryption_observer_, | 1377 EXPECT_CALL(encryption_observer_, |
| 1379 OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); | 1378 OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); |
| 1380 EXPECT_CALL(encryption_observer_, OnPassphraseAccepted()); | 1379 EXPECT_CALL(encryption_observer_, OnPassphraseAccepted()); |
| 1381 EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); | 1380 EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1409 Cryptographer* cryptographer = trans.GetCryptographer(); | 1408 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1410 std::string bootstrap_token; | 1409 std::string bootstrap_token; |
| 1411 cryptographer->GetBootstrapToken(&bootstrap_token); | 1410 cryptographer->GetBootstrapToken(&bootstrap_token); |
| 1412 other_cryptographer.Bootstrap(bootstrap_token); | 1411 other_cryptographer.Bootstrap(bootstrap_token); |
| 1413 | 1412 |
| 1414 // Now update the nigori to reflect the new keys, and update the | 1413 // Now update the nigori to reflect the new keys, and update the |
| 1415 // cryptographer to have pending keys. | 1414 // cryptographer to have pending keys. |
| 1416 KeyParams params = {"localhost", "dummy", "old_gaia"}; | 1415 KeyParams params = {"localhost", "dummy", "old_gaia"}; |
| 1417 other_cryptographer.AddKey(params); | 1416 other_cryptographer.AddKey(params); |
| 1418 WriteNode node(&trans); | 1417 WriteNode node(&trans); |
| 1419 EXPECT_EQ(BaseNode::INIT_OK, node.InitByTagLookup(kNigoriTag)); | 1418 EXPECT_EQ(BaseNode::INIT_OK, node.InitTypeRoot(NIGORI)); |
| 1420 sync_pb::NigoriSpecifics nigori; | 1419 sync_pb::NigoriSpecifics nigori; |
| 1421 other_cryptographer.GetKeys(nigori.mutable_encryption_keybag()); | 1420 other_cryptographer.GetKeys(nigori.mutable_encryption_keybag()); |
| 1422 node.SetNigoriSpecifics(nigori); | 1421 node.SetNigoriSpecifics(nigori); |
| 1423 cryptographer->SetPendingKeys(nigori.encryption_keybag()); | 1422 cryptographer->SetPendingKeys(nigori.encryption_keybag()); |
| 1424 | 1423 |
| 1425 // other_cryptographer now contains all encryption keys, and is encrypting | 1424 // other_cryptographer now contains all encryption keys, and is encrypting |
| 1426 // with the newest gaia. | 1425 // with the newest gaia. |
| 1427 KeyParams new_params = {"localhost", "dummy", "new_gaia"}; | 1426 KeyParams new_params = {"localhost", "dummy", "new_gaia"}; |
| 1428 other_cryptographer.AddKey(new_params); | 1427 other_cryptographer.AddKey(new_params); |
| 1429 } | 1428 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 Cryptographer* cryptographer = trans.GetCryptographer(); | 1491 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1493 std::string bootstrap_token; | 1492 std::string bootstrap_token; |
| 1494 cryptographer->GetBootstrapToken(&bootstrap_token); | 1493 cryptographer->GetBootstrapToken(&bootstrap_token); |
| 1495 other_cryptographer.Bootstrap(bootstrap_token); | 1494 other_cryptographer.Bootstrap(bootstrap_token); |
| 1496 | 1495 |
| 1497 // Now update the nigori to reflect the new keys, and update the | 1496 // Now update the nigori to reflect the new keys, and update the |
| 1498 // cryptographer to have pending keys. | 1497 // cryptographer to have pending keys. |
| 1499 KeyParams params = {"localhost", "dummy", "explicit"}; | 1498 KeyParams params = {"localhost", "dummy", "explicit"}; |
| 1500 other_cryptographer.AddKey(params); | 1499 other_cryptographer.AddKey(params); |
| 1501 WriteNode node(&trans); | 1500 WriteNode node(&trans); |
| 1502 EXPECT_EQ(BaseNode::INIT_OK, node.InitByTagLookup(kNigoriTag)); | 1501 EXPECT_EQ(BaseNode::INIT_OK, node.InitTypeRoot(NIGORI)); |
| 1503 sync_pb::NigoriSpecifics nigori; | 1502 sync_pb::NigoriSpecifics nigori; |
| 1504 other_cryptographer.GetKeys(nigori.mutable_encryption_keybag()); | 1503 other_cryptographer.GetKeys(nigori.mutable_encryption_keybag()); |
| 1505 cryptographer->SetPendingKeys(nigori.encryption_keybag()); | 1504 cryptographer->SetPendingKeys(nigori.encryption_keybag()); |
| 1506 EXPECT_TRUE(cryptographer->has_pending_keys()); | 1505 EXPECT_TRUE(cryptographer->has_pending_keys()); |
| 1507 nigori.set_keybag_is_frozen(true); | 1506 nigori.set_keybag_is_frozen(true); |
| 1508 node.SetNigoriSpecifics(nigori); | 1507 node.SetNigoriSpecifics(nigori); |
| 1509 } | 1508 } |
| 1510 EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_)); | 1509 EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_)); |
| 1511 EXPECT_CALL(encryption_observer_, | 1510 EXPECT_CALL(encryption_observer_, |
| 1512 OnPassphraseTypeChanged(CUSTOM_PASSPHRASE, _)); | 1511 OnPassphraseTypeChanged(CUSTOM_PASSPHRASE, _)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1541 EXPECT_FALSE(SetUpEncryption(DONT_WRITE_NIGORI, UNINITIALIZED)); | 1540 EXPECT_FALSE(SetUpEncryption(DONT_WRITE_NIGORI, UNINITIALIZED)); |
| 1542 Cryptographer other_cryptographer(&encryptor_); | 1541 Cryptographer other_cryptographer(&encryptor_); |
| 1543 { | 1542 { |
| 1544 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 1543 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
| 1545 Cryptographer* cryptographer = trans.GetCryptographer(); | 1544 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1546 // Now update the nigori to reflect the new keys, and update the | 1545 // Now update the nigori to reflect the new keys, and update the |
| 1547 // cryptographer to have pending keys. | 1546 // cryptographer to have pending keys. |
| 1548 KeyParams params = {"localhost", "dummy", "passphrase"}; | 1547 KeyParams params = {"localhost", "dummy", "passphrase"}; |
| 1549 other_cryptographer.AddKey(params); | 1548 other_cryptographer.AddKey(params); |
| 1550 WriteNode node(&trans); | 1549 WriteNode node(&trans); |
| 1551 EXPECT_EQ(BaseNode::INIT_OK, node.InitByTagLookup(kNigoriTag)); | 1550 EXPECT_EQ(BaseNode::INIT_OK, node.InitTypeRoot(NIGORI)); |
| 1552 sync_pb::NigoriSpecifics nigori; | 1551 sync_pb::NigoriSpecifics nigori; |
| 1553 other_cryptographer.GetKeys(nigori.mutable_encryption_keybag()); | 1552 other_cryptographer.GetKeys(nigori.mutable_encryption_keybag()); |
| 1554 node.SetNigoriSpecifics(nigori); | 1553 node.SetNigoriSpecifics(nigori); |
| 1555 cryptographer->SetPendingKeys(nigori.encryption_keybag()); | 1554 cryptographer->SetPendingKeys(nigori.encryption_keybag()); |
| 1556 EXPECT_FALSE(cryptographer->is_ready()); | 1555 EXPECT_FALSE(cryptographer->is_ready()); |
| 1557 } | 1556 } |
| 1558 EXPECT_CALL(encryption_observer_, | 1557 EXPECT_CALL(encryption_observer_, |
| 1559 OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); | 1558 OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); |
| 1560 EXPECT_CALL(encryption_observer_, OnPassphraseAccepted()); | 1559 EXPECT_CALL(encryption_observer_, OnPassphraseAccepted()); |
| 1561 EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); | 1560 EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 | 1735 |
| 1737 // Create a bookmark and set the title/url, then verify the data was properly | 1736 // Create a bookmark and set the title/url, then verify the data was properly |
| 1738 // set. This replicates the unique way bookmarks have of creating sync nodes. | 1737 // set. This replicates the unique way bookmarks have of creating sync nodes. |
| 1739 // See BookmarkChangeProcessor::PlaceSyncNode(..). | 1738 // See BookmarkChangeProcessor::PlaceSyncNode(..). |
| 1740 TEST_F(SyncManagerTest, CreateLocalBookmark) { | 1739 TEST_F(SyncManagerTest, CreateLocalBookmark) { |
| 1741 std::string title = "title"; | 1740 std::string title = "title"; |
| 1742 std::string url = "url"; | 1741 std::string url = "url"; |
| 1743 { | 1742 { |
| 1744 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 1743 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
| 1745 ReadNode bookmark_root(&trans); | 1744 ReadNode bookmark_root(&trans); |
| 1746 ASSERT_EQ(BaseNode::INIT_OK, | 1745 ASSERT_EQ(BaseNode::INIT_OK, bookmark_root.InitTypeRoot(BOOKMARKS)); |
| 1747 bookmark_root.InitByTagLookup(ModelTypeToRootTag(BOOKMARKS))); | |
| 1748 WriteNode node(&trans); | 1746 WriteNode node(&trans); |
| 1749 ASSERT_TRUE(node.InitBookmarkByCreation(bookmark_root, NULL)); | 1747 ASSERT_TRUE(node.InitBookmarkByCreation(bookmark_root, NULL)); |
| 1750 node.SetIsFolder(false); | 1748 node.SetIsFolder(false); |
| 1751 node.SetTitle(title); | 1749 node.SetTitle(title); |
| 1752 | 1750 |
| 1753 sync_pb::BookmarkSpecifics bookmark_specifics(node.GetBookmarkSpecifics()); | 1751 sync_pb::BookmarkSpecifics bookmark_specifics(node.GetBookmarkSpecifics()); |
| 1754 bookmark_specifics.set_url(url); | 1752 bookmark_specifics.set_url(url); |
| 1755 node.SetBookmarkSpecifics(bookmark_specifics); | 1753 node.SetBookmarkSpecifics(bookmark_specifics); |
| 1756 } | 1754 } |
| 1757 { | 1755 { |
| 1758 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 1756 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
| 1759 ReadNode bookmark_root(&trans); | 1757 ReadNode bookmark_root(&trans); |
| 1760 ASSERT_EQ(BaseNode::INIT_OK, | 1758 ASSERT_EQ(BaseNode::INIT_OK, bookmark_root.InitTypeRoot(BOOKMARKS)); |
| 1761 bookmark_root.InitByTagLookup(ModelTypeToRootTag(BOOKMARKS))); | |
| 1762 int64 child_id = bookmark_root.GetFirstChildId(); | 1759 int64 child_id = bookmark_root.GetFirstChildId(); |
| 1763 | 1760 |
| 1764 ReadNode node(&trans); | 1761 ReadNode node(&trans); |
| 1765 ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id)); | 1762 ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id)); |
| 1766 EXPECT_FALSE(node.GetIsFolder()); | 1763 EXPECT_FALSE(node.GetIsFolder()); |
| 1767 EXPECT_EQ(title, node.GetTitle()); | 1764 EXPECT_EQ(title, node.GetTitle()); |
| 1768 EXPECT_EQ(url, node.GetBookmarkSpecifics().url()); | 1765 EXPECT_EQ(url, node.GetBookmarkSpecifics().url()); |
| 1769 } | 1766 } |
| 1770 } | 1767 } |
| 1771 | 1768 |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2576 | 2573 |
| 2577 UserShare* share = sync_manager_.GetUserShare(); | 2574 UserShare* share = sync_manager_.GetUserShare(); |
| 2578 | 2575 |
| 2579 // The test harness automatically initializes all types in the routing info. | 2576 // The test harness automatically initializes all types in the routing info. |
| 2580 // Check that autofill is not among them. | 2577 // Check that autofill is not among them. |
| 2581 ASSERT_FALSE(enabled_types.Has(AUTOFILL)); | 2578 ASSERT_FALSE(enabled_types.Has(AUTOFILL)); |
| 2582 | 2579 |
| 2583 // Further ensure that the test harness did not create its root node. | 2580 // Further ensure that the test harness did not create its root node. |
| 2584 { | 2581 { |
| 2585 syncable::ReadTransaction trans(FROM_HERE, share->directory.get()); | 2582 syncable::ReadTransaction trans(FROM_HERE, share->directory.get()); |
| 2586 syncable::Entry autofill_root_node(&trans, syncable::GET_BY_SERVER_TAG, | 2583 syncable::Entry autofill_root_node(&trans, |
| 2587 ModelTypeToRootTag(AUTOFILL)); | 2584 syncable::GET_TYPE_ROOT, |
| 2585 AUTOFILL); |
| 2588 ASSERT_FALSE(autofill_root_node.good()); | 2586 ASSERT_FALSE(autofill_root_node.good()); |
| 2589 } | 2587 } |
| 2590 | 2588 |
| 2591 // One more redundant check. | 2589 // One more redundant check. |
| 2592 ASSERT_FALSE(sync_manager_.InitialSyncEndedTypes().Has(AUTOFILL)); | 2590 ASSERT_FALSE(sync_manager_.InitialSyncEndedTypes().Has(AUTOFILL)); |
| 2593 | 2591 |
| 2594 // Give autofill a progress marker. | 2592 // Give autofill a progress marker. |
| 2595 sync_pb::DataTypeProgressMarker autofill_marker; | 2593 sync_pb::DataTypeProgressMarker autofill_marker; |
| 2596 autofill_marker.set_data_type_id( | 2594 autofill_marker.set_data_type_id( |
| 2597 GetSpecificsFieldNumberFromModelType(AUTOFILL)); | 2595 GetSpecificsFieldNumberFromModelType(AUTOFILL)); |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3135 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3133 // SyncManagerInitInvalidStorageTest::GetFactory will return |
| 3136 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3134 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. |
| 3137 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3135 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's |
| 3138 // task is to ensure that SyncManagerImpl reported initialization failure in | 3136 // task is to ensure that SyncManagerImpl reported initialization failure in |
| 3139 // OnInitializationComplete callback. | 3137 // OnInitializationComplete callback. |
| 3140 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3138 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { |
| 3141 EXPECT_FALSE(initialization_succeeded_); | 3139 EXPECT_FALSE(initialization_succeeded_); |
| 3142 } | 3140 } |
| 3143 | 3141 |
| 3144 } // namespace syncer | 3142 } // namespace syncer |
| OLD | NEW |