AU: Restrict to HTTPS for official builds.

Also, fix multi http fetcher unit tests to predictably force non-expensive
connections.

BUG=7945
TEST=unit tests; tested on device with dev server as well as with
no /root/.dev_mode, dev server, omaha update

Change-Id: Iacc0188b464ec018fc0dbbc8d7d447386113ceb7

Review URL: http://codereview.chromium.org/4004004
diff --git a/libcurl_http_fetcher.h b/libcurl_http_fetcher.h
index 2628ecc..25c4e49 100644
--- a/libcurl_http_fetcher.h
+++ b/libcurl_http_fetcher.h
@@ -35,6 +35,8 @@
         idle_seconds_(1),
         force_connection_type_(false),
         forced_expensive_connection_(false),
+        force_build_type_(false),
+        forced_official_build_(false),
         in_write_callback_(false),
         terminate_requested_(false) {}
 
@@ -69,12 +71,17 @@
 
   // Sets the retry timeout. Useful for testing.
   void set_retry_seconds(int seconds) { retry_seconds_ = seconds; }
-  
+
   void SetConnectionAsExpensive(bool is_expensive) {
     force_connection_type_ = true;
     forced_expensive_connection_ = is_expensive;
   }
 
+  void SetBuildType(bool is_official) {
+    force_build_type_ = true;
+    forced_official_build_ = is_official;
+  }
+
  private:
   // Asks libcurl for the http response code and stores it in the object.
   void GetHttpResponseCode();
@@ -133,6 +140,9 @@
   // expensive.
   bool ConnectionIsExpensive() const;
 
+  // Returns whether or not the current build is official.
+  bool IsOfficialBuild() const;
+
   // Handles for the libcurl library
   CURLM *curl_multi_handle_;
   CURL *curl_handle_;
@@ -168,15 +178,20 @@
 
   // Seconds to wait before asking libcurl to "perform".
   int idle_seconds_;
-  
+
   // If true, assume the network is expensive or not, according to
   // forced_expensive_connection_. (Useful for testing).
   bool force_connection_type_;
   bool forced_expensive_connection_;
 
+  // If true, assume the build is official or not, according to
+  // forced_official_build_. Useful for testing.
+  bool force_build_type_;
+  bool forced_official_build_;
+
   // If true, we are currently performing a write callback on the delegate.
   bool in_write_callback_;
-  
+
   // We can't clean everything up while we're in a write callback, so
   // if we get a terminate request, queue it until we can handle it.
   bool terminate_requested_;