| Index: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-get-from-service-worker.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-get-from-service-worker.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-get-from-service-worker.html
|
| index c8e7742de65d8b8aba72487ed6ca733e331656bf..f813359fc172c8de84d41bfca110f37e61b652c0 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-get-from-service-worker.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-get-from-service-worker.html
|
| @@ -13,38 +13,29 @@
|
| // an array of the notifications which were previously displayed by the
|
| // Service Worker.
|
| async_test(function(test) {
|
| - var scope = 'resources/scope/' + location.pathname,
|
| - script = 'resources/instrumentation-service-worker.js';
|
| + var scope = 'resources/scope/' + location.pathname;
|
| + var script = 'instrumentation-service-worker.js';
|
| + var port;
|
| + var registration;
|
|
|
| testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
|
|
|
| - var info = null;
|
| - getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(workerInfo) {
|
| - info = workerInfo;
|
| + getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(info) {
|
| + port = info.port;
|
| + registration = info.registration;
|
|
|
| // (1) Tell the Service Worker to display a new Notification and wait for it
|
| // to have been displayed to the user.
|
| - info.port.postMessage({
|
| + return sendCommand(port, {
|
| command: 'show',
|
|
|
| title: scope,
|
| options: { body: 'Hello, world!' }
|
| });
|
| -
|
| - return new Promise(function(resolve) {
|
| - info.port.addEventListener('message', function(event) {
|
| - if (typeof event.data != 'object' || !event.data.command) {
|
| - assert_unreached('Invalid message from the Service Worker.');
|
| - return;
|
| - }
|
| -
|
| - assert_equals(event.data.command, 'show');
|
| - resolve();
|
| - });
|
| - });
|
| - }).then(function() {
|
| + }).then(function(data) {
|
| + assert_true(data.success);
|
| // (2) Get a list of all notifications in the document.
|
| - return info.registration.getNotifications();
|
| + return registration.getNotifications();
|
| }).then(function(notifications) {
|
| // (3) Verify that there's only one notification: the one we just showed.
|
| assert_equals(notifications.length, 1);
|
|
|