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

Side by Side Diff: LayoutTests/http/tests/push_messaging/subscribe_worker_not_activated.html

Issue 841333002: Push API: rename registration to subscription. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use https in the spec link. Created 5 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>register() is rejected when the service worker is not active yet</title> 4 <title>subscribe() is rejected when the service worker is not active yet</title>
5 <link rel="manifest" href="resources/push_manifest.json"> 5 <link rel="manifest" href="resources/push_manifest.json">
6 <script src="../resources/testharness.js"></script> 6 <script src="../resources/testharness.js"></script>
7 <script src="../resources/testharnessreport.js"></script> 7 <script src="../resources/testharnessreport.js"></script>
8 <script src="../serviceworker/resources/test-helpers.js"></script> 8 <script src="../serviceworker/resources/test-helpers.js"></script>
9 </head> 9 </head>
10 <body> 10 <body>
11 <script> 11 <script>
12 async_test(function(test) { 12 async_test(function(test) {
13 var workerUrl = 'resources/empty_worker.js'; 13 var workerUrl = 'resources/empty_worker.js';
14 var workerScope = 'resources/scope/' + location.pathname; 14 var workerScope = 'resources/scope/' + location.pathname;
15 var swRegistration; 15 var swRegistration;
16 service_worker_unregister_and_register(test, workerUrl, workerScope) 16 service_worker_unregister_and_register(test, workerUrl, workerScope)
17 .then(function(serviceWorkerRegistration) { 17 .then(function(serviceWorkerRegistration) {
18 swRegistration = serviceWorkerRegistration; 18 swRegistration = serviceWorkerRegistration;
19 assert_not_equals(swRegistration.installing, null, 'The worker shoul d be installing'); 19 assert_not_equals(swRegistration.installing, null, 'The worker shoul d be installing');
20 assert_equals(swRegistration.active, null, 'The worker should not be active yet'); 20 assert_equals(swRegistration.active, null, 'The worker should not be active yet');
21 // If running manually, grant permission when prompted. 21 // If running manually, grant permission when prompted.
22 if (self.testRunner) 22 if (self.testRunner)
23 testRunner.setPushMessagingPermission(location.origin, true); 23 testRunner.setPushMessagingPermission(location.origin, true);
24 return swRegistration.pushManager.register(); 24 return swRegistration.pushManager.subscribe();
25 }) 25 })
26 .then(function(pushRegistration) { 26 .then(function(pushRegistration) {
27 assert_unreached('register() must not succeed without an active serv ice worker'); 27 assert_unreached('subscribe() must not succeed without an active ser vice worker');
28 }, function(e) { 28 }, function(e) {
29 assert_equals(e.name, 'AbortError'); 29 assert_equals(e.name, 'AbortError');
30 assert_equals(e.message, 'Registration failed - no active Service Wo rker'); 30 assert_equals(e.message, 'Subscription failed - no active Service Wo rker');
31 return service_worker_unregister_and_done(test, workerScope); 31 return service_worker_unregister_and_done(test, workerScope);
32 }) 32 })
33 .catch(unreached_rejection(test)); 33 .catch(unreached_rejection(test));
34 }, 'register() is rejected when the service worker is not active yet'); 34 }, 'subscribe() is rejected when the service worker is not active yet');
35 </script> 35 </script>
36 </body> 36 </body>
37 </html> 37 </html>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/push_messaging/subscribe_success.html ('k') | LayoutTests/http/tests/push_messaging/unregister.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698