Index: components/url_matcher/url_matcher_unittest.cc |
diff --git a/components/url_matcher/url_matcher_unittest.cc b/components/url_matcher/url_matcher_unittest.cc |
index 748d3101352d9e86d1bd5009811028eb22233c37..1f02b2586ccc8149b0891468142db97aa9c87c3b 100644 |
--- a/components/url_matcher/url_matcher_unittest.cc |
+++ b/components/url_matcher/url_matcher_unittest.cc |
@@ -69,8 +69,8 @@ TEST(URLMatcherConditionTest, IsFullURLCondition) { |
&pattern).IsFullURLCondition()); |
EXPECT_TRUE(URLMatcherCondition(URLMatcherCondition::PATH_CONTAINS, |
&pattern).IsFullURLCondition()); |
- EXPECT_TRUE(URLMatcherCondition(URLMatcherCondition::QUERY_CONTAINS, |
- &pattern).IsFullURLCondition()); |
+ EXPECT_FALSE(URLMatcherCondition(URLMatcherCondition::QUERY_CONTAINS, |
+ &pattern).IsFullURLCondition()); |
EXPECT_TRUE(URLMatcherCondition(URLMatcherCondition::URL_PREFIX, |
&pattern).IsFullURLCondition()); |
@@ -326,6 +326,25 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { |
EXPECT_FALSE( |
Matches(factory.CreateQueryEqualsCondition("www.google.com"), url)); |
+ EXPECT_FALSE( |
+ Matches(factory.CreateQueryContainsCondition("www.google.com"), url)); |
+ EXPECT_TRUE(Matches( |
+ factory.CreateQueryContainsCondition("sourceid=chrome-instant"), url)); |
+ // The '?' at the beginning is just ignored. |
+ EXPECT_TRUE(Matches( |
+ factory.CreateQueryContainsCondition("?sourceid=chrome-instant"), url)); |
+ EXPECT_TRUE(Matches(factory.CreateQueryContainsCondition("?ie=UTF-8"), url)); |
+ EXPECT_TRUE(Matches(factory.CreateQueryContainsCondition("ie=UTF-8"), url)); |
+ // Partial key value pairs not supported |
+ EXPECT_FALSE( |
+ Matches(factory.CreateQueryContainsCondition("t&ie=UTF-8"), url)); |
+ // Looks for an exact match, i.e., looks for "&e=UTF-8" or "?e=UTF-8" below |
+ // and fails. |
+ EXPECT_FALSE(Matches(factory.CreateQueryContainsCondition("e=UTF-8"), url)); |
+ // Multiple key value pairs are supported (though not very useful) |
battre
2014/04/01 08:23:00
I think the two previous occurrences are not 100%
kaliamoorthi
2014/04/01 13:11:17
Done.
|
+ EXPECT_TRUE(Matches( |
+ factory.CreateQueryContainsCondition("sourceid=chrome-instant&ie=UTF-8"), |
+ url)); |
// Test adjacent components |
EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition( |
@@ -628,7 +647,6 @@ TEST(URLMatcherTest, TestComponentsImplyContains) { |
conditions.insert(factory->CreateQueryContainsCondition("test=v")); |
conditions.insert(factory->CreateQuerySuffixCondition("l&a=b")); |
- conditions.insert(factory->CreateQueryContainsCondition("l&a=b")); |
// The '?' for equality is just ignored. |
conditions.insert(factory->CreateQueryEqualsCondition("?test=val&a=b")); |