Commit 21648f3f authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Convert some async_test(async ...) cases to promise_tests

Passing an async function to async_test will soon be disallowed in WPT,
as any asserts thrown will be turned into unhandled promise rejections
and the test will timeout. If a test needs async functions it should use
promise_test instead.

(The naming conflict is a sad historical legacy; WPT had async_test long
before EcmaScript spec'd promises!)

Bug: https://github.com/web-platform-tests/wpt/issues/21435
Change-Id: I0a31872525844a1540aea548e329929e8097663e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414923Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809464}
parent a099d2db
......@@ -18,11 +18,10 @@
// Navigate the iframe to URLs whose host aren't canonical. They need to be
// percent encoded. Several navigation are made to ensure potential assertions
// can be reached before the end of the test. See https://crbug.com/901489.
async_test(async function(t) {
promise_test(async function(t) {
await navigate_iframe("http://foo,.example.test/resources/dummy.html");
await navigate_iframe("http://bar,.example.test/resources/dummy.html");
await navigate_iframe("http://baz,.example.test/resources/dummy.html");
t.done();
}, "Navigate iframe to URL with non-canonicalized hostname");
</script>
</body>
......@@ -3,11 +3,10 @@
<script src="../resources/testharnessreport.js"></script>
<iframe id="i"></iframe>
<script>
async_test(async function(t) {
promise_test(async function(t) {
let face = new FontFace("face", "url(../resources/Ahem.ttf)", {});
await face.load();
i.contentDocument.fonts.add(face);
document.fonts.add(face);
t.done();
});
</script>
......@@ -16,17 +16,18 @@
return iframe;
}
async_test(async function(test)
promise_test(async function(test)
{
iframe = allociframe();
keySystemAccess = await iframe.contentWindow.navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration());
keys = await keySystemAccess.createMediaKeys();
const domException = iframe.contentWindow.DOMException;
document.body.removeChild(iframe);
keys.getStatusForPolicy({minHdcpVersion : '1.0'}).then(function(result) {
assert_unreached('getStatusforPolicy() should fail');
}, function(error) {
test.done();
});
return promise_rejects_dom(test,
'InvalidAccessError',
domException,
keys.getStatusForPolicy({minHdcpVersion : '1.0'}),
'getStatusforPolicy() should fail');
}, 'Test context destruction.');
</script>
</body>
......
......@@ -28,7 +28,7 @@
);
};
async_test(async function(t) {
promise_test(async function(t) {
// 1. Initial navigation to about:srcdoc.
assert_equals("error", await message());
......@@ -47,7 +47,5 @@
// (4).
iframe.srcdoc = iframe.srcdoc;
assert_equals("error", await message());
t.done();
});
</script>
......@@ -22,7 +22,7 @@
return new Promise(resolved => window.onScriptLoaded = resolved);
};
async_test(async function(t) {
promise_test(async function(t) {
// 1. Check file subresource can be loaded from the initial about:srcdoc
// document.
await scriptLoaded();
......@@ -30,6 +30,5 @@
// 2. Check file subresource can be loaded again after a new navigation to
// about:srcdoc.
await scriptLoaded();
t.done();
});
</script>
......@@ -11,11 +11,10 @@
<script>
'use strict';
async_test(async t => {
promise_test(async t => {
const adapter = await navigator.gpu.requestAdapter();
assert_true(adapter !== null);
const device = await adapter.requestDevice();
assert_true(device !== null);
t.done();
});
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment