Enable test mode updates.

* Uses the GPIO module to deduce whether a current update session needs
  to be treated as a controlled test, which allows a few relaxations.

* LibcurlHttpFetcher is extended to relax some of its security lock down
  provisions.

* Fix: a test mode flag remains persistent throughout an update attempt,
  so that it can be delegated to the various HttpFetcher instances used
  in the same attempt.

BUG=chromium-os:25397
TEST=Builds and unittests; automated test script works w/ servo
connected Alex

Change-Id: I8a29d1a21a0632912c10f01f69a26d9c659472fd
Reviewed-on: https://gerrit.chromium.org/gerrit/25128
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
diff --git a/update_check_scheduler.cc b/update_check_scheduler.cc
index be599ab..074cb4a 100644
--- a/update_check_scheduler.cc
+++ b/update_check_scheduler.cc
@@ -90,12 +90,12 @@
   CHECK(me->scheduled_);
   me->scheduled_ = false;
 
-  bool is_test = false;
+  bool is_test_mode = false;
   if (me->system_state_->IsOOBEComplete() ||
-      (is_test = (!me->is_test_update_attempted_ &&
-                  me->gpio_handler_ &&
-                  me->gpio_handler_->IsTestModeSignaled()))) {
-    if (is_test) {
+      (is_test_mode = (!me->is_test_update_attempted_ &&
+                       me->gpio_handler_ &&
+                       me->gpio_handler_->IsTestModeSignaled()))) {
+    if (is_test_mode) {
       LOG(WARNING)
           << "test mode signaled, allowing update check prior to OOBE complete";
       me->is_test_update_attempted_ = true;
@@ -103,7 +103,7 @@
 
     // Before updating, we flush any previously generated UMA reports.
     CertificateChecker::FlushReport();
-    me->update_attempter_->Update("", "", false, false, is_test, false);
+    me->update_attempter_->Update("", "", false, false, is_test_mode, false);
   } else {
     // Skips all automatic update checks if the OOBE process is not complete and
     // schedules a new check as if it is the first one.