From a80b26a3f515eb78994cc9c3c7b40073995c213c Mon Sep 17 00:00:00 2001 From: Andreas Pehrson Date: Fri, 12 Jul 2019 13:41:45 +0000 Subject: [PATCH] Bug 1014393 - Minor mochitest fixes. r=jib Differential Revision: https://phabricator.services.mozilla.com/D35311 --HG-- extra : moz-landing-system : lando --- .../test/test_mediarecorder_record_4ch_audiocontext.html | 3 ++- dom/media/test/test_mediarecorder_record_audionode.html | 4 +++- .../test_mediarecorder_record_getdata_afterstart.html | 9 +++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dom/media/test/test_mediarecorder_record_4ch_audiocontext.html b/dom/media/test/test_mediarecorder_record_4ch_audiocontext.html index d26da7797019..e25d18d93360 100644 --- a/dom/media/test/test_mediarecorder_record_4ch_audiocontext.html +++ b/dom/media/test/test_mediarecorder_record_4ch_audiocontext.html @@ -56,7 +56,8 @@ function startTest() { } totalBlobSize += e.data.size; 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) { mMediaRecorder.stop(); stopTriggered = true; diff --git a/dom/media/test/test_mediarecorder_record_audionode.html b/dom/media/test/test_mediarecorder_record_audionode.html index 731675b822a8..32c8a37a461d 100644 --- a/dom/media/test/test_mediarecorder_record_audionode.html +++ b/dom/media/test/test_mediarecorder_record_audionode.html @@ -65,7 +65,9 @@ async function testRecord(source, mimeType) { const chunks = []; 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"); if (mimeType != "") { is(data.type, mimeType, "Blob has given mimetype"); diff --git a/dom/media/test/test_mediarecorder_record_getdata_afterstart.html b/dom/media/test/test_mediarecorder_record_getdata_afterstart.html index 5b7b9cabe98a..56540f2af3da 100644 --- a/dom/media/test/test_mediarecorder_record_getdata_afterstart.html +++ b/dom/media/test/test_mediarecorder_record_getdata_afterstart.html @@ -38,13 +38,13 @@ function startTest(test, token) { info('onstart fired successfully'); hasonstart = true; // 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.onstop = function() { 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'); SimpleTest.finish(); }; @@ -53,8 +53,9 @@ function startTest(test, token) { info('ondataavailable fired successfully'); if (mMediaRecorder.state == 'recording') { hasondataavailable = true; - ok(hasonstart, "should has onstart event first"); - ok(e.data.size > 0, 'check blob has data'); + ok(hasonstart, "should have had start event first"); + is(e.data.type, mMediaRecorder.mimeType, + "blob's mimeType matches the recorder's"); mMediaRecorder.stop(); } };