| Index: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-openwindow-crash.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-openwindow-crash.html b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-openwindow-crash.html
|
| index 8ed8fb9954754efd9fa8a3835da932818d91f15f..f8bc5926c47b7534c5a62db168d1c3d38b0c8119 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-openwindow-crash.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/notifications/serviceworker-notificationclick-openwindow-crash.html
|
| @@ -13,35 +13,27 @@
|
| // notificationclick event does not cause the browser to crash.
|
|
|
| async_test(function(test) {
|
| - var scope = 'resources/scope/' + location.pathname,
|
| - script = 'resources/instrumentation-service-worker.js',
|
| - workerInfo = null;
|
| + var scope = 'resources/scope/' + location.pathname;
|
| + var script = 'instrumentation-service-worker.js';
|
| + var port;
|
|
|
| testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
|
| getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(info) {
|
| - workerInfo = info;
|
| + port = info.port;
|
|
|
| // (1) Display a persistent notification with an OPENWINDOW trigger.
|
| - return workerInfo.registration.showNotification(scope, {
|
| + return info.registration.showNotification(scope, {
|
| body: 'ACTION:OPENWINDOW'
|
| });
|
| }).then(function() {
|
| // (2) Simulate a click on the notification, invokes the Service Worker event.
|
| - testRunner.simulateWebNotificationClick(scope, -1 /* action_index */);
|
| + return simulateNotificationClick(scope, -1 /* action_index */, port);
|
| + }).then(function(data) {
|
| + // (3) Confirm that the service worker successfully handled the notificationclick
|
| + // event for the correct notification.
|
| + assert_equals(data.notification.title, scope);
|
|
|
| - workerInfo.port.addEventListener('message', function(event) {
|
| - if (typeof event.data != 'object' || !event.data.command) {
|
| - assert_unreached('Invalid message from the Service Worker.');
|
| - return;
|
| - }
|
| -
|
| - // (3) Listen for confirmation by the Service Worker that the notificationclick
|
| - // event has been executed successfully.
|
| - assert_equals(event.data.command, 'click');
|
| - assert_equals(event.data.notification.title, scope);
|
| -
|
| - test.done();
|
| - });
|
| + test.done();
|
| }).catch(unreached_rejection(test));
|
|
|
| }, 'Opening a window in a Service Worker should not trigger a DCHECK.');
|
|
|