| 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..27a901e15b1633048e4c1deec40ae2b66d4a438b 100644
|
| --- a/extensions/common/matcher/url_matcher_unittest.cc
|
| +++ b/extensions/common/matcher/url_matcher_unittest.cc
|
| @@ -484,6 +484,16 @@ TEST(URLMatcherConditionSetTest, Matching) {
|
| EXPECT_FALSE(condition_set6->IsMatch(matching_patterns, url1));
|
| matching_patterns.insert(m1.string_pattern()->id());
|
| EXPECT_TRUE(condition_set6->IsMatch(matching_patterns, url1));
|
| +
|
| + matching_patterns.clear();
|
| + regex_conditions.clear();
|
| + URLMatcherCondition r2 = factory.CreateStrippedURLMatchesCondition("b[a]r");
|
| + regex_conditions.insert(r2);
|
| + scoped_refptr<URLMatcherConditionSet> condition_set7(
|
| + new URLMatcherConditionSet(1, regex_conditions));
|
| + EXPECT_FALSE(condition_set7->IsMatch(matching_patterns, url1));
|
| + matching_patterns.insert(r2.string_pattern()->id());
|
| + EXPECT_TRUE(condition_set7->IsMatch(matching_patterns, url1));
|
| }
|
|
|
|
|
| @@ -626,4 +636,40 @@ TEST(URLMatcherTest, TestComponentsImplyContains) {
|
| EXPECT_EQ(1u, matcher.MatchURL(url).size());
|
| }
|
|
|
| +// Check that matches in everything but the query are found.
|
| +TEST(URLMatcherTest, TestStrippedUrlRegExPositive) {
|
| + GURL url("https://www.google.com:1234/webhp?test=val&a=b");
|
| +
|
| + URLMatcher matcher;
|
| + URLMatcherConditionFactory* factory = matcher.condition_factory();
|
| +
|
| + URLMatcherConditionSet::Conditions conditions;
|
| +
|
| + conditions.insert(factory->CreateStrippedURLMatchesCondition("w..hp"));
|
| + const int kConditionSetId = 1;
|
| + URLMatcherConditionSet::Vector insert;
|
| + insert.push_back(make_scoped_refptr(
|
| + new URLMatcherConditionSet(kConditionSetId, conditions)));
|
| + matcher.AddConditionSets(insert);
|
| + EXPECT_EQ(1u, matcher.MatchURL(url).size());
|
| +}
|
| +
|
| +// Check that matches in the query are ignored.
|
| +TEST(URLMatcherTest, TestStrippedUrlRegExNegative) {
|
| + GURL url("https://www.google.com:1234/webhp?test=val&a=b");
|
| +
|
| + URLMatcher matcher;
|
| + URLMatcherConditionFactory* factory = matcher.condition_factory();
|
| +
|
| + URLMatcherConditionSet::Conditions conditions;
|
| +
|
| + conditions.insert(factory->CreateStrippedURLMatchesCondition("val"));
|
| + const int kConditionSetId = 1;
|
| + URLMatcherConditionSet::Vector insert;
|
| + insert.push_back(make_scoped_refptr(
|
| + new URLMatcherConditionSet(kConditionSetId, conditions)));
|
| + matcher.AddConditionSets(insert);
|
| + EXPECT_EQ(0u, matcher.MatchURL(url).size());
|
| +}
|
| +
|
| } // namespace extensions
|
|
|