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

Unified Diff: sync/sessions/sync_session_unittest.cc

Issue 10006046: Abort sync cycles when download step fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Retry on migration done responses Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/sessions/sync_session.cc ('k') | sync/test/engine/mock_connection_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/sync_session_unittest.cc
diff --git a/sync/sessions/sync_session_unittest.cc b/sync/sessions/sync_session_unittest.cc
index 48524a4167476da834bf51278bf8692f479030f5..d5ce46a6d3c8b16043ee1636fd4d9d3467b66baf 100644
--- a/sync/sessions/sync_session_unittest.cc
+++ b/sync/sessions/sync_session_unittest.cc
@@ -215,6 +215,8 @@ TEST_F(SyncSessionTest, MoreToSyncIfUnsyncedGreaterThanCommitted) {
TEST_F(SyncSessionTest, MoreToDownloadIfDownloadFailed) {
status()->set_updates_request_types(ParamsMeaningAllEnabledTypes());
+ status()->set_last_download_updates_result(NETWORK_IO_ERROR);
+
// When DownloadUpdatesCommand fails, these should be false.
EXPECT_FALSE(status()->ServerSaysNothingMoreToDownload());
EXPECT_FALSE(status()->download_updates_succeeded());
@@ -229,6 +231,7 @@ TEST_F(SyncSessionTest, MoreToDownloadIfGotChangesRemaining) {
// When the server returns changes_remaining, that means there's
// more to download.
+ status()->set_last_download_updates_result(SYNCER_OK);
status()->mutable_updates_response()->mutable_get_updates()
->set_changes_remaining(1000L);
EXPECT_FALSE(status()->ServerSaysNothingMoreToDownload());
@@ -242,54 +245,7 @@ TEST_F(SyncSessionTest, MoreToDownloadIfGotChangesRemaining) {
TEST_F(SyncSessionTest, MoreToDownloadIfGotNoChangesRemaining) {
status()->set_updates_request_types(ParamsMeaningAllEnabledTypes());
- // When the server returns a timestamp, that means we're up to date.
- status()->mutable_updates_response()->mutable_get_updates()
- ->set_changes_remaining(0);
- EXPECT_TRUE(status()->ServerSaysNothingMoreToDownload());
- EXPECT_TRUE(status()->download_updates_succeeded());
-
- // Download updates has its own loop in the syncer; it shouldn't factor
- // into HasMoreToSync.
- EXPECT_FALSE(session_->HasMoreToSync());
-}
-
-TEST_F(SyncSessionTest, MoreToDownloadIfGotNoChangesRemainingForSubset) {
- status()->set_updates_request_types(ParamsMeaningJustOneEnabledType());
-
- // When the server returns a timestamp, that means we're up to date for that
- // type. But there may still be more to download if there are other
- // datatypes that we didn't request on this go-round.
- status()->mutable_updates_response()->mutable_get_updates()
- ->set_changes_remaining(0);
-
- EXPECT_TRUE(status()->ServerSaysNothingMoreToDownload());
- EXPECT_TRUE(status()->download_updates_succeeded());
-
- // Download updates has its own loop in the syncer; it shouldn't factor
- // into HasMoreToSync.
- EXPECT_FALSE(session_->HasMoreToSync());
-}
-
-TEST_F(SyncSessionTest, MoreToDownloadIfGotChangesRemainingAndEntries) {
- status()->set_updates_request_types(ParamsMeaningAllEnabledTypes());
- // The actual entry count should not factor into the HasMoreToSync
- // determination.
- status()->mutable_updates_response()->mutable_get_updates()->add_entries();
- status()->mutable_updates_response()->mutable_get_updates()
- ->set_changes_remaining(1000000L);;
- EXPECT_FALSE(status()->ServerSaysNothingMoreToDownload());
- EXPECT_TRUE(status()->download_updates_succeeded());
-
- // Download updates has its own loop in the syncer; it shouldn't factor
- // into HasMoreToSync.
- EXPECT_FALSE(session_->HasMoreToSync());
-}
-
-TEST_F(SyncSessionTest, MoreToDownloadIfGotNoChangesRemainingAndEntries) {
- status()->set_updates_request_types(ParamsMeaningAllEnabledTypes());
- // The actual entry count should not factor into the HasMoreToSync
- // determination.
- status()->mutable_updates_response()->mutable_get_updates()->add_entries();
+ status()->set_last_download_updates_result(SYNCER_OK);
status()->mutable_updates_response()->mutable_get_updates()
->set_changes_remaining(0);
EXPECT_TRUE(status()->ServerSaysNothingMoreToDownload());
« no previous file with comments | « sync/sessions/sync_session.cc ('k') | sync/test/engine/mock_connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698