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

Unified Diff: net/base/port_util_unittest.cc

Issue 1230313005: split port_util.h off of net_util.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove garbage that got added Created 5 years, 5 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/port_util.cc ('k') | net/ftp/ftp_network_transaction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/port_util_unittest.cc
diff --git a/net/spdy/spdy_header_block_unittest.cc b/net/base/port_util_unittest.cc
similarity index 31%
copy from net/spdy/spdy_header_block_unittest.cc
copy to net/base/port_util_unittest.cc
index 99e9ac21b535432f9320fedfeb552751125cb1c9..6bd163f7a8ffaefa4cff2091aeda35c040aa7831 100644
--- a/net/spdy/spdy_header_block_unittest.cc
+++ b/net/base/port_util_unittest.cc
@@ -2,30 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "net/spdy/spdy_header_block.h"
+#include "net/base/port_util.h"
+
+#include <string>
-#include "base/memory/scoped_ptr.h"
-#include "base/values.h"
-#include "net/log/net_log.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
-namespace {
-
-TEST(SpdyHeaderBlockTest, ToNetLogParamAndBackAgain) {
- SpdyHeaderBlock headers;
- headers["A"] = "a";
- headers["B"] = "b";
+TEST(NetUtilTest, SetExplicitlyAllowedPortsTest) {
+ std::string invalid[] = {"1,2,a", "'1','2'", "1, 2, 3", "1 0,11,12"};
+ std::string valid[] = {"", "1", "1,2", "1,2,3", "10,11,12,13"};
- scoped_ptr<base::Value> event_param(SpdyHeaderBlockNetLogCallback(
- &headers, NetLogCaptureMode::IncludeCookiesAndCredentials()));
+ for (size_t i = 0; i < arraysize(invalid); ++i) {
+ SetExplicitlyAllowedPorts(invalid[i]);
+ EXPECT_EQ(0, static_cast<int>(GetCountOfExplicitlyAllowedPorts()));
+ }
- SpdyHeaderBlock headers2;
- ASSERT_TRUE(SpdyHeaderBlockFromNetLogParam(event_param.get(), &headers2));
- EXPECT_EQ(headers, headers2);
+ for (size_t i = 0; i < arraysize(valid); ++i) {
+ SetExplicitlyAllowedPorts(valid[i]);
+ EXPECT_EQ(i, GetCountOfExplicitlyAllowedPorts());
+ }
}
-} // namespace
-
} // namespace net
« no previous file with comments | « net/base/port_util.cc ('k') | net/ftp/ftp_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698