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

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

Issue 2600733002: Convert budget LayoutTests to use promise_test. (Closed)
Patch Set: Created 4 years 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 | « no previous file | third_party/WebKit/LayoutTests/http/tests/budget/get-cost-fails-in-service-worker.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/budget/get-budget-in-service-worker.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/budget/get-budget-in-service-worker.html b/third_party/WebKit/LayoutTests/http/tests/budget/get-budget-in-service-worker.html
index 999c7c1e864e55c18f1d22a2f9b43a2bf1e62b1f..2207164fe1ec71e416d585cf3a65f749460aef0e 100644
--- a/third_party/WebKit/LayoutTests/http/tests/budget/get-budget-in-service-worker.html
+++ b/third_party/WebKit/LayoutTests/http/tests/budget/get-budget-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.addBudget(TEST_BUDGET_TIME, TEST_BUDGET_AT);
- getActiveServiceWorkerWithMessagePort(test, script, scope)
+ return getActiveServiceWorkerWithMessagePort(test, script, scope)
.then(function(workerInfo) {
Peter Beverloo 2017/01/04 18:18:11 nit: I'd move the .then() a level up, i.e. return
harkness 2017/01/06 13:37:09 Done.
port = workerInfo.port;
- port.postMessage({command: 'getBudget'});
port.addEventListener('message', function(event) {
if (typeof event.data != 'object' || !event.data.command)
@@ -32,8 +31,9 @@
'getBudget should succeed. Error message: ' + event.data.errorMessage);
assert_equals(event.data.budgetAt, TEST_BUDGET_AT);
assert_equals(event.data.time, TEST_BUDGET_TIME);
- test.done();
});
+
+ return sendCommand(port, { command: 'getBudget' });
})
.catch(unreached_rejection(test));
Peter Beverloo 2017/01/04 18:18:11 You should drop these - a rejection in a promise_t
harkness 2017/01/06 13:37:09 Done.
});
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/budget/get-cost-fails-in-service-worker.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698