UpdateManager: Obey server-dictated poll interval when scheduling checks.
This abides by the current logic, as found in
UpdateCheckScheduler::ComputeNextIntervalAndFuzz(). New unit tests
added to verify this behavior, as well as the addition of a new
UpdaterProvider variable to pull this value from the UpdateAttempter.
BUG=chromium:358269
TEST=Unit tests.
Change-Id: I0ac67dea5a622823a9c4713ec7165a55bc0a5c92
Reviewed-on: https://chromium-review.googlesource.com/207471
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_attempter.h b/update_attempter.h
index 3d08347..037fc24 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -195,11 +195,16 @@
// This will return an empty string otherwise.
std::string const& GetPrevVersion() const { return prev_version_; }
- // Returns the nubmer of consecutive failed update checks.
+ // Returns the number of consecutive failed update checks.
virtual unsigned int consecutive_failed_update_checks() const {
return consecutive_failed_update_checks_;
}
+ // Returns the poll interval dictated by Omaha, if provided; zero otherwise.
+ virtual unsigned int server_dictated_poll_interval() const {
+ return server_dictated_poll_interval_;
+ }
+
private:
// Update server URL for automated lab test.
static const char* const kTestUpdateUrl;
@@ -458,6 +463,10 @@
// next update check interval.
unsigned int consecutive_failed_update_checks_ = 0;
+ // The poll interval (in seconds) that was dictated by Omaha, if any; zero
+ // otherwise. This is needed for calculating the update check interval.
+ unsigned int server_dictated_poll_interval_ = 0;
+
DISALLOW_COPY_AND_ASSIGN(UpdateAttempter);
};