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

Side by Side Diff: LayoutTests/http/tests/push_messaging/has-permission-document.html

Issue 783983003: Push API: move PushManager from Navigator to ServiceWorkerRegistration [switchover 6/6] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Push API: hasPermission 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) {
13 assert_true(!!window.testRunner, 'This test requires the TestRunner.');
14 var url = 'resources/empty-worker.js';
15 var scope = 'resources/scope/hasPermission';
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 return swRegistration.pushManager.hasPermission();
22 })
23 .then(function(permissionStatus) {
24 assert_equals(permissionStatus, 'default', 'By default hasPermission resolves with default.');
25 testRunner.setPushMessagingPermission(origin, true);
26 return swRegistration.pushManager.hasPermission();
27 })
28 .then(function(permissionStatus) {
29 assert_equals(permissionStatus, 'granted', 'Once granted hasPermissi on resolves with granted.');
30 testRunner.setPushMessagingPermission(origin, false);
31 return swRegistration.pushManager.hasPermission();
32 })
33 .then(function(permissionStatus) {
34 assert_equals(permissionStatus, 'denied', 'Once denied hasPermission resolves with denied.');
35 testRunner.clearPushMessagingPermissions();
36 return swRegistration.pushManager.hasPermission();
37 })
38 .then(function(permissionStatus) {
Peter Beverloo 2014/12/08 21:40:50 This clause shouldn't be included, as it tests the
Michael van Ouwerkerk 2014/12/09 18:47:45 Done. Actually, I split these into three separate
39 assert_equals(permissionStatus, 'default', 'After a reset hasPermiss ion resolves with default again.');
40 test.done();
41 })
42 .catch(unreached_rejection(test));
43 }, 'Push API: hasPermission in document context');
44 </script>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698