Bug 962878: testcase: Modify the testcase since we can not guarantee the last onDataAvailble always has data. r=roc

This commit is contained in:
Benjamin Chen 2014-06-24 13:52:09 +08:00
Родитель 03c8d42516
Коммит 5437f9b363
2 изменённых файлов: 6 добавлений и 2 удалений

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

@ -364,7 +364,6 @@ skip-if = toolkit == 'gonk' && !debug # bug 1021677
[test_mediarecorder_creation_fail.html]
[test_mediarecorder_getencodeddata.html]
[test_mediarecorder_record_4ch_audiocontext.html]
skip-if = toolkit == 'gonk' && !debug # bug 1021678
[test_mediarecorder_record_audiocontext.html]
[test_mediarecorder_record_audiocontext_mlk.html]
[test_mediarecorder_record_gum_video_timeslice.html]

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

@ -26,6 +26,7 @@ function startTest() {
var onstopTriggered = false;
dest.channelCount = 4;
var expectedMimeType = 'audio/ogg';
var totalBlobSize = 0;
source.channelCountMode = 'explicit';
source.connect(dest);
var elem = document.createElement('audio');
@ -49,7 +50,11 @@ function startTest() {
SimpleTest.finish();
};
mMediaRecorder.ondataavailable = function (e) {
ok(e.data.size > 0, 'check blob has data');
if (mMediaRecorder.state == 'recording') {
ok(e.data.size > 0, 'check blob has data');
}
totalBlobSize += e.data.size;
ok(totalBlobSize > 0, 'check the totalBlobSize');
is(mMediaRecorder.mimeType, expectedMimeType, 'blob should has mimetype, return ' + mMediaRecorder.mimeType);
if (!stopTriggered) {
mMediaRecorder.stop();