xref: /aosp_15_r20/external/cronet/net/base/port_util_unittest.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 #include "net/base/port_util.h"
6 
7 #include <string>
8 
9 #include "testing/gtest/include/gtest/gtest.h"
10 
11 namespace net {
12 
TEST(NetUtilTest,SetExplicitlyAllowedPortsTest)13 TEST(NetUtilTest, SetExplicitlyAllowedPortsTest) {
14   const std::vector<uint16_t> valid[] = {
15       {}, {1}, {1, 2}, {1, 2, 3}, {10, 11, 12, 13}};
16 
17   for (size_t i = 0; i < std::size(valid); ++i) {
18     SetExplicitlyAllowedPorts(valid[i]);
19     EXPECT_EQ(i, GetCountOfExplicitlyAllowedPorts());
20   }
21 }
22 
23 }  // namespace net
24