| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ip_pattern.h" | 5 #include "net/base/ip_pattern.h" |
| 6 | 6 |
| 7 #include "net/base/ip_address_number.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 9 |
| 9 namespace net { | 10 namespace net { |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 bool IsValidPattern(const std::string& pattern_text) { | 14 bool IsValidPattern(const std::string& pattern_text) { |
| 14 IPPattern pattern; | 15 IPPattern pattern; |
| 15 return pattern.ParsePattern(pattern_text); | 16 return pattern.ParsePattern(pattern_text); |
| 16 } | 17 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 EXPECT_FALSE(IsValidPattern("1.2.3.4.5")); // Too long | 152 EXPECT_FALSE(IsValidPattern("1.2.3.4.5")); // Too long |
| 152 EXPECT_FALSE(IsValidPattern("1.2.3")); // Too short | 153 EXPECT_FALSE(IsValidPattern("1.2.3")); // Too short |
| 153 EXPECT_FALSE(IsValidPattern("1.2.3.A")); // Non-decimal. | 154 EXPECT_FALSE(IsValidPattern("1.2.3.A")); // Non-decimal. |
| 154 EXPECT_FALSE(IsValidPattern("1.A.3.4")); // Non-decimal | 155 EXPECT_FALSE(IsValidPattern("1.A.3.4")); // Non-decimal |
| 155 EXPECT_FALSE(IsValidPattern("1.256.3.4")); // Out of range | 156 EXPECT_FALSE(IsValidPattern("1.256.3.4")); // Out of range |
| 156 } | 157 } |
| 157 | 158 |
| 158 } // namespace | 159 } // namespace |
| 159 | 160 |
| 160 } // namespace net | 161 } // namespace net |
| OLD | NEW |