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

Side by Side Diff: chrome/browser/sync/internal_api/syncapi_unittest.cc

Issue 8787006: Delay autofill commits to reduce client to server traffic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 9 years 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
OLDNEW
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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 } 1426 }
1427 { 1427 {
1428 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 1428 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
1429 ReadNode password_node(&trans); 1429 ReadNode password_node(&trans);
1430 EXPECT_FALSE(password_node.InitByIdLookup(node_id)); 1430 EXPECT_FALSE(password_node.InitByIdLookup(node_id));
1431 } 1431 }
1432 } 1432 }
1433 1433
1434 } // namespace 1434 } // namespace
1435 1435
1436 TEST_F(SyncManagerTest, NudgeDelayTest) {
1437 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::BOOKMARKS),
1438 base::TimeDelta::FromMilliseconds(
1439 SyncManager::kDefaultNudgeDelayMilliseconds));
1440
1441 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::AUTOFILL),
1442 base::TimeDelta::FromMilliseconds(
1443 SyncManager::kPiggybackNudgeDelay));
1444
1445 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::PREFERENCES),
1446 base::TimeDelta::FromMilliseconds(
1447 SyncManager::kPreferencesNudgeDelayMilliseconds));
1448 }
1449
1450
1436 // Friended by WriteNode, so can't be in an anonymouse namespace. 1451 // Friended by WriteNode, so can't be in an anonymouse namespace.
1437 TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { 1452 TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
1438 EXPECT_TRUE(SetUpEncryption(true)); 1453 EXPECT_TRUE(SetUpEncryption(true));
1439 std::string title; 1454 std::string title;
1440 SyncAPINameToServerName("Google", &title); 1455 SyncAPINameToServerName("Google", &title);
1441 std::string url = "http://www.google.com"; 1456 std::string url = "http://www.google.com";
1442 std::string raw_title2 = ".."; // An invalid cosmo title. 1457 std::string raw_title2 = ".."; // An invalid cosmo title.
1443 std::string title2; 1458 std::string title2;
1444 SyncAPINameToServerName(raw_title2, &title2); 1459 SyncAPINameToServerName(raw_title2, &title2);
1445 std::string url2 = "http://www.bla.com"; 1460 std::string url2 = "http://www.bla.com";
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 EXPECT_EQ(syncable::BOOKMARKS, node2.GetModelType()); 1546 EXPECT_EQ(syncable::BOOKMARKS, node2.GetModelType());
1532 // We should de-canonicalize the title in GetTitle(), but the title in the 1547 // We should de-canonicalize the title in GetTitle(), but the title in the
1533 // specifics should be stored in the server legal form. 1548 // specifics should be stored in the server legal form.
1534 EXPECT_EQ(raw_title2, node2.GetTitle()); 1549 EXPECT_EQ(raw_title2, node2.GetTitle());
1535 EXPECT_EQ(title2, node2.GetBookmarkSpecifics().title()); 1550 EXPECT_EQ(title2, node2.GetBookmarkSpecifics().title());
1536 EXPECT_EQ(url2, node2.GetBookmarkSpecifics().url()); 1551 EXPECT_EQ(url2, node2.GetBookmarkSpecifics().url());
1537 } 1552 }
1538 } 1553 }
1539 1554
1540 } // namespace browser_sync 1555 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698