Files
firefox/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-serializable.html
T
jugglinmike 773d3f13fb Bug 1587233 [wpt PR 19587] - [2dcontext] Include required resource, a=testonly
Automatic update from web-platform-tests
[2dcontext] Include required resource (#19587)

"common.sub.js" references a function named `getVideoURI` at the top
level. This function is provided by "/common/media.js"; if the latter
file is not included, "common.sub.js" cannot be executed.

Load the required resource prior to "common.sub.js" so that the test may
run to completion.
--

wpt-commits: 72fcf2b027ede6465ee5ad9edbab8c8b8bd8c888
wpt-pr: 19587
2019-10-24 18:02:58 +01:00

44 lines
1.4 KiB
HTML

<!DOCTYPE html>
<meta charset=utf-8>
<title>createImageBitmap serialize test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/namespaces.js"></script>
<script src="/common/media.js"></script>
<script src="common.sub.js"></script>
<div id=log></div>
<script>
let worker, continuations = {};
setup(function() {
worker = new Worker("transfer-worker.js");
worker.addEventListener("message", function(event) {
let { name, bitmap } = event.data;
if (continuations.hasOwnProperty(name)) {
continuations[name](bitmap);
}
});
});
for (let { name, factory } of imageSourceTypes) {
promise_test(function(t) {
return factory().then(createImageBitmap).then(function(bitmap) {
assert_equals(bitmap.width, 20);
assert_equals(bitmap.height, 20);
worker.postMessage({ name: t.name, bitmap: bitmap });
assert_equals(bitmap.width, 20);
assert_equals(bitmap.height, 20);
return new Promise(function(resolve) {
continuations[t.name] = resolve;
});
}).then(function(bitmap) {
assert_class_string(bitmap, "ImageBitmap");
assert_equals(bitmap.width, 20);
assert_equals(bitmap.height, 20);
});
}, `Serialize ImageBitmap created from ${name}`);
}
</script>