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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util_unittest.cc
===================================================================
--- net/base/net_util_unittest.cc (revision 25619)
+++ net/base/net_util_unittest.cc (working copy)
@@ -1313,3 +1313,19 @@
EXPECT_EQ(expected_url, net::SimplifyUrlForRequest(input_url));
}
}
+
+TEST(NetUtilTest, SetExplicitlyAllowedPortsTest) {
+ std::wstring invalid[] = { L"1,2,a", L"'1','2'", L"1, 2, 3", L"1 0,11,12" };
+ std::wstring valid[] = { L"", L"1", L"1,2", L"1,2,3", L"10,11,12,13" };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(invalid); ++i) {
+ net::SetExplicitlyAllowedPorts(invalid[i]);
+ EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size()));
+ }
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) {
+ net::SetExplicitlyAllowedPorts(valid[i]);
+ EXPECT_EQ(i, net::explicitly_allowed_ports.size());
+ }
+}
+
« 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