UpdateManager: Do not schedule periodic update checks on unofficial builds.
This abides by the current logic, as found in
UpdateCheckScheduler::Run(). New unit test added to verify this
behavior.
BUG=chromium:358269
TEST=Unit tests.
Change-Id: Id7ff2134492f0c861f5abff76223b61496a2fe63
Reviewed-on: https://chromium-review.googlesource.com/207213
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_manager/chromeos_policy.cc b/update_manager/chromeos_policy.cc
index 86f53ce..fd2f882 100644
--- a/update_manager/chromeos_policy.cc
+++ b/update_manager/chromeos_policy.cc
@@ -156,6 +156,14 @@
result->updates_enabled = true;
result->target_channel.clear();
+ // Unofficial builds should not perform any automatic update checks.
+ const bool* is_official_build_p = ec->GetValue(
+ state->system_provider()->var_is_official_build());
+ if (is_official_build_p && !(*is_official_build_p)) {
+ result->updates_enabled = false;
+ return EvalStatus::kSucceeded;
+ }
+
DevicePolicyProvider* const dp_provider = state->device_policy_provider();
const bool* device_policy_is_loaded_p = ec->GetValue(