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

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: Reworked HaveAuth test Created 6 years, 3 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 6826e0b0c59088730664a23332a5349780e3bf8d..1a73b37aa1e5ef0c8b762b6a8dbdddbd550c665e 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
@@ -169,7 +169,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(
@@ -181,10 +191,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(
@@ -199,7 +219,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