Index: extensions/common/matcher/url_matcher_unittest.cc |
diff --git a/extensions/common/matcher/url_matcher_unittest.cc b/extensions/common/matcher/url_matcher_unittest.cc |
index 09fc562c17229ba582172ee1fa2853f57cc5d3cd..b17c13c3f014c4070916f2b3a21728a83be83645 100644 |
--- a/extensions/common/matcher/url_matcher_unittest.cc |
+++ b/extensions/common/matcher/url_matcher_unittest.cc |
@@ -247,7 +247,7 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { |
std::string url = factory.CanonicalizeURLForComponentSearches(gurl); |
// Test host component. |
- EXPECT_TRUE(Matches(factory.CreateHostPrefixCondition(""), url)); |
+ EXPECT_TRUE(Matches(factory.CreateHostPrefixCondition(std::string()), url)); |
EXPECT_TRUE(Matches(factory.CreateHostPrefixCondition("www.goog"), url)); |
EXPECT_TRUE( |
Matches(factory.CreateHostPrefixCondition("www.google.com"), url)); |
@@ -258,7 +258,7 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { |
Matches(factory.CreateHostPrefixCondition("www.google.com/"), url)); |
EXPECT_FALSE(Matches(factory.CreateHostPrefixCondition("webhp"), url)); |
- EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition(""), url)); |
+ EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition(std::string()), url)); |
EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition("com"), url)); |
EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition(".com"), url)); |
EXPECT_TRUE( |
@@ -270,7 +270,7 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { |
Matches(factory.CreateHostSuffixCondition("www.google.com/"), url)); |
EXPECT_FALSE(Matches(factory.CreateHostSuffixCondition("webhp"), url)); |
- EXPECT_FALSE(Matches(factory.CreateHostEqualsCondition(""), url)); |
+ EXPECT_FALSE(Matches(factory.CreateHostEqualsCondition(std::string()), url)); |
EXPECT_FALSE(Matches(factory.CreateHostEqualsCondition("www"), url)); |
EXPECT_TRUE( |
Matches(factory.CreateHostEqualsCondition("www.google.com"), url)); |
@@ -279,14 +279,14 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { |
// Test path component. |
- EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition(""), url)); |
+ EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition(std::string()), url)); |
EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition("/web"), url)); |
EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition("/webhp"), url)); |
EXPECT_FALSE(Matches(factory.CreatePathPrefixCondition("webhp"), url)); |
EXPECT_FALSE(Matches(factory.CreatePathPrefixCondition("/webhp?"), url)); |
EXPECT_FALSE(Matches(factory.CreatePathPrefixCondition("?sourceid"), url)); |
- EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition(""), url)); |
+ EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition(std::string()), url)); |
EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition("webhp"), url)); |
EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition("/webhp"), url)); |
EXPECT_FALSE(Matches(factory.CreatePathSuffixCondition("/web"), url)); |
@@ -300,12 +300,12 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { |
// Test query component. |
- EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition(""), url)); |
+ EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition(std::string()), url)); |
EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition("sourceid"), url)); |
// The '?' at the beginning is just ignored. |
EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition("?sourceid"), url)); |
- EXPECT_TRUE(Matches(factory.CreateQuerySuffixCondition(""), url)); |
+ EXPECT_TRUE(Matches(factory.CreateQuerySuffixCondition(std::string()), url)); |
EXPECT_TRUE(Matches(factory.CreateQuerySuffixCondition("ion=1"), url)); |
EXPECT_FALSE(Matches(factory.CreateQuerySuffixCondition("www"), url)); |
// "Suffix" condition + pattern starting with '?' = "equals" condition. |
@@ -330,21 +330,26 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { |
// Test adjacent components |
EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition( |
"google.com", "/webhp"), url)); |
- EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition( |
- "", "/webhp"), url)); |
- EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition( |
- "google.com", ""), url)); |
- EXPECT_FALSE(Matches(factory.CreateHostSuffixPathPrefixCondition( |
- "www", ""), url)); |
+ EXPECT_TRUE(Matches( |
+ factory.CreateHostSuffixPathPrefixCondition(std::string(), "/webhp"), |
+ url)); |
+ EXPECT_TRUE(Matches( |
+ factory.CreateHostSuffixPathPrefixCondition("google.com", std::string()), |
+ url)); |
+ EXPECT_FALSE(Matches( |
+ factory.CreateHostSuffixPathPrefixCondition("www", std::string()), url)); |
EXPECT_TRUE(Matches(factory.CreateHostEqualsPathPrefixCondition( |
"www.google.com", "/webhp"), url)); |
- EXPECT_FALSE(Matches(factory.CreateHostEqualsPathPrefixCondition( |
- "", "/webhp"), url)); |
+ EXPECT_FALSE(Matches( |
+ factory.CreateHostEqualsPathPrefixCondition(std::string(), "/webhp"), |
+ url)); |
EXPECT_TRUE(Matches(factory.CreateHostEqualsPathPrefixCondition( |
- "www.google.com", ""), url)); |
- EXPECT_FALSE(Matches(factory.CreateHostEqualsPathPrefixCondition( |
- "google.com", ""), url)); |
+ "www.google.com", std::string()), |
+ url)); |
+ EXPECT_FALSE(Matches( |
+ factory.CreateHostEqualsPathPrefixCondition("google.com", std::string()), |
+ url)); |
} |
TEST(URLMatcherConditionFactoryTest, TestFullSearches) { |
@@ -354,9 +359,9 @@ TEST(URLMatcherConditionFactoryTest, TestFullSearches) { |
URLMatcherConditionFactory factory; |
std::string url = factory.CanonicalizeURLForFullSearches(gurl); |
- EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(""), url)); |
- EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition( |
- "https://www.goog"), url)); |
+ EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(std::string()), url)); |
+ EXPECT_TRUE( |
+ Matches(factory.CreateURLPrefixCondition("https://www.goog"), url)); |
EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition( |
"https://www.google.com"), url)); |
EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition( |
@@ -365,11 +370,11 @@ TEST(URLMatcherConditionFactoryTest, TestFullSearches) { |
"http://www.google.com"), url)); |
EXPECT_FALSE(Matches(factory.CreateURLPrefixCondition("webhp"), url)); |
- EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition(""), url)); |
+ EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition(std::string()), url)); |
EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition("ion=1"), url)); |
EXPECT_FALSE(Matches(factory.CreateURLSuffixCondition("www"), url)); |
- EXPECT_TRUE(Matches(factory.CreateURLContainsCondition(""), url)); |
+ EXPECT_TRUE(Matches(factory.CreateURLContainsCondition(std::string()), url)); |
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("www.goog"), url)); |
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("webhp"), url)); |
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("?"), url)); |