fune/testing/web-platform/tests/webcodecs/idlharness.https.any.js
Dale Curtis c03655e9fa Bug 1814999 [wpt PR 38358] - Fix dependencies for WebCodecs idlharness.js test., a=testonly
Automatic update from web-platform-tests
Fix dependencies for WebCodecs idlharness.js test.

WebCodecs uses events, but without specifying the right deps, the test
harness doesn't know how to process those.

https://github.com/w3c/webcodecs/pull/637 will fix the imported IDL to
pare down the last remaining failures (except metadata since we
intentionally don't have that yet).

R=dbaron

Bug: 1412203
Change-Id: I62424285c49d1cf84a8f17081a5fb158da9a042d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4222139
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1101909}

--

wpt-commits: cb996520530ee3d49995a81e3654b4bc90e92d7d
wpt-pr: 38358
2023-02-20 09:49:00 +00:00

61 lines
1.9 KiB
JavaScript

// META: global=window,dedicatedworker
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: script=./utils.js
// META: timeout=long
'use strict';
var defaultCodecInit = {
output: function() {
assert_unreached("unexpected output");
},
error: function() {
assert_unreached("unexpected error");
},
}
var defaultAudioChunkInit = {
type: 'key',
timestamp: 1234,
duration: 9876,
data: new Uint8Array([5, 6, 7, 8])
};
var defaultVideoChunkInit = {
type: 'key',
timestamp: 1234,
duration: 5678,
data: new Uint8Array([9, 10, 11, 12])
};
idl_test(['webcodecs'], ['dom', 'html', 'webidl'], async idlArray => {
self.imageBody =
await fetch('four-colors.png').then(response => response.arrayBuffer());
let decoder = new ImageDecoder({data: self.imageBody, type: 'image/png'});
await decoder.tracks.ready;
self.imageTracks = decoder.tracks.selectedTrack;
idlArray.add_objects({
AudioDecoder: [`new AudioDecoder(defaultCodecInit)`],
VideoDecoder: [`new VideoDecoder(defaultCodecInit)`],
AudioEncoder: [`new AudioEncoder(defaultCodecInit)`],
VideoEncoder: [`new VideoEncoder(defaultCodecInit)`],
EncodedAudioChunk: [`new EncodedAudioChunk(defaultAudioChunkInit)`],
EncodedVideoChunk: [`new EncodedVideoChunk(defaultVideoChunkInit)`],
AudioData: [`make_audio_data(1234, 2, 8000, 100)`],
VideoFrame: [
`new VideoFrame(makeImageBitmap(32, 16), {timestamp: 100, duration: 33})`
],
VideoColorSpace: [
`new VideoColorSpace()`,
`new VideoColorSpace({primaries: 'bt709', transfer: 'bt709', matrix: 'bt709', fullRange: true})`,
],
ImageDecoder:
[`new ImageDecoder({data: self.imageBody, type: 'image/png'})`],
ImageTrackList:
[`new ImageDecoder({data: self.imageBody, type: 'image/png'}).tracks`],
ImageTrack: [`self.imageTracks`],
});
});