update_engine: Do not ignore backoff on test/dev images
Currently we need to automatically try to test backoff scenarios, but the
backoff is disabled by default on test/dev images. This patch adds a check for a
new preference 'no-ignore-backoff' if the image was a non-official build. If the
preference does not exist, the default behavior is achieved, otherwise the
backoff is not being ignored.
BUG=chromium:825065
TEST=unittest
Change-Id: I2fca7e343479274fc9125407d27a4ae84d543641
Reviewed-on: https://chromium-review.googlesource.com/988296
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: David Haddock <dhaddock@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/common/constants.cc b/common/constants.cc
index 6fd373e..d3d851a 100644
--- a/common/constants.cc
+++ b/common/constants.cc
@@ -47,6 +47,7 @@
"metrics-attempt-last-reporting-time";
const char kPrefsMetricsCheckLastReportingTime[] =
"metrics-check-last-reporting-time";
+const char kPrefsNoIgnoreBackoff[] = "no-ignore-backoff";
const char kPrefsNumReboots[] = "num-reboots";
const char kPrefsNumResponsesSeen[] = "num-responses-seen";
const char kPrefsOmahaCohort[] = "omaha-cohort";
diff --git a/common/constants.h b/common/constants.h
index 1be22de..ddf7df5 100644
--- a/common/constants.h
+++ b/common/constants.h
@@ -49,6 +49,7 @@
extern const char kPrefsManifestSignatureSize[];
extern const char kPrefsMetricsAttemptLastReportingTime[];
extern const char kPrefsMetricsCheckLastReportingTime[];
+extern const char kPrefsNoIgnoreBackoff[];
extern const char kPrefsNumReboots[];
extern const char kPrefsNumResponsesSeen[];
extern const char kPrefsOmahaCohort[];
diff --git a/payload_state.cc b/payload_state.cc
index 6689cf4..a393b91 100644
--- a/payload_state.cc
+++ b/payload_state.cc
@@ -408,9 +408,11 @@
}
}
- if (!system_state_->hardware()->IsOfficialBuild()) {
+ if (!system_state_->hardware()->IsOfficialBuild() &&
+ !prefs_->Exists(kPrefsNoIgnoreBackoff)) {
// Backoffs are needed only for official builds. We do not want any delays
- // or update failures due to backoffs during testing or development.
+ // or update failures due to backoffs during testing or development. Unless
+ // the |kPrefsNoIgnoreBackoff| is manually set.
LOG(INFO) << "No backoffs for test/dev images. "
<< "Can proceed with the download";
return false;