From 9fa829bda86b5a374ee8156a6a86599229c8269f Mon Sep 17 00:00:00 2001 From: Eugene Zemtsov Date: Tue, 13 Apr 2021 10:21:41 +0000 Subject: [PATCH] Bug 1703973 [wpt PR 28421] - webcodecs: IDL changes for (Video|Audio)Encoder.isConfigSupported(), a=testonly Automatic update from web-platform-tests webcodecs: IDL changes for (Video|Audio)Encoder.isConfigSupported() Also 1. basics of config validation based on validation logic from encoders 2. Trivial tests Bug: 1176442 Change-Id: I944fae057adafede9b33a402a8c7718aec72b97c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2811654 Reviewed-by: Chrome Cunningham Commit-Queue: Eugene Zemtsov Cr-Commit-Position: refs/heads/master@{#870710} -- wpt-commits: c25923e1e3a5c2de964768aded0243c2ed153365 wpt-pr: 28421 --- .../tests/webcodecs/audio-encoder-config.any.js | 19 +++++++++++++++++++ .../web-platform/tests/webcodecs/audio-encoder.any.js | 7 ------- .../tests/webcodecs/video-encoder-config.any.js | 19 +++++++++++++++++++ 3 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 testing/web-platform/tests/webcodecs/audio-encoder-config.any.js create mode 100644 testing/web-platform/tests/webcodecs/video-encoder-config.any.js diff --git a/testing/web-platform/tests/webcodecs/audio-encoder-config.any.js b/testing/web-platform/tests/webcodecs/audio-encoder-config.any.js new file mode 100644 index 000000000000..b7ea8fbf0165 --- /dev/null +++ b/testing/web-platform/tests/webcodecs/audio-encoder-config.any.js @@ -0,0 +1,19 @@ +// META: global=window,dedicatedworker +// META: script=/webcodecs/utils.js + +const invalidConfigs = [ + { + comment: 'Emtpy codec', + config: {codec: ''}, + }, + { + comment: 'Unrecognized codec', + config: {codec: 'bogus'}, + }, +]; + +invalidConfigs.forEach(entry => { + promise_test(t => { + return promise_rejects_js(t, TypeError, AudioEncoder.isConfigSupported(entry.config)); + }, 'Test that AudioDecoder.isConfigSupported() rejects invalid config:' + entry.comment); +}); \ No newline at end of file diff --git a/testing/web-platform/tests/webcodecs/audio-encoder.any.js b/testing/web-platform/tests/webcodecs/audio-encoder.any.js index 34210d493768..610c2b7df936 100644 --- a/testing/web-platform/tests/webcodecs/audio-encoder.any.js +++ b/testing/web-platform/tests/webcodecs/audio-encoder.any.js @@ -32,13 +32,6 @@ function join_buffers(buffers) { return result; } -function clone_frame(frame) { - return new AudioFrame({ - timestamp: frame.timestamp, - buffer: join_buffers([frame.buffer]) - }); -} - promise_test(async t => { let sample_rate = 48000; let total_duration_s = 1; diff --git a/testing/web-platform/tests/webcodecs/video-encoder-config.any.js b/testing/web-platform/tests/webcodecs/video-encoder-config.any.js new file mode 100644 index 000000000000..af55716f8ec1 --- /dev/null +++ b/testing/web-platform/tests/webcodecs/video-encoder-config.any.js @@ -0,0 +1,19 @@ +// META: global=window,dedicatedworker +// META: script=/webcodecs/utils.js + +const invalidConfigs = [ + { + comment: 'Emtpy codec', + config: {codec: ''}, + }, + { + comment: 'Unrecognized codec', + config: {codec: 'bogus'}, + }, +]; + +invalidConfigs.forEach(entry => { + promise_test(t => { + return promise_rejects_js(t, TypeError, VideoEncoder.isConfigSupported(entry.config)); + }, 'Test that AudioDecoder.isConfigSupported() rejects invalid config:' + entry.comment); +}); \ No newline at end of file -- 2.11.4.GIT