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

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: Address review nits Created 7 years, 2 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
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>

Powered by Google App Engine
This is Rietveld 408576698