1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifdef UNSAFE_BUFFERS_BUILD
6 // TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7 #pragma allow_unsafe_buffers
8 #endif
9
10 #include "net/base/port_util.h"
11
12 #include <string>
13
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace net {
17
TEST(NetUtilTest,SetExplicitlyAllowedPortsTest)18 TEST(NetUtilTest, SetExplicitlyAllowedPortsTest) {
19 const std::vector<uint16_t> valid[] = {
20 {}, {1}, {1, 2}, {1, 2, 3}, {10, 11, 12, 13}};
21
22 for (size_t i = 0; i < std::size(valid); ++i) {
23 SetExplicitlyAllowedPorts(valid[i]);
24 EXPECT_EQ(i, GetCountOfExplicitlyAllowedPorts());
25 }
26 }
27
28 } // namespace net
29