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

Side by Side Diff: net/proxy/proxy_bypass_rules_unittest.cc

Issue 3390026: net: Append base:: in the StringPrintf calls. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix include order Created 10 years, 2 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "net/proxy/proxy_bypass_rules.h" 5 #include "net/proxy/proxy_bypass_rules.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/stringprintf.h"
8 #include "net/proxy/proxy_config_service_common_unittest.h" 9 #include "net/proxy/proxy_config_service_common_unittest.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace net { 12 namespace net {
12 13
13 namespace { 14 namespace {
14 15
15 TEST(ProxyBypassRulesTest, ParseAndMatchBasicHost) { 16 TEST(ProxyBypassRulesTest, ParseAndMatchBasicHost) {
16 ProxyBypassRules rules; 17 ProxyBypassRules rules;
17 rules.ParseFromString("wWw.gOogle.com"); 18 rules.ParseFromString("wWw.gOogle.com");
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // This is a bit of a gray-area, but GURL does not strip trailing dots 269 // This is a bit of a gray-area, but GURL does not strip trailing dots
269 // in host-names, so the following are considered non-local. 270 // in host-names, so the following are considered non-local.
270 {"http://www./x", false}, 271 {"http://www./x", false},
271 {"http://localhost./x", false}, 272 {"http://localhost./x", false},
272 }; 273 };
273 274
274 ProxyBypassRules rules; 275 ProxyBypassRules rules;
275 rules.ParseFromString("<local>"); 276 rules.ParseFromString("<local>");
276 277
277 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 278 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
278 SCOPED_TRACE(StringPrintf( 279 SCOPED_TRACE(base::StringPrintf(
279 "Test[%d]: %s", static_cast<int>(i), tests[i].url)); 280 "Test[%d]: %s", static_cast<int>(i), tests[i].url));
280 EXPECT_EQ(tests[i].expected_is_local, rules.Matches(GURL(tests[i].url))); 281 EXPECT_EQ(tests[i].expected_is_local, rules.Matches(GURL(tests[i].url)));
281 } 282 }
282 } 283 }
283 284
284 TEST(ProxyBypassRulesTest, ParseAndMatchCIDR_IPv4) { 285 TEST(ProxyBypassRulesTest, ParseAndMatchCIDR_IPv4) {
285 ProxyBypassRules rules; 286 ProxyBypassRules rules;
286 rules.ParseFromString("192.168.1.1/16"); 287 rules.ParseFromString("192.168.1.1/16");
287 ASSERT_EQ(1u, rules.rules().size()); 288 ASSERT_EQ(1u, rules.rules().size());
288 EXPECT_EQ("192.168.1.1/16", rules.rules()[0]->ToString()); 289 EXPECT_EQ("192.168.1.1/16", rules.rules()[0]->ToString());
(...skipping 16 matching lines...) Expand all
305 EXPECT_EQ("a:b:c:d::/48", rules.rules()[0]->ToString()); 306 EXPECT_EQ("a:b:c:d::/48", rules.rules()[0]->ToString());
306 307
307 EXPECT_TRUE(rules.Matches(GURL("http://[A:b:C:9::]"))); 308 EXPECT_TRUE(rules.Matches(GURL("http://[A:b:C:9::]")));
308 EXPECT_FALSE(rules.Matches(GURL("http://foobar.com"))); 309 EXPECT_FALSE(rules.Matches(GURL("http://foobar.com")));
309 EXPECT_FALSE(rules.Matches(GURL("http://192.169.1.1"))); 310 EXPECT_FALSE(rules.Matches(GURL("http://192.169.1.1")));
310 } 311 }
311 312
312 } // namespace 313 } // namespace
313 314
314 } // namespace net 315 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/multi_threaded_proxy_resolver_unittest.cc ('k') | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698