Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / net / base / port_util_unittest.cc
blob6bd163f7a8ffaefa4cff2091aeda35c040aa7831
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/base/port_util.h"
7 #include <string>
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace net {
13 TEST(NetUtilTest, SetExplicitlyAllowedPortsTest) {
14 std::string invalid[] = {"1,2,a", "'1','2'", "1, 2, 3", "1 0,11,12"};
15 std::string valid[] = {"", "1", "1,2", "1,2,3", "10,11,12,13"};
17 for (size_t i = 0; i < arraysize(invalid); ++i) {
18 SetExplicitlyAllowedPorts(invalid[i]);
19 EXPECT_EQ(0, static_cast<int>(GetCountOfExplicitlyAllowedPorts()));
22 for (size_t i = 0; i < arraysize(valid); ++i) {
23 SetExplicitlyAllowedPorts(valid[i]);
24 EXPECT_EQ(i, GetCountOfExplicitlyAllowedPorts());
28 } // namespace net