Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc |
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc |
index 16d91f947b4d9e4ea30825631e0a559df60bffa2..7e3a48dc7c90dce9f62912088137ee00d2c2a14e 100644 |
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc |
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_protocol_unittest.cc |
@@ -305,106 +305,6 @@ TEST_F(DataReductionProxyProtocolTest, TestIdempotency) { |
} |
} |
-// Tests that the response is correctly overwritten as a redirect. |
-TEST_F(DataReductionProxyProtocolTest, OverrideResponseAsRedirect) { |
- net::TestURLRequestContext context; |
- const struct { |
- const char* headers; |
- const char* expected_headers; |
- } tests[] = { |
- { "HTTP/1.1 200 0K\n" |
- "Chrome-Proxy: block=1\n" |
- "Via: 1.1 Chrome-Compression-Proxy\n", |
- |
- "HTTP/1.1 302 Found\n" |
- "Chrome-Proxy: block=1\n" |
- "Via: 1.1 Chrome-Compression-Proxy\n" |
- "Location: http://www.google.com/\n" |
- }, |
- { "HTTP/1.1 200 0K\n" |
- "Chrome-Proxy: block-once\n" |
- "Via: 1.1 Chrome-Compression-Proxy\n", |
- |
- "HTTP/1.1 302 Found\n" |
- "Chrome-Proxy: block-once\n" |
- "Via: 1.1 Chrome-Compression-Proxy\n" |
- "Location: http://www.google.com/\n" |
- }, |
- { "HTTP/1.1 302 Found\n" |
- "Location: http://foo.com/\n", |
- |
- "HTTP/1.1 302 Found\n" |
- "Location: http://www.google.com/\n" |
- }, |
- }; |
- |
- for (size_t i = 0; i < arraysize(tests); ++i) { |
- std::string headers(tests[i].headers); |
- HeadersToRaw(&headers); |
- scoped_refptr<HttpResponseHeaders> original_response_headers( |
- new HttpResponseHeaders(headers)); |
- scoped_refptr<HttpResponseHeaders> override_response_headers; |
- TestDelegate test_delegate; |
- scoped_ptr<net::URLRequest> request( |
- context.CreateRequest(GURL("http://www.google.com/"), |
- net::DEFAULT_PRIORITY, |
- NULL, |
- NULL)); |
- OverrideResponseAsRedirect(request.get(), original_response_headers.get(), |
- &override_response_headers); |
- int expected_flags = net::LOAD_DISABLE_CACHE | net::LOAD_BYPASS_PROXY; |
- EXPECT_EQ(expected_flags, request->load_flags()); |
- std::string override_headers; |
- override_response_headers->GetNormalizedHeaders(&override_headers); |
- EXPECT_EQ(std::string(tests[i].expected_headers), override_headers); |
- } |
-} |
- |
-// Tests that the response is correctly overwritten as a redirect with CORS |
-// headers when an Origin header is provided in the initial request. |
-TEST_F(DataReductionProxyProtocolTest, OverrideResponseAsRedirectCORS) { |
- net::TestURLRequestContext context; |
- const struct { |
- const char* headers; |
- const char* expected_headers; |
- } tests[] = { |
- { "HTTP/1.1 200 0K\n" |
- "Chrome-Proxy: block=1\n" |
- "Via: 1.1 Chrome-Compression-Proxy\n", |
- |
- "HTTP/1.1 302 Found\n" |
- "Chrome-Proxy: block=1\n" |
- "Via: 1.1 Chrome-Compression-Proxy\n" |
- "Location: http://www.google.com/\n" |
- "Access-Control-Allow-Origin: http://www.else.com\n" |
- "Access-Control-Allow-Credentials: true\n" |
- }, |
- }; |
- |
- for (size_t i = 0; i < arraysize(tests); ++i) { |
- std::string headers(tests[i].headers); |
- HeadersToRaw(&headers); |
- scoped_refptr<HttpResponseHeaders> original_response_headers( |
- new HttpResponseHeaders(headers)); |
- scoped_refptr<HttpResponseHeaders> override_response_headers; |
- TestDelegate test_delegate; |
- scoped_ptr<net::URLRequest> request( |
- context.CreateRequest(GURL("http://www.google.com/"), |
- net::DEFAULT_PRIORITY, |
- NULL, |
- NULL)); |
- request->SetExtraRequestHeaderByName("Origin", "http://www.else.com", true); |
- OverrideResponseAsRedirect(request.get(), original_response_headers.get(), |
- &override_response_headers); |
- int expected_flags = net::LOAD_DISABLE_CACHE | net::LOAD_BYPASS_PROXY; |
- EXPECT_EQ(expected_flags, request->load_flags()); |
- std::string override_headers; |
- override_response_headers->GetNormalizedHeaders(&override_headers); |
- EXPECT_EQ(std::string(tests[i].expected_headers), override_headers); |
- } |
-} |
- |
- |
// After each test, the proxy retry info will contain zero, one, or two of the |
// data reduction proxies depending on whether no bypass was indicated by the |
// initial response, a single proxy bypass was indicated, or a double bypass |