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

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

Issue 1097383006: Notifications: use testRunner.setPermission() in addition of grantWebNotificationPermission. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cleanup
Patch Set: fix expectations 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 that takes some t ime to load.</title> 4 <title>Notifications: Showing a notification with an image that takes some t ime to load.</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 a non-trivia l 12 // Tests that showing a notification with an image that takes a non-trivia l
13 // time to load still ends up resolving the promise. 13 // time to load still ends up resolving the promise.
14 14
15 async_test(function(test) { 15 async_test(function(test) {
16 var scope = 'resources/scope/' + location.pathname, 16 var scope = 'resources/scope/' + location.pathname,
17 script = 'resources/instrumentation-service-worker.js'; 17 script = 'resources/instrumentation-service-worker.js';
18 18
19 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
19 testRunner.grantWebNotificationPermission(location.origin, true); 20 testRunner.grantWebNotificationPermission(location.origin, true);
20 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) { 21 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) {
21 // (1) Display a Web Notification through the Service Worker with 22 // (1) Display a Web Notification through the Service Worker with
22 // an image that takes 200ms to load. 23 // an image that takes 200ms to load.
23 info.port.postMessage({ 24 info.port.postMessage({
24 command: 'show', 25 command: 'show',
25 26
26 title: 'My Notification', 27 title: 'My Notification',
27 options: { body: 'Hello, world!', 28 options: { body: 'Hello, world!',
28 icon: '/resources/slow-image.php?redirect_name=squa re100.png&mimeType=image/png&sleep=200' } 29 icon: '/resources/slow-image.php?redirect_name=squa re100.png&mimeType=image/png&sleep=200' }
(...skipping 10 matching lines...) Expand all
39 assert_equals(event.data.command, 'show'); 40 assert_equals(event.data.command, 'show');
40 assert_true(event.data.success); 41 assert_true(event.data.success);
41 42
42 test.done(); 43 test.done();
43 }); 44 });
44 }).catch(unreached_rejection(test)); 45 }).catch(unreached_rejection(test));
45 46
46 }, 'Displaying a notification with an image that takes some time to load s till resolves the promise.'); 47 }, 'Displaying a notification with an image that takes some time to load s till resolves the promise.');
47 </script> 48 </script>
48 </body> 49 </body>
49 </html> 50 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698