diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-25 08:31:43 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-25 08:31:43 +0000 |
commit | 3b76103e0186e3ac2b67373b6f35f81a44d986c8 (patch) | |
tree | c03154bfa6d381f1279d46282009fdd37ac6e4ef /chrome/common/extensions/extension_extent_unittest.cc | |
parent | 75709691d97122dbefd7d73ce0cfade557e498b5 (diff) | |
download | chromium_src-3b76103e0186e3ac2b67373b6f35f81a44d986c8.zip chromium_src-3b76103e0186e3ac2b67373b6f35f81a44d986c8.tar.gz chromium_src-3b76103e0186e3ac2b67373b6f35f81a44d986c8.tar.bz2 |
Revert r50834
TBR=tony@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50835 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_extent_unittest.cc')
-rw-r--r-- | chrome/common/extensions/extension_extent_unittest.cc | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/chrome/common/extensions/extension_extent_unittest.cc b/chrome/common/extensions/extension_extent_unittest.cc index 41f2d15..4e308fa 100644 --- a/chrome/common/extensions/extension_extent_unittest.cc +++ b/chrome/common/extensions/extension_extent_unittest.cc @@ -14,22 +14,44 @@ TEST(ExtensionExtentTest, Empty) { EXPECT_FALSE(extent.ContainsURL(GURL("invalid"))); } -TEST(ExtensionExtentTest, One) { +TEST(ExtensionExtentTest, OriginOnly) { ExtensionExtent extent; - extent.AddPattern(*URLPattern::CreateFromString("http://www.google.com/*")); + extent.set_origin(GURL("http://www.google.com/")); EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/"))); - EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/monkey"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foobar"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo/bar"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/?stuff#here"))); + EXPECT_FALSE(extent.ContainsURL(GURL("https://www.google.com/"))); - EXPECT_FALSE(extent.ContainsURL(GURL("https://www.microsoft.com/"))); + EXPECT_FALSE(extent.ContainsURL(GURL("http://www.google.com:8080/"))); } -TEST(ExtensionExtentTest, Two) { +TEST(ExtensionExtentTest, OriginAndOnePath) { ExtensionExtent extent; - extent.AddPattern(*URLPattern::CreateFromString("http://www.google.com/*")); - extent.AddPattern(*URLPattern::CreateFromString("http://www.yahoo.com/*")); + extent.set_origin(GURL("http://www.google.com/")); + extent.add_path("foo"); + + EXPECT_FALSE(extent.ContainsURL(GURL("http://www.google.com/"))); + EXPECT_FALSE(extent.ContainsURL(GURL("http://www.google.com/fo"))); + + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/FOO"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foobar"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo/bar"))); +} + +TEST(ExtensionExtentTest, OriginAndTwoPaths) { + ExtensionExtent extent; + extent.set_origin(GURL("http://www.google.com/")); + extent.add_path("foo"); + extent.add_path("hot"); + + EXPECT_FALSE(extent.ContainsURL(GURL("http://www.google.com/monkey"))); - EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/monkey"))); - EXPECT_TRUE(extent.ContainsURL(GURL("http://www.yahoo.com/monkey"))); - EXPECT_FALSE(extent.ContainsURL(GURL("https://www.apple.com/monkey"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/hot"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foobar"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/hotdog"))); } |