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..cbcf53be764b15e29756d732fe6f475e25847f69 100644 |
--- a/net/spdy/spdy_header_block_unittest.cc |
+++ b/net/base/port_util_unittest.cc |
@@ -2,30 +2,25 @@ |
// 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 "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(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"}; |
mmenke
2015/07/16 15:07:57
include <string>?
eroman
2015/07/21 01:04:04
Done.
|
-TEST(SpdyHeaderBlockTest, ToNetLogParamAndBackAgain) { |
- SpdyHeaderBlock headers; |
- headers["A"] = "a"; |
- headers["B"] = "b"; |
+ for (size_t i = 0; i < arraysize(invalid); ++i) { |
+ SetExplicitlyAllowedPorts(invalid[i]); |
+ EXPECT_EQ(0, static_cast<int>(GetCountOfExplicitlyAllowedPorts())); |
+ } |
- scoped_ptr<base::Value> event_param(SpdyHeaderBlockNetLogCallback( |
- &headers, NetLogCaptureMode::IncludeCookiesAndCredentials())); |
- |
- 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 |