Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>Push API: register in document context</title> | |
| 5 <link rel="manifest" href="resources/push_manifest.json"> | |
| 6 <script src="../resources/testharness.js"></script> | |
| 7 <script src="../resources/testharnessreport.js"></script> | |
| 8 <script src="../serviceworker/resources/test-helpers.js"></script> | |
| 9 </head> | |
| 10 <body> | |
| 11 <script> | |
| 12 async_test(function(test) { | |
|
Peter Beverloo
2014/12/08 21:40:50
This is a bit of a weird test. Also, "register in
Michael van Ouwerkerk
2014/12/09 18:47:45
It was mixed up because multiple async tests on th
| |
| 13 assert_true(!!window.testRunner, 'This test requires the TestRunner.'); | |
| 14 var url = 'resources/empty-worker.js'; | |
| 15 var scope = 'resources/scope/register'; | |
| 16 var origin = 'http://127.0.0.1:8000'; | |
| 17 var swRegistration; | |
| 18 service_worker_unregister_and_register(test, url, scope) | |
| 19 .then(function(serviceWorkerRegistration) { | |
| 20 swRegistration = serviceWorkerRegistration; | |
| 21 testRunner.setPushMessagingPermission(origin, true); | |
| 22 return swRegistration.pushManager.register(); | |
| 23 }) | |
| 24 .then(function(pushRegistration) { | |
| 25 assert_equals(pushRegistration.pushEndpoint, 'https://example.com/La youtTestEndpoint'); | |
| 26 assert_equals(pushRegistration.pushRegistrationId, 'layoutTestRegist rationId_0'); | |
| 27 testRunner.resetPushMessagingRegistrations(); | |
| 28 testRunner.setPushMessagingPermission(origin, false); | |
| 29 return swRegistration.pushManager.register(); | |
| 30 }) | |
| 31 .then(function(pushRegistration) { | |
| 32 assert_unreached('Registration must not succeed after permission is denied.'); | |
| 33 }, function(e) { | |
| 34 assert_equals(e.name, 'AbortError'); | |
| 35 assert_equals(e.message, 'Registration failed - permission denied'); | |
| 36 test.done(); | |
| 37 }) | |
| 38 .catch(unreached_rejection(test)); | |
| 39 }, 'Push API: register in document context'); | |
| 40 </script> | |
| 41 </body> | |
| 42 </html> | |
| OLD | NEW |