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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-image-redirect-loop.html

Issue 1910723003: Add layout tests for notification icon with redirect loop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NotificationTestsUsePromises
Patch Set: Rebase. Created 4 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 404s.</title > 4 <title>Notifications: Showing a notification with an image that has a redire ct loop still succeeds.</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 creates a 404 resp onse 12 // Tests that showing a notification with an image that has a redirect loo p still succeeds.
13 // works properly, and does not block the actual display of it.
14 13
15 async_test(function(test) { 14 async_test(function(test) {
16 var scope = 'resources/scope/' + location.pathname, 15 var scope = 'resources/scope/' + location.pathname,
17 script = 'instrumentation-service-worker.js'; 16 script = 'instrumentation-service-worker.js';
18 17
19 testRunner.setPermission('notifications', 'granted', location.origin, location.origin); 18 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
20 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) { 19 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) {
21 // (1) Display a Web Notification through the Service Worker with 20 // (1) Display a Web Notification through the Service Worker with
22 // an image that will trigger a 404 response immediately. 21 // an image that takes redirects to another image.
23 return sendCommand(info.port, { 22 return sendCommand(info.port, {
24 command: 'show', 23 command: 'show',
25 24
26 title: 'My Notification', 25 title: 'My Notification',
27 options: { body: 'Hello, world!', 26 options: { body: 'Hello, world!',
28 icon: '/resources/404image.php' } 27 icon: '/resources/infinite-loop.php' }
29 }); 28 });
30 }).then(function(data) { 29 }).then(function(data) {
31 // (2) Confirm that the service worker displayed the notification successfully. 30 // (2) Confirm that the service worker displayed the notification successfully.
32 assert_true(data.success); 31 assert_true(data.success);
33 32
34 test.done(); 33 test.done();
35 }).catch(unreached_rejection(test)); 34 }).catch(unreached_rejection(test));
36 35
37 }, 'Displaying a notification with an image that 404s still resolves the p romise.'); 36 }, 'Showing a notification with an image that has a redirect loop still su cceeds.');
38 </script> 37 </script>
39 </body> 38 </body>
40 </html> 39 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698