UM: Policy for deciding download URL.

This adds a new private policy (UpdateDownloadUrl) for determining which
download URL should be used for obtaining the update payload. We further
extend an existing public policy (UpdateCanStart) to return the download
URL details, based on the current URL index and the number of failures
associated with it. This renders the explicit notion of "HTTP download
allowed" in the return value unnecessary: If HTTP is not allowed, then
HTTP URLs will not be considered.

We also implement logic for logging the start/end of a policy
evaluation, so that intermediate log messages emitted during evaluation
have a clear context.

BUG=chromium:358329
TEST=Unit tests.

Change-Id: Ib5343417480d8825082f83bed2630a6611360b61
Reviewed-on: https://chromium-review.googlesource.com/203373
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_manager/default_policy.h b/update_manager/default_policy.h
index b3767dc..f9f4011 100644
--- a/update_manager/default_policy.h
+++ b/update_manager/default_policy.h
@@ -35,9 +35,10 @@
       const bool interactive,
       const UpdateState& update_state) const override {
     result->update_can_start = true;
-    result->http_allowed = false;
     result->p2p_allowed = false;
     result->target_channel.clear();
+    result->download_url_idx = 0;
+    result->download_url_num_failures = 0;
     result->cannot_start_reason = UpdateCannotStartReason::kUndefined;
     result->scatter_wait_period = base::TimeDelta();
     result->scatter_check_threshold = 0;
@@ -53,6 +54,12 @@
     return EvalStatus::kSucceeded;
   }
 
+ protected:
+  // Policy override.
+  virtual std::string PolicyName() const override {
+    return "DefaultPolicy";
+  }
+
  private:
   DISALLOW_COPY_AND_ASSIGN(DefaultPolicy);
 };