Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 488843002: [Sync] Add support for server controlled nudge delays (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/internal_api/sync_manager_impl.cc ('k') | sync/protocol/client_commands.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 tag)); 1602 tag));
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) {
1613 EXPECT_EQ(
1614 sync_manager_.GetNudgeDelayTimeDelta(BOOKMARKS),
1615 base::TimeDelta::FromMilliseconds(SyncManagerImpl::GetSlowNudgeDelay()));
1616
1617 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(AUTOFILL),
1618 base::TimeDelta::FromSeconds(kDefaultShortPollIntervalSeconds));
1619
1620 EXPECT_EQ(
1621 sync_manager_.GetNudgeDelayTimeDelta(PREFERENCES),
1622 base::TimeDelta::FromMilliseconds(SyncManagerImpl::GetSlowNudgeDelay()));
1623
1624 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(EXTENSIONS),
1625 base::TimeDelta::FromMilliseconds(
1626 SyncManagerImpl::GetDefaultNudgeDelay()));
1627 }
1628
1629 // Friended by WriteNode, so can't be in an anonymouse namespace. 1612 // Friended by WriteNode, so can't be in an anonymouse namespace.
1630 TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { 1613 TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
1631 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); 1614 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION));
1632 std::string title; 1615 std::string title;
1633 SyncAPINameToServerName("Google", &title); 1616 SyncAPINameToServerName("Google", &title);
1634 std::string url = "http://www.google.com"; 1617 std::string url = "http://www.google.com";
1635 std::string raw_title2 = ".."; // An invalid cosmo title. 1618 std::string raw_title2 = ".."; // An invalid cosmo title.
1636 std::string title2; 1619 std::string title2;
1637 SyncAPINameToServerName(raw_title2, &title2); 1620 SyncAPINameToServerName(raw_title2, &title2);
1638 std::string url2 = "http://www.bla.com"; 1621 std::string url2 = "http://www.bla.com";
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after
3197 // SyncManagerInitInvalidStorageTest::GetFactory will return 3180 // SyncManagerInitInvalidStorageTest::GetFactory will return
3198 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. 3181 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails.
3199 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's 3182 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's
3200 // task is to ensure that SyncManagerImpl reported initialization failure in 3183 // task is to ensure that SyncManagerImpl reported initialization failure in
3201 // OnInitializationComplete callback. 3184 // OnInitializationComplete callback.
3202 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { 3185 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) {
3203 EXPECT_FALSE(initialization_succeeded_); 3186 EXPECT_FALSE(initialization_succeeded_);
3204 } 3187 }
3205 3188
3206 } // namespace syncer 3189 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_manager_impl.cc ('k') | sync/protocol/client_commands.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698