Updater avoids download in case of an error HTTP response.

(a) LibcurlHttpFetcher avoids download if the HTTP reponse indicates an
error; corresponding change to unit test code and test HTTP server.  (b)
Added a method for returning the total bytes downloaded to HttpFetcher
and all subclasses, needed for unit testing.  (c) Generalized check for
successful HTTP response code in LibcurlHttpFetcher.

BUG=chromium-os:9648
TEST=unit tests

Change-Id: I46d72fbde0ecfb53823b0705ce17f9547515ee61
Reviewed-on: https://gerrit.chromium.org/gerrit/11773
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
diff --git a/mock_http_fetcher.h b/mock_http_fetcher.h
index 6d72b92..0fd9537 100644
--- a/mock_http_fetcher.h
+++ b/mock_http_fetcher.h
@@ -51,6 +51,11 @@
       delegate_->SeekToOffset(offset);
   }
 
+  // Dummy: no bytes were downloaded.
+  virtual size_t GetBytesDownloaded() {
+    return sent_size_;
+  }
+
   // Begins the transfer if it hasn't already begun.
   virtual void BeginTransfer(const std::string& url);