| Index: net/base/net_util_unittest.cc
|
| diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc
|
| index 46293a3aaec8340255e7190d3c0b2f19cc45c57b..a4c7a5ce997eafc6db7b6a7f799d61ab941a1c2b 100644
|
| --- a/net/base/net_util_unittest.cc
|
| +++ b/net/base/net_util_unittest.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -2166,3 +2166,22 @@ TEST(NetUtilTest, IPNumberMatchesPrefix) {
|
| prefix_length_in_bits));
|
| }
|
| }
|
| +
|
| +TEST(NetUtilTest, IsLocalhost) {
|
| + EXPECT_TRUE(net::IsLocalhost("localhost"));
|
| + EXPECT_TRUE(net::IsLocalhost("127.0.0.1"));
|
| + EXPECT_TRUE(net::IsLocalhost("127.0.1.0"));
|
| + EXPECT_TRUE(net::IsLocalhost("127.1.0.0"));
|
| + EXPECT_TRUE(net::IsLocalhost("127.0.0.255"));
|
| + EXPECT_TRUE(net::IsLocalhost("127.0.255.0"));
|
| + EXPECT_TRUE(net::IsLocalhost("127.255.0.0"));
|
| + EXPECT_TRUE(net::IsLocalhost("::1"));
|
| + EXPECT_TRUE(net::IsLocalhost("0:0:0:0:0:0:0:1"));
|
| +
|
| + EXPECT_FALSE(net::IsLocalhost("127.0.0.1.1"));
|
| + EXPECT_FALSE(net::IsLocalhost(".127.0.0.255"));
|
| + EXPECT_FALSE(net::IsLocalhost("::1:1"));
|
| + EXPECT_FALSE(net::IsLocalhost("0:0:0:0:1:0:0:1"));
|
| + EXPECT_FALSE(net::IsLocalhost("::1:1"));
|
| + EXPECT_FALSE(net::IsLocalhost("0:0:0:0:0:0:0:0:1"));
|
| +}
|
|
|