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 64e28737e265e4b9ebb4ec6782b315e56e877485..7667d8bfdc25fef30b2dfb748405717160aa5bfd 100644 |
--- a/content/browser/service_worker/service_worker_utils_unittest.cc |
+++ b/content/browser/service_worker/service_worker_utils_unittest.cc |
@@ -24,6 +24,24 @@ TEST(ServiceWorkerUtilsTest, ScopeMatches) { |
GURL("http://www.example.com/*"), GURL("http://www.foo.com/"))); |
ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches( |
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 |