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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_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: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc
index 17430d87cae36775b2e6588c75f3bd1d4d5b9bf3..563bc053e3f0037db4e33db76701e8cb0fc1f54d 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc
@@ -156,7 +156,17 @@ TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) {
&headers);
EXPECT_FALSE(headers.HasHeader(kChromeProxyHeader));
- // Write headers with a valid data reduction proxy;
+ // Don't write headers with a valid data reduction ssl proxy.
+ auth_handler.MaybeAddRequestHeader(
+ NULL,
+ net::ProxyServer::FromURI(
+ net::HostPortPair::FromURL(
+ GURL(params->DefaultSSLOrigin())).ToString(),
+ net::ProxyServer::SCHEME_HTTP),
+ &headers);
+ EXPECT_FALSE(headers.HasHeader(kChromeProxyHeader));
+
+ // Write headers with a valid data reduction proxy.
auth_handler.MaybeAddRequestHeader(
NULL,
net::ProxyServer::FromURI(
@@ -168,10 +178,20 @@ TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) {
headers.GetHeader(kChromeProxyHeader, &header_value);
EXPECT_EQ(kExpectedHeader2, header_value);
+ // Write headers with a valid data reduction ssl proxy when one is expected.
+ net::HttpRequestHeaders ssl_headers;
+ auth_handler.MaybeAddProxyTunnelRequestHandler(
+ net::HostPortPair::FromURL(GURL(params->DefaultSSLOrigin())),
+ &ssl_headers);
+ EXPECT_TRUE(ssl_headers.HasHeader(kChromeProxyHeader));
+ std::string ssl_header_value;
+ ssl_headers.GetHeader(kChromeProxyHeader, &ssl_header_value);
+ EXPECT_EQ(kExpectedHeader2, ssl_header_value);
+
// Fast forward 24 hours. The header should be the same.
auth_handler.set_offset(base::TimeDelta::FromSeconds(24 * 60 * 60));
net::HttpRequestHeaders headers2;
- // Write headers with a valid data reduction proxy;
+ // Write headers with a valid data reduction proxy.
auth_handler.MaybeAddRequestHeader(
NULL,
net::ProxyServer::FromURI(
@@ -186,7 +206,7 @@ TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) {
// Fast forward one more second. The header should be new.
auth_handler.set_offset(base::TimeDelta::FromSeconds(24 * 60 * 60 + 1));
net::HttpRequestHeaders headers3;
- // Write headers with a valid data reduction proxy;
+ // Write headers with a valid data reduction proxy.
auth_handler.MaybeAddRequestHeader(
NULL,
net::ProxyServer::FromURI(

Powered by Google App Engine
This is Rietveld 408576698