Bug 1331839 - Harden test_mediarecorder_bitrate.html. r=jwwang

MozReview-Commit-ID: BFNAhS7B7C6

--HG--
extra : rebase_source : a6934456b3511f9c3b32539e41db4804b30f9ff5
This commit is contained in:
Andreas Pehrson 2017-01-24 15:07:43 +01:00
Родитель 88f22bd389
Коммит e7d6233c55
1 изменённых файлов: 84 добавлений и 87 удалений

Просмотреть файл

@ -29,10 +29,19 @@ function runTest(test, token, bitrate) {
element.token = token;
element.src = test.name;
element.test = test;
element.stream = element.mozCaptureStreamUntilEnded();
element.preload = "metadata";
element.onloadedmetadata = function () {
info("loadedmetadata");
const stream = element.mozCaptureStreamUntilEnded();
element.onloadedmetadata = null;
element.play();
const mediaRecorder = new MediaRecorder(stream, {videoBitsPerSecond: bitrate});
mediaRecorder.start();
is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
is(mediaRecorder.stream, stream,
'Media recorder stream = element stream at the start of recording');
var mediaRecorder = new MediaRecorder(element.stream , {videoBitsPerSecond: bitrate});
var onStopFired = false;
var onDataAvailableFired = false;
var encoded_size = 0;
@ -109,19 +118,7 @@ function runTest(test, token, bitrate) {
}
}
};
element.preload = "metadata";
element.onloadedmetadata = function () {
element.onloadedmetadata = null;
mediaRecorder.start();
is(mediaRecorder.state, 'recording',
'Media recorder should be recording');
is(mediaRecorder.stream, element.stream,
'Media recorder stream = element stream at the start of recording');
element.play();
}
};
}
manager.runTests(gMediaRecorderVideoTests, startTest);