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

Unified Diff: content/browser/service_worker/service_worker_utils_unittest.cc

Issue 259893002: ServiceWorker: Additional scope-matching test cases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698