| Index: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-page-notification-fetch-resources.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-page-notification-fetch-resources.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-page-notification-fetch-resources.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dbbfe5bdc10472aef52105e9607634e49b9f2b2f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-page-notification-fetch-resources.html
|
| @@ -0,0 +1,37 @@
|
| +<!doctype html>
|
| +<html>
|
| + <head>
|
| + <title>Notifications: the fetch handler handles the request for the icon.</title>
|
| + <script src="../resources/testharness.js"></script>
|
| + <script src="../resources/testharnessreport.js"></script>
|
| + <script src="../serviceworker/resources/test-helpers.js"></script>
|
| + <script src="resources/test-helpers.js"></script>
|
| + </head>
|
| + <body>
|
| + <script>
|
| + // Tests that the request for the notification icon is handled by the fetch event handler for
|
| + // a page notification.
|
| + promise_test(test => {
|
| + var scope = './';
|
| + var script = 'instrumentation-service-worker.js';
|
| + var port;
|
| + var iconPath = '/resources/square20.png';
|
| +
|
| + testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
|
| +
|
| + return getActiveServiceWorkerWithMessagePort(test, script, scope).then(info => {
|
| + port = info.port;
|
| + assert_true(!!navigator.serviceWorker.controller, 'The page must be controlled.');
|
| + // (1) Create a page notification and wait for it to show.
|
| + var notification = new Notification('Title', { icon: iconPath });
|
| + return listenOnce(notification, 'show');
|
| + }).then(event => {
|
| + return sendCommand(port, { command: 'get-fetch-history' });
|
| + }).then(data => {
|
| + // (2) Confirm that the icon request passed through the fetch event handler.
|
| + assert_equals(data.fetchHistory[0], location.origin + iconPath);
|
| + });
|
| + }, 'The request for the notification icon is handled by the fetch event handler.');
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|