Download via HTTP only if enterprise policy allows.

In order to rollout HTTP-downloads for AU to stable channel, we want to
be a bit more conservative to preseve the defense in depth we have now
with HTTPS. So, we're introduced a new enterprise policy which should be
explicitly enabled in order for the payloads to be downloaded via HTTP.

This CL adds the support for honoring such a policy in update engine.

BUG=chromium:235562
TEST=New unit tests added, existing ones updated and they all pass.
TEST=Tested on ZGB with and without policy and it works as expected.
Change-Id: I356efbe237b10031161a57c70cb851c521915a76
Reviewed-on: https://gerrit.chromium.org/gerrit/55805
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index ff3236c..095de23 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -237,11 +237,14 @@
   EXPECT_CALL(*mock_system_state_.mock_payload_state(), UpdateFailed(_))
       .Times(0);
   OmahaResponse response;
-  response.payload_urls.push_back("http://url");
+  string url1 = "http://url1";
+  response.payload_urls.push_back(url1);
   response.payload_urls.push_back("https://url");
+  EXPECT_CALL(*(mock_system_state_.mock_payload_state()), GetCurrentUrl())
+      .WillRepeatedly(Return(url1));
   mock_system_state_.mock_payload_state()->SetResponse(response);
   attempter_.ScheduleErrorEventAction();
-  EXPECT_EQ(0, mock_system_state_.mock_payload_state()->GetUrlIndex());
+  EXPECT_EQ(url1, mock_system_state_.mock_payload_state()->GetCurrentUrl());
 }
 
 TEST_F(UpdateAttempterTest, ScheduleErrorEventActionTest) {