AU: coalesce interactive / user-initiated flags
The latter was introduced recently but turns out it just carries
a duplicate meaning to the former, so we're eliminating it. This also
makes the case of a simulated scheduled update check more accurate, as
all of the effects of a scheduled update are made.
BUG=None
TEST=Unit tests; interactive/scheduled update check behaves as expected.
Change-Id: I8971aefcfc15cb76733059860832507e88795883
Reviewed-on: https://gerrit.chromium.org/gerrit/41082
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index b2cbe4c..1feda05 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -148,8 +148,7 @@
const string& omaha_url,
bool obey_proxies,
bool interactive,
- bool is_test_mode,
- bool is_user_initiated) {
+ bool is_test_mode) {
chrome_proxy_resolver_.Init();
fake_update_success_ = false;
if (status_ == UPDATE_STATUS_UPDATED_NEED_REBOOT) {
@@ -169,8 +168,7 @@
omaha_url,
obey_proxies,
interactive,
- is_test_mode,
- is_user_initiated)) {
+ is_test_mode)) {
return;
}
@@ -189,8 +187,7 @@
const string& omaha_url,
bool obey_proxies,
bool interactive,
- bool is_test_mode,
- bool is_user_initiated) {
+ bool is_test_mode) {
http_response_code_ = 0;
// Set the test mode flag for the current update attempt.
@@ -231,7 +228,7 @@
system_state_->set_device_policy(NULL);
}
- CalculateScatteringParams(is_user_initiated);
+ CalculateScatteringParams(interactive);
// Determine whether an alternative test address should be used.
string omaha_url_to_use = omaha_url;
@@ -283,7 +280,7 @@
return true;
}
-void UpdateAttempter::CalculateScatteringParams(bool is_user_initiated) {
+void UpdateAttempter::CalculateScatteringParams(bool interactive) {
// Take a copy of the old scatter value before we update it, as
// we need to update the waiting period if this value changes.
TimeDelta old_scatter_factor = scatter_factor_;
@@ -299,8 +296,8 @@
bool is_scatter_enabled = false;
if (scatter_factor_.InSeconds() == 0) {
LOG(INFO) << "Scattering disabled since scatter factor is set to 0";
- } else if (is_user_initiated) {
- LOG(INFO) << "Scattering disabled as this update check is user-initiated";
+ } else if (interactive) {
+ LOG(INFO) << "Scattering disabled as this is an interactive update check";
} else if (!system_state_->IsOOBEComplete()) {
LOG(INFO) << "Scattering disabled since OOBE is not complete yet";
} else {
@@ -510,7 +507,7 @@
void UpdateAttempter::CheckForUpdate(const string& app_version,
const string& omaha_url,
- bool is_user_initiated) {
+ bool interactive) {
LOG(INFO) << "New update check requested";
if (status_ != UPDATE_STATUS_IDLE) {
@@ -529,9 +526,9 @@
is_test_update_attempted_ = true;
}
- // Passing true for is_user_initiated to indicate that this
- // is not a scheduled update check.
- Update(app_version, omaha_url, true, true, is_test_mode, is_user_initiated);
+ // Pass through the interactive flag, in case we want to simulate a scheduled
+ // test.
+ Update(app_version, omaha_url, true, interactive, is_test_mode);
}
bool UpdateAttempter::RebootIfNeeded() {