Chromium Code Reviews| 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..3fc71a4941b79feae7c980172504bcf2b7ae951f |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/registration.html |
| @@ -0,0 +1,43 @@ |
| +<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() { |
|
michaeln
2013/10/24 23:26:55
I'd suggest we not add this particular positive te
|
| + debug("Registering normal pattern"); |
| + return navigator.registerServiceWorker("/*", "serviceworker.js").then( |
| + function(worker) { |
| + debug("ServiceWorker registered."); |
| + }); |
| + } |
| + 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> |