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 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 } | 1603 } |
1604 { | 1604 { |
1605 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); | 1605 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); |
1606 ReadNode password_node(&trans); | 1606 ReadNode password_node(&trans); |
1607 EXPECT_EQ(BaseNode::INIT_FAILED_DECRYPT_IF_NECESSARY, | 1607 EXPECT_EQ(BaseNode::INIT_FAILED_DECRYPT_IF_NECESSARY, |
1608 password_node.InitByIdLookup(node_id)); | 1608 password_node.InitByIdLookup(node_id)); |
1609 } | 1609 } |
1610 } | 1610 } |
1611 | 1611 |
1612 TEST_F(SyncManagerTest, NudgeDelayTest) { | 1612 TEST_F(SyncManagerTest, NudgeDelayTest) { |
1613 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(BOOKMARKS), | 1613 EXPECT_EQ( |
1614 base::TimeDelta::FromMilliseconds( | 1614 sync_manager_.GetNudgeDelayTimeDelta(BOOKMARKS), |
1615 SyncManagerImpl::GetDefaultNudgeDelay())); | 1615 base::TimeDelta::FromMilliseconds(SyncManagerImpl::GetSlowNudgeDelay())); |
1616 | 1616 |
1617 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(AUTOFILL), | 1617 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(AUTOFILL), |
1618 base::TimeDelta::FromSeconds( | 1618 base::TimeDelta::FromSeconds(kDefaultShortPollIntervalSeconds)); |
1619 kDefaultShortPollIntervalSeconds)); | |
1620 | 1619 |
1621 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(PREFERENCES), | 1620 EXPECT_EQ( |
1622 base::TimeDelta::FromMilliseconds( | 1621 sync_manager_.GetNudgeDelayTimeDelta(PREFERENCES), |
1623 SyncManagerImpl::GetPreferencesNudgeDelay())); | 1622 base::TimeDelta::FromMilliseconds(SyncManagerImpl::GetSlowNudgeDelay())); |
| 1623 |
| 1624 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(EXTENSIONS), |
| 1625 base::TimeDelta::FromMilliseconds( |
| 1626 SyncManagerImpl::GetDefaultNudgeDelay())); |
1624 } | 1627 } |
1625 | 1628 |
1626 // Friended by WriteNode, so can't be in an anonymouse namespace. | 1629 // Friended by WriteNode, so can't be in an anonymouse namespace. |
1627 TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { | 1630 TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { |
1628 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); | 1631 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); |
1629 std::string title; | 1632 std::string title; |
1630 SyncAPINameToServerName("Google", &title); | 1633 SyncAPINameToServerName("Google", &title); |
1631 std::string url = "http://www.google.com"; | 1634 std::string url = "http://www.google.com"; |
1632 std::string raw_title2 = ".."; // An invalid cosmo title. | 1635 std::string raw_title2 = ".."; // An invalid cosmo title. |
1633 std::string title2; | 1636 std::string title2; |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3194 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3197 // SyncManagerInitInvalidStorageTest::GetFactory will return |
3195 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3198 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. |
3196 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3199 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's |
3197 // task is to ensure that SyncManagerImpl reported initialization failure in | 3200 // task is to ensure that SyncManagerImpl reported initialization failure in |
3198 // OnInitializationComplete callback. | 3201 // OnInitializationComplete callback. |
3199 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3202 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { |
3200 EXPECT_FALSE(initialization_succeeded_); | 3203 EXPECT_FALSE(initialization_succeeded_); |
3201 } | 3204 } |
3202 | 3205 |
3203 } // namespace syncer | 3206 } // namespace syncer |
OLD | NEW |