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/update_manager-inl.h b/update_manager/update_manager-inl.h
index 544a371..362d4c5 100644
--- a/update_manager/update_manager-inl.h
+++ b/update_manager/update_manager-inl.h
@@ -22,8 +22,10 @@
                                         Args...) const,
     R* result, Args... args) {
   std::string error;
+  const std::string policy_name = policy_->PolicyRequestName(policy_method);
 
   // First try calling the actual policy.
+  LOG(INFO) << "Evaluating " << policy_name << " START";
   EvalStatus status = (policy_.get()->*policy_method)(ec, state_.get(), &error,
                                                       result, args...);
 
@@ -37,6 +39,8 @@
       LOG(WARNING) << "Request to default policy also failed: " << error;
     }
   }
+  LOG(INFO) << "Evaluating " << policy_name << " END";
+
   // TODO(deymo): Log the actual state used from the EvaluationContext.
   return status;
 }