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 "components/sync/core_impl/sync_manager_impl.h" | 9 #include "components/sync/core_impl/sync_manager_impl.h" |
10 | 10 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return entry.GetMetahandle(); | 215 return entry.GetMetahandle(); |
216 } | 216 } |
217 | 217 |
218 int GetTotalNodeCount(UserShare* share, int64_t root) { | 218 int GetTotalNodeCount(UserShare* share, int64_t root) { |
219 ReadTransaction trans(FROM_HERE, share); | 219 ReadTransaction trans(FROM_HERE, share); |
220 ReadNode node(&trans); | 220 ReadNode node(&trans); |
221 EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(root)); | 221 EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(root)); |
222 return node.GetTotalNodeCount(); | 222 return node.GetTotalNodeCount(); |
223 } | 223 } |
224 | 224 |
| 225 const char kUrl[] = "example.com"; |
| 226 const char kPasswordValue[] = "secret"; |
| 227 const char kClientTag[] = "tag"; |
| 228 |
225 } // namespace | 229 } // namespace |
226 | 230 |
227 class SyncApiTest : public testing::Test { | 231 class SyncApiTest : public testing::Test { |
228 public: | 232 public: |
229 void SetUp() override { test_user_share_.SetUp(); } | 233 void SetUp() override { test_user_share_.SetUp(); } |
230 | 234 |
231 void TearDown() override { test_user_share_.TearDown(); } | 235 void TearDown() override { test_user_share_.TearDown(); } |
232 | 236 |
233 protected: | 237 protected: |
234 // Create an entry with the given |model_type|, |client_tag| and | 238 // Create an entry with the given |model_type|, |client_tag| and |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 ReadTransaction trans(FROM_HERE, user_share()); | 515 ReadTransaction trans(FROM_HERE, user_share()); |
512 trans.GetCryptographer()->AddKey(params); | 516 trans.GetCryptographer()->AddKey(params); |
513 } | 517 } |
514 { | 518 { |
515 WriteTransaction trans(FROM_HERE, user_share()); | 519 WriteTransaction trans(FROM_HERE, user_share()); |
516 ReadNode root_node(&trans); | 520 ReadNode root_node(&trans); |
517 root_node.InitByRootLookup(); | 521 root_node.InitByRootLookup(); |
518 | 522 |
519 WriteNode password_node(&trans); | 523 WriteNode password_node(&trans); |
520 WriteNode::InitUniqueByCreationResult result = | 524 WriteNode::InitUniqueByCreationResult result = |
521 password_node.InitUniqueByCreation(PASSWORDS, root_node, "foo"); | 525 password_node.InitUniqueByCreation(PASSWORDS, root_node, kClientTag); |
522 EXPECT_EQ(WriteNode::INIT_SUCCESS, result); | 526 EXPECT_EQ(WriteNode::INIT_SUCCESS, result); |
523 sync_pb::PasswordSpecificsData data; | 527 sync_pb::PasswordSpecificsData data; |
524 data.set_password_value("secret"); | 528 data.set_password_value(kPasswordValue); |
525 password_node.SetPasswordSpecifics(data); | 529 password_node.SetPasswordSpecifics(data, GetPassphraseType(&trans)); |
526 } | 530 } |
527 { | 531 { |
528 ReadTransaction trans(FROM_HERE, user_share()); | 532 ReadTransaction trans(FROM_HERE, user_share()); |
529 | 533 |
530 ReadNode password_node(&trans); | 534 ReadNode password_node(&trans); |
531 EXPECT_EQ(BaseNode::INIT_OK, | 535 EXPECT_EQ(BaseNode::INIT_OK, |
532 password_node.InitByClientTagLookup(PASSWORDS, "foo")); | 536 password_node.InitByClientTagLookup(PASSWORDS, kClientTag)); |
533 const sync_pb::PasswordSpecificsData& data = | 537 const sync_pb::PasswordSpecificsData& data = |
534 password_node.GetPasswordSpecifics(); | 538 password_node.GetPasswordSpecifics(); |
535 EXPECT_EQ("secret", data.password_value()); | 539 EXPECT_EQ(kPasswordValue, data.password_value()); |
| 540 // Check that nothing has appeared in the unencrypted field. |
| 541 EXPECT_FALSE(password_node.GetEntitySpecifics() |
| 542 .password() |
| 543 .has_unencrypted_metadata()); |
536 } | 544 } |
537 } | 545 } |
538 | 546 |
| 547 TEST_F(SyncApiTest, WriteDoesntChangeUnencryptedPasswordMetadata) { |
| 548 KeyParams params = {"localhost", "username", "passphrase"}; |
| 549 { |
| 550 ReadTransaction trans(FROM_HERE, user_share()); |
| 551 trans.GetCryptographer()->AddKey(params); |
| 552 } |
| 553 { |
| 554 WriteTransaction trans(FROM_HERE, user_share()); |
| 555 ReadNode root_node(&trans); |
| 556 root_node.InitByRootLookup(); |
| 557 |
| 558 WriteNode password_node(&trans); |
| 559 WriteNode::InitUniqueByCreationResult result = |
| 560 password_node.InitUniqueByCreation(PASSWORDS, root_node, kClientTag); |
| 561 EXPECT_EQ(WriteNode::INIT_SUCCESS, result); |
| 562 sync_pb::EntitySpecifics entity_specifics; |
| 563 sync_pb::PasswordSpecifics* password_specifics = |
| 564 entity_specifics.mutable_password(); |
| 565 password_specifics->mutable_unencrypted_metadata()->set_url(kUrl); |
| 566 password_node.SetEntitySpecifics(entity_specifics); |
| 567 sync_pb::PasswordSpecificsData data; |
| 568 data.set_password_value(kPasswordValue); |
| 569 password_node.SetPasswordSpecifics(data, GetPassphraseType(&trans)); |
| 570 } |
| 571 { |
| 572 ReadTransaction trans(FROM_HERE, user_share()); |
| 573 |
| 574 ReadNode password_node(&trans); |
| 575 EXPECT_EQ(BaseNode::INIT_OK, |
| 576 password_node.InitByClientTagLookup(PASSWORDS, kClientTag)); |
| 577 const sync_pb::PasswordSpecificsData& data = |
| 578 password_node.GetPasswordSpecifics(); |
| 579 EXPECT_EQ(kUrl, password_node.GetEntitySpecifics() |
| 580 .password() |
| 581 .unencrypted_metadata() |
| 582 .url()); |
| 583 EXPECT_EQ(kPasswordValue, data.password_value()); |
| 584 } |
| 585 } |
| 586 |
539 TEST_F(SyncApiTest, WriteEncryptedTitle) { | 587 TEST_F(SyncApiTest, WriteEncryptedTitle) { |
540 KeyParams params = {"localhost", "username", "passphrase"}; | 588 KeyParams params = {"localhost", "username", "passphrase"}; |
541 { | 589 { |
542 ReadTransaction trans(FROM_HERE, user_share()); | 590 ReadTransaction trans(FROM_HERE, user_share()); |
543 trans.GetCryptographer()->AddKey(params); | 591 trans.GetCryptographer()->AddKey(params); |
544 } | 592 } |
545 encryption_handler()->EnableEncryptEverything(); | 593 encryption_handler()->EnableEncryptEverything(); |
546 int bookmark_id; | 594 int bookmark_id; |
547 { | 595 { |
548 WriteTransaction trans(FROM_HERE, user_share()); | 596 WriteTransaction trans(FROM_HERE, user_share()); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 ReadNode root_node(&trans); | 883 ReadNode root_node(&trans); |
836 root_node.InitByRootLookup(); | 884 root_node.InitByRootLookup(); |
837 // Create new password. | 885 // Create new password. |
838 { | 886 { |
839 WriteNode password_node(&trans); | 887 WriteNode password_node(&trans); |
840 WriteNode::InitUniqueByCreationResult result = | 888 WriteNode::InitUniqueByCreationResult result = |
841 password_node.InitUniqueByCreation(PASSWORDS, root_node, "foo"); | 889 password_node.InitUniqueByCreation(PASSWORDS, root_node, "foo"); |
842 ASSERT_EQ(WriteNode::INIT_SUCCESS, result); | 890 ASSERT_EQ(WriteNode::INIT_SUCCESS, result); |
843 sync_pb::PasswordSpecificsData password_specifics; | 891 sync_pb::PasswordSpecificsData password_specifics; |
844 password_specifics.set_password_value("secret"); | 892 password_specifics.set_password_value("secret"); |
845 password_node.SetPasswordSpecifics(password_specifics); | 893 password_node.SetPasswordSpecifics(password_specifics, |
| 894 GetPassphraseType(&trans)); |
846 } | 895 } |
847 // Delete password. | 896 // Delete password. |
848 { | 897 { |
849 WriteNode password_node(&trans); | 898 WriteNode password_node(&trans); |
850 BaseNode::InitByLookupResult result = | 899 BaseNode::InitByLookupResult result = |
851 password_node.InitByClientTagLookup(PASSWORDS, "foo"); | 900 password_node.InitByClientTagLookup(PASSWORDS, "foo"); |
852 ASSERT_EQ(BaseNode::INIT_OK, result); | 901 ASSERT_EQ(BaseNode::INIT_OK, result); |
853 password_node.Tombstone(); | 902 password_node.Tombstone(); |
854 } | 903 } |
855 // Create password again triggering undeletion. | 904 // Create password again triggering undeletion. |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 | 1499 |
1451 ReadNode root_node(&trans); | 1500 ReadNode root_node(&trans); |
1452 root_node.InitByRootLookup(); | 1501 root_node.InitByRootLookup(); |
1453 | 1502 |
1454 WriteNode password_node(&trans); | 1503 WriteNode password_node(&trans); |
1455 WriteNode::InitUniqueByCreationResult result = | 1504 WriteNode::InitUniqueByCreationResult result = |
1456 password_node.InitUniqueByCreation(PASSWORDS, root_node, "foo"); | 1505 password_node.InitUniqueByCreation(PASSWORDS, root_node, "foo"); |
1457 EXPECT_EQ(WriteNode::INIT_SUCCESS, result); | 1506 EXPECT_EQ(WriteNode::INIT_SUCCESS, result); |
1458 sync_pb::PasswordSpecificsData data; | 1507 sync_pb::PasswordSpecificsData data; |
1459 data.set_password_value("secret"); | 1508 data.set_password_value("secret"); |
1460 password_node.SetPasswordSpecifics(data); | 1509 password_node.SetPasswordSpecifics(data, |
| 1510 GetPassphraseTypeWithTrans(&trans)); |
1461 } | 1511 } |
1462 EXPECT_CALL(encryption_observer_, | 1512 EXPECT_CALL(encryption_observer_, |
1463 OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); | 1513 OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); |
1464 ExpectPassphraseAcceptance(); | 1514 ExpectPassphraseAcceptance(); |
1465 SetCustomPassphraseAndCheck("new_passphrase"); | 1515 SetCustomPassphraseAndCheck("new_passphrase"); |
1466 EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); | 1516 EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); |
1467 { | 1517 { |
1468 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 1518 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
1469 Cryptographer* cryptographer = trans.GetCryptographer(); | 1519 Cryptographer* cryptographer = trans.GetCryptographer(); |
1470 EXPECT_TRUE(cryptographer->is_ready()); | 1520 EXPECT_TRUE(cryptographer->is_ready()); |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 // New node shouldn't start off unsynced. | 2083 // New node shouldn't start off unsynced. |
2034 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); | 2084 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); |
2035 | 2085 |
2036 // Manually change to the same data via SetPasswordSpecifics. Should not set | 2086 // Manually change to the same data via SetPasswordSpecifics. Should not set |
2037 // is_unsynced. | 2087 // is_unsynced. |
2038 { | 2088 { |
2039 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 2089 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
2040 WriteNode node(&trans); | 2090 WriteNode node(&trans); |
2041 EXPECT_EQ(BaseNode::INIT_OK, | 2091 EXPECT_EQ(BaseNode::INIT_OK, |
2042 node.InitByClientTagLookup(PASSWORDS, client_tag)); | 2092 node.InitByClientTagLookup(PASSWORDS, client_tag)); |
2043 node.SetPasswordSpecifics(node.GetPasswordSpecifics()); | 2093 node.SetPasswordSpecifics(node.GetPasswordSpecifics(), |
| 2094 GetPassphraseTypeWithTrans(&trans)); |
2044 } | 2095 } |
2045 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); | 2096 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); |
2046 | 2097 |
2047 // Manually change to different data. Should set is_unsynced. | 2098 // Manually change to different data. Should set is_unsynced. |
2048 { | 2099 { |
2049 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 2100 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
2050 WriteNode node(&trans); | 2101 WriteNode node(&trans); |
2051 EXPECT_EQ(BaseNode::INIT_OK, | 2102 EXPECT_EQ(BaseNode::INIT_OK, |
2052 node.InitByClientTagLookup(PASSWORDS, client_tag)); | 2103 node.InitByClientTagLookup(PASSWORDS, client_tag)); |
2053 Cryptographer* cryptographer = trans.GetCryptographer(); | 2104 Cryptographer* cryptographer = trans.GetCryptographer(); |
2054 sync_pb::PasswordSpecificsData data; | 2105 sync_pb::PasswordSpecificsData data; |
2055 data.set_password_value("secret2"); | 2106 data.set_password_value("secret2"); |
2056 cryptographer->Encrypt( | 2107 cryptographer->Encrypt( |
2057 data, entity_specifics.mutable_password()->mutable_encrypted()); | 2108 data, entity_specifics.mutable_password()->mutable_encrypted()); |
2058 node.SetPasswordSpecifics(data); | 2109 node.SetPasswordSpecifics(data, GetPassphraseTypeWithTrans(&trans)); |
2059 const syncable::Entry* node_entry = node.GetEntry(); | 2110 const syncable::Entry* node_entry = node.GetEntry(); |
2060 EXPECT_TRUE(node_entry->GetIsUnsynced()); | 2111 EXPECT_TRUE(node_entry->GetIsUnsynced()); |
2061 } | 2112 } |
2062 } | 2113 } |
2063 | 2114 |
2064 // Passwords have their own handling for encryption. Verify setting a new | 2115 // Passwords have their own handling for encryption. Verify setting a new |
2065 // passphrase updates the data. | 2116 // passphrase updates the data. |
2066 TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) { | 2117 TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) { |
2067 std::string client_tag = "title"; | |
2068 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); | 2118 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); |
2069 sync_pb::EntitySpecifics entity_specifics; | 2119 sync_pb::EntitySpecifics entity_specifics; |
2070 { | 2120 { |
2071 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 2121 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
2072 Cryptographer* cryptographer = trans.GetCryptographer(); | 2122 Cryptographer* cryptographer = trans.GetCryptographer(); |
2073 sync_pb::PasswordSpecificsData data; | 2123 sync_pb::PasswordSpecificsData data; |
2074 data.set_password_value("secret"); | 2124 data.set_password_value(kPasswordValue); |
| 2125 entity_specifics.mutable_password() |
| 2126 ->mutable_unencrypted_metadata() |
| 2127 ->set_url(kUrl); |
2075 cryptographer->Encrypt( | 2128 cryptographer->Encrypt( |
2076 data, entity_specifics.mutable_password()->mutable_encrypted()); | 2129 data, entity_specifics.mutable_password()->mutable_encrypted()); |
2077 } | 2130 } |
2078 MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag, | 2131 EXPECT_TRUE(entity_specifics.password().has_unencrypted_metadata()); |
2079 syncable::GenerateSyncableHash(PASSWORDS, client_tag), | 2132 MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, kClientTag, |
| 2133 syncable::GenerateSyncableHash(PASSWORDS, kClientTag), |
2080 entity_specifics); | 2134 entity_specifics); |
2081 // New node shouldn't start off unsynced. | 2135 // New node shouldn't start off unsynced. |
2082 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); | 2136 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, kClientTag)); |
2083 | 2137 |
2084 // Set a new passphrase. Should set is_unsynced. | 2138 // Set a new passphrase. Should set is_unsynced. |
2085 testing::Mock::VerifyAndClearExpectations(&encryption_observer_); | 2139 testing::Mock::VerifyAndClearExpectations(&encryption_observer_); |
| 2140 |
2086 EXPECT_CALL(encryption_observer_, | 2141 EXPECT_CALL(encryption_observer_, |
2087 OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); | 2142 OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); |
2088 ExpectPassphraseAcceptance(); | 2143 ExpectPassphraseAcceptance(); |
2089 SetCustomPassphraseAndCheck("new_passphrase"); | 2144 SetCustomPassphraseAndCheck("new_passphrase"); |
2090 EXPECT_TRUE(ResetUnsyncedEntry(PASSWORDS, client_tag)); | 2145 { |
| 2146 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
| 2147 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 2148 EXPECT_TRUE(cryptographer->is_ready()); |
| 2149 ReadNode password_node(&trans); |
| 2150 EXPECT_EQ(BaseNode::INIT_OK, |
| 2151 password_node.InitByClientTagLookup(PASSWORDS, kClientTag)); |
| 2152 const sync_pb::PasswordSpecificsData& data = |
| 2153 password_node.GetPasswordSpecifics(); |
| 2154 EXPECT_EQ(kPasswordValue, data.password_value()); |
| 2155 EXPECT_FALSE(password_node.GetEntitySpecifics() |
| 2156 .password() |
| 2157 .has_unencrypted_metadata()); |
| 2158 } |
| 2159 EXPECT_TRUE(ResetUnsyncedEntry(PASSWORDS, kClientTag)); |
2091 } | 2160 } |
2092 | 2161 |
2093 // Passwords have their own handling for encryption. Verify it does not result | 2162 // Passwords have their own handling for encryption. Verify it does not result |
2094 // in unnecessary writes via ReencryptEverything. | 2163 // in unnecessary writes via ReencryptEverything. |
2095 TEST_F(SyncManagerTest, UpdatePasswordReencryptEverything) { | 2164 TEST_F(SyncManagerTest, UpdatePasswordReencryptEverything) { |
2096 std::string client_tag = "title"; | |
2097 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); | 2165 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); |
2098 sync_pb::EntitySpecifics entity_specifics; | 2166 sync_pb::EntitySpecifics entity_specifics; |
2099 { | 2167 { |
2100 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 2168 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
2101 Cryptographer* cryptographer = trans.GetCryptographer(); | 2169 Cryptographer* cryptographer = trans.GetCryptographer(); |
2102 sync_pb::PasswordSpecificsData data; | 2170 sync_pb::PasswordSpecificsData data; |
2103 data.set_password_value("secret"); | 2171 data.set_password_value(kPasswordValue); |
2104 cryptographer->Encrypt( | 2172 cryptographer->Encrypt( |
2105 data, entity_specifics.mutable_password()->mutable_encrypted()); | 2173 data, entity_specifics.mutable_password()->mutable_encrypted()); |
2106 } | 2174 } |
2107 MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag, | 2175 entity_specifics.mutable_password()->mutable_unencrypted_metadata()->set_url( |
2108 syncable::GenerateSyncableHash(PASSWORDS, client_tag), | 2176 kUrl); |
| 2177 MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, kClientTag, |
| 2178 syncable::GenerateSyncableHash(PASSWORDS, kClientTag), |
2109 entity_specifics); | 2179 entity_specifics); |
2110 // New node shouldn't start off unsynced. | 2180 // New node shouldn't start off unsynced. |
2111 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); | 2181 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, kClientTag)); |
2112 | 2182 |
2113 // Force a re-encrypt everything. Should not set is_unsynced. | 2183 // Force a re-encrypt everything. Should not set is_unsynced. |
2114 testing::Mock::VerifyAndClearExpectations(&encryption_observer_); | 2184 testing::Mock::VerifyAndClearExpectations(&encryption_observer_); |
2115 EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); | 2185 EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); |
2116 EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_)); | 2186 EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_)); |
2117 EXPECT_CALL(encryption_observer_, OnEncryptedTypesChanged(_, false)); | 2187 EXPECT_CALL(encryption_observer_, OnEncryptedTypesChanged(_, false)); |
2118 sync_manager_.GetEncryptionHandler()->Init(); | 2188 sync_manager_.GetEncryptionHandler()->Init(); |
2119 PumpLoop(); | 2189 PumpLoop(); |
2120 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); | 2190 EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, kClientTag)); |
2121 } | 2191 } |
2122 | 2192 |
2123 // Test that attempting to start up with corrupted password data triggers | 2193 // Test that attempting to start up with corrupted password data triggers |
2124 // an unrecoverable error (rather than crashing). | 2194 // an unrecoverable error (rather than crashing). |
2125 TEST_F(SyncManagerTest, ReencryptEverythingWithUnrecoverableErrorPasswords) { | 2195 TEST_F(SyncManagerTest, ReencryptEverythingWithUnrecoverableErrorPasswords) { |
2126 const char kClientTag[] = "client_tag"; | 2196 const char kClientTag[] = "client_tag"; |
2127 | 2197 |
2128 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); | 2198 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); |
2129 sync_pb::EntitySpecifics entity_specifics; | 2199 sync_pb::EntitySpecifics entity_specifics; |
2130 { | 2200 { |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3353 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3423 // SyncManagerInitInvalidStorageTest::GetFactory will return |
3354 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3424 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. |
3355 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3425 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's |
3356 // task is to ensure that SyncManagerImpl reported initialization failure in | 3426 // task is to ensure that SyncManagerImpl reported initialization failure in |
3357 // OnInitializationComplete callback. | 3427 // OnInitializationComplete callback. |
3358 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3428 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { |
3359 EXPECT_FALSE(initialization_succeeded_); | 3429 EXPECT_FALSE(initialization_succeeded_); |
3360 } | 3430 } |
3361 | 3431 |
3362 } // namespace syncer | 3432 } // namespace syncer |
OLD | NEW |