Commit 30bd6059 authored by jsbell@chromium.org's avatar jsbell@chromium.org

ServiceWorker: Additional scope-matching test cases

Tests to ensure that ?-escaping works and \-escaping is not necessary.

BUG=360629

Review URL: https://codereview.chromium.org/259893002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267016 0039d316-1c4b-4281-b951-d872f2087c98
parent d5403810
...@@ -24,6 +24,24 @@ TEST(ServiceWorkerUtilsTest, ScopeMatches) { ...@@ -24,6 +24,24 @@ TEST(ServiceWorkerUtilsTest, ScopeMatches) {
GURL("http://www.example.com/*"), GURL("http://www.foo.com/"))); GURL("http://www.example.com/*"), GURL("http://www.foo.com/")));
ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches( ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches(
GURL("http://www.example.com/*"), GURL("https://www.foo.com/page.html"))); GURL("http://www.example.com/*"), GURL("https://www.foo.com/page.html")));
ASSERT_TRUE(ServiceWorkerUtils::ScopeMatches(
GURL("http://www.example.com/"), GURL("http://www.example.com/")));
ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches(
GURL("http://www.example.com/"), GURL("http://www.example.com/x")));
ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches(
GURL("http://www.example.com/?"), GURL("http://www.example.com/x")));
ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches(
GURL("http://www.example.com/?"), GURL("http://www.example.com/")));
ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches(
GURL("http://www.example.com/?"), GURL("http://www.example.com/xx")));
ASSERT_TRUE(ServiceWorkerUtils::ScopeMatches(
GURL("http://www.example.com/?"), GURL("http://www.example.com/?")));
// URLs canonicalize \ to / so this is equivalent to "...//*" and "...//x"
ASSERT_TRUE(ServiceWorkerUtils::ScopeMatches(
GURL("http://www.example.com/\\*"), GURL("http://www.example.com/\\x")));
} }
} // namespace content } // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment