Index: content/browser/service_worker/service_worker_utils_unittest.cc |
diff --git a/content/browser/service_worker/service_worker_utils_unittest.cc b/content/browser/service_worker/service_worker_utils_unittest.cc |
index 7667d8bfdc25fef30b2dfb748405717160aa5bfd..c21484510c377aa0d047c73a8112de75046a41bc 100644 |
--- a/content/browser/service_worker/service_worker_utils_unittest.cc |
+++ b/content/browser/service_worker/service_worker_utils_unittest.cc |
@@ -30,6 +30,7 @@ TEST(ServiceWorkerUtilsTest, ScopeMatches) { |
ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches( |
GURL("http://www.example.com/"), GURL("http://www.example.com/x"))); |
+ // '?' is not a wildcard. |
ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches( |
GURL("http://www.example.com/?"), GURL("http://www.example.com/x"))); |
ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches( |
@@ -39,6 +40,18 @@ TEST(ServiceWorkerUtilsTest, ScopeMatches) { |
ASSERT_TRUE(ServiceWorkerUtils::ScopeMatches( |
GURL("http://www.example.com/?"), GURL("http://www.example.com/?"))); |
+ // '*' only has special meaning in terminal position. |
+ ASSERT_TRUE(ServiceWorkerUtils::ScopeMatches( |
+ GURL("http://www.example.com/*/x"), GURL("http://www.example.com/*/x"))); |
+ ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches( |
+ GURL("http://www.example.com/*/x"), GURL("http://www.example.com/a/x"))); |
+ ASSERT_FALSE( |
+ ServiceWorkerUtils::ScopeMatches(GURL("http://www.example.com/*/x/*"), |
+ GURL("http://www.example.com/a/x/b"))); |
+ ASSERT_TRUE( |
+ ServiceWorkerUtils::ScopeMatches(GURL("http://www.example.com/*/x/*"), |
+ GURL("http://www.example.com/*/x/b"))); |
+ |
// 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"))); |