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

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: Created 5 years, 11 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..3859a15d1de59694a7a1afd43d6ee3667bfaf23b 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
@@ -287,11 +287,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(
bengr 2015/02/04 00:49:25 #include "net/proxy/proxy_server.h"
tbansal1 2015/02/04 22:49:10 Done.
+ proxy, net::ProxyServer::SCHEME_HTTP);
+ if (!proxy_server.is_valid())
+ return std::string(":65535");
bengr 2015/02/04 00:49:25 why this port?
tbansal1 2015/02/04 22:49:10 Done.
+ return proxy_server.host_port_pair().ToString();
}
// Checks that |expected_num_bad_proxies| proxies are on the proxy retry list.
@@ -774,8 +774,13 @@ TEST_F(DataReductionProxyProtocolTest, BypassLogic) {
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(
bengr 2015/02/04 00:49:25 You should be able to use ProxyServer::ToPacString
tbansal1 2015/02/04 22:49:10 Done.
+ primary, net::ProxyServer::SCHEME_HTTP).host_port_pair().ToString() +
+ "; PROXY " +
+ net::ProxyServer::FromURI(
+ fallback,
+ net::ProxyServer::SCHEME_HTTP).host_port_pair().ToString() +
+ "; DIRECT"));
TestProxyFallback(tests[i].method,
tests[i].first_response,
tests[i].expected_retry,
@@ -800,8 +805,13 @@ TEST_F(DataReductionProxyProtocolTest,
ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult(
"PROXY " +
- HostPortPair::FromURL(GURL(primary)).ToString() + "; PROXY " +
- HostPortPair::FromURL(GURL(fallback)).ToString() + "; DIRECT"));
+ net::ProxyServer::FromURI(
bengr 2015/02/04 00:49:25 ToPacString
tbansal1 2015/02/04 22:49:10 Done.
+ primary, net::ProxyServer::SCHEME_HTTP).host_port_pair().ToString() +
+ "; PROXY " +
+ net::ProxyServer::FromURI(
+ fallback,
+ net::ProxyServer::SCHEME_HTTP).host_port_pair().ToString() +
+ "; DIRECT"));
// This response with the DRP via header should be accepted without causing a
// bypass.

Powered by Google App Engine
This is Rietveld 408576698