port_util_unittest.cc 606 B

1234567891011121314151617181920212223
  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.
  4. #include "net/base/port_util.h"
  5. #include <string>
  6. #include "testing/gtest/include/gtest/gtest.h"
  7. namespace net {
  8. TEST(NetUtilTest, SetExplicitlyAllowedPortsTest) {
  9. const std::vector<uint16_t> valid[] = {
  10. {}, {1}, {1, 2}, {1, 2, 3}, {10, 11, 12, 13}};
  11. for (size_t i = 0; i < std::size(valid); ++i) {
  12. SetExplicitlyAllowedPorts(valid[i]);
  13. EXPECT_EQ(i, GetCountOfExplicitlyAllowedPorts());
  14. }
  15. }
  16. } // namespace net