summaryrefslogtreecommitdiffstats
path: root/components/cronet/android
diff options
context:
space:
mode:
authorryansturm <ryansturm@chromium.org>2016-02-29 16:13:21 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-01 00:15:41 +0000
commit4e254a6cef98f089a02123d32a22672b3e900aa7 (patch)
tree399890f9bc92c9e28ad980ec975c8014aec86c6d /components/cronet/android
parentbd162ec5dcf4377d94bc08b871a64945a2793612 (diff)
downloadchromium_src-4e254a6cef98f089a02123d32a22672b3e900aa7.zip
chromium_src-4e254a6cef98f089a02123d32a22672b3e900aa7.tar.gz
chromium_src-4e254a6cef98f089a02123d32a22672b3e900aa7.tar.bz2
Passing in a Data Reduction Proxy Delegate from Cronet with Data Reduction Proxy Enabled
The Cronet test, CronetUrlRequestContextTest#testDataReductionProxyEnabled started to fail as a result of https://codereview.chromium.org/1680893002 This fix creates a DataReductionProxyDelegate for Cronet when built with the data_reduction build flag. The test relied on having DataReductionProxyNetworkDelegate handle the proxy resolution before, but that work is now handled by DataReductionProxyDelegate. BUG=589600 Review URL: https://codereview.chromium.org/1725123005 Cr-Commit-Position: refs/heads/master@{#378337}
Diffstat (limited to 'components/cronet/android')
-rw-r--r--components/cronet/android/cronet_data_reduction_proxy.cc5
-rw-r--r--components/cronet/android/cronet_data_reduction_proxy.h5
-rw-r--r--components/cronet/android/cronet_url_request_context_adapter.cc2
3 files changed, 12 insertions, 0 deletions
diff --git a/components/cronet/android/cronet_data_reduction_proxy.cc b/components/cronet/android/cronet_data_reduction_proxy.cc
index 360862fb..76321be 100644
--- a/components/cronet/android/cronet_data_reduction_proxy.cc
+++ b/components/cronet/android/cronet_data_reduction_proxy.cc
@@ -11,6 +11,7 @@
#include "base/single_thread_task_runner.h"
#include "components/cronet/android/cronet_in_memory_pref_store.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h"
@@ -106,6 +107,10 @@ CronetDataReductionProxy::CreateNetworkDelegate(
false /* No bypass UMA */);
}
+scoped_ptr<net::ProxyDelegate> CronetDataReductionProxy::CreateProxyDelegate() {
+ return io_data_->CreateProxyDelegate();
+}
+
scoped_ptr<net::URLRequestInterceptor>
CronetDataReductionProxy::CreateInterceptor() {
return io_data_->CreateInterceptor();
diff --git a/components/cronet/android/cronet_data_reduction_proxy.h b/components/cronet/android/cronet_data_reduction_proxy.h
index ff4fa5f..c67ed78 100644
--- a/components/cronet/android/cronet_data_reduction_proxy.h
+++ b/components/cronet/android/cronet_data_reduction_proxy.h
@@ -25,6 +25,7 @@ class DataReductionProxySettings;
namespace net {
class NetLog;
class NetworkDelegate;
+class ProxyDelegate;
class URLRequestContext;
class URLRequestContextGetter;
class URLRequestInterceptor;
@@ -57,6 +58,10 @@ class CronetDataReductionProxy {
scoped_ptr<net::NetworkDelegate> CreateNetworkDelegate(
scoped_ptr<net::NetworkDelegate> wrapped_network_delegate);
+ // Constructs a proxy delegate suitable for adding Data Reduction Proxy
+ // proxy resolution.
+ scoped_ptr<net::ProxyDelegate> CreateProxyDelegate();
+
// Constructs a URLRequestInterceptor suitable for carrying out the Data
// Reduction Proxy's bypass protocol.
scoped_ptr<net::URLRequestInterceptor> CreateInterceptor();
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc
index 776fec7..e42ed20 100644
--- a/components/cronet/android/cronet_url_request_context_adapter.cc
+++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -418,6 +418,8 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread(
GetNetworkTaskRunner(), net_log_.get()));
network_delegate = data_reduction_proxy_->CreateNetworkDelegate(
std::move(network_delegate));
+ context_builder.set_proxy_delegate(
+ data_reduction_proxy_->CreateProxyDelegate());
std::vector<scoped_ptr<net::URLRequestInterceptor>> interceptors;
interceptors.push_back(data_reduction_proxy_->CreateInterceptor());
context_builder.SetInterceptors(std::move(interceptors));