Index: third_party/WebKit/LayoutTests/http/tests/budget/get-cost-fails-in-service-worker.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/budget/get-cost-fails-in-service-worker.html b/third_party/WebKit/LayoutTests/http/tests/budget/get-cost-fails-in-service-worker.html |
index 8ebb91b00e46067d19ed8101f9abd0601678bcc8..20de85ac44a28c835a5404446e2c78cd59a7c166 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/budget/get-cost-fails-in-service-worker.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/budget/get-cost-fails-in-service-worker.html |
@@ -11,29 +11,27 @@ |
</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 => { |
- getActiveServiceWorkerWithMessagePort(test, script, scope) |
- .then(function(workerInfo) { |
- port = workerInfo.port; |
- port.postMessage({ command: 'getCostInvalidType' }); |
+ return budgetServiceMock.then(mock => { |
+ return getActiveServiceWorkerWithMessagePort(test, script, scope); |
+ }).then(function(workerInfo) { |
+ port = workerInfo.port; |
- port.addEventListener('message', function(event) { |
- if (typeof event.data != 'object' || !event.data.command) |
- assert_unreached('Invalid message from the service worker'); |
+ port.addEventListener('message', function(event) { |
+ if (typeof event.data != 'object' || !event.data.command) |
+ assert_unreached('Invalid message from the service worker'); |
- assert_equals(event.data.command, 'getCostInvalidType'); |
- assert_false(event.data.success, |
- 'getCost should fail with invalid arguments.'); |
- assert_equals(event.data.errorMessage, "Failed to execute 'getCost' on 'BudgetService': The provided value 'frobinator' is not a valid enum value of type OperationType."); |
- test.done(); |
- }); |
- }) |
- .catch(unreached_rejection(test)); |
+ assert_equals(event.data.command, 'getCostInvalidType'); |
+ assert_false(event.data.success, |
+ 'getCost should fail with invalid arguments.'); |
+ assert_equals(event.data.errorMessage, "Failed to execute 'getCost' on 'BudgetService': The provided value 'frobinator' is not a valid enum value of type OperationType."); |
+ }); |
+ |
+ return sendCommand(port, { command: 'getCostInvalidType' }); |
}); |
}, 'getCost with invalid arugment should fail from Service Worker'); |
</script> |