summaryrefslogtreecommitdiffstats
path: root/net/websockets
diff options
context:
space:
mode:
authorryansturm <ryansturm@chromium.org>2016-02-22 16:10:21 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-23 00:11:18 +0000
commit7de050c68ce2a97c0165d09d06c89b8aff79fb77 (patch)
treec4a0af565f1c857da1bced1be3995b3e64b6ce99 /net/websockets
parent703186e524f56ea2f1f13dc87a4dd0aff3f8a9f0 (diff)
downloadchromium_src-7de050c68ce2a97c0165d09d06c89b8aff79fb77.zip
chromium_src-7de050c68ce2a97c0165d09d06c89b8aff79fb77.tar.gz
chromium_src-7de050c68ce2a97c0165d09d06c89b8aff79fb77.tar.bz2
Moving proxy resolution logic out of NetworkDelegate and into ProxyDelegate for DataReductionProxy
This involves removing two methods off the NetworkDelegate interface (and four off LayeredNetworkDelegate). DataReductionProxy's logic for these two methods will be moved to the DataReductionProxyDelegate from the DataReductionProxyNetworkDelegate. This also involved cleaning up some unit tests and moving calls to use ProxyDelegate instead of NetworkDelegate where relevant. Refactoring proxy related calls from NetworkDelegate to ProxyDelegate BUG=583369 Review URL: https://codereview.chromium.org/1680893002 Cr-Commit-Position: refs/heads/master@{#376860}
Diffstat (limited to 'net/websockets')
-rw-r--r--net/websockets/websocket_end_to_end_test.cc35
1 files changed, 26 insertions, 9 deletions
diff --git a/net/websockets/websocket_end_to_end_test.cc b/net/websockets/websocket_end_to_end_test.cc
index bb1d951..3dcf336 100644
--- a/net/websockets/websocket_end_to_end_test.cc
+++ b/net/websockets/websocket_end_to_end_test.cc
@@ -22,7 +22,7 @@
#include "base/strings/string_piece.h"
#include "base/thread_task_runner_handle.h"
#include "net/base/auth.h"
-#include "net/base/network_delegate.h"
+#include "net/base/proxy_delegate.h"
#include "net/base/test_data_directory.h"
#include "net/proxy/proxy_service.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
@@ -195,9 +195,9 @@ void ConnectTestingEventInterface::QuitNestedEventLoop() {
// A subclass of TestNetworkDelegate that additionally implements the
// OnResolveProxy callback and records the information passed to it.
-class TestNetworkDelegateWithProxyInfo : public TestNetworkDelegate {
+class TestProxyDelegateWithProxyInfo : public ProxyDelegate {
public:
- TestNetworkDelegateWithProxyInfo() {}
+ TestProxyDelegateWithProxyInfo() {}
struct ResolvedProxyInfo {
GURL url;
@@ -217,17 +217,34 @@ class TestNetworkDelegateWithProxyInfo : public TestNetworkDelegate {
resolved_proxy_info_.proxy_info = *result;
}
+ void OnTunnelConnectCompleted(const HostPortPair& endpoint,
+ const HostPortPair& proxy_server,
+ int net_error) override {}
+ void OnFallback(const ProxyServer& bad_proxy, int net_error) override {}
+ void OnBeforeSendHeaders(URLRequest* request,
+ const ProxyInfo& proxy_info,
+ HttpRequestHeaders* headers) override {}
+ void OnBeforeTunnelRequest(const HostPortPair& proxy_server,
+ HttpRequestHeaders* extra_headers) override {}
+ void OnTunnelHeadersReceived(
+ const HostPortPair& origin,
+ const HostPortPair& proxy_server,
+ const HttpResponseHeaders& response_headers) override {}
+ bool IsTrustedSpdyProxy(const net::ProxyServer& proxy_server) override {
+ return true;
+ }
+
private:
ResolvedProxyInfo resolved_proxy_info_;
- DISALLOW_COPY_AND_ASSIGN(TestNetworkDelegateWithProxyInfo);
+ DISALLOW_COPY_AND_ASSIGN(TestProxyDelegateWithProxyInfo);
};
class WebSocketEndToEndTest : public ::testing::Test {
protected:
WebSocketEndToEndTest()
: event_interface_(),
- network_delegate_(new TestNetworkDelegateWithProxyInfo),
+ proxy_delegate_(new TestProxyDelegateWithProxyInfo),
context_(true),
channel_(),
initialised_context_(false) {}
@@ -236,7 +253,7 @@ class WebSocketEndToEndTest : public ::testing::Test {
// ConnectAndWait(). This method is for the use of tests that need the
// URLRequestContext initialised before calling ConnectAndWait().
void InitialiseContext() {
- context_.set_network_delegate(network_delegate_.get());
+ context_.set_proxy_delegate(proxy_delegate_.get());
context_.Init();
initialised_context_ = true;
}
@@ -257,7 +274,7 @@ class WebSocketEndToEndTest : public ::testing::Test {
}
ConnectTestingEventInterface* event_interface_; // owned by channel_
- scoped_ptr<TestNetworkDelegateWithProxyInfo> network_delegate_;
+ scoped_ptr<TestProxyDelegateWithProxyInfo> proxy_delegate_;
TestURLRequestContext context_;
scoped_ptr<WebSocketChannel> channel_;
std::vector<std::string> sub_protocols_;
@@ -369,8 +386,8 @@ TEST_F(WebSocketEndToEndTest, DISABLED_ON_ANDROID(HttpsProxyUsed)) {
GURL ws_url = ws_server.GetURL(kEchoServer);
EXPECT_TRUE(ConnectAndWait(ws_url));
- const TestNetworkDelegateWithProxyInfo::ResolvedProxyInfo& info =
- network_delegate_->resolved_proxy_info();
+ const TestProxyDelegateWithProxyInfo::ResolvedProxyInfo& info =
+ proxy_delegate_->resolved_proxy_info();
EXPECT_EQ(ws_url, info.url);
EXPECT_TRUE(info.proxy_info.is_http());
}