Skip to content

Commit d99447a

Browse files
Migrate fast/mediarecorder/MediaRecorder-audio-video to WPT
Already covered by existing WPT tests: - Stream track validation: MediaRecorder-creation.https.html - State transitions (inactive → recording): MediaRecorder-events-and-exceptions.html - requestData() triggers dataavailable: MediaRecorder-requestData.html Migrated coverage to WPT: - audio-only stop/onstop: MediaRecorder-stop.html - video-only/audio-only monotonic timecode: MediaRecorder-blob-timecode.https.html Bug: 485677942 Change-Id: Ia69ad06f7590e75d827d22e07bb9583177701fc2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7741340 Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: Markus Handell <handellm@google.com> Commit-Queue: Hyowon Kim <hyowon@igalia.com> Cr-Commit-Position: refs/heads/main@{#1637356}
1 parent 5670df7 commit d99447a

2 files changed

Lines changed: 37 additions & 3 deletions

File tree

mediacapture-record/MediaRecorder-blob-timecode.https.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
<body>
1313

1414
<script>
15-
promise_test(async t => {
15+
async function testBlobTimecode(t, constraints) {
1616
await setMediaPermission();
17-
const stream = await navigator.mediaDevices.getUserMedia({video:true, audio:true});
17+
const stream = await navigator.mediaDevices.getUserMedia(constraints);
1818
t.add_cleanup(() => stream.getTracks().forEach(tr => tr.stop()));
1919
const recorder = new MediaRecorder(stream);
2020

@@ -33,7 +33,19 @@
3333
combinedSize += data.size;
3434
}
3535
recorder.stop();
36-
}, "MediaRecorder Blob timecode for first chunk must be 0 and monotonically increasing");
36+
}
37+
38+
promise_test(async t => {
39+
await testBlobTimecode(t, {video:true});
40+
}, "MediaRecorder Blob timecode for first chunk must be 0 and monotonically increasing for video-only");
41+
42+
promise_test(async t => {
43+
await testBlobTimecode(t, {audio:true});
44+
}, "MediaRecorder Blob timecode for first chunk must be 0 and monotonically increasing for audio-only");
45+
46+
promise_test(async t => {
47+
await testBlobTimecode(t, {video:true, audio:true});
48+
}, "MediaRecorder Blob timecode for first chunk must be 0 and monotonically increasing for audio/video");
3749

3850
</script>
3951
</body>

mediacapture-record/MediaRecorder-stop.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,28 @@
111111
assertSequenceIn(events, ["start", "dataavailable", "stop"]);
112112
}, "MediaRecorder will stop recording and fire a stop event when stop() is called");
113113

114+
promise_test(async t => {
115+
if (!isMimetypeSupported(mimeType, t)) {
116+
return;
117+
}
118+
119+
const {stream: audio} = createAudioStream(t);
120+
const recorder = new MediaRecorder(audio, {mimeType});
121+
const events = recordEvents(recorder,
122+
["start", "stop", "dataavailable", "pause", "resume", "error"]);
123+
recorder.start();
124+
assert_equals(recorder.state, "recording", "MediaRecorder has been started successfully");
125+
recorder.stop();
126+
assert_equals(recorder.state, "inactive", "MediaRecorder state should be inactive immediately following stop() call");
127+
128+
const event = await new Promise(r => recorder.onstop = r);
129+
assert_equals(event.type, "stop", "the event type should be stop");
130+
assert_true(event.isTrusted, "isTrusted should be true when the event is created by C++");
131+
assert_equals(recorder.state, "inactive", "MediaRecorder is inactive after stop event");
132+
133+
assertSequenceIn(events, ["start", "dataavailable", "stop"]);
134+
}, "MediaRecorder will stop recording and fire a stop event when stop() is called for audio-only streams");
135+
114136
promise_test(async t => {
115137
if (!isMimetypeSupported(mimeType, t)) {
116138
return;

0 commit comments

Comments
 (0)