Don't scatter during OOBE or user-initiated update checks.
We need to add logic to disable scattering of downloads if we are in OOBE
or if we're doing a manual update check.
Scheduled checks are already disabled during OOBE, but this extra check
will ensure that any scattering policy (there's a pending work item to get
policy during OOBE) during OOBE will have no effect on the update.
Similarly manual (i.e user-initiated) update checks through
update_engine_client or through Chrome UI should not honor scattering.
That way, this can serve as a simple user-friendly workaround in case
there's any bug in scattering logic that bricks the system by any chance.
BUG=chromeos-31563: Don't scatter during OOBE or manual update checks.
TEST=Updated unit tests. Tested all code paths manually on ZGB and Kaen.
Change-Id: Ib631e560c1f620ca53db79ee59dc66efb27ea83c
Reviewed-on: https://gerrit.chromium.org/gerrit/24564
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index e2bfc15..a0bf9a7 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -213,8 +213,9 @@
transfer_size_ = -1;
resume_offset_ = 0;
retry_count_ = 0;
- max_retry_count_ = (utils::IsOOBEComplete()) ? kMaxRetryCountOobeComplete
- : kMaxRetryCountOobeNotComplete;
+ max_retry_count_ = (system_state_->IsOOBEComplete() ?
+ kMaxRetryCountOobeComplete :
+ kMaxRetryCountOobeNotComplete);
no_network_retry_count_ = 0;
http_response_code_ = 0;
terminate_requested_ = false;