diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /testing/web-platform/tests/mediacapture-record | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/mediacapture-record')
6 files changed, 126 insertions, 73 deletions
diff --git a/testing/web-platform/tests/mediacapture-record/MediaRecorder-canvas-media-source.https.html b/testing/web-platform/tests/mediacapture-record/MediaRecorder-canvas-media-source.https.html index e640714d5c..0680c21879 100644 --- a/testing/web-platform/tests/mediacapture-record/MediaRecorder-canvas-media-source.https.html +++ b/testing/web-platform/tests/mediacapture-record/MediaRecorder-canvas-media-source.https.html @@ -9,6 +9,8 @@ <meta name=variant content="?mimeType=video/webm;codecs=vp9,opus"> <meta name=variant content="?mimeType=video/webm;codecs=av1,opus"> <meta name=variant content="?mimeType=video/mp4;codecs=avc1,mp4a.40.2"> + <meta name=variant content="?mimeType=video/mp4;codecs=vp9,opus"> + <meta name=variant content="?mimeType=video/mp4"> <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#dom-mediarecorder-mimeType"> <script src="/resources/testharness.js"></script> @@ -84,9 +86,9 @@ async_test(test => { const params = new URLSearchParams(window.location.search); const mimeType = params.get('mimeType'); - if (mimeType) { - assert_implements_optional(MediaRecorder.isTypeSupported(mimeType), - `"${mimeType}" for MediaRecorder is not supported`); + if (mimeType && !MediaRecorder.isTypeSupported(mimeType)) { + test.done(); + return; } const canvas = document.querySelector("canvas"); diff --git a/testing/web-platform/tests/mediacapture-record/MediaRecorder-events-and-exceptions.html b/testing/web-platform/tests/mediacapture-record/MediaRecorder-events-and-exceptions.html index 409e46c91d..97ada21266 100644 --- a/testing/web-platform/tests/mediacapture-record/MediaRecorder-events-and-exceptions.html +++ b/testing/web-platform/tests/mediacapture-record/MediaRecorder-events-and-exceptions.html @@ -8,6 +8,8 @@ <meta name=variant content="?mimeType=video/webm;codecs=vp9,opus"> <meta name=variant content="?mimeType=video/webm;codecs=av1,opus"> <meta name=variant content="?mimeType=video/mp4;codecs=avc1,mp4a.40.2"> + <meta name=variant content="?mimeType=video/mp4;codecs=vp9,opus"> + <meta name=variant content="?mimeType=video/mp4"> <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#mediarecorder"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -81,9 +83,9 @@ const params = new URLSearchParams(window.location.search); const mimeType = params.get('mimeType'); - if (mimeType) { - assert_implements_optional(MediaRecorder.isTypeSupported(mimeType), - `"${mimeType}" for MediaRecorder is not supported`); + if (mimeType && !MediaRecorder.isTypeSupported(mimeType)) { + test.done(); + return; } const recorder = new MediaRecorder(new MediaStream(), { mimeType }); diff --git a/testing/web-platform/tests/mediacapture-record/MediaRecorder-mimetype.html b/testing/web-platform/tests/mediacapture-record/MediaRecorder-mimetype.html index 74248d65f4..57baa1346f 100644 --- a/testing/web-platform/tests/mediacapture-record/MediaRecorder-mimetype.html +++ b/testing/web-platform/tests/mediacapture-record/MediaRecorder-mimetype.html @@ -21,6 +21,7 @@ const AUDIO_CODECS_MIME_TYPES = [ 'audio/webm; codecs="vorbis"', 'audio/webm; codecs="opus"', 'audio/mp4: codecs="mp4a.40.2"', + 'audio/mp4: codecs="opus"', ]; const VIDEO_ONLY_MIME_TYPES = [ @@ -33,6 +34,7 @@ const VIDEO_CODECS_MIME_TYPES = [ 'video/webm; codecs="vp9"', 'video/webm; codecs="av1"', 'video/mp4: codecs="avc1"', + 'video/mp4: codecs="vp9"', ]; const AUDIO_VIDEO_MIME_TYPES = [ @@ -42,6 +44,7 @@ const AUDIO_VIDEO_MIME_TYPES = [ 'video/webm; codecs="vp9, opus"', 'video/webm; codecs="av1, opus"', 'video/mp4: codecs="avc1, mp4a.40.2"', + 'video/mp4; codecs="vp9, opus"', ]; const AUDIO_MIME_TYPES = [ diff --git a/testing/web-platform/tests/mediacapture-record/MediaRecorder-pause-resume.html b/testing/web-platform/tests/mediacapture-record/MediaRecorder-pause-resume.html index 8dc231279a..f584508a0d 100644 --- a/testing/web-platform/tests/mediacapture-record/MediaRecorder-pause-resume.html +++ b/testing/web-platform/tests/mediacapture-record/MediaRecorder-pause-resume.html @@ -8,6 +8,10 @@ <meta name=variant content="?mimeType=video/webm;codecs=vp9,opus"> <meta name=variant content="?mimeType=video/webm;codecs=av1,opus"> <meta name=variant content="?mimeType=video/mp4;codecs=avc1,mp4a.40.2"> + <meta name=variant content="?mimeType=video/mp4;codecs=avc1,opus"> + <meta name=variant content="?mimeType=video/mp4;codecs=vp9,opus"> + <meta name=variant content="?mimeType=video/mp4;codecs=vp9,mp4a.40.2"> + <meta name=variant content="?mimeType=video/mp4"> <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#mediarecorder"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/testing/web-platform/tests/mediacapture-record/MediaRecorder-peerconnection.https.html b/testing/web-platform/tests/mediacapture-record/MediaRecorder-peerconnection.https.html index 3fbc1f0f2d..daae044fa8 100644 --- a/testing/web-platform/tests/mediacapture-record/MediaRecorder-peerconnection.https.html +++ b/testing/web-platform/tests/mediacapture-record/MediaRecorder-peerconnection.https.html @@ -4,6 +4,20 @@ <head> <title>MediaRecorder peer connection</title> + <meta name=variant content="?kinds=video&mimeType=''"> + <meta name=variant content="?kinds=audio&mimeType=''"> + <meta name=variant content="?kinds=video,audio&mimeType=''"> + <meta name=variant content="?kinds=audio&mimeType=audio/webm;codecs=opus"> + <meta name=variant content="?kinds=video&mimeType=video/webm;codecs=vp8"> + <meta name=variant content="?kinds=video,audio&mimeType=video/webm;codecs=vp8,opus"> + <meta name=variant content="?kinds=video&mimeType=video/webm;codecs=vp9"> + <meta name=variant content="?kinds=video,audio&mimeType=video/webm;codecs=vp9,opus"> + <meta name=variant content="?kinds=video,audio&mimeType=video/mp4;codecs=avc1,mp4a.40.2"> + <meta name=variant content="?kinds=video&mimeType=video/mp4;codecs=vp9"> + <meta name=variant content="?kinds=audio&mimeType=audio/mp4;codecs=opus"> + <meta name=variant content="?kinds=video,audio&mimeType=video/mp4;codecs=vp9,opus"> + <meta name=variant content="?kinds=video,audio&mimeType=video/mp4"> + <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#dom-mediarecorder-mimeType"> <script src="/resources/testharness.js"></script> @@ -15,74 +29,83 @@ </head> <body> - <video id="remote" autoplay width="240"></video> - <script> +<video id="remote" autoplay width="240"></video> + +<script> + const params = new URLSearchParams(window.location.search); + const mimeType = params.get('mimeType'); + const kinds = params.get('kinds'); + const tag = `kinds "${kinds} "mimeType "${mimeType}"`; + let stream; + let pc; -promise_setup(async () => { - const t = {add_cleanup: add_completion_callback}; - const [, pc, stream] = await startConnection(t, true, true); - const [audio] = stream.getAudioTracks(); - const [video] = stream.getVideoTracks(); + promise_setup(async () => { + const t = {add_cleanup: add_completion_callback}; + const [, connection_pc, connection_stream] = await startConnection(t, true, true); + pc = connection_pc; + + let video = null; + if (kinds.indexOf('video') != -1) { + video = connection_stream.getVideoTracks()[0]; + } - // Needed for the tests to get exercised in Chrome (bug) - document.getElementById('remote').srcObject = stream; + let audio = null; + if (kinds.indexOf('audio') != -1) { + audio = connection_stream.getAudioTracks()[0]; + } - for (const {kinds, mimeType} of [ - { kinds: { video }, mimeType: "" }, - { kinds: { audio }, mimeType: "" }, - { kinds: { video, audio }, mimeType: "" }, - { kinds: { audio }, mimeType: "audio/webm;codecs=opus" }, - { kinds: { video }, mimeType: "video/webm;codecs=vp8" }, - { kinds: { video, audio }, mimeType: "video/webm;codecs=vp8,opus" }, - { kinds: { video }, mimeType: "video/webm;codecs=vp9" }, - { kinds: { video, audio }, mimeType: "video/webm;codecs=vp9,opus" }, - { kinds: { audio }, mimeType: "audio/mp4;codecs=mp4a.40.2" }, - { kinds: { video, audio }, mimeType: "video/mp4;codecs=avc1,mp4a.40.2" } - ]) { - const tag = `${JSON.stringify(kinds)} mimeType "${mimeType}"`; - const stream = new MediaStream([kinds.audio, kinds.video].filter(n => n)); + // Needed for the tests to get exercised in Chrome (bug) + document.getElementById('remote').srcObject = connection_stream; + stream = new MediaStream([audio, video].filter(n => n)); + }); + promise_test(async t => { // Spec doesn't mandate codecs, so if not supported, test failure instead. if (mimeType && !MediaRecorder.isTypeSupported(mimeType)) { promise_test(async t => { assert_throws_dom('NotSupportedError', () => new MediaRecorder(stream, { mimeType })); - }, `MediaRecorder constructor throws on no support, ${tag}`); - continue; + }, `MediaRecorder constructor throws on no support 1, ${tag}`); + return; } - promise_test(async t => { - const recorder = new MediaRecorder(stream, { mimeType }); - recorder.start(200); - await new Promise(r => recorder.onstart = r); - let combinedSize = 0; - // Wait for a small amount of data to appear. Kept small for mobile tests - while (combinedSize < 2000) { - const {data} = await new Promise(r => recorder.ondataavailable = r); - combinedSize += data.size; - } - recorder.stop(); - }, `PeerConnection MediaRecorder receives data after onstart, ${tag}`); + const recorder = new MediaRecorder(stream, { mimeType }); + recorder.start(200); + await new Promise(r => recorder.onstart = r); + let combinedSize = 0; + // Wait for a small amount of data to appear. Kept small for mobile tests + while (combinedSize < 2000) { + const {data} = await new Promise(r => recorder.ondataavailable = r); + combinedSize += data.size; + } + recorder.stop(); + }, `PeerConnection MediaRecorder receives data after onstart, ${tag}`); - promise_test(async t => { - const clone = stream.clone(); - const recorder = new MediaRecorder(clone, { mimeType }); - recorder.start(); - await new Promise(r => recorder.onstart = r); - await waitForReceivedFramesOrPackets(t, pc, kinds.audio, kinds.video, 10); - for (const track of clone.getTracks()) { - track.stop(); - } - // As the tracks ended, expect data from the recorder. - await Promise.all([ - new Promise(r => recorder.onstop = r), - new Promise(r => recorder.ondataavailable = r) - ]); - }, `PeerConnection MediaRecorder gets ondata on stopping tracks, ${tag}`); - } -}); + promise_test(async t => { + // Spec doesn't mandate codecs, so if not supported, test failure instead. + if (mimeType && !MediaRecorder.isTypeSupported(mimeType)) { + promise_test(async t => { + assert_throws_dom('NotSupportedError', + () => new MediaRecorder(stream, { mimeType })); + }, `MediaRecorder constructor throws on no support 2, ${tag}`); + return; + } + + const clone = stream.clone(); + const recorder = new MediaRecorder(clone, { mimeType }); + recorder.start(); + await new Promise(r => recorder.onstart = r); + await waitForReceivedFramesOrPackets(t, pc, kinds.audio, kinds.video, 10); + for (const track of clone.getTracks()) { + track.stop(); + } + // As the tracks ended, expect data from the recorder. + await Promise.all([ + new Promise(r => recorder.onstop = r), + new Promise(r => recorder.ondataavailable = r) + ]); + }, `PeerConnection MediaRecorder gets ondata on stopping tracks, ${tag}`); </script> </body> - </html> diff --git a/testing/web-platform/tests/mediacapture-record/MediaRecorder-stop.html b/testing/web-platform/tests/mediacapture-record/MediaRecorder-stop.html index d6ce370772..9ef5051638 100644 --- a/testing/web-platform/tests/mediacapture-record/MediaRecorder-stop.html +++ b/testing/web-platform/tests/mediacapture-record/MediaRecorder-stop.html @@ -7,6 +7,8 @@ <meta name=variant content="?mimeType=video/webm;codecs=vp9,opus"> <meta name=variant content="?mimeType=video/webm;codecs=av1,opus"> <meta name=variant content="?mimeType=video/mp4;codecs=avc1,mp4a.40.2"> + <meta name=variant content="?mimeType=video/mp4;codecs=vp9,opus"> + <meta name=variant content="?mimeType=video/mp4"> <link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#mediarecorder"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -38,18 +40,21 @@ return true; } - function doneWithUnsupportedType(mimeType) { - if (mimeType) { - assert_implements_optional(MediaRecorder.isTypeSupported(mimeType), - `"${mimeType}" for MediaRecorder is not supported`); + function isMimetypeSupported(mimeType, t) { + if (mimeType && !MediaRecorder.isTypeSupported(mimeType)) { + t.done(); + return false; } + return true; } const params = new URLSearchParams(window.location.search); const mimeType = params.get('mimeType'); const tag = `mimeType "${mimeType}"`; promise_test(async t => { - doneWithUnsupportedType(mimeType); + if (!isMimetypeSupported(mimeType, t)) { + return; + } const {stream: video} = createVideoStream(t); const recorder = new MediaRecorder(video, {mimeType}); @@ -73,7 +78,9 @@ }, "MediaRecorder will stop recording and fire a stop event when all tracks are ended"); promise_test(async t => { - doneWithUnsupportedType(mimeType); + if (!isMimetypeSupported(mimeType, t)) { + return; + } const {stream: video} = createVideoStream(t); const recorder = new MediaRecorder(video, {mimeType}); @@ -96,7 +103,9 @@ }, "MediaRecorder will stop recording and fire a stop event when stop() is called"); promise_test(async t => { - doneWithUnsupportedType(mimeType); + if (!isMimetypeSupported(mimeType, t)) { + return; + } const recorder = new MediaRecorder(createVideoStream(t).stream, {mimeType}); recorder.stop(); @@ -107,7 +116,9 @@ }, "MediaRecorder will not fire an exception when stopped after creation"); promise_test(async t => { - doneWithUnsupportedType(mimeType); + if (!isMimetypeSupported(mimeType, t)) { + return; + } const recorder = new MediaRecorder(createVideoStream(t).stream, {mimeType}); recorder.start(); @@ -121,7 +132,9 @@ }, "MediaRecorder will not fire an exception when stopped after having just been stopped"); promise_test(async t => { - doneWithUnsupportedType(mimeType); + if (!isMimetypeSupported(mimeType, t)) { + return; + } const {stream} = createVideoStream(t); const recorder = new MediaRecorder(stream, {mimeType}); @@ -136,7 +149,9 @@ }, "MediaRecorder will not fire an exception when stopped after having just been spontaneously stopped"); promise_test(async t => { - doneWithUnsupportedType(mimeType); + if (!isMimetypeSupported(mimeType, t)) { + return; + } const {stream} = createAudioVideoStream(t); const recorder = new MediaRecorder(stream, {mimeType}); @@ -155,7 +170,9 @@ }, "MediaRecorder will fire start event even if stopped synchronously"); promise_test(async t => { - doneWithUnsupportedType(mimeType); + if (!isMimetypeSupported(mimeType, t)) { + return; + } const {stream} = createAudioVideoStream(t); const recorder = new MediaRecorder(stream, {mimeType}); @@ -178,7 +195,9 @@ }, "MediaRecorder will fire start event even if a track is removed synchronously"); promise_test(async t => { - doneWithUnsupportedType(mimeType); + if (!isMimetypeSupported(mimeType, t)) { + return; + } const {stream} = createFlowingAudioVideoStream(t); const recorder = new MediaRecorder(stream, {mimeType}); |