Revert "Continue with an older update if update progress is 30% or more"

This reverts commit 249030ef688639585974d7fd2b4383f695551da0.

The problem with this patch is that if we decide to resume an older
update, we will already have overwritten the persistent data used by
PayloadState.

BUG=chromium:244538
TEST=None
Change-Id: Ifb19a399e0afb35e974670ae4171d24b5b1491a5
Reviewed-on: https://gerrit.chromium.org/gerrit/58937
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
diff --git a/constants.cc b/constants.cc
index 4dcb83b..3609a02 100644
--- a/constants.cc
+++ b/constants.cc
@@ -41,8 +41,6 @@
 const char kPrefsUpdateServerCertificate[] = "update-server-cert";
 const char kPrefsUpdateStateNextDataOffset[] = "update-state-next-data-offset";
 const char kPrefsUpdateStateNextOperation[] = "update-state-next-operation";
-const char kPrefsUpdateStateOverallProgress[] =
-    "update-state-overall-progress";
 const char kPrefsUpdateStateSHA256Context[] = "update-state-sha-256-context";
 const char kPrefsUpdateStateSignatureBlob[] = "update-state-signature-blob";
 const char kPrefsUpdateStateSignedSHA256Context[] =
diff --git a/constants.h b/constants.h
index a188a51..e97ec90 100644
--- a/constants.h
+++ b/constants.h
@@ -44,7 +44,6 @@
 extern const char kPrefsUpdateServerCertificate[];
 extern const char kPrefsUpdateStateNextDataOffset[];
 extern const char kPrefsUpdateStateNextOperation[];
-extern const char kPrefsUpdateStateOverallProgress[];
 extern const char kPrefsUpdateStateSHA256Context[];
 extern const char kPrefsUpdateStateSignatureBlob[];
 extern const char kPrefsUpdateStateSignedSHA256Context[];
@@ -66,10 +65,6 @@
 // The default number of UMA buckets for metrics.
 const int kNumDefaultUmaBuckets = 50;
 
-// If an update has completed at least this many percent, complete it
-// instead of letting a newer update clobber it.
-const int kUpdateClobberPercentage = 30;
-
 // General constants
 const int kNumBytesInOneMiB = 1024 * 1024;
 
diff --git a/delta_performer.cc b/delta_performer.cc
index 64342ad..dd9a4c7 100644
--- a/delta_performer.cc
+++ b/delta_performer.cc
@@ -1110,30 +1110,8 @@
   string interrupted_hash;
   TEST_AND_RETURN_FALSE(prefs->GetString(kPrefsUpdateCheckResponseHash,
                                          &interrupted_hash) &&
-                        !interrupted_hash.empty());
-  if (interrupted_hash != update_check_response_hash) {
-    /* If there is a new update but we're already way into the current
-     * update (say, 30%), just continue the current update. Why?
-     * Because otherwise infrequently used machines with low-bandwidth
-     * connections will never finish updating. This is detailed in bug
-     * 244538, see
-     * https://code.google.com/p/chromium/issues/detail?id=244538
-     */
-    int64_t overall_progress = 0;
-    prefs->GetInt64(kPrefsUpdateStateOverallProgress, &overall_progress);
-    if (overall_progress > kUpdateClobberPercentage) {
-      LOG(INFO) << "Resuming current update (at "
-                << overall_progress
-                << "% completion) "
-                << "despite the fact that there's a newer update.";
-    } else {
-      LOG(INFO) << "Abandoning current update (at "
-                << overall_progress
-                << "% completion) "
-                << "because there is a newer update available.";
-      return false;
-    }
-  }
+                        !interrupted_hash.empty() &&
+                        interrupted_hash == update_check_response_hash);
 
   int64_t resumed_update_failures;
   TEST_AND_RETURN_FALSE(!prefs->GetInt64(kPrefsResumedUpdateFailures,
@@ -1170,7 +1148,6 @@
     prefs->SetString(kPrefsUpdateStateSignatureBlob, "");
     prefs->SetInt64(kPrefsManifestMetadataSize, -1);
     prefs->SetInt64(kPrefsResumedUpdateFailures, 0);
-    prefs->SetInt64(kPrefsUpdateStateOverallProgress, 0);
   }
   return true;
 }
@@ -1189,8 +1166,6 @@
   }
   TEST_AND_RETURN_FALSE(prefs_->SetInt64(kPrefsUpdateStateNextOperation,
                                          next_operation_num_));
-  TEST_AND_RETURN_FALSE(prefs_->SetInt64(kPrefsUpdateStateOverallProgress,
-                                         overall_progress_));
   return true;
 }
 
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index aa6880a..410fceb 100644
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -575,8 +575,6 @@
                               state->metadata_size)).WillOnce(Return(true));
   EXPECT_CALL(prefs, SetInt64(kPrefsUpdateStateNextOperation, _))
       .WillRepeatedly(Return(true));
-  EXPECT_CALL(prefs, SetInt64(kPrefsUpdateStateOverallProgress, _))
-      .WillRepeatedly(Return(true));
   EXPECT_CALL(prefs, GetInt64(kPrefsUpdateStateNextOperation, _))
       .WillOnce(Return(false));
   EXPECT_CALL(prefs, SetInt64(kPrefsUpdateStateNextDataOffset, _))