| Index: net/http/http_network_layer_unittest.cc
|
| diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc
|
| index 7fdfbc0efcc07cfd2e9cc0c60f676d682eed3ae5..488807bf8e67205c152a80531fc6e0ab982c9b14 100644
|
| --- a/net/http/http_network_layer_unittest.cc
|
| +++ b/net/http/http_network_layer_unittest.cc
|
| @@ -623,7 +623,7 @@ TEST_F(HttpNetworkLayerTest, ServerFallbackWithProxyTimedBypass) {
|
| MockRead("HTTP/1.1 200 OK\r\n"
|
| "Connection: keep-alive\r\n"
|
| "Chrome-Proxy: bypass=86400\r\n"
|
| - "Via: 1.1 Chrome Compression Proxy\r\n\r\n"),
|
| + "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n"),
|
| MockRead("Bypass message"),
|
| MockRead(SYNCHRONOUS, OK),
|
| };
|
| @@ -681,6 +681,64 @@ TEST_F(HttpNetworkLayerTest, NoServerFallbackWithChainedViaHeader) {
|
| MockRead data_reads[] = {
|
| MockRead("HTTP/1.1 200 OK\r\n"
|
| "Connection: keep-alive\r\n"
|
| + "Via: 1.1 Chrome-Compression-Proxy, 1.0 some-other-proxy\r\n\r\n"),
|
| + MockRead("Bypass message"),
|
| + MockRead(SYNCHRONOUS, OK),
|
| + };
|
| +
|
| + TestProxyFallbackByMethodWithMockReads(chrome_proxy, std::string(),
|
| + data_reads, arraysize(data_reads),
|
| + "GET", std::string(), false, 0);
|
| +}
|
| +
|
| +TEST_F(HttpNetworkLayerTest, NoServerFallbackWithDeprecatedViaHeader) {
|
| + // Verify that Chrome will not be induced to bypass the Chrome proxy when
|
| + // the Chrome Proxy via header is present, even if that header is chained.
|
| + std::string chrome_proxy = GetChromeProxy();
|
| + ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult(
|
| + "PROXY " + chrome_proxy + "; PROXY good:8080"));
|
| +
|
| + MockRead data_reads[] = {
|
| + MockRead("HTTP/1.1 200 OK\r\n"
|
| + "Connection: keep-alive\r\n"
|
| + "Via: 1.1 Chrome Compression Proxy\r\n\r\n"),
|
| + MockRead("Bypass message"),
|
| + MockRead(SYNCHRONOUS, OK),
|
| + };
|
| +
|
| + TestProxyFallbackByMethodWithMockReads(chrome_proxy, std::string(),
|
| + data_reads, arraysize(data_reads),
|
| + "GET", std::string(), false, 0);
|
| +}
|
| +
|
| +TEST_F(HttpNetworkLayerTest, ServerFallbackWithNoViaHeader) {
|
| + // Verify that the lack of a Via header induces proxy fallback to a second
|
| + // proxy, if configured.
|
| + std::string chrome_proxy = GetChromeProxy();
|
| + ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult(
|
| + "PROXY " + chrome_proxy + "; PROXY good:8080"));
|
| +
|
| + MockRead data_reads[] = {
|
| + MockRead("HTTP/1.1 200 OK\r\n"
|
| + "Connection: keep-alive\r\n\r\n"),
|
| + MockRead("Bypass message"),
|
| + MockRead(SYNCHRONOUS, OK),
|
| + };
|
| +
|
| + TestProxyFallbackWithMockReads(chrome_proxy, std::string(), data_reads,
|
| + arraysize(data_reads), 1u);
|
| +}
|
| +
|
| +TEST_F(HttpNetworkLayerTest, NoServerFallbackWithChainedViaHeader) {
|
| + // Verify that Chrome will not be induced to bypass the Chrome proxy when
|
| + // the Chrome Proxy via header is present, even if that header is chained.
|
| + std::string chrome_proxy = GetChromeProxy();
|
| + ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult(
|
| + "PROXY " + chrome_proxy + "; PROXY good:8080"));
|
| +
|
| + MockRead data_reads[] = {
|
| + MockRead("HTTP/1.1 200 OK\r\n"
|
| + "Connection: keep-alive\r\n"
|
| "Via: 1.1 Chrome Compression Proxy, 1.0 some-other-proxy\r\n\r\n"),
|
| MockRead("Bypass message"),
|
| MockRead(SYNCHRONOUS, OK),
|
| @@ -706,7 +764,7 @@ TEST_F(HttpNetworkLayerTest, ServerFallbackWithProxyTimedBypassAll) {
|
| MockRead("HTTP/1.1 200 OK\r\n"
|
| "Connection: keep-alive\r\n"
|
| "Chrome-Proxy: block=86400\r\n"
|
| - "Via: 1.1 Chrome Compression Proxy\r\n\r\n"),
|
| + "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n"),
|
| MockRead("Bypass message"),
|
| MockRead(SYNCHRONOUS, OK),
|
| };
|
|
|