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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-page-notification-fetch-resources.html

Issue 1909043003: Tests that notification resource requests are handled by onfetch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NotificationTestsUsePromises
Patch Set: 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
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <title>Notifications: the fetch handler handles the request for the icon.</t itle>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 <script src="../serviceworker/resources/test-helpers.js"></script>
8 <script src="resources/test-helpers.js"></script>
9 </head>
10 <body>
11 <script>
12 // Tests that the request for the notification icon is handled by the fetc h event handler.
13
14 async_test(test => {
15 var scope = './';
16 var script = 'instrumentation-service-worker.js';
17 var port;
18 var registration;
19 var iconPath = '/resources/square20.png';
20
21 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
22
23 getActiveServiceWorkerWithMessagePort(test, script, scope).then(info = > {
24 port = info.port;
25 registration = info.registration;
26 assert_true(!!navigator.serviceWorker.controller, 'The page must b e controlled.');
27 // (1) Create a page notification and wait for it to show.
28 var notification = new Notification('Title', { icon: iconPath });
29 return listenOnce(notification, 'show');
30 }).then(event => {
31 return sendCommand(port, { command: 'get-fetch-history' });
32 }).then(data => {
33 // (2) Confirm that the icon request passed through the fetch even t handler.
34 assert_equals(data.fetchHistory[0], location.origin + iconPath);
35 test.done();
36 }).catch(unreached_rejection(test));
37
38 }, 'The request for the notification icon is handled by the fetch event ha ndler.');
39 </script>
40 </body>
41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698