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

Side by Side Diff: LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-abort.html

Issue 1100163002: Notifications: stop using notifications specific permission methods in LayoutTests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@notifications_testrunner_setpermission
Patch Set: update Created 5 years, 8 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
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Notifications: Showing a notification with an image and then abort th e load immediately.</title> 4 <title>Notifications: Showing a notification with an image and then abort th e load immediately.</title>
5 <script src="../resources/testharness.js"></script> 5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script> 6 <script src="../resources/testharnessreport.js"></script>
7 <script src="../serviceworker/resources/test-helpers.js"></script> 7 <script src="../serviceworker/resources/test-helpers.js"></script>
8 <script src="resources/test-helpers.js"></script> 8 <script src="resources/test-helpers.js"></script>
9 </head> 9 </head>
10 <body> 10 <body>
11 <script> 11 <script>
12 // Tests that showing a notification with an image that takes 200ms to loa d, which 12 // Tests that showing a notification with an image that takes 200ms to loa d, which
13 // is unlikely to succeed because the Service Worker registration will be unregistered 13 // is unlikely to succeed because the Service Worker registration will be unregistered
14 // immediately after, does not cause a crash. 14 // immediately after, does not cause a crash.
15 15
16 async_test(function(test) { 16 async_test(function(test) {
17 var scope = 'resources/scope/' + location.pathname, 17 var scope = 'resources/scope/' + location.pathname,
18 script = 'resources/instrumentation-service-worker.js'; 18 script = 'resources/instrumentation-service-worker.js';
19 19
20 testRunner.setPermission('notifications', 'granted', location.origin, location.origin); 20 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
21 testRunner.grantWebNotificationPermission(location.origin, true);
22 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) { 21 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) {
23 // (1) Display a Web Notification through the Service Worker with which 22 // (1) Display a Web Notification through the Service Worker with which
24 // will take 200ms to load, and unregister the Service Worker imme diately 23 // will take 200ms to load, and unregister the Service Worker imme diately
25 // after that to abort the in-progress load. 24 // after that to abort the in-progress load.
26 info.port.postMessage({ 25 info.port.postMessage({
27 command: 'show', 26 command: 'show',
28 27
29 title: 'My Notification', 28 title: 'My Notification',
30 options: { body: 'Hello, world!', 29 options: { body: 'Hello, world!',
31 icon: '/resources/slow-image.php?redirect_name=squa re100.png&mimeType=image/png&sleep=200' } 30 icon: '/resources/slow-image.php?redirect_name=squa re100.png&mimeType=image/png&sleep=200' }
32 }); 31 });
33 32
34 return info.registration.unregister().then(function () { 33 return info.registration.unregister().then(function () {
35 test.done(); 34 test.done();
36 }); 35 });
37 }).catch(unreached_rejection(test)); 36 }).catch(unreached_rejection(test));
38 37
39 }, 'Showing a notification with an image and then abort the load immediate ly.'); 38 }, 'Showing a notification with an image and then abort the load immediate ly.');
40 </script> 39 </script>
41 </body> 40 </body>
42 </html> 41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698