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

Unified Diff: LayoutTests/http/tests/serviceworker/registration.html

Issue 27278002: Add an Error class for ServiceWorkers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix windows Created 7 years, 1 month 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 | « LayoutTests/TestExpectations ('k') | LayoutTests/http/tests/serviceworker/registration-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/registration.html
diff --git a/LayoutTests/http/tests/serviceworker/registration.html b/LayoutTests/http/tests/serviceworker/registration.html
new file mode 100644
index 0000000000000000000000000000000000000000..f69154ef9fe87ecb96b9f1c547f0d5580baf010e
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/registration.html
@@ -0,0 +1,48 @@
+<html>
+<head>
+<script src="/js-test-resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+ description("Tests if ServiceWorker registration is working")
+
+ function test_registerBasics() {
+ debug("Registering normal pattern");
+ return navigator.registerServiceWorker("/*", "serviceworker.js").then(
+ function(worker) {
+ debug("Successfully registered");
+ return worker;
+ },
+ function(e) {
+ regError = e;
+ shouldBe("'DisabledError'", "regError.name");
+ });
+ }
+ function test_registerPatternOutsideDomain() {
+ debug("Registering pattern outside domain");
+ return navigator.registerServiceWorker("http://foo.com/*", "serviceworker.js")
+ .catch(function(e) {
+ regError = e;
+ shouldBe("'SecurityError'", "regError.name");
+ });
+ }
+ function test_registerScriptOutsideDomain() {
+ debug("Registering pattern outside domain");
+ return navigator.registerServiceWorker("/*", "http://foo.com/serviceworker.js")
+ .catch(function(e) {
+ regError = e;
+ shouldBe("'SecurityError'", "regError.name");
+ });
+ }
+ var jsTestIsAsync = true;
+ test_registerBasics()
+ .then(test_registerPatternOutsideDomain)
+ .then(test_registerScriptOutsideDomain)
+ .then(finishJSTest, function(e) {
+ testFailed("Tests failed, exited with error:" + e.name + ": " + e.message);
+ finishJSTest();
+ });
+</script>
+<script src="/js-test-resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/http/tests/serviceworker/registration-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698