Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/budget/reserve-in-service-worker.html

Issue 2600733002: Convert budget LayoutTests to use promise_test. (Closed)
Patch Set: Changed then scoping and removed unnecessary rejection. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/budget/interfaces-in-service-worker.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2441c5cdd174616ddd4867eacdeed99404b3a921 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,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 => {
+ return budgetServiceMock.then(mock => {
mock.setReserveSuccess(true);
- getActiveServiceWorkerWithMessagePort(test, script, scope)
- .then(function(workerInfo) {
- port = workerInfo.port;
- port.postMessage({ command: 'reserve' });
+ 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, 'reserve');
- assert_true(event.data.success,
- 'reserve should succeed. Error message: ' + event.data.errorMessage);
- test.done();
- });
- })
- .catch(unreached_rejection(test));
+ assert_equals(event.data.command, 'reserve');
+ assert_true(event.data.success,
+ 'reserve should succeed. Error message: ' + event.data.errorMessage);
+ });
+
+ return sendCommand(port, { command: 'reserve' });
});
}, 'reserve should succeed from Service Worker');
</script>
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/budget/interfaces-in-service-worker.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698