| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" | 5 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
| 6 | 6 |
| 7 #include "net/http/http_response_headers.h" | 7 #include "net/http/http_response_headers.h" |
| 8 #include "net/proxy/proxy_service.h" | 8 #include "net/proxy/proxy_service.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } | 267 } |
| 268 | 268 |
| 269 TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyBypassEventType) { | 269 TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyBypassEventType) { |
| 270 const struct { | 270 const struct { |
| 271 const char* headers; | 271 const char* headers; |
| 272 net::ProxyService::DataReductionProxyBypassType expected_result; | 272 net::ProxyService::DataReductionProxyBypassType expected_result; |
| 273 } tests[] = { | 273 } tests[] = { |
| 274 { "HTTP/1.1 200 OK\n" | 274 { "HTTP/1.1 200 OK\n" |
| 275 "Chrome-Proxy: bypass=0\n" | 275 "Chrome-Proxy: bypass=0\n" |
| 276 "Via: 1.1 Chrome-Compression-Proxy\n", | 276 "Via: 1.1 Chrome-Compression-Proxy\n", |
| 277 net::ProxyService::MEDIUM_BYPASS, |
| 278 }, |
| 279 { "HTTP/1.1 200 OK\n" |
| 280 "Chrome-Proxy: bypass=1\n" |
| 281 "Via: 1.1 Chrome-Compression-Proxy\n", |
| 277 net::ProxyService::SHORT_BYPASS, | 282 net::ProxyService::SHORT_BYPASS, |
| 278 }, | 283 }, |
| 279 { "HTTP/1.1 200 OK\n" | 284 { "HTTP/1.1 200 OK\n" |
| 280 "Chrome-Proxy: bypass=59\n" | 285 "Chrome-Proxy: bypass=59\n" |
| 281 "Via: 1.1 Chrome-Compression-Proxy\n", | 286 "Via: 1.1 Chrome-Compression-Proxy\n", |
| 282 net::ProxyService::SHORT_BYPASS, | 287 net::ProxyService::SHORT_BYPASS, |
| 283 }, | 288 }, |
| 284 { "HTTP/1.1 200 OK\n" | 289 { "HTTP/1.1 200 OK\n" |
| 285 "Chrome-Proxy: bypass=60\n" | 290 "Chrome-Proxy: bypass=60\n" |
| 286 "Via: 1.1 Chrome-Compression-Proxy\n", | 291 "Via: 1.1 Chrome-Compression-Proxy\n", |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 std::string headers(tests[i].headers); | 366 std::string headers(tests[i].headers); |
| 362 HeadersToRaw(&headers); | 367 HeadersToRaw(&headers); |
| 363 scoped_refptr<net::HttpResponseHeaders> parsed( | 368 scoped_refptr<net::HttpResponseHeaders> parsed( |
| 364 new net::HttpResponseHeaders(headers)); | 369 new net::HttpResponseHeaders(headers)); |
| 365 DataReductionProxyInfo chrome_proxy_info; | 370 DataReductionProxyInfo chrome_proxy_info; |
| 366 EXPECT_EQ(tests[i].expected_result, | 371 EXPECT_EQ(tests[i].expected_result, |
| 367 GetDataReductionProxyBypassType(parsed, &chrome_proxy_info)); | 372 GetDataReductionProxyBypassType(parsed, &chrome_proxy_info)); |
| 368 } | 373 } |
| 369 } | 374 } |
| 370 } // namespace data_reduction_proxy | 375 } // namespace data_reduction_proxy |
| OLD | NEW |