Index: third_party/WebKit/LayoutTests/http/tests/budget/reserve-in-service-worker.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/budget/reserve-in-service-worker.html b/third_party/WebKit/LayoutTests/http/tests/budget/reserve-in-service-worker.html |
index e8112b0276e348f4e4dca0eb564efa822a552d54..2a109284a7ab720871b7e7e45e414172282e272f 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/budget/reserve-in-service-worker.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/budget/reserve-in-service-worker.html |
@@ -11,17 +11,16 @@ |
</head> |
<body> |
<script> |
- async_test(function(test) { |
- var script = 'resources/instrumentation-service-worker.js'; |
- var scope = 'resources/scope/' + location.pathname; |
- var port; |
+ promise_test(function(test) { |
+ const script = 'resources/instrumentation-service-worker.js'; |
+ const scope = 'resources/scope/' + location.pathname; |
+ let port; |
- budgetServiceMock.then(mock => { |
+ return budgetServiceMock.then(mock => { |
mock.setReserveSuccess(true); |
- getActiveServiceWorkerWithMessagePort(test, script, scope) |
+ return getActiveServiceWorkerWithMessagePort(test, script, scope) |
.then(function(workerInfo) { |
port = workerInfo.port; |
- port.postMessage({ command: 'reserve' }); |
port.addEventListener('message', function(event) { |
if (typeof event.data != 'object' || !event.data.command) |
@@ -30,8 +29,9 @@ |
assert_equals(event.data.command, 'reserve'); |
assert_true(event.data.success, |
'reserve should succeed. Error message: ' + event.data.errorMessage); |
- test.done(); |
}); |
+ |
+ return sendCommand(port, { command: 'reserve' }); |
}) |
.catch(unreached_rejection(test)); |
}); |