PM: Policy for checking whether an update can start.

This policy is based on existing logic found in the following locations
through the current update engine code base:

- UpdateAttempter::CalculateUpdateParams(), which applies various device
  policy attributes and sets the update params.

- UpdateAttempter::CalculateScatteringParams(), called by the former for
  deciding the scatter wait period for the current update. Calls
  UpdateAttempter::GenerateNewWaitingPeriod() to compute a new wait
  period.

- OmahaRequestAction::IsWallClockBasedWaitingSatisfied() and
  OmahaRequestAction::IsUpdateCheckCountBasedWaitingSatisfied, which
  check whether a scattering derived wait period has elapsed and whether
  a check threshold counter was satisfied, respectively.

- UpdateAttempter::CalculateP2PParams() and
  P2PManagerImpl::IsP2PEnabled(), which decide whether P2P can be used.

- PayloadState::ComputeCandidateUrls(), where there's logic for deciding
  whether HTTP downloads are allowed.

Note that this policy request is based on two others. One is the public
UpdateCheckAllowed(), whose positive return value invalidates the
current update attempt. The second is a private policy
UpdateScattering() that decides whether the current update attempt is
subject to scattering.

BUG=chromium:358323
TEST=Unit tests.

Change-Id: I889a3d1c10e1722585fdc1aa87fb6f9d627b60c7
Reviewed-on: https://chromium-review.googlesource.com/198781
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/policy_manager/mock_policy.h b/policy_manager/mock_policy.h
index 7aa9d66..ffa323d 100644
--- a/policy_manager/mock_policy.h
+++ b/policy_manager/mock_policy.h
@@ -22,9 +22,10 @@
                      EvalStatus(EvaluationContext*, State*, std::string*,
                                 UpdateCheckParams*));
 
-  MOCK_CONST_METHOD4(UpdateDownloadAndApplyAllowed,
+  MOCK_CONST_METHOD6(UpdateCanStart,
                      EvalStatus(EvaluationContext*, State*, std::string*,
-                                bool*));
+                                UpdateCanStartResult*,
+                                const bool, const UpdateState&));
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MockPolicy);