Bug 1014393 - Minor mochitest fixes. r=jib

Differential Revision: https://phabricator.services.mozilla.com/D35311

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-07-12 13:41:45 +00:00
Родитель 8d5c8d17a4
Коммит a80b26a3f5
3 изменённых файлов: 10 добавлений и 6 удалений

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

@ -56,7 +56,8 @@ function startTest() {
} }
totalBlobSize += e.data.size; totalBlobSize += e.data.size;
ok(totalBlobSize > 0, 'check the totalBlobSize'); ok(totalBlobSize > 0, 'check the totalBlobSize');
is(mMediaRecorder.mimeType, expectedMimeType, 'blob should has mimetype, return ' + mMediaRecorder.mimeType); is(e.data.type, expectedMimeType, 'blob should have expected mimetype');
is(mMediaRecorder.mimeType, expectedMimeType, 'recorder should have expected mimetype');
if (!stopTriggered) { if (!stopTriggered) {
mMediaRecorder.stop(); mMediaRecorder.stop();
stopTriggered = true; stopTriggered = true;

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

@ -65,7 +65,9 @@ async function testRecord(source, mimeType) {
const chunks = []; const chunks = [];
let {data} = await new Promise(r => recorder.ondataavailable = r); let {data} = await new Promise(r => recorder.ondataavailable = r);
is(recorder.state, "recording", "Expected to still be recording"); if (!isOffline) {
is(recorder.state, "recording", "Expected to still be recording");
}
is(data.type, recorder.mimeType, "Blob has recorder mimetype"); is(data.type, recorder.mimeType, "Blob has recorder mimetype");
if (mimeType != "") { if (mimeType != "") {
is(data.type, mimeType, "Blob has given mimetype"); is(data.type, mimeType, "Blob has given mimetype");

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

@ -38,13 +38,13 @@ function startTest(test, token) {
info('onstart fired successfully'); info('onstart fired successfully');
hasonstart = true; hasonstart = true;
// On audio only case, we produce audio/ogg as mimeType. // On audio only case, we produce audio/ogg as mimeType.
is('audio/ogg', mMediaRecorder.mimeType, "check the record mimetype return " + mMediaRecorder.mimeType); is('audio/ogg', mMediaRecorder.mimeType, "MediaRecorder mimetype as expected");
mMediaRecorder.requestData(); mMediaRecorder.requestData();
}; };
mMediaRecorder.onstop = function() { mMediaRecorder.onstop = function() {
info('onstop fired successfully'); info('onstop fired successfully');
ok (hasondataavailable, "should have ondataavailable before onstop"); ok(hasondataavailable, "should have ondataavailable before onstop");
is(mMediaRecorder.state, 'inactive', 'check recording status is inactive'); is(mMediaRecorder.state, 'inactive', 'check recording status is inactive');
SimpleTest.finish(); SimpleTest.finish();
}; };
@ -53,8 +53,9 @@ function startTest(test, token) {
info('ondataavailable fired successfully'); info('ondataavailable fired successfully');
if (mMediaRecorder.state == 'recording') { if (mMediaRecorder.state == 'recording') {
hasondataavailable = true; hasondataavailable = true;
ok(hasonstart, "should has onstart event first"); ok(hasonstart, "should have had start event first");
ok(e.data.size > 0, 'check blob has data'); is(e.data.type, mMediaRecorder.mimeType,
"blob's mimeType matches the recorder's");
mMediaRecorder.stop(); mMediaRecorder.stop();
} }
}; };