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

Unified Diff: net/proxy/proxy_config_service_common_unittest.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: net/proxy/proxy_config_service_common_unittest.cc
diff --git a/net/proxy/proxy_config_service_common_unittest.cc b/net/proxy/proxy_config_service_common_unittest.cc
index 3835bb1ad201f745943395552d625f1c9d033938..ce7eaeadf41248d6931f37d174d5a6f7ab5aa3cc 100644
--- a/net/proxy/proxy_config_service_common_unittest.cc
+++ b/net/proxy/proxy_config_service_common_unittest.cc
@@ -29,9 +29,9 @@ void MatchesProxyServerHelper(const char* failure_message,
if (strlen(expected_proxy) == 0) {
if (!actual_proxies.IsEmpty()) {
*did_fail = true;
- *failure_details
- << failure_message << ". Was expecting no proxies but got "
- << actual_proxies.size() << ".";
+ *failure_details << failure_message
+ << ". Was expecting no proxies but got "
+ << actual_proxies.size() << ".";
}
return;
}
@@ -39,9 +39,9 @@ void MatchesProxyServerHelper(const char* failure_message,
// Otherwise we check that |actual_proxies| holds a single matching proxy.
if (actual_proxies.size() != 1) {
*did_fail = true;
- *failure_details
- << failure_message << ". Was expecting exactly one proxy but got "
- << actual_proxies.size() << ".";
+ *failure_details << failure_message
+ << ". Was expecting exactly one proxy but got "
+ << actual_proxies.size() << ".";
return;
}
@@ -51,9 +51,9 @@ void MatchesProxyServerHelper(const char* failure_message,
actual_proxy_string = actual_proxy.ToURI();
if (std::string(expected_proxy) != actual_proxy_string) {
- *failure_details
- << failure_message << ". Was expecting: \"" << expected_proxy
- << "\" but got: \"" << actual_proxy_string << "\"";
+ *failure_details << failure_message << ". Was expecting: \""
+ << expected_proxy << "\" but got: \""
+ << actual_proxy_string << "\"";
*did_fail = true;
}
}
@@ -61,8 +61,9 @@ void MatchesProxyServerHelper(const char* failure_message,
std::string FlattenProxyBypass(const ProxyBypassRules& bypass_rules) {
std::string flattened_proxy_bypass;
for (ProxyBypassRules::RuleList::const_iterator it =
- bypass_rules.rules().begin();
- it != bypass_rules.rules().end(); ++it) {
+ bypass_rules.rules().begin();
+ it != bypass_rules.rules().end();
+ ++it) {
if (!flattened_proxy_bypass.empty())
flattened_proxy_bypass += ",";
flattened_proxy_bypass += (*it)->ToString();
@@ -72,15 +73,14 @@ std::string FlattenProxyBypass(const ProxyBypassRules& bypass_rules) {
} // namespace
-ProxyRulesExpectation::ProxyRulesExpectation(
- ProxyConfig::ProxyRules::Type type,
- const char* single_proxy,
- const char* proxy_for_http,
- const char* proxy_for_https,
- const char* proxy_for_ftp,
- const char* fallback_proxy,
- const char* flattened_bypass_rules,
- bool reverse_bypass)
+ProxyRulesExpectation::ProxyRulesExpectation(ProxyConfig::ProxyRules::Type type,
+ const char* single_proxy,
+ const char* proxy_for_http,
+ const char* proxy_for_https,
+ const char* proxy_for_ftp,
+ const char* fallback_proxy,
+ const char* flattened_bypass_rules,
+ bool reverse_bypass)
: type(type),
single_proxy(single_proxy),
proxy_for_http(proxy_for_http),
@@ -91,34 +91,43 @@ ProxyRulesExpectation::ProxyRulesExpectation(
reverse_bypass(reverse_bypass) {
}
-
::testing::AssertionResult ProxyRulesExpectation::Matches(
const ProxyConfig::ProxyRules& rules) const {
::testing::AssertionResult failure_details = ::testing::AssertionFailure();
bool failed = false;
if (rules.type != type) {
- failure_details << "Type mismatch. Expected: "
- << type << " but was: " << rules.type;
+ failure_details << "Type mismatch. Expected: " << type
+ << " but was: " << rules.type;
failed = true;
}
- MatchesProxyServerHelper("Bad single_proxy", single_proxy,
- rules.single_proxies, &failure_details, &failed);
- MatchesProxyServerHelper("Bad proxy_for_http", proxy_for_http,
- rules.proxies_for_http, &failure_details,
+ MatchesProxyServerHelper("Bad single_proxy",
+ single_proxy,
+ rules.single_proxies,
+ &failure_details,
+ &failed);
+ MatchesProxyServerHelper("Bad proxy_for_http",
+ proxy_for_http,
+ rules.proxies_for_http,
+ &failure_details,
+ &failed);
+ MatchesProxyServerHelper("Bad proxy_for_https",
+ proxy_for_https,
+ rules.proxies_for_https,
+ &failure_details,
&failed);
- MatchesProxyServerHelper("Bad proxy_for_https", proxy_for_https,
- rules.proxies_for_https, &failure_details,
+ MatchesProxyServerHelper("Bad fallback_proxy",
+ fallback_proxy,
+ rules.fallback_proxies,
+ &failure_details,
&failed);
- MatchesProxyServerHelper("Bad fallback_proxy", fallback_proxy,
- rules.fallback_proxies, &failure_details, &failed);
std::string actual_flattened_bypass = FlattenProxyBypass(rules.bypass_rules);
if (std::string(flattened_bypass_rules) != actual_flattened_bypass) {
- failure_details
- << "Bad bypass rules. Expected: \"" << flattened_bypass_rules
- << "\" but got: \"" << actual_flattened_bypass << "\"";
+ failure_details << "Bad bypass rules. Expected: \""
+ << flattened_bypass_rules << "\" but got: \""
+ << actual_flattened_bypass << "\"";
failed = true;
}
@@ -133,15 +142,20 @@ ProxyRulesExpectation::ProxyRulesExpectation(
// static
ProxyRulesExpectation ProxyRulesExpectation::Empty() {
- return ProxyRulesExpectation(ProxyConfig::ProxyRules::TYPE_NO_RULES,
- "", "", "", "", "", "", false);
+ return ProxyRulesExpectation(
+ ProxyConfig::ProxyRules::TYPE_NO_RULES, "", "", "", "", "", "", false);
}
// static
ProxyRulesExpectation ProxyRulesExpectation::EmptyWithBypass(
const char* flattened_bypass_rules) {
return ProxyRulesExpectation(ProxyConfig::ProxyRules::TYPE_NO_RULES,
- "", "", "", "", "", flattened_bypass_rules,
+ "",
+ "",
+ "",
+ "",
+ "",
+ flattened_bypass_rules,
false);
}
@@ -150,8 +164,13 @@ ProxyRulesExpectation ProxyRulesExpectation::Single(
const char* single_proxy,
const char* flattened_bypass_rules) {
return ProxyRulesExpectation(ProxyConfig::ProxyRules::TYPE_SINGLE_PROXY,
- single_proxy, "", "", "", "",
- flattened_bypass_rules, false);
+ single_proxy,
+ "",
+ "",
+ "",
+ "",
+ flattened_bypass_rules,
+ false);
}
// static
@@ -161,8 +180,13 @@ ProxyRulesExpectation ProxyRulesExpectation::PerScheme(
const char* proxy_ftp,
const char* flattened_bypass_rules) {
return ProxyRulesExpectation(ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- "", proxy_http, proxy_https, proxy_ftp, "",
- flattened_bypass_rules, false);
+ "",
+ proxy_http,
+ proxy_https,
+ proxy_ftp,
+ "",
+ flattened_bypass_rules,
+ false);
}
// static
@@ -173,8 +197,13 @@ ProxyRulesExpectation ProxyRulesExpectation::PerSchemeWithSocks(
const char* socks_proxy,
const char* flattened_bypass_rules) {
return ProxyRulesExpectation(ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- "", proxy_http, proxy_https, proxy_ftp,
- socks_proxy, flattened_bypass_rules, false);
+ "",
+ proxy_http,
+ proxy_https,
+ proxy_ftp,
+ socks_proxy,
+ flattened_bypass_rules,
+ false);
}
// static
@@ -184,8 +213,13 @@ ProxyRulesExpectation ProxyRulesExpectation::PerSchemeWithBypassReversed(
const char* proxy_ftp,
const char* flattened_bypass_rules) {
return ProxyRulesExpectation(ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME,
- "", proxy_http, proxy_https, proxy_ftp, "",
- flattened_bypass_rules, true);
+ "",
+ proxy_http,
+ proxy_https,
+ proxy_ftp,
+ "",
+ flattened_bypass_rules,
+ true);
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698