diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/webcodecs/idlharness.https.any.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webcodecs/idlharness.https.any.js')
-rw-r--r-- | testing/web-platform/tests/webcodecs/idlharness.https.any.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webcodecs/idlharness.https.any.js b/testing/web-platform/tests/webcodecs/idlharness.https.any.js new file mode 100644 index 0000000000..f1ed92a159 --- /dev/null +++ b/testing/web-platform/tests/webcodecs/idlharness.https.any.js @@ -0,0 +1,61 @@ +// 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`], + }); +}); |