Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: chrome/common/extensions/matcher/url_matcher_unittest.cc

Issue 10823313: Let url filter test the scheme in urlContains/Equals/Prefix/Suffix criteria (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/matcher/url_matcher_unittest.cc
diff --git a/chrome/common/extensions/matcher/url_matcher_unittest.cc b/chrome/common/extensions/matcher/url_matcher_unittest.cc
index add8530ff137e8a70b29c91302e9502aa71d2888..c05486e342b264722c291bc12955d960308880a6 100644
--- a/chrome/common/extensions/matcher/url_matcher_unittest.cc
+++ b/chrome/common/extensions/matcher/url_matcher_unittest.cc
@@ -326,18 +326,20 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) {
}
TEST(URLMatcherConditionFactoryTest, TestFullSearches) {
- GURL gurl("https://www.google.com/webhp?sourceid=chrome-instant&ie=UTF-8"
+ GURL gurl("https://www.google.com:1234/webhp?sourceid=chrome-instant&ie=UTF-8"
Yoyo Zhou 2012/08/14 15:40:11 Hmm, you added a port here, but none of the tests
battre 2012/08/16 13:16:25 Done.
"&ion=1#hl=en&output=search&sclient=psy-ab&q=chrome%20is%20awesome");
URLMatcherConditionFactory factory;
std::string url = factory.CanonicalizeURLForFullSearches(gurl);
EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(""), url));
- EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition("www.goog"), url));
- EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition("www.google.com"), url));
- EXPECT_TRUE(
- Matches(factory.CreateURLPrefixCondition(".www.google.com"), url));
- EXPECT_TRUE(
- Matches(factory.CreateURLPrefixCondition("www.google.com/"), 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(
+ "https://www.google.com/"), url));
+ EXPECT_FALSE( Matches(factory.CreateURLPrefixCondition(
Yoyo Zhou 2012/08/14 15:40:11 nit: extra space after (
battre 2012/08/16 13:16:25 Done.
+ "http://www.google.com"), url));
EXPECT_FALSE(Matches(factory.CreateURLPrefixCondition("webhp"), url));
EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition(""), url));
@@ -346,18 +348,19 @@ TEST(URLMatcherConditionFactoryTest, TestFullSearches) {
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition(""), url));
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("www.goog"), url));
- EXPECT_TRUE(Matches(factory.CreateURLContainsCondition(".www.goog"), url));
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("webhp"), url));
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("?"), url));
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("sourceid"), url));
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("ion=1"), url));
+ EXPECT_FALSE(Matches(factory.CreateURLContainsCondition(".www.goog"), url));
EXPECT_FALSE(Matches(factory.CreateURLContainsCondition("foobar"), url));
EXPECT_FALSE(Matches(factory.CreateURLContainsCondition("search"), url));
EXPECT_TRUE(Matches(factory.CreateURLEqualsCondition(
- "www.google.com/webhp?sourceid=chrome-instant&ie=UTF-8&ion=1"), url));
+ "https://www.google.com/webhp?sourceid=chrome-instant&ie=UTF-8&ion=1"),
+ url));
EXPECT_FALSE(
- Matches(factory.CreateURLEqualsCondition("www.google.com"), url));
+ Matches(factory.CreateURLEqualsCondition("https://www.google.com"), url));
}

Powered by Google App Engine
This is Rietveld 408576698