UpdateManager: Do not schedule update checks if booted from removable device.

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: I5720b2b3c85c7de7f64eec4f7da000d3e13c778d
Reviewed-on: https://chromium-review.googlesource.com/207230
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 fd2f882..adbef4f 100644
--- a/update_manager/chromeos_policy.cc
+++ b/update_manager/chromeos_policy.cc
@@ -164,6 +164,14 @@
     return EvalStatus::kSucceeded;
   }
 
+  // Do not perform any automatic update checks if booted from removable device.
+  const bool* is_boot_device_removable_p = ec->GetValue(
+      state->system_provider()->var_is_boot_device_removable());
+  if (is_boot_device_removable_p && *is_boot_device_removable_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(