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

Side by Side Diff: chrome/common/extensions/url_pattern_unittest.cc

Issue 165366: Merge 22260 - When a content script has a match pattern of http://*/*, we... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/url_pattern.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
Merged /trunk/src/chrome/common/extensions/url_pattern_unittest.cc:r22260
Merged /branches/chrome_webkit_merge_branch/chrome/common/extensions/url_pattern_unittest.cc:r69-2775
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "chrome/common/extensions/url_pattern.h" 5 #include "chrome/common/extensions/url_pattern.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 // See url_pattern.h for examples of valid and invalid patterns. 8 // See url_pattern.h for examples of valid and invalid patterns.
9 9
10 TEST(URLPatternTest, ParseInvalid) { 10 TEST(URLPatternTest, ParseInvalid) {
(...skipping 19 matching lines...) Expand all
30 URLPattern pattern; 30 URLPattern pattern;
31 EXPECT_TRUE(pattern.Parse("http://*/*")); 31 EXPECT_TRUE(pattern.Parse("http://*/*"));
32 EXPECT_EQ("http", pattern.scheme()); 32 EXPECT_EQ("http", pattern.scheme());
33 EXPECT_EQ("", pattern.host()); 33 EXPECT_EQ("", pattern.host());
34 EXPECT_TRUE(pattern.match_subdomains()); 34 EXPECT_TRUE(pattern.match_subdomains());
35 EXPECT_EQ("/*", pattern.path()); 35 EXPECT_EQ("/*", pattern.path());
36 EXPECT_TRUE(pattern.MatchesUrl(GURL("http://google.com"))); 36 EXPECT_TRUE(pattern.MatchesUrl(GURL("http://google.com")));
37 EXPECT_TRUE(pattern.MatchesUrl(GURL("http://yahoo.com"))); 37 EXPECT_TRUE(pattern.MatchesUrl(GURL("http://yahoo.com")));
38 EXPECT_TRUE(pattern.MatchesUrl(GURL("http://google.com/foo"))); 38 EXPECT_TRUE(pattern.MatchesUrl(GURL("http://google.com/foo")));
39 EXPECT_FALSE(pattern.MatchesUrl(GURL("https://google.com"))); 39 EXPECT_FALSE(pattern.MatchesUrl(GURL("https://google.com")));
40 EXPECT_TRUE(pattern.MatchesUrl(GURL("http://74.125.127.100/search")));
40 } 41 }
41 42
42 // all domains 43 // all domains
43 TEST(URLPatternTest, Match2) { 44 TEST(URLPatternTest, Match2) {
44 URLPattern pattern; 45 URLPattern pattern;
45 EXPECT_TRUE(pattern.Parse("https://*/foo*")); 46 EXPECT_TRUE(pattern.Parse("https://*/foo*"));
46 EXPECT_EQ("https", pattern.scheme()); 47 EXPECT_EQ("https", pattern.scheme());
47 EXPECT_EQ("", pattern.host()); 48 EXPECT_EQ("", pattern.host());
48 EXPECT_TRUE(pattern.match_subdomains()); 49 EXPECT_TRUE(pattern.match_subdomains());
49 EXPECT_EQ("/foo*", pattern.path()); 50 EXPECT_EQ("/foo*", pattern.path());
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 EXPECT_TRUE(pattern.Parse("http://*.xn--gkd/a%C2%81%E1*")); 112 EXPECT_TRUE(pattern.Parse("http://*.xn--gkd/a%C2%81%E1*"));
112 EXPECT_EQ("http", pattern.scheme()); 113 EXPECT_EQ("http", pattern.scheme());
113 EXPECT_EQ("xn--gkd", pattern.host()); 114 EXPECT_EQ("xn--gkd", pattern.host());
114 EXPECT_TRUE(pattern.match_subdomains()); 115 EXPECT_TRUE(pattern.match_subdomains());
115 EXPECT_EQ("/a%C2%81%E1*", pattern.path()); 116 EXPECT_EQ("/a%C2%81%E1*", pattern.path());
116 EXPECT_TRUE(pattern.MatchesUrl( 117 EXPECT_TRUE(pattern.MatchesUrl(
117 GURL("http://abc.\xe1\x80\xbf/a\xc2\x81\xe1xyz"))); 118 GURL("http://abc.\xe1\x80\xbf/a\xc2\x81\xe1xyz")));
118 EXPECT_TRUE(pattern.MatchesUrl( 119 EXPECT_TRUE(pattern.MatchesUrl(
119 GURL("http://\xe1\x80\xbf/a\xc2\x81\xe1\xe1"))); 120 GURL("http://\xe1\x80\xbf/a\xc2\x81\xe1\xe1")));
120 }; 121 };
OLDNEW
« no previous file with comments | « chrome/common/extensions/url_pattern.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698