AU: Manual proxy support

Utilize the ChromeProxyResolver to resolve proxies in our network
requests. This means the following changes:

- HttpFetcher classes take a ProxyResolver* in their ctor. Also, a few
  useful functions in HttpFetcher to allow subclasses to iterate
  through the proxies.

- LibcurlHttpFetcher support for using the ProxyResolver. It will
  attempt to use each proxy in the order specified. If any data comes
  in from any proxy, it won't continue down the list and will continue
  to use that proxy for its lifetime.

- UpdateAttempter can choose, for a given update session, whether or
  not to use the ChromeProxyResolver or DirectProxyResolver. For now,
  the logic is: for automatic checks, 80% of the time use
  ChromeProxyResolver, 20% DirectProxyResolver. For manual checks, the
  first 19 manual checks in a row use Chrome, then once it uses
  Direct, then starts over again. The idea is that the updater doesn't
  necessarily trust Chrome, so some requests should skip it. If a
  manual check is performed, the user likely wants her proxy settings
  honored, so use them, but don't allow frequent manual checks to
  starve out usage of the DirectProxyResolver.

- Updates to tests

BUG=3167
TEST=unittests, tested on device

Review URL: http://codereview.chromium.org/5205002

Change-Id: Iee0f589e5b28d4b804afe1f5b6729ba066d48d62
diff --git a/libcurl_http_fetcher.h b/libcurl_http_fetcher.h
index b3ba518..c41804e 100644
--- a/libcurl_http_fetcher.h
+++ b/libcurl_http_fetcher.h
@@ -22,8 +22,9 @@
  public:
   static const int kMaxRedirects = 10;
 
-  LibcurlHttpFetcher()
-      : curl_multi_handle_(NULL),
+  explicit LibcurlHttpFetcher(ProxyResolver* proxy_resolver)
+      : HttpFetcher(proxy_resolver),
+        curl_multi_handle_(NULL),
         curl_handle_(NULL),
         timeout_source_(NULL),
         transfer_in_progress_(false),
@@ -38,6 +39,7 @@
         force_build_type_(false),
         forced_official_build_(false),
         in_write_callback_(false),
+        sent_byte_(false),
         terminate_requested_(false) {}
 
   // Cleans up all internal state. Does not notify delegate
@@ -198,6 +200,10 @@
 
   // If true, we are currently performing a write callback on the delegate.
   bool in_write_callback_;
+  
+  // If true, we have returned at least one byte in the write callback
+  // to the delegate.
+  bool sent_byte_;
 
   // 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.