Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="/js-test-resources/js-test-pre.js"></script> | |
| 4 </head> | |
| 5 <body> | |
| 6 <script> | |
| 7 description("Tests if ServiceWorker registration is working") | |
| 8 | |
| 9 function test_registerBasics() { | |
|
michaeln
2013/10/24 23:26:55
I'd suggest we not add this particular positive te
| |
| 10 debug("Registering normal pattern"); | |
| 11 return navigator.registerServiceWorker("/*", "serviceworker.js").then( | |
| 12 function(worker) { | |
| 13 debug("ServiceWorker registered."); | |
| 14 }); | |
| 15 } | |
| 16 function test_registerPatternOutsideDomain() { | |
| 17 debug("Registering pattern outside domain"); | |
| 18 return navigator.registerServiceWorker("http://foo.com/*", "servicewor ker.js") | |
| 19 .catch(function(e) { | |
| 20 regError = e; | |
| 21 shouldBe("'SecurityError'", "regError.name"); | |
| 22 }); | |
| 23 } | |
| 24 function test_registerScriptOutsideDomain() { | |
| 25 debug("Registering pattern outside domain"); | |
| 26 return navigator.registerServiceWorker("/*", "http://foo.com/servicewo rker.js") | |
| 27 .catch(function(e) { | |
| 28 regError = e; | |
| 29 shouldBe("'SecurityError'", "regError.name"); | |
| 30 }); | |
| 31 } | |
| 32 var jsTestIsAsync = true; | |
| 33 test_registerBasics() | |
| 34 .then(test_registerPatternOutsideDomain) | |
| 35 .then(test_registerScriptOutsideDomain) | |
| 36 .then(finishJSTest, function(e) { | |
| 37 testFailed("Tests failed, exited with error:" + e.name + ": " + e.mess age); | |
| 38 finishJSTest(); | |
| 39 }); | |
| 40 </script> | |
| 41 <script src="/js-test-resources/js-test-post.js"></script> | |
| 42 </body> | |
| 43 </html> | |
| OLD | NEW |