Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: net/http/http_proxy_client_socket_pool_unittest.cc

Issue 517693002: Add embedder-specific headers to HTTP CONNECT tunnel request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/http_proxy_client_socket_pool_unittest.cc
diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc
index f2464919e3a72e53a9a3c66a76db1490d50b98f5..b7745421112332f91ac858995c6f662cd4af4e52 100644
--- a/net/http/http_proxy_client_socket_pool_unittest.cc
+++ b/net/http/http_proxy_client_socket_pool_unittest.cc
@@ -88,6 +88,11 @@ class HttpProxyClientSocketPoolTest
BoundNetLog().net_log()),
session_(CreateNetworkSession()),
http_proxy_histograms_("HttpProxyUnitTest"),
+ before_proxy_tunnel_request_callback_(
+ base::Bind(
+ &HttpProxyClientSocketPoolTest::OnBeforeProxyTunnelRequest,
+ base::Unretained(this))),
+ on_before_proxy_tunnel_request_called_(false),
spdy_util_(GetParam().protocol),
pool_(kMaxSockets,
kMaxSocketsPerGroup,
@@ -95,6 +100,7 @@ class HttpProxyClientSocketPoolTest
NULL,
&transport_socket_pool_,
&ssl_socket_pool_,
+ before_proxy_tunnel_request_callback_,
NULL) {}
virtual ~HttpProxyClientSocketPoolTest() {
@@ -154,7 +160,8 @@ class HttpProxyClientSocketPoolTest
session_->http_auth_cache(),
session_->http_auth_handler_factory(),
session_->spdy_session_pool(),
- tunnel));
+ tunnel,
+ before_proxy_tunnel_request_callback_));
}
scoped_refptr<HttpProxySocketParams> CreateTunnelParams() {
@@ -208,6 +215,15 @@ class HttpProxyClientSocketPoolTest
return transport_socket_pool_.last_request_priority();
}
+ void OnBeforeProxyTunnelRequest(const HostPortPair& proxy,
+ HttpRequestHeaders* extra_headers) {
+ on_before_proxy_tunnel_request_called_ = true;
+ }
+
+ bool on_before_proxy_tunnel_request_called() {
+ return on_before_proxy_tunnel_request_called_;
+ }
+
private:
SpdySessionDependencies session_deps_;
@@ -220,6 +236,9 @@ class HttpProxyClientSocketPoolTest
const scoped_refptr<HttpNetworkSession> session_;
ClientSocketPoolHistograms http_proxy_histograms_;
+ const base::Callback<void(const HostPortPair&, HttpRequestHeaders*)>
+ before_proxy_tunnel_request_callback_;
+ bool on_before_proxy_tunnel_request_called_;
protected:
SpdyTestUtil spdy_util_;
@@ -264,6 +283,7 @@ TEST_P(HttpProxyClientSocketPoolTest, NoTunnel) {
HttpProxyClientSocket* tunnel_socket =
static_cast<HttpProxyClientSocket*>(handle_.socket());
EXPECT_TRUE(tunnel_socket->IsConnected());
+ EXPECT_FALSE(on_before_proxy_tunnel_request_called());
}
// Make sure that HttpProxyConnectJob passes on its priority to its
@@ -363,6 +383,7 @@ TEST_P(HttpProxyClientSocketPoolTest, HaveAuth) {
HttpProxyClientSocket* tunnel_socket =
static_cast<HttpProxyClientSocket*>(handle_.socket());
EXPECT_TRUE(tunnel_socket->IsConnected());
+ EXPECT_TRUE(on_before_proxy_tunnel_request_called());
}
TEST_P(HttpProxyClientSocketPoolTest, AsyncHaveAuth) {

Powered by Google App Engine
This is Rietveld 408576698