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

Side by Side Diff: net/base/net_util_unittest.cc

Issue 194057: Check in patch for pierre.lafayette, http://codereview.chromium.org/178059/sh... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/base/net_util.cc ('k') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 #include "net/base/escape.h" 10 #include "net/base/escape.h"
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 "foobar://google.com:80/sup?yo", 1306 "foobar://google.com:80/sup?yo",
1307 }, 1307 },
1308 }; 1308 };
1309 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 1309 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
1310 SCOPED_TRACE(StringPrintf("Test[%d]: %s", i, tests[i].input_url)); 1310 SCOPED_TRACE(StringPrintf("Test[%d]: %s", i, tests[i].input_url));
1311 GURL input_url(GURL(tests[i].input_url)); 1311 GURL input_url(GURL(tests[i].input_url));
1312 GURL expected_url(GURL(tests[i].expected_simplified_url)); 1312 GURL expected_url(GURL(tests[i].expected_simplified_url));
1313 EXPECT_EQ(expected_url, net::SimplifyUrlForRequest(input_url)); 1313 EXPECT_EQ(expected_url, net::SimplifyUrlForRequest(input_url));
1314 } 1314 }
1315 } 1315 }
1316
1317 TEST(NetUtilTest, SetExplicitlyAllowedPortsTest) {
1318 std::wstring invalid[] = { L"1,2,a", L"'1','2'", L"1, 2, 3", L"1 0,11,12" };
1319 std::wstring valid[] = { L"", L"1", L"1,2", L"1,2,3", L"10,11,12,13" };
1320
1321 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(invalid); ++i) {
1322 net::SetExplicitlyAllowedPorts(invalid[i]);
1323 EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size()));
1324 }
1325
1326 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) {
1327 net::SetExplicitlyAllowedPorts(valid[i]);
1328 EXPECT_EQ(i, net::explicitly_allowed_ports.size());
1329 }
1330 }
1331
OLDNEW
« no previous file with comments | « net/base/net_util.cc ('k') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698