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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc

Issue 863203009: Store Proxy Servers as proxy servers and not GURLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed failing test code. Created 5 years, 10 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/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
index 406ece1ea47d03346dc481365979839f136fb6a0..a27cc65abcb8f5150a21c31ca477b8b1d45b09e4 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol_unittest.cc
@@ -27,6 +27,7 @@
#include "net/base/network_delegate.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_transaction_test_util.h"
+#include "net/proxy/proxy_server.h"
#include "net/proxy/proxy_service.h"
#include "net/socket/socket_test_util.h"
#include "net/url_request/static_http_user_agent_settings.h"
@@ -287,11 +288,11 @@ class DataReductionProxyProtocolTest : public testing::Test {
// Returns the key to the |ProxyRetryInfoMap|.
std::string GetProxyKey(std::string proxy) {
- GURL gurl(proxy);
- std::string host_port = HostPortPair::FromURL(GURL(proxy)).ToString();
- if (gurl.SchemeIs("https"))
- return "https://" + host_port;
- return host_port;
+ net::ProxyServer proxy_server = net::ProxyServer::FromURI(
+ proxy, net::ProxyServer::SCHEME_HTTP);
+ if (!proxy_server.is_valid())
+ return HostPortPair::FromURL(GURL(std::string())).ToString();
+ return proxy_server.host_port_pair().ToString();
}
// Checks that |expected_num_bad_proxies| proxies are on the proxy retry list.
@@ -773,9 +774,11 @@ TEST_F(DataReductionProxyProtocolTest, BypassLogic) {
std::string fallback = proxy_params_->DefaultFallbackOrigin();
for (size_t i = 0; i < arraysize(tests); ++i) {
ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult(
- "PROXY " +
- HostPortPair::FromURL(GURL(primary)).ToString() + "; PROXY " +
- HostPortPair::FromURL(GURL(fallback)).ToString() + "; DIRECT"));
+ net::ProxyServer::FromURI(
+ primary, net::ProxyServer::SCHEME_HTTP).ToPacString() + "; " +
+ net::ProxyServer::FromURI(
+ fallback,
+ net::ProxyServer::SCHEME_HTTP).ToPacString() + "; DIRECT"));
TestProxyFallback(tests[i].method,
tests[i].first_response,
tests[i].expected_retry,
@@ -799,9 +802,12 @@ TEST_F(DataReductionProxyProtocolTest,
"DataReductionProxyRemoveMissingViaHeaderOtherBypass", "Relaxed");
ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult(
- "PROXY " +
- HostPortPair::FromURL(GURL(primary)).ToString() + "; PROXY " +
- HostPortPair::FromURL(GURL(fallback)).ToString() + "; DIRECT"));
+ net::ProxyServer::FromURI(
+ primary, net::ProxyServer::SCHEME_HTTP).ToPacString() + "; " +
+ net::ProxyServer::FromURI(
+ fallback,
+ net::ProxyServer::SCHEME_HTTP).ToPacString() +
+ "; DIRECT"));
// This response with the DRP via header should be accepted without causing a
// bypass.

Powered by Google App Engine
This is Rietveld 408576698