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/download_action_unittest.cc b/download_action_unittest.cc
index 8135841..16c2507 100644
--- a/download_action_unittest.cc
+++ b/download_action_unittest.cc
@@ -143,7 +143,9 @@
ObjectFeederAction<InstallPlan> feeder_action;
feeder_action.set_obj(install_plan);
PrefsMock prefs;
- MockHttpFetcher* http_fetcher = new MockHttpFetcher(&data[0], data.size());
+ MockHttpFetcher* http_fetcher = new MockHttpFetcher(&data[0],
+ data.size(),
+ NULL);
// takes ownership of passed in HttpFetcher
DownloadAction download_action(&prefs, http_fetcher);
download_action.SetTestFileWriter(&writer);
@@ -289,7 +291,9 @@
feeder_action.set_obj(install_plan);
PrefsMock prefs;
DownloadAction download_action(&prefs,
- new MockHttpFetcher(&data[0], data.size()));
+ new MockHttpFetcher(&data[0],
+ data.size(),
+ NULL));
download_action.SetTestFileWriter(&writer);
DownloadActionDelegateMock download_delegate;
if (use_download_delegate) {
@@ -393,7 +397,7 @@
ObjectFeederAction<InstallPlan> feeder_action;
feeder_action.set_obj(install_plan);
PrefsMock prefs;
- DownloadAction download_action(&prefs, new MockHttpFetcher("x", 1));
+ DownloadAction download_action(&prefs, new MockHttpFetcher("x", 1, NULL));
download_action.SetTestFileWriter(&writer);
DownloadActionTestAction test_action;
@@ -427,7 +431,7 @@
ObjectFeederAction<InstallPlan> feeder_action;
feeder_action.set_obj(install_plan);
PrefsMock prefs;
- DownloadAction download_action(&prefs, new MockHttpFetcher("x", 1));
+ DownloadAction download_action(&prefs, new MockHttpFetcher("x", 1, NULL));
download_action.SetTestFileWriter(&writer);
BondActions(&feeder_action, &download_action);