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

Side by Side Diff: components/data_reduction_proxy/common/data_reduction_proxy_headers_unittest.cc

Issue 333113002: Move data reduction proxy to Chrome-Proxy header for authentication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flywheel-refactor-net-fake-a-redirect-response-headers-chrome-proxy-auth
Patch Set: Created 6 years, 6 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 unified diff | Download patch
OLDNEW
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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 { "HTTP/1.1 502 Bad Gateway\n" 330 { "HTTP/1.1 502 Bad Gateway\n"
331 "Chrome-Proxy: bypass=1799\n", 331 "Chrome-Proxy: bypass=1799\n",
332 net::ProxyService::SHORT_BYPASS, 332 net::ProxyService::SHORT_BYPASS,
333 }, 333 },
334 { "HTTP/1.1 414 Request-URI Too Long\n", 334 { "HTTP/1.1 414 Request-URI Too Long\n",
335 net::ProxyService::PROXY_4XX_BYPASS, 335 net::ProxyService::PROXY_4XX_BYPASS,
336 }, 336 },
337 { "HTTP/1.1 414 Request-URI Too Long\n" 337 { "HTTP/1.1 414 Request-URI Too Long\n"
338 "Via: 1.1 Chrome-Compression-Proxy\n", 338 "Via: 1.1 Chrome-Compression-Proxy\n",
339 net::ProxyService::BYPASS_EVENT_TYPE_MAX, 339 net::ProxyService::BYPASS_EVENT_TYPE_MAX,
340 },
341 { "HTTP/1.1 407 Proxy Authentication Required\n",
342 net::ProxyService::MALFORMED_407_BYPASS,
343 },
344 { "HTTP/1.1 407 Proxy Authentication Required\n"
345 "Proxy-Authenticate: Basic\n"
346 "Via: 1.1 Chrome-Compression-Proxy\n",
347 net::ProxyService::BYPASS_EVENT_TYPE_MAX,
348 } 340 }
349 }; 341 };
350 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 342 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
351 std::string headers(tests[i].headers); 343 std::string headers(tests[i].headers);
352 HeadersToRaw(&headers); 344 HeadersToRaw(&headers);
353 scoped_refptr<net::HttpResponseHeaders> parsed( 345 scoped_refptr<net::HttpResponseHeaders> parsed(
354 new net::HttpResponseHeaders(headers)); 346 new net::HttpResponseHeaders(headers));
355 DataReductionProxyInfo chrome_proxy_info; 347 DataReductionProxyInfo chrome_proxy_info;
356 EXPECT_EQ(tests[i].expected_result, 348 EXPECT_EQ(tests[i].expected_result,
357 GetDataReductionProxyBypassEventType(parsed, &chrome_proxy_info)); 349 GetDataReductionProxyBypassEventType(parsed, &chrome_proxy_info));
358 } 350 }
359 } 351 }
360 } // namespace data_reduction_proxy 352 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698