OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(invalid); ++i) { | 1624 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(invalid); ++i) { |
1625 net::SetExplicitlyAllowedPorts(invalid[i]); | 1625 net::SetExplicitlyAllowedPorts(invalid[i]); |
1626 EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size())); | 1626 EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size())); |
1627 } | 1627 } |
1628 | 1628 |
1629 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) { | 1629 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) { |
1630 net::SetExplicitlyAllowedPorts(valid[i]); | 1630 net::SetExplicitlyAllowedPorts(valid[i]); |
1631 EXPECT_EQ(i, net::explicitly_allowed_ports.size()); | 1631 EXPECT_EQ(i, net::explicitly_allowed_ports.size()); |
1632 } | 1632 } |
1633 } | 1633 } |
| 1634 |
| 1635 TEST(NetUtilTest, GetHostOrSpecFromURL) { |
| 1636 EXPECT_EQ("example.com", |
| 1637 net::GetHostOrSpecFromURL(GURL("http://example.com/test"))); |
| 1638 EXPECT_EQ("example.com", |
| 1639 net::GetHostOrSpecFromURL(GURL("http://example.com./test"))); |
| 1640 EXPECT_EQ("file:///tmp/test.html", |
| 1641 net::GetHostOrSpecFromURL(GURL("file:///tmp/test.html"))); |
| 1642 } |
OLD | NEW |