OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ssl_false_start_blacklist.h" | 5 #include "net/base/ssl_false_start_blacklist.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 namespace net { | 8 namespace net { |
9 | 9 |
10 TEST(SSLFalseStartBlacklistTest, LastTwoLabels) { | 10 TEST(SSLFalseStartBlacklistTest, LastTwoLabels) { |
11 #define F SSLFalseStartBlacklist::LastTwoLabels | 11 #define F SSLFalseStartBlacklist::LastTwoLabels |
12 EXPECT_STREQ(F("a.b.c.d"), "c.d"); | 12 EXPECT_EQ(F("a.b.c.d"), "c.d"); |
13 EXPECT_STREQ(F("a.b"), "a.b"); | 13 EXPECT_EQ(F("a.b"), "a.b"); |
14 EXPECT_STREQ(F("example.com"), "example.com"); | 14 EXPECT_EQ(F("example.com"), "example.com"); |
15 EXPECT_STREQ(F("www.example.com"), "example.com"); | 15 EXPECT_EQ(F("www.example.com"), "example.com"); |
16 EXPECT_STREQ(F("www.www.example.com"), "example.com"); | 16 EXPECT_EQ(F("www.www.example.com"), "example.com"); |
| 17 EXPECT_EQ(F("www.www.example.com."), "example.com"); |
| 18 EXPECT_EQ(F("www.www.example.com.."), "example.com"); |
17 | 19 |
18 EXPECT_TRUE(F("com") == NULL); | 20 EXPECT_TRUE(F("com").empty()); |
19 EXPECT_TRUE(F(".com") == NULL); | 21 EXPECT_TRUE(F(".com").empty()); |
20 EXPECT_TRUE(F("") == NULL); | 22 EXPECT_TRUE(F("").empty()); |
21 #undef F | 23 #undef F |
22 } | 24 } |
23 | 25 |
24 TEST(SSLFalseStartBlacklistTest, IsMember) { | 26 TEST(SSLFalseStartBlacklistTest, IsMember) { |
25 EXPECT_TRUE(SSLFalseStartBlacklist::IsMember("example.com")); | 27 EXPECT_TRUE(SSLFalseStartBlacklist::IsMember("example.com")); |
26 EXPECT_TRUE(SSLFalseStartBlacklist::IsMember("www.example.com")); | 28 EXPECT_TRUE(SSLFalseStartBlacklist::IsMember("www.example.com")); |
27 EXPECT_TRUE(SSLFalseStartBlacklist::IsMember("a.b.example.com")); | 29 EXPECT_TRUE(SSLFalseStartBlacklist::IsMember("a.b.example.com")); |
28 EXPECT_FALSE(SSLFalseStartBlacklist::IsMember("aexample.com")); | 30 EXPECT_FALSE(SSLFalseStartBlacklist::IsMember("aexample.com")); |
29 EXPECT_FALSE(SSLFalseStartBlacklist::IsMember("com")); | 31 EXPECT_FALSE(SSLFalseStartBlacklist::IsMember("com")); |
30 } | 32 } |
31 | 33 |
32 } // namespace net | 34 } // namespace net |
OLD | NEW |