diff --git a/multimedia/media/media_js_standard/AVPlayerTestBase.js b/multimedia/media/media_js_standard/AVPlayerTestBase.js index b278114f3391ba4352dd2eadcc06fff97ccb993c..cbd2cfe50b55e9b6d6b34a92c6ae2145f52a6309 100644 --- a/multimedia/media/media_js_standard/AVPlayerTestBase.js +++ b/multimedia/media/media_js_standard/AVPlayerTestBase.js @@ -516,10 +516,12 @@ export async function createToRelease(src, avPlayer, done) { console.info(`case CreateToRelease loop is ${i}`); expect(avPlayer.state).assertEqual(AV_PLAYER_STATE.RELEASED); avPlayer = null; + if(i == 999){ + done(); + } }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); } } - done(); } export async function playToCompleted(src, avPlayer, done) { diff --git a/multimedia/media/media_js_standard/AVRecorderTestBase.js b/multimedia/media/media_js_standard/AVRecorderTestBase.js index 03832e309743d5139ec7c827baccb3a4540ed093..efadf2f66e2af5974c4be9367f27be73b73743a6 100644 --- a/multimedia/media/media_js_standard/AVRecorderTestBase.js +++ b/multimedia/media/media_js_standard/AVRecorderTestBase.js @@ -16,6 +16,21 @@ import media from '@ohos.multimedia.media' import * as mediaTestBase from './MediaTestBase.js'; +async function idleCallBack(avRecorder) { + console.info('case createAVRecorder called'); + await media.createAVRecorder().then((recorder) => { + if (recorder != null) { + avRecorder = recorder; + console.info('createAVRecorder success'); + } else { + console.info('createAVRecorder fail'); + } + }).catch((error) => { + console.info(`createAVRecorder catchCallback, error:${error}`); + }); + return avRecorder; +} + export async function idle(avRecorder) { console.info('case createAVRecorder called'); await media.createAVRecorder().then((recorder) => { @@ -48,6 +63,7 @@ export function prepareCallback(avRecorder, avConfig) { avRecorder.prepare(avConfig, (err) => { console.info('case prepare called' + err); if (err == null) { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); console.info('prepare success'); } else { console.error(`case prepare error, errMessage is ${err.message}`); @@ -55,28 +71,29 @@ export function prepareCallback(avRecorder, avConfig) { }) } -export function preparePromise(avRecorder, avConfig) { +export async function preparePromise(avRecorder, avConfig) { if (typeof(avRecorder) == 'undefined') { return; } - avRecorder.prepare(avConfig).then(() => { + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); console.info('prepare success'); - }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + }).catch((err) => { + console.info('prepare failed and catch error is ' + err.message); + }); } -export function getInputSurfacePromise(avRecorder) { +export async function getInputSurfacePromise(avRecorder) { let surfaceID = null; if (typeof(avRecorder) == 'undefined') { return; } - avRecorder.getInputSurface().then((surfaceId) => { + await avRecorder.getInputSurface().then((surfaceId) => { console.info('getInputSurface success'); surfaceID = surfaceId; }).catch((err) => { console.info('getInputSurface failed and catch error is ' + err.message); }); - - // videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); } export function getInputSurfaceCallback(avRecorder) { @@ -92,30 +109,37 @@ export function getInputSurfaceCallback(avRecorder) { console.info('getInputSurface failed and error is ' + err.message); } }); - // videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); } -export function startCallback(avRecorder) { +export function startCallback(avRecorder, recorderTime) { if (typeof(avRecorder) == 'undefined') { return; } avRecorder.start((err) => { console.info('case start called'); if (err == null) { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STARTED); console.info('start AVRecorder success'); + sleep(recorderTime); } else { console.info('start AVRecorder failed and error is ' + err.message); } }) } -export function startPromise(avRecorder) { +export async function startPromise(avRecorder, recorderTime) { if (typeof(avRecorder) == 'undefined') { return; } - avRecorder.start().then(() => { + await avRecorder.start().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STARTED); console.info('start success'); - }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + if (recorderTime != undefined) { + sleep(recorderTime); + } + }).catch((err) => { + console.info('start failed and catch error is ' + err.message); + }); } export function pauseCallback(avRecorder) { @@ -125,6 +149,7 @@ export function pauseCallback(avRecorder) { avRecorder.pause((err) => { console.info('case pause called'); if (err == null) { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PAUSED); console.info('pause AVRecorder success'); } else { console.info('pause AVRecorder failed and error is ' + err.message); @@ -132,13 +157,16 @@ export function pauseCallback(avRecorder) { }) } -export function pausePromise(avRecorder) { +export async function pausePromise(avRecorder) { if (typeof(avRecorder) == 'undefined') { return; } - avRecorder.pause().then(() => { + await avRecorder.pause().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PAUSED); console.info('pause success'); - }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + }).catch((err) => { + console.info('pause failed and catch error is ' + err.message); + }); } export function resumeCallback(avRecorder) { @@ -155,11 +183,11 @@ export function resumeCallback(avRecorder) { }) } -export function resumePromise(avRecorder) { +export async function resumePromise(avRecorder) { if (typeof(avRecorder) == 'undefined') { return; } - avRecorder.resume().then(() => { + await avRecorder.resume().then(() => { console.info('resume success'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); } @@ -171,6 +199,7 @@ export function stopCallback(avRecorder) { avRecorder.stop((err) => { console.info('case stop called'); if (err == null) { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STOPPED); console.info('stop AVRecorder success'); } else { console.info('stop AVRecorder failed and error is ' + err.message); @@ -178,13 +207,16 @@ export function stopCallback(avRecorder) { }) } -export function stopPromise(avRecorder) { +export async function stopPromise(avRecorder) { if (typeof(avRecorder) == 'undefined') { return; } - avRecorder.stop().then(() => { + await avRecorder.stop().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STOPPED); console.info('stop success'); - }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + }).catch((err) => { + console.info('stop failed and catch error is ' + err.message); + }); } export function resetCallback(avRecorder) { @@ -194,6 +226,7 @@ export function resetCallback(avRecorder) { avRecorder.reset((err) => { console.info('case reset called'); if (err == null) { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); console.info('reset AVRecorder success'); } else { console.info('reset AVRecorder failed and error is ' + err.message); @@ -201,13 +234,15 @@ export function resetCallback(avRecorder) { }) } -export function resetPromise(avRecorder) { +export async function resetPromise(avRecorder) { if (typeof(avRecorder) == 'undefined') { return; } - avRecorder.reset().then(() => { - console.info('reset success'); - }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + await avRecorder.reset().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + }).catch((err) => { + console.info('reset AVRecorder failed and catch error is ' + err.message); + }); } export function releaseCallback(avRecorder) { @@ -217,6 +252,7 @@ export function releaseCallback(avRecorder) { avRecorder.release((err) => { console.info('case release called'); if (err == null) { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); console.info('release AVRecorder success'); } else { console.info('release AVRecorder failed and error is ' + err.message); @@ -224,13 +260,25 @@ export function releaseCallback(avRecorder) { }) } -export function releasePromise(avRecorder) { +export async function releasePromise(avRecorder) { if (typeof(avRecorder) == 'undefined') { return; } - avRecorder.release().then(() => { - console.info('release success'); - }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +async function releaseDone(avRecorder, done){ + await avRecorder.release().then(() => { + console.info('releaseDone avRecorder.state is ' + avRecorder.state); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release releaseDone failed and catch error is ' + err.message); + }); } export function sleep(ms) { @@ -264,7 +312,7 @@ export async function setOnCallback(avConfig, avRecorder, recorderTime, done) { case AV_RECORDER_STATE.IDLE: console.info(`case avRecorderWithCallBack is idle`); expect(avRecorder.state).assertEqual("idle"); - //start->stop->release + // start->stop->release prepareCallback(avRecorder, avConfig); break; case AV_RECORDER_STATE.PREPARED: @@ -285,7 +333,7 @@ export async function setOnCallback(avConfig, avRecorder, recorderTime, done) { case AV_RECORDER_STATE.STOPPED: console.info(`case avRecorderWithCallBack is stopped`) expect(avRecorder.state).assertEqual('stopped'); - avRecorder.release() + releasePromise(avRecorder) break; case AV_RECORDER_STATE.RELEASED: console.info(`case avRecorderWithCallBack is released`); @@ -317,7 +365,7 @@ export async function setPrepareOnCallback(avConfig, avRecorder, recorderTime, d releaseCallback(avRecorder); break; case AV_RECORDER_STATE.RELEASED: - console.info(`case avRecorderReliabilitTest03 is released`); + console.info(`case setPrepareOnCallback is released`); expect(avRecorder.state).assertEqual('released'); done(); break; @@ -337,54 +385,2532 @@ export async function avRecorderWithCallBack(avConfig, avRecorder, recorderTime, await avRecorder.prepare(avConfig) } -export async function avRecorderReliabilitTest01(avConfig, avRecorder, recorderTime, done) { - let result = true; +export async function avRecorderWithCallBack2(avConfig, avRecorder, recorderTime, done) { avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); - await avRecorder.pause().then(() => { - console.info('pause AVRecorder success'); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + await stopPromise(avRecorder); + await avRecorder.reset().then(() => { + console.info('reset avRecorderWithCallBack2 success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); }).catch((err) => { - console.info('pause AVRecorder failed and catch error is ' + err.message); - result = false + console.info('reset avRecorderWithCallBack2 failed and catch error is ' + err.message); }); - expect(result).assertEqual(false); - await avRecorder.prepare(avConfig).then(() => { - expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); - console.info('prepare success'); + await releaseDone(avRecorder, done) +} + +export async function avRecorderWithCallBack3(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + await resumePromise(avRecorder); + await stopPromise(avRecorder); + await avRecorder.reset().then(() => { + console.info('reset avRecorderWithCallBack3 success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); }).catch((err) => { - console.info('prepare failed and catch error is ' + err.message); + console.info('reset avRecorderWithCallBack3 failed and catch error is ' + err.message); }); - await avRecorder.release().then(() => { - console.info('release AVRecorder success'); - expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); - done(); + await releaseDone(avRecorder, done) +} + +export async function avRecorderWithCallBack4(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await stopPromise(avRecorder); + await avRecorder.reset().then(() => { + console.info('reset avRecorderWithCallBack4 success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); }).catch((err) => { - console.info('release AVRecorder failed and catch error is ' + err.message); + console.info('reset avRecorderWithCallBack4 failed and catch error is ' + err.message); }); + await releaseDone(avRecorder, done) } -export async function avRecorderReliabilitTest02(avConfig, avRecorder, recorderTime, done) { +export async function avRecorderWithCallBack5(avConfig, avRecorder, recorderTime, done) { avRecorder = await idle(avRecorder); - await avRecorder.prepare(avConfig).then(() => { - expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); - console.info('avRecorderReliabilitTest02 prepare success'); + + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + await resumePromise(avRecorder); + await avRecorder.reset().then(() => { + console.info('reset avRecorderWithCallBack5 success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + }).catch((err) => { + console.info('reset avRecorderWithCallBack5 failed and catch error is ' + err.message); + }); + await releaseDone(avRecorder, done) +} + +export async function avRecorderWithCallBack6(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + await startPromise(avRecorder, recorderTime); + await avRecorder.reset().then(() => { + console.info('reset avRecorderWithCallBack6 success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + }).catch((err) => { + console.info('reset avRecorderWithCallBack6 failed and catch error is ' + err.message); + }); + await releaseDone(avRecorder, done) +} + +export async function avRecorderWithCallBack7(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + await resumePromise(avRecorder); + await pausePromise(avRecorder); + await avRecorder.reset().then(() => { + console.info('reset avRecorderWithCallBack7 success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + }).catch((err) => { + console.info('reset avRecorderWithCallBack7 failed and catch error is ' + err.message); + }); + await releaseDone(avRecorder, done) +} + +export async function avRecorderWithCallBack8(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + await stopPromise(avRecorder); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + await avRecorder.reset().then(() => { + console.info('reset avRecorderWithCallBack8 success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + }).catch((err) => { + console.info('reset avRecorderWithCallBack8 failed and catch error is ' + err.message); + }); + await releaseDone(avRecorder, done) +} + +export async function avRecorderWithCallBack9(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await stopPromise(avRecorder); + await avRecorder.reset().then(() => { + console.info('reset avRecorderWithCallBack9 success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + }).catch((err) => { + console.info('reset avRecorderWithCallBack9 failed and catch error is ' + err.message); + }); + await releaseDone(avRecorder, done) +} + +export async function avRecorderWithCallBack10(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await stopPromise(avRecorder); + await pausePromise(avRecorder); + await avRecorder.reset().then(() => { + console.info('reset AVRecorder success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + }).catch((err) => { + console.info('reset AVRecorder failed and catch error is ' + err.message); + }); + await releaseDone(avRecorder, done) +} + +export async function avRecorderWithCallBack11(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + await avRecorder.reset().then(() => { + console.info('avRecorderWithCallBack11 reset AVRecorder success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); }).catch((err) => { - console.info('avRecorderReliabilitTest02 prepare failed and catch error is ' + err.message); + console.info('avRecorderWithCallBack11 reset AVRecorder failed and catch error is ' + err.message); }); + await releaseDone(avRecorder, done) +} + +export async function avRecorderWithCallBack13(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + await resumePromise(avRecorder); + await sleep(recorderTime); + await stopPromise(avRecorder); await avRecorder.release().then(() => { - console.info('avRecorderReliabilitTest02 release AVRecorder success'); expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + console.info('release success'); done(); }).catch((err) => { - console.info('avRecorderReliabilitTest02 release AVRecorder failed and catch error is ' + err.message); + console.info('release failed and catch error is ' + err.message); }); } -export async function avRecorderReliabilitTest03(avConfig, avRecorder, recorderTime, done) { +export async function setPrepareOnPromise(avRecorder, avConfig, loopTimes, done) { + console.info(`case setOnCallback in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.IDLE: + console.info(`case avRecorderWithPreparePromise is idled`) + expect(avRecorder.state).assertEqual('idle'); + while (loopTimes > 0) { + avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + loopTimes--; + console.info('prepare success'); + }).catch((err) => { + console.info('prepare failed and catch error is ' + err.message); + }); + } + case AV_RECORDER_STATE.PREPARED: + console.info(`case avRecorderWithPreparePromise is prepared`) + expect(avRecorder.state).assertEqual('prepared'); + if (loopTimes <= 0) { + releasePromise(avRecorder); + } + case AV_RECORDER_STATE.RELEASED: + console.info(`case setPrepareOnCallback is released`); + expect(avRecorder.state).assertEqual('released'); + offCallback(avRecorder, ['stateChange', 'error']); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderWithPreparePromise(avConfig, avRecorder, loopTimes, done) { avRecorder = await idle(avRecorder); - setPrepareOnCallback(avConfig, avRecorder, recorderTime, done) - await avRecorder.prepare(avConfig) + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await resetPromise(avRecorder); + setPrepareOnPromise(avRecorder, avConfig, loopTimes, done); +} + +export async function setStartOnPromise(avRecorder, loopTimes, done) { + console.info(`case setOnCallback in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.PREPARED: + console.info(`case avRecorderWithStartPromise is prepared`) + expect(avRecorder.state).assertEqual('prepared'); + while (loopTimes > 0) { + avRecorder.start().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STARTED); + loopTimes--; + console.info('start success'); + }).catch((err) => { + console.info('start failed and catch error is ' + err.message); + }); + } + case AV_RECORDER_STATE.STARTED: + console.info(`case avRecorderWithStartPromise is started`) + expect(avRecorder.state).assertEqual('started'); + if (loopTimes <= 0) { + releasePromise(avRecorder); + } + case AV_RECORDER_STATE.RELEASED: + console.info(`case setPrepareOnCallback is released`); + expect(avRecorder.state).assertEqual('released'); + offCallback(avRecorder, ['stateChange', 'error']); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderWithStartPromise(avConfig, avRecorder, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + setStartOnPromise(avRecorder, loopTimes, done); +} + +export async function setPauseOnPromise(avRecorder, loopTimes, done) { + console.info(`case setOnCallback in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.STARTED: + console.info(`case avRecorderWithPausePromise is started`) + expect(avRecorder.state).assertEqual('started'); + while (loopTimes > 0) { + avRecorder.pause().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PAUSED); + loopTimes--; + console.info('pause success'); + }).catch((err) => { + console.info('pause failed and catch error is ' + err.message); + }); + } + case AV_RECORDER_STATE.PAUSED: + console.info(`case avRecorderWithPausePromise is paused`) + expect(avRecorder.state).assertEqual('paused'); + if (loopTimes <= 0) { + releasePromise(avRecorder); + } + case AV_RECORDER_STATE.RELEASED: + console.info(`case setPrepareOnCallback is released`); + expect(avRecorder.state).assertEqual('released'); + offCallback(avRecorder, ['stateChange', 'error']); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderWithPausePromise(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + setPauseOnPromise(avRecorder, loopTimes, done); +} + +export async function setResumeOnPromise(avRecorder, loopTimes, done) { + console.info(`case setOnCallback in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.PAUSED: + console.info(`case avRecorderWithResumePromise is paused`) + expect(avRecorder.state).assertEqual('paused'); + while (loopTimes > 0) { + avRecorder.resume().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PAUSED); + loopTimes--; + console.info('resume success'); + }).catch((err) => { + console.info('resume failed and catch error is ' + err.message); + }); + } + + case AV_RECORDER_STATE.STARTED: + console.info(`case avRecorderWithResumePromise is resumed`) + expect(avRecorder.state).assertEqual('started'); + if (loopTimes <= 0) { + releasePromise(avRecorder); + } + case AV_RECORDER_STATE.RELEASED: + console.info(`case setPrepareOnCallback is released`); + expect(avRecorder.state).assertEqual('released'); + offCallback(avRecorder, ['stateChange', 'error']); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderWithResumePromise(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + setResumeOnPromise(avRecorder, loopTimes, done); +} + +export async function setStopOnPromise(avRecorder, loopTimes, done) { + console.info(`case setOnCallback in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.STARTED: + console.info(`case avRecorderWithStopPromise is started`) + expect(avRecorder.state).assertEqual('started'); + while (loopTimes > 0) { + avRecorder.stop().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STOPPED); + loopTimes--; + console.info('stop success'); + }).catch((err) => { + console.info('stop failed and catch error is ' + err.message); + }); + } + case AV_RECORDER_STATE.STOPPED: + console.info(`case avRecorderWithStopPromise is stopped`) + expect(avRecorder.state).assertEqual('stopped'); + if (loopTimes <= 0) { + releasePromise(avRecorder); + } + case AV_RECORDER_STATE.RELEASED: + console.info(`case setPrepareOnCallback is released`); + expect(avRecorder.state).assertEqual('released'); + offCallback(avRecorder, ['stateChange', 'error']); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderWithStopPromise(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + setStopOnPromise(avRecorder, loopTimes, done); } +export async function setResetOnPromise(avRecorder, loopTimes, done) { + console.info(`case setOnCallback in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.STARTED: + console.info(`case avRecorderWithResetPromise is started`) + expect(avRecorder.state).assertEqual('started'); + while (loopTimes > 0) { + avRecorder.reset().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + loopTimes--; + console.info('reset success'); + }).catch((err) => { + console.info('reset failed and catch error is ' + err.message); + }); + } + case AV_RECORDER_STATE.IDLE: + console.info(`case avRecorderWithResetPromise is reseted`) + expect(avRecorder.state).assertEqual('idle'); + if (loopTimes <= 0) { + releasePromise(avRecorder); + } + case AV_RECORDER_STATE.RELEASED: + console.info(`case setPrepareOnCallback is released`); + expect(avRecorder.state).assertEqual('released'); + offCallback(avRecorder, ['stateChange', 'error']); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderWithResetPromise(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + setResetOnPromise(avRecorder, loopTimes, done); +} + +export async function setReleaseOnPromise(avRecorder, loopTimes, done) { + console.info(`case setOnCallback in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.STARTED: + console.info(`case avRecorderWithReleasePromise is started`) + expect(avRecorder.state).assertEqual('started'); + while (loopTimes > 0) { + avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + loopTimes--; + console.info('release success'); + }).catch((err) => { + console.info('release failed and catch error is ' + err.message); + }); + } + case AV_RECORDER_STATE.RELEASED: + console.info(`case avRecorderWithReleasePromise is released`) + expect(avRecorder.state).assertEqual('released'); + if (loopTimes <= 0) { + offCallback(avRecorder, ['stateChange', 'error']); + done(); + } + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderWithReleasePromise(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + setReleaseOnPromise(avRecorder, loopTimes, done); +} + +export async function avRecorderWithPrepareCallback(avConfig, avRecorder, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + while (loopTimes > 0) { + prepareCallback(avRecorder, avConfig); + loopTimes--; + } + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderWithStartCallback(avConfig, avRecorder, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + while (loopTimes > 0) { + avRecorder.start((err) => { + console.info('case start called'); + if (err == null) { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STARTED); + console.info('start AVRecorder success'); + } else { + console.info('start AVRecorder failed and error is ' + err.message); + } + }) + loopTimes--; + } + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderWithPauseCallback(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + while (loopTimes > 0) { + pauseCallback(avRecorder, avConfig); + loopTimes--; + } + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderWithResumeCallback(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await pausePromise(avRecorder); + while (loopTimes > 0) { + resumeCallback(avRecorder, avConfig); + loopTimes--; + } + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderWithStopCallback(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + while (loopTimes > 0) { + stopCallback(avRecorder, avConfig); + loopTimes--; + } + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderWithResetCallback(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + while (loopTimes > 0) { + resetCallback(avRecorder, avConfig); + loopTimes--; + } + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderWithReleaseCallback(avConfig, avRecorder, recorderTime, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + while (loopTimes > 0) { + releaseCallback(avRecorder, avConfig); + loopTimes--; + } + done(); +} + +export async function avRecorderWithLongRun(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder, recorderTime); + await stopPromise(avRecorder); + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderLoopPrepare2Reset(avConfig, avRecorder, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + while (loopTimes > 0) { + prepareCallback(avRecorder, avConfig); + startCallback(avRecorder); + resetCallback(avRecorder); + loopTimes--; + } + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderLoopCreate2Release(avConfig, avRecorder, loopTimes, done) { + while (loopTimes > 0) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + prepareCallback(avRecorder, avConfig); + startCallback(avRecorder); + resetCallback(avRecorder); + releaseCallback(avRecorder); + loopTimes--; + } + done(); +} + +export async function avRecorderLoopPrepare2Stop(avConfig, avRecorder, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + while (loopTimes > 0) { + prepareCallback(avRecorder, avConfig); + startCallback(avRecorder); + stopCallback(avRecorder); + loopTimes--; + } + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderLoopPause2Resume(avConfig, avRecorder, loopTimes, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder); + while (loopTimes > 0) { + pauseCallback(avRecorder); + resumeCallback(avRecorder); + loopTimes--; + } + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('release AVRecorder failed and catch error is ' + err.message); + }); +} + +export async function avRecorderLoopCreate2Release2(avConfig, avRecorder, loopTimes, done) { + while (loopTimes > 0) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + releaseCallback(avRecorder); + loopTimes--; + } + done(); +} + +export async function setPrepare2ResetOnCallback(avConfig, avRecorder, done) { + console.info(`case setOnCallback in`); + let count = 0; + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.IDLE: + console.info(`case AV_RECORDER_STATE.IDLE`); + expect(avRecorder.state).assertEqual('idle'); + count++; + if (count == 1001) { + releasePromise(avRecorder); + } else { + avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info(`case avRecorderLoopPrepare2ResetWithCallback is prepared`); + avRecorder.start().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STARTED); + console.info(`case avRecorderLoopPrepare2ResetWithCallback is started`); + avRecorder.reset().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + console.info(`case avRecorderLoopPrepare2ResetWithCallback is reset`); + }).catch((err1) => { + console.info('reset failed and catch error is ' + err1.message); + }); + }).catch((err2) => { + console.info('start failed and catch error is ' + err2.message); + }); + }).catch((err3) => { + console.info('prepare failed and catch error is ' + err3.message); + }); + } + case AV_RECORDER_STATE.RELEASED: + console.info(`case AV_RECORDER_STATE.RELEASED`) + expect(avRecorder.state).assertEqual('released'); + offCallback(avRecorder, ['stateChange', 'error']); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderLoopPrepare2ResetWithCallback(avConfig, avRecorder, done) { + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig); + await resetPromise(avRecorder); + setPrepare2ResetOnCallback(avConfig, avRecorder, done); +} + +export async function setCreate2ReleaseOnCallback(avRecorder, avConfig, loopTimes, done) { + console.info(`case setOnCallback in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.IDLE: + console.info(`case AV_RECORDER_STATE.IDLE`); + expect(avRecorder.state).assertEqual('idle'); + await releasePromise(avRecorder); + case AV_RECORDER_STATE.PREPARED: + console.info(`case AV_RECORDER_STATE.PREPARED`); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + await startPromise(avRecorder); + break; + case AV_RECORDER_STATE.STARTED: + console.info(`case AV_RECORDER_STATE.STARTED`) + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STARTED); + await resetPromise(avRecorder); + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case AV_RECORDER_STATE.RELEASED`); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + loopTimes--; + if (loopTimes <= 0) { + done(); + } else { + avRecorderLoopCreate2ReleaseWithCallback(avRecorder, avConfig, loopTimes, done); + } + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderLoopCreate2ReleaseWithCallback(avRecorder, avConfig, loopTimes, done) { + + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig); + setCreate2ReleaseOnCallback(avRecorder, loopTimes, done) +} + +export async function setPrepare2StopOnCallback(avRecorder, done) { + console.info(`case setOnCallback in`); + let count = 0; + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.PREPARED: + console.info(`case AV_RECORDER_STATE.PREPARED`); + expect(avRecorder.state).assertEqual('prepared'); + while (count < 1001) { + avRecorder.start().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STARTED); + console.info(`case avRecorderLoopPrepare2StopWithCallback is started`); + avRecorder.stop().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STOPPED); + console.info(`case avRecorderLoopPrepare2StopWithCallback is stopped`); + count++; + }).catch((err1) => { + console.info('stop failed and catch error is ' + err1.message); + }); + }).catch((err2) => { + console.info('start failed and catch error is ' + err2.message); + }); + } + offCallback(avRecorder, ['stateChange', 'error']); + done(); + case AV_RECORDER_STATE.STOPPED: + console.info(`case AV_RECORDER_STATE.STOPPED`) + expect(avRecorder.state).assertEqual('stopped'); + if (count == 1001) { + await releasePromise(avRecorder); + } + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case AV_RECORDER_STATE.RELEASED`) + expect(avRecorder.state).assertEqual('released'); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderLoopPrepare2StopWithCallback(avConfig, avRecorder, done) { + + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + setPrepare2StopOnCallback(avRecorder, done) +} + +export async function setPause2ResumeOnCallback(avRecorder, done) { + console.info(`case setOnCallback in`); + let count = 0; + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.STARTED: + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STARTED); + console.info(`case avRecorderLoopPause2ResumeWithCallback is started`); + count++; + if (count == 1001) { + offCallback(avRecorder, ['stateChange', 'error']); + done(); + } else { + avRecorder.pause().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PAUSED); + console.info(`case avRecorderLoopPause2ResumeWithCallback is paused`); + avRecorder.reset().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE); + console.info(`case avRecorderLoopPause2ResumeWithCallback is resumed`); + }).catch((err1) => { + console.info('reset failed and catch error is ' + err1.message); + }); + }).catch((err2) => { + console.info('pause failed and catch error is ' + err2.message); + }); + } + case AV_RECORDER_STATE.IDLE: + console.info(`case AV_RECORDER_STATE.IDLE`) + expect(avRecorder.state).assertEqual('idle'); + if (count == 1001) { + await releasePromise(avRecorder); + } + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case AV_RECORDER_STATE.RELEASED`) + expect(avRecorder.state).assertEqual('released'); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderLoopPause2ResumeWithCallback(avConfig, avRecorder, done) { + avRecorder = await idle(avRecorder); + console.info('case avConfig.url is ' + avConfig.url); + await preparePromise(avRecorder, avConfig); + await startPromise(avRecorder); + setPause2ResumeOnCallback(avRecorder, done); +} + +export async function setCreate2Release2OnCallback(avRecorder, loopTimes, done) { + console.info(`case setOnCallback in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); + switch (state) { + case AV_RECORDER_STATE.IDLE: + console.info(`case AV_RECORDER_STATE.IDLE`); + expect(avRecorder.state).assertEqual('idle'); + case AV_RECORDER_STATE.RELEASED: + console.info(`case AV_RECORDER_STATE.RELEASED`); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + loopTimes--; + if (loopTimes <= 0) { + done(); + } else { + avRecorderLoopCreate2Release2WithCallback(avRecorder, loopTimes, done); + } + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case AV_RECORDER_STATE.ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); +} + +export async function avRecorderLoopCreate2Release2WithCallback(avRecorder, loopTimes, done) { + avRecorder = await idle(avRecorder); + await releasePromise(avRecorder); + setCreate2Release2OnCallback(avRecorder, done); +} + +export async function avRecorderReliabilitTest01(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await avRecorder.pause((err) => { + if (err == null) { + console.info('pause avRecorderReliabilitTest01 success'); + } else { + result = false + expect(result).assertEqual(false); + console.info('pause avRecorderReliabilitTest01 failed and error is ' + err.message); + + } + }); + console.info('pause avRecorderReliabilitTest01 001'); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest02(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest03(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + setPrepareOnCallback(avConfig, avRecorder, recorderTime, done) + await avRecorder.prepare(avConfig) +} + +export async function avRecorderReliabilitTest04(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await avRecorder.resume().then(() => { + console.info('resume avRecorderReliabilitTest04 success'); + }).catch((err) => { + console.info('resume avRecorderReliabilitTest04 failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(false); + await preparePromise(avRecorder, avConfig) + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest05(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + await prepareCallback(avRecorder, avConfig) + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest06(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await startPromise(avRecorder) + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest07(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await resumePromise(avRecorder) + await startPromise(avRecorder) + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest08(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest08 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest08 failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(false); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest09(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest09 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest09 failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(false); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest10(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest11(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await resumePromise(avRecorder) + await pausePromise(avRecorder) + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest12(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await stopPromise(avRecorder) + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest12 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest12 failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(false); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest13(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await stopPromise(avRecorder) + await resetPromise(avRecorder) + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest13 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest13 failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(false); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest14(avConfig, avRecorder, recorderTime, done) { + let result1 = true; + let result2 = true; + let result3 = true; + let result4 = true; + let result5 = true; + + avRecorder = await idle(avRecorder); + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest14 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest14 failed and catch error is ' + err.message); + result1 = false + }); + expect(result1).assertEqual(false); + + await preparePromise(avRecorder, avConfig) + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest14 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest14 failed and catch error is ' + err.message); + result2 = false + }); + expect(result2).assertEqual(false); + + await startPromise(avRecorder) + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest14 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest14 failed and catch error is ' + err.message); + result3 = false + }); + expect(result3).assertEqual(true); + + await stopPromise(avRecorder) + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest14 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest14 failed and catch error is ' + err.message); + result4 = false + }); + expect(result4).assertEqual(false); + + await resetPromise(avRecorder) + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest14 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest14 failed and catch error is ' + err.message); + result5 = false + }); + expect(result5).assertEqual(false); + + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest15(avConfig, avRecorder, recorderTime, done) { + let result1 = true; + let result2 = true; + let result3 = true; + + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest15 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest15 failed and catch error is ' + err.message); + result1 = false + }); + expect(result1).assertEqual(true); + + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest15 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest15 failed and catch error is ' + err.message); + result2 = false + }); + expect(result2).assertEqual(true); + + await avRecorder.pause().then(() => { + console.info('pause avRecorderReliabilitTest15 success'); + }).catch((err) => { + console.info('pause avRecorderReliabilitTest15 failed and catch error is ' + err.message); + result3 = false + }); + expect(result3).assertEqual(true); + + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest16(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await avRecorder.resume().then(() => { + console.info('resume AVRecorder success'); + }).catch((err) => { + console.info('resume AVRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(false); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest17(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await avRecorder.resume().then(() => { + console.info('resume AVRecorder success'); + }).catch((err) => { + console.info('resume AVRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(false); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest18(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest18 resume AVRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest18 resume AVRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(true); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest19(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest19 resume AVRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest19 resume AVRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(true); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest20(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await stopPromise(avRecorder) + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest20 resume AVRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest20 resume AVRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(false); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest21(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await resetPromise(avRecorder) + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest20 resume AVRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest20 resume AVRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(false); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest22(avConfig, avRecorder, recorderTime, done) { + let result1 = true; + let result2 = true; + let result3 = true; + let result4 = true; + let result5 = true; + + avRecorder = await idle(avRecorder); + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest22 resume avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest22 resume avRecorder failed and catch error is ' + err.message); + result1 = false + }); + expect(result1).assertEqual(false); + + await preparePromise(avRecorder, avConfig) + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest22 resume avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest22 resume avRecorder failed and catch error is ' + err.message); + result2 = false + }); + expect(result2).assertEqual(false); + + await startPromise(avRecorder) + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest22 resume avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest22 resume avRecorder failed and catch error is ' + err.message); + result3 = false + }); + expect(result3).assertEqual(true); + + await pausePromise(avRecorder) + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest22 resume avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest22 resume avRecorder failed and catch error is ' + err.message); + result4 = false + }); + expect(result4).assertEqual(true); + + await resetPromise(avRecorder) + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest22 resume avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest22 resume avRecorder failed and catch error is ' + err.message); + result5 = false + }); + expect(result5).assertEqual(false); + + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest23(avConfig, avRecorder, recorderTime, done) { + let result1 = true; + let result2 = true; + let result3 = true; + + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest23 resume avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest23 resume avRecorder failed and catch error is ' + err.message); + result1 = false + }); + expect(result1).assertEqual(true); + + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest23 resume avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest23 resume avRecorder failed and catch error is ' + err.message); + result2 = false + }); + expect(result2).assertEqual(true); + + await avRecorder.resume().then(() => { + console.info('avRecorderReliabilitTest23 resume avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest23 resume avRecorder failed and catch error is ' + err.message); + result3 = false + }); + expect(result3).assertEqual(true); + + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest24(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await avRecorder.stop().then(() => { + console.info('avRecorderReliabilitTest24 stop avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest24 stop avRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(true); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest25(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await resumePromise(avRecorder) + await avRecorder.stop().then(() => { + console.info('avRecorderReliabilitTest25 stop avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest25 stop avRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(true); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest26(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await avRecorder.reset().then(() => { + console.info('avRecorderReliabilitTest26 reset avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest26 reset avRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(true); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest27(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await resumePromise(avRecorder) + await avRecorder.reset().then(() => { + console.info('avRecorderReliabilitTest27 reset avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest27 reset avRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(true); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest28(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await avRecorder.release().then(() => { + console.info('avRecorderReliabilitTest28 release avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest28 release avRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(true); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest29(avConfig, avRecorder, recorderTime, done) { + let result = true; + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await resumePromise(avRecorder) + await avRecorder.release().then(() => { + console.info('avRecorderReliabilitTest29 release avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest29 release avRecorder failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(true); + await releaseDone(avRecorder, done) +} + +export async function avRecorderReliabilitTest30(avConfig, avRecorder, recorderTime, done) { + let result1 = true; + let result2 = true; + let result3 = true; + + avRecorder = await idle(avRecorder); + await preparePromise(avRecorder, avConfig) + await startPromise(avRecorder) + await pausePromise(avRecorder) + await avRecorder.release().then(() => { + console.info('avRecorderReliabilitTest30 release avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest30 release avRecorder failed and catch error is ' + err.message); + result1 = false + }); + expect(result1).assertEqual(true); + + await avRecorder.release().then(() => { + console.info('avRecorderReliabilitTest30 release avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest30 release avRecorder failed and catch error is ' + err.message); + result2 = false + }); + expect(result2).assertEqual(true); + + await avRecorder.release().then(() => { + console.info('avRecorderReliabilitTest30 release avRecorder success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest30 release avRecorder failed and catch error is ' + err.message); + result3 = false + }); + expect(result3).assertEqual(true); + done(); +} + +export async function avRecorderReliabilitTest31(avConfig, avRecorder, recorderTime, done) { + let surfaceID = null; + let result = true; + avRecorder = await idle(avRecorder); + avRecorder.getInputSurface().then((surfaceId) => { + console.info('avRecorderReliabilitTest31 getInputSurface success'); + surfaceID = surfaceId; + }).catch((err) => { + console.info('avRecorderReliabilitTest31 getInputSurface failed and catch error is ' + err.message); + result = false + }); + expect(result).assertEqual(true); + await releaseDone(avRecorder, done) +} + + +export async function getInputSurfaceTest32(avConfig, avRecorder, recorderTime, done) { + console.info(`case getInputSurfaceTest in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state); + switch (state) { + case AV_RECORDER_STATE.PREPARED: + console.info(`case getInputSurfaceTest32 state is PREPARED`); + expect(avRecorder.state).assertEqual('prepared'); + getInputSurfacePromise(avRecorder) + releasePromise(avRecorder) + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case getInputSurfaceTest32 state is released`); + expect(avRecorder.state).assertEqual('released'); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case getInputSurfaceTest32 state is ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); + avRecorder.on('error', (err) => { + console.info('case getInputSurfaceTest32 avRecorder.on(error) called, errMessage is ' + err.message); + done(); + }); +} + +export async function avRecorderReliabilitTest32(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + getInputSurfaceTest32(avConfig, avRecorder, recorderTime, done) + await preparePromise(avRecorder, avConfig) +} + +export async function getInputSurfaceTest33(avConfig, avRecorder, recorderTime, done) { + console.info(`case getInputSurfaceTest33 in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state); + switch (state) { + case AV_RECORDER_STATE.PREPARED: + console.info(`case getInputSurfaceTest33 state is PREPARED`); + expect(avRecorder.state).assertEqual('prepared'); + getInputSurfacePromise(avRecorder) + startPromise(avRecorder) + break; + case AV_RECORDER_STATE.STARTED: + console.info(`case getInputSurfaceTest33 state is started`) + expect(avRecorder.state).assertEqual('started'); + await sleep(recorderTime); + console.info(`case getInputSurfaceTest33 111`) + getInputSurfacePromise(avRecorder) + console.info(`case getInputSurfaceTest33 222`) + releasePromise(avRecorder) + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case getInputSurfaceTest33 state is released`); + expect(avRecorder.state).assertEqual('released'); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case getInputSurfaceTest33 state is ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); + avRecorder.on('error', (err) => { + console.info('case avRecorder.on(error) called, errMessage is ' + err.message); + done(); + }); +} + +export async function avRecorderReliabilitTest33(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + getInputSurfaceTest33(avConfig, avRecorder, recorderTime, done) + await preparePromise(avRecorder, avConfig) +} + +export async function getInputSurfaceTest34(avConfig, avRecorder, recorderTime, done) { + console.info(`case getInputSurfaceTest34 in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state); + switch (state) { + case AV_RECORDER_STATE.PREPARED: + console.info(`case getInputSurfaceTest34 state is PREPARED`); + expect(avRecorder.state).assertEqual('prepared'); + getInputSurfacePromise(avRecorder) + startPromise(avRecorder) + break; + case AV_RECORDER_STATE.STARTED: + console.info(`case getInputSurfaceTest34 state is started`) + expect(avRecorder.state).assertEqual('started'); + await sleep(recorderTime); + pausePromise(avRecorder) + break; + case AV_RECORDER_STATE.PAUSED: + console.info(`case getInputSurfaceTest34 state is paused`) + expect(avRecorder.state).assertEqual('paused'); + getInputSurfacePromise(avRecorder) + releasePromise(avRecorder) + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case getInputSurfaceTest34 state is released`); + expect(avRecorder.state).assertEqual('released'); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case getInputSurfaceTest34 state is ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); + avRecorder.on('error', (err) => { + console.info('case avRecorder.on(error) called, errMessage is ' + err.message); + done(); + }); +} + +export async function avRecorderReliabilitTest34(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + getInputSurfaceTest34(avConfig, avRecorder, recorderTime, done) + await preparePromise(avRecorder, avConfig) +} + +export async function getInputSurfaceTest35(avConfig, avRecorder, recorderTime, done) { + console.info(`case getInputSurfaceTest35 in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state); + switch (state) { + case AV_RECORDER_STATE.PREPARED: + console.info(`case getInputSurfaceTest35 state is PREPARED`); + expect(avRecorder.state).assertEqual('prepared'); + getInputSurfacePromise(avRecorder) + startPromise(avRecorder) + break; + case AV_RECORDER_STATE.STARTED: + console.info(`case getInputSurfaceTest35 state is started`) + expect(avRecorder.state).assertEqual('started'); + await sleep(recorderTime); + pausePromise(avRecorder) + break; + case AV_RECORDER_STATE.PAUSED: + console.info(`case getInputSurfaceTest35 state is paused`) + expect(avRecorder.state).assertEqual('paused'); + resumePromise(avRecorder) + getInputSurfacePromise(avRecorder) + releasePromise(avRecorder) + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case getInputSurfaceTest35 state is released`); + expect(avRecorder.state).assertEqual('released'); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case getInputSurfaceTest35 state is ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); + avRecorder.on('error', (err) => { + console.info('case avRecorder.on(error) called, errMessage is ' + err.message); + done(); + }); +} + +export async function avRecorderReliabilitTest35(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + getInputSurfaceTest35(avConfig, avRecorder, recorderTime, done) + await preparePromise(avRecorder, avConfig) +} + +export async function getInputSurfaceTest36(avConfig, avRecorder, recorderTime, done) { + console.info(`case getInputSurfaceTest36 in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state); + switch (state) { + case AV_RECORDER_STATE.PREPARED: + console.info(`case getInputSurfaceTest36 state is PREPARED`); + expect(avRecorder.state).assertEqual('prepared'); + getInputSurfacePromise(avRecorder) + startPromise(avRecorder) + break; + case AV_RECORDER_STATE.STARTED: + console.info(`case getInputSurfaceTest36 state is started`) + expect(avRecorder.state).assertEqual('started'); + await sleep(recorderTime); + stopPromise(avRecorder) + break; + case AV_RECORDER_STATE.STOPPED: + console.info(`case getInputSurfaceTest36 state is stopped`) + expect(avRecorder.state).assertEqual('stopped'); + getInputSurfacePromise(avRecorder) + releasePromise(avRecorder) + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case getInputSurfaceTest36 state is released`); + expect(avRecorder.state).assertEqual('released'); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case getInputSurfaceTest36 state is ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); + avRecorder.on('error', (err) => { + console.info('case avRecorder.on(error) called, errMessage is ' + err.message); + done(); + }); +} + +export async function avRecorderReliabilitTest36(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + getInputSurfaceTest36(avConfig, avRecorder, recorderTime, done) + await preparePromise(avRecorder, avConfig) +} + +export async function getInputSurfaceTest37(avConfig, avRecorder, recorderTime, done) { + console.info(`case getInputSurfaceTest37 in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state); + switch (state) { + case AV_RECORDER_STATE.IDLE: + console.info(`case getInputSurfaceTest37 state is idle`); + expect(avRecorder.state).assertEqual("idle"); + getInputSurfacePromise(avRecorder) + releasePromise(avRecorder) + break; + case AV_RECORDER_STATE.PREPARED: + console.info(`case getInputSurfaceTest37 state isPREPARED`); + expect(avRecorder.state).assertEqual('prepared'); + getInputSurfacePromise(avRecorder) + startPromise(avRecorder) + break; + case AV_RECORDER_STATE.STARTED: + console.info(`case getInputSurfaceTest37 state isstarted`) + expect(avRecorder.state).assertEqual('started'); + await sleep(recorderTime); + resetPromise(avRecorder) + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case getInputSurfaceTest37 state is released`); + expect(avRecorder.state).assertEqual('released'); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case getInputSurfaceTest37 state is ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); + avRecorder.on('error', (err) => { + console.info('case avRecorder.on(error) called, errMessage is ' + err.message); + done(); + }); +} + +export async function avRecorderReliabilitTest37(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + getInputSurfaceTest37(avConfig, avRecorder, recorderTime, done) + await preparePromise(avRecorder, avConfig) +} + +export async function getInputSurfaceTest38(avConfig, avRecorder, recorderTime, done) { + let result1 = true; + let result2 = true; + let result3 = true; + let surfaceID = null; + console.info(`case getInputSurfaceTest38 in`); + avRecorder.on('stateChange', async (state, reason) => { + console.info('case state has changed, new state is :' + state); + switch (state) { + case AV_RECORDER_STATE.PREPARED: + console.info(`case getInputSurfaceTest38 state is PREPARED`); + expect(avRecorder.state).assertEqual('prepared'); + + avRecorder.getInputSurface().then((surfaceId) => { + console.info('getInputSurfaceTest38 getInputSurface success'); + surfaceID = surfaceId; + }).catch((err) => { + console.info('getInputSurfaceTest38 getInputSurface failed and catch error is ' + err.message); + result1 = false + }); + expect(result1).assertEqual(true); + + avRecorder.getInputSurface().then((surfaceId) => { + console.info('getInputSurfaceTest38 getInputSurface success'); + surfaceID = surfaceId; + }).catch((err) => { + console.info('getInputSurfaceTest38 getInputSurface failed and catch error is ' + err.message); + result2 = false + }); + expect(result2).assertEqual(true); + + avRecorder.getInputSurface().then((surfaceId) => { + console.info('getInputSurfaceTest38 getInputSurface success'); + surfaceID = surfaceId; + }).catch((err) => { + console.info('getInputSurfaceTest38 getInputSurface failed and catch error is ' + err.message); + result3 = false + }); + expect(result3).assertEqual(true); + releasePromise(avRecorder) + break; + case AV_RECORDER_STATE.RELEASED: + console.info(`case getInputSurfaceTest38 state is released`); + expect(avRecorder.state).assertEqual('released'); + done(); + break; + case AV_RECORDER_STATE.ERROR: + console.info(`case getInputSurfaceTest38 state is ERROR`) + expect(avRecorder.state).assertEqual('error'); + break; + default: + console.info('case state is unknown'); + } + }); + avRecorder.on('error', (err) => { + console.info('case avRecorder.on(error) called, errMessage is ' + err.message); + done(); + }); +} + +export async function avRecorderReliabilitTest38(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + getInputSurfaceTest38(avConfig, avRecorder, recorderTime, done) + await preparePromise(avRecorder, avConfig) +} + +export async function createTimeTestCallback(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + let start = Date.now(); + console.info(`createTimeTestCallback start time is : ${start}`) + avRecorder = await idleCallBack(avRecorder); + let end = Date.now() + let execution = parseInt(end - start) + console.info("createTimeTestCallback execution time is :" + execution) + totalTime = totalTime + execution; + await avRecorder.release().then(() => { + console.info('createTimeTestCallback avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + let avg = totalTime/10; + console.info("createTimeTest avg time is :" + avg) + done(); +} + +export async function prepareTimeCallback(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idleCallBack(avRecorder); + await sleep(20) + let start = Date.now(); + console.info(`prepareTimeWithoutCallback start time is : ${start}`) + let end; + await avRecorder.prepare(avConfig, (err) => { + if (err == null) { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('prepareTimeWithoutCallback avPlayer state is prepared') + end = Date.now() + console.info(`prepareTimeWithoutCallback end time is : ${end}`) + } else { + console.info('prepare failed and error is ' + err.message); + } + }) + let execution = parseInt(end - start) + console.info("prepareTimeWithoutCallback execution time is :" + execution) + totalTime = totalTime + execution; + await avRecorder.release().then(() => { + console.info('prepareTimeWithoutCallback avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + let avg = totalTime/10; + console.info("prepareTimeWithoutCallback avg time is :" + avg) + done(); +} + +export async function getInputSurfaceTimeTestCallback(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + let surfaceID = null; + for(var i = 0;i < 10;i++){ + avRecorder = await idleCallBack(avRecorder); + await sleep(20) + let end; + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('getInputSurfaceTimeTestCallback avPlayer state is prepared') + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + let start = Date.now(); + console.info(`getInputSurfaceTimeTestCallback start time is : ${start}`) + await avRecorder.getInputSurface((err, surfaceId) => { + if (err == null) { + console.info('getInputSurfaceTimeTestCallback success'); + surfaceID = surfaceId; + end = Date.now() + console.info(`getInputSurfaceTimeTestCallback end time is : ${end}`) + let execution = parseInt(end - start) + console.info("getInputSurfaceTimeTestCallback execution time is :" + execution) + totalTime = totalTime + execution; + } else { + console.info('getInputSurfaceTimeTestCallback failed and error is ' + err.message); + } + }); + await avRecorder.release().then(() => { + console.info('getInputSurfaceTimeTestCallback avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + let avg = totalTime/10; + console.info("getInputSurfaceTimeTestCallback avg time is :" + avg) + done(); +} + +export async function startTimeTestCallback(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idleCallBack(avRecorder); + await sleep(20) + let end; + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('startTimeTestCallback avPlayer state is prepared') + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + let start = Date.now(); + console.info(`startTimeTestCallback start time is : ${start}`) + await avRecorder.start((err) => { + if (err == null) { + end = Date.now() + console.info(`startTimeTestCallback end time is : ${end}`) + console.info('startTimeTestCallback avRecorder success'); + let execution = parseInt(end - start) + console.info("startTimeTestCallback execution time is :" + execution) + totalTime = totalTime + execution; + } else { + console.info('startTimeTestCallback failed and error is ' + err.message); + } + }); + await avRecorder.release().then(() => { + console.info('startTimeTestCallback avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + let avg = totalTime/10; + console.info("startTimeTestCallback avg time is :" + avg) + done(); +} + +export async function pauseTimeTestCallback(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idleCallBack(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('pauseTimeTestCallback avPlayer state is prepared') + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await avRecorder.start().then(() => { + console.info('start avRecorder success'); + }).catch((err) => { + console.info('pauseTimeTestCallback start avRecorder failed and catch error is ' + err.message); + }); + let start = Date.now(); + console.info(`pauseTimeTestCallback start time is : ${start}`) + let end; + await avRecorder.pause((err) => { + if (err == null) { + end = Date.now() + console.info(`pauseTimeTestCallback end time is : ${end}`) + console.info('pause pauseTimeTestCallback success'); + let execution = parseInt(end - start) + console.info("pauseTimeTestCallback execution time is :" + execution) + totalTime = totalTime + execution; + } else { + console.info('pause pauseTimeTestCallback failed and error is ' + err.message); + } + }); + await avRecorder.release().then(() => { + console.info('pauseTimeTestCallback avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + let avg = totalTime/10; + console.info("pauseTimeTestCallback avg time is :" + avg) + done(); +} + +export async function resumeTimeTestCallback(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idleCallBack(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('resumeTimeTestCallback avPlayer state is prepared') + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await avRecorder.start().then(() => { + console.info('start resumeTimeTestCallback success'); + }).catch((err) => { + console.info('resumeTimeTestCallback start avRecorder failed and catch error is ' + err.message); + }); + let end; + await avRecorder.pause((err) => { + if (err == null) { + console.info('pause resumeTimeTestCallback success'); + } else { + console.info('pause resumeTimeTestCallback failed and error is ' + err.message); + } + }); + let start = Date.now(); + console.info(`resumeTimeTestCallback start time is : ${start}`) + await avRecorder.resume((err) => { + if (err == null) { + console.info('resume resumeTimeTestCallback success'); + end = Date.now() + console.info(`resumeTimeTestCallback end time is : ${end}`) + let execution = parseInt(end - start) + console.info("resumeTimeTestCallback execution time is :" + execution) + totalTime = totalTime + execution; + } else { + console.info('resume resumeTimeTestCallback failed and error is ' + err.message); + } + }); + await avRecorder.release().then(() => { + console.info('resumeTimeTestCallback avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + let avg = totalTime/10; + console.info("resumeTimeTestCallback avg time is :" + avg) + done(); +} + +export async function stopTimeTestCallback(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idleCallBack(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('stopTimeTestCallback avPlayer state is prepared') + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await avRecorder.start().then(() => { + console.info('start stopTimeTestCallback success'); + }).catch((err) => { + console.info('stopTimeTestCallback start avRecorder failed and catch error is ' + err.message); + }); + let end; + let start = Date.now(); + console.info(`stopTimeTestCallback start time is : ${start}`) + await avRecorder.stop((err) => { + if (err == null) { + console.info('resume stopTimeTestCallback success'); + end = Date.now() + console.info(`stopTimeTestCallback end time is : ${end}`) + let execution = parseInt(end - start) + console.info("stopTimeTestCallback execution time is :" + execution) + totalTime = totalTime + execution; + } else { + console.info('resume stopTimeTestCallback failed and error is ' + err.message); + } + }); + await avRecorder.release().then(() => { + console.info('stopTimeTestCallback avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + let avg = totalTime/10; + console.info("stopTimeTestCallback avg time is :" + avg) + done(); +} + +export async function resetTimeTestCallback(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idleCallBack(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('resetTimeTestCallback avPlayer state is prepared') + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await avRecorder.start().then(() => { + console.info('start resetTimeTestCallback success'); + }).catch((err) => { + console.info('resetTimeTestCallback start avRecorder failed and catch error is ' + err.message); + }); + let end; + let start = Date.now(); + console.info(`resetTimeTestCallback start time is : ${start}`) + await avRecorder.reset((err) => { + if (err == null) { + console.info('resume resetTimeTestCallback success'); + end = Date.now() + console.info(`resetTimeTestCallback end time is : ${end}`) + let execution = parseInt(end - start) + console.info("resetTimeTestCallback execution time is :" + execution) + totalTime = totalTime + execution; + } else { + console.info('resume resetTimeTestCallback failed and error is ' + err.message); + } + }); + await avRecorder.release().then(() => { + console.info('resetTimeTestCallback avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + let avg = totalTime/10; + console.info("resetTimeTestCallback avg time is :" + avg) + done(); +} + +export async function releaseTimeTestCallback(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idleCallBack(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('releaseTimeTestCallback avPlayer state is prepared') + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + + await avRecorder.start().then(() => { + console.info('start releaseTimeTestCallback success'); + }).catch((err) => { + console.info('releaseTimeTestCallback start avRecorder failed and catch error is ' + err.message); + }); + let end; + let start = Date.now(); + console.info(`releaseTimeTestCallback start time is : ${start}`) + await avRecorder.release((err) => { + if (err == null) { + console.info(`releaseTimeTestCallback current state is : ${avRecorder.state}`) + console.info('release releaseTimeTestCallback success'); + end = Date.now() + console.info(`releaseTimeTestCallback end time is : ${end}`) + let execution = parseInt(end - start) + console.info("releaseTimeTestCallback execution time is :" + execution) + totalTime = totalTime + execution; + } else { + console.info('resume releaseTimeTestCallback failed and error is ' + err.message); + } + }); + if(i == 9){ + let avg = totalTime/10; + console.info("releaseTimeTestCallback avg time is :" + avg) + done(); + } + } +} + +export async function createTimeTestPromise(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + let start = Date.now(); + console.info(`createTimeTestPromise start time is : ${start}`) + avRecorder = await idle(avRecorder); + let end = Date.now() + let execution = parseInt(end - start) + console.info("createTimeTestPromise execution time is :" + execution) + totalTime = totalTime + execution; + await avRecorder.release().then(() => { + console.info('createTimeTestPromise avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + let avg = totalTime/10; + console.info("createTimeTestPromise avg time is :" + avg) + done(); +} + +export async function prepareTimePromise(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idle(avRecorder); + await sleep(20) + let start = Date.now(); + console.info(`prepareTimeWithoutPromise start time is : ${start}`) + let end; + await avRecorder.prepare(avConfig).then(() => { + console.info('prepare success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('prepareTimeWithoutPromise avPlayer state is prepared') + end = Date.now() + console.info(`prepareTimeWithoutPromise end time is : ${end}`) + }).catch((err) => { + console.info('prepare failed and catch error is ' + err.message); + }); + let execution = parseInt(end - start) + console.info("prepareTimeWithoutPromise execution time is :" + execution) + totalTime = totalTime + execution; + await avRecorder.release().then(() => { + console.info('prepareTimeWithoutPromise avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + } + let avg = totalTime/10; + console.info("prepareTimeWithoutPromise avg time is :" + avg) + done(); +} + +export async function getInputSurfaceTimeTestPromise(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + let surfaceID = null; + for(var i = 0;i < 10;i++){ + avRecorder = await idle(avRecorder); + await sleep(20) + let end; + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('getInputSurfaceTimeTestPromise avPlayer state is prepared') + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + let start = Date.now(); + console.info(`getInputSurfaceTimeTestPromise start time is : ${start}`) + await avRecorder.getInputSurface().then((surfaceId) => { + console.info('getInputSurfaceTimeTestPromise success'); + surfaceID = surfaceId; + end = Date.now() + console.info(`getInputSurfaceTimeTestPromise end time is : ${end}`) + let execution = parseInt(end - start) + console.info("getInputSurfaceTimeTestPromise execution time is :" + execution) + totalTime = totalTime + execution; + }).catch((err) => { + console.info('getInputSurface failed and catch error is ' + err.message); + }); + await avRecorder.release().then(() => { + console.info('getInputSurfaceTimeTestPromise avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + } + let avg = totalTime/10; + console.info("getInputSurfaceTimeTestPromise avg time is :" + avg) + done(); +} + +export async function startTimeTestPromise(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idle(avRecorder); + await sleep(20) + let end; + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('startTimeTestPromise avPlayer state is prepared') + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + let start = Date.now(); + console.info(`startTimeTestPromise start time is : ${start}`) + await avRecorder.start().then(() => { + console.info('start AVRecorder success'); + end = Date.now() + console.info(`startTimeTestPromise end time is : ${end}`) + let execution = parseInt(end - start) + console.info("startTimeTestPromise execution time is :" + execution) + totalTime = totalTime + execution; + console.info('startTimeTestPromise avRecorder success'); + }).catch((err) => { + console.info('start AVRecorder failed and catch error is ' + err.message); + }); + await avRecorder.release().then(() => { + console.info('startTimeTestPromise avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + } + let avg = totalTime/10; + console.info("startTimeTestPromise avg time is :" + avg) + done(); +} + +export async function pauseTimeTestPromise(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idle(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('pauseTimeTestPromise avPlayer state is prepared') + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + await avRecorder.start().then(() => { + console.info('start avRecorder success'); + }).catch((err) => { + console.info('pauseTimeTestPromise start avRecorder failed and catch error is ' + err.message); + }); + let start = Date.now(); + console.info(`pauseTimeTestPromise start time is : ${start}`) + let end; + await avRecorder.pause().then(() => { + console.info('pause AVRecorder success'); + end = Date.now() + console.info(`pauseTimeTestPromise end time is : ${end}`) + let execution = parseInt(end - start) + console.info("pauseTimeTestPromise execution time is :" + execution) + totalTime = totalTime + execution; + console.info('pause pauseTimeTestPromise success'); + }).catch((err) => { + console.info('pause AVRecorder failed and catch error is ' + err.message); + }); + await avRecorder.release().then(() => { + console.info('pauseTimeTestPromise avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + } + let avg = totalTime/10; + console.info("pauseTimeTestPromise avg time is :" + avg) + done(); +} + +export async function resumeTimeTestPromise(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idle(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('resumeTimeTestPromise avPlayer state is prepared') + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + + await avRecorder.start().then(() => { + console.info('start resumeTimeTestPromise success'); + }).catch((err) => { + console.info('resumeTimeTestPromise start avRecorder failed and catch error is ' + err.message); + }); + let end; + await avRecorder.pause((err) => { + if (err == null) { + console.info('pause resumeTimeTestPromise success'); + } else { + console.info('pause resumeTimeTestPromise failed and error is ' + err.message); + } + }); + let start = Date.now(); + console.info(`resumeTimeTestPromise start time is : ${start}`) + await avRecorder.resume().then(() => { + console.info('resume AVRecorder success'); + console.info('resume resumeTimeTestPromise success'); + end = Date.now() + console.info(`resumeTimeTestPromise end time is : ${end}`) + let execution = parseInt(end - start) + console.info("resumeTimeTestPromise execution time is :" + execution) + totalTime = totalTime + execution; + }).catch((err) => { + console.info('resume AVRecorder failed and catch error is ' + err.message); + }); + await avRecorder.release().then(() => { + console.info('resumeTimeTestPromise avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + } + let avg = totalTime/10; + console.info("resumeTimeTestPromise avg time is :" + avg) + done(); +} + +export async function stopTimeTestPromise(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idle(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('stopTimeTestPromise avPlayer state is prepared') + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + + await avRecorder.start().then(() => { + console.info('start stopTimeTestPromise success'); + }).catch((err) => { + console.info('stopTimeTestPromise start avRecorder failed and catch error is ' + err.message); + }); + let end; + let start = Date.now(); + console.info(`stopTimeTestPromise start time is : ${start}`) + await avRecorder.stop().then(() => { + console.info('stop AVRecorder success'); + console.info('resume stopTimeTestPromise success'); + end = Date.now() + console.info(`stopTimeTestPromise end time is : ${end}`) + let execution = parseInt(end - start) + console.info("stopTimeTestPromise execution time is :" + execution) + totalTime = totalTime + execution; + }).catch((err) => { + console.info('stop AVRecorder failed and catch error is ' + err.message); + }); + await avRecorder.release().then(() => { + console.info('stopTimeTestPromise avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + } + let avg = totalTime/10; + console.info("stopTimeTestPromise avg time is :" + avg) + done(); +} + +export async function resetTimeTestPromise(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idle(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('resetTimeTestPromise avPlayer state is prepared') + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + + await avRecorder.start().then(() => { + console.info('start resetTimeTestPromise success'); + }).catch((err) => { + console.info('resetTimeTestPromise start avRecorder failed and catch error is ' + err.message); + }); + let end; + let start = Date.now(); + console.info(`resetTimeTestPromise start time is : ${start}`) + await avRecorder.reset().then(() => { + console.info('reset AVRecorder success'); + console.info('resume resetTimeTestPromise success'); + end = Date.now() + console.info(`resetTimeTestPromise end time is : ${end}`) + let execution = parseInt(end - start) + console.info("resetTimeTestPromise execution time is :" + execution) + totalTime = totalTime + execution; + }).catch((err) => { + console.info('resume resetTimeTestPromise failed and error is ' + err.message); + }); + await avRecorder.release().then(() => { + console.info('resetTimeTestPromise avPlayer is release') + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + } + let avg = totalTime/10; + console.info("resetTimeTestPromise avg time is :" + avg) + done(); +} + +export async function releaseTimeTestPromise(avConfig, avRecorder, recorderTime, done) { + let totalTime = 0; + for(var i = 0;i < 10;i++){ + avRecorder = await idle(avRecorder); + await sleep(20) + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('releaseTimeTestPromise avPlayer state is prepared') + }, mediaTestBase.failurePromise).catch(mediaTestBase.catchPromise); + + await avRecorder.start().then(() => { + console.info('start releaseTimeTestPromise success'); + }).catch((err) => { + console.info('releaseTimeTestPromise start avRecorder failed and catch error is ' + err.message); + }); + let end; + let start = Date.now(); + console.info(`releaseTimeTestPromise start time is : ${start}`) + await avRecorder.release().then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + console.info('release AVRecorder success'); + console.info('resume releaseTimeTestPromise success'); + end = Date.now() + let execution = parseInt(end - start) + console.info("releaseTimeTestPromise execution time is :" + execution) + totalTime = totalTime + execution; + console.info(`releaseTimeTestPromise end time is : ${end}`) + }).catch((err) => { + console.info('resume releaseTimeTestPromise failed and error is ' + err.message); + }); + } + let avg = totalTime/10; + console.info("releaseTimeTestPromise avg time is :" + avg) + done(); +} + + + + + + + + + + + + + diff --git a/multimedia/media/media_js_standard/avRecorder/Test.json b/multimedia/media/media_js_standard/avRecorder/Test.json index b9bc1c958b9a186e796338fe1f14d91e356c2c40..23a587a5d26050985ea1da02487cb57359b60241 100644 --- a/multimedia/media/media_js_standard/avRecorder/Test.json +++ b/multimedia/media/media_js_standard/avRecorder/Test.json @@ -2,9 +2,9 @@ "description": "Configuration for avRecorder Tests", "driver": { "type": "OHJSUnitTest", - "test-timeout": "1000000", - "shell-timeout": "1000000", - "testcase-timeout": 60000, + "test-timeout": "2000000", + "shell-timeout": "2000000", + "testcase-timeout": 150000, "bundle-name": "ohos.acts.multimedia.audio.avrecorder", "package-name": "ohos.acts.multimedia.audio.avrecorder" }, diff --git a/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js b/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js index 1230def728949b60a8f0d74fe8532bf55425fdf0..4ac55c757b7f874c6520b465a0d24531e118fd58 100644 --- a/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js +++ b/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js @@ -34,10 +34,99 @@ export default function avRecorderTest() { 'audio_9.m4a', 'audio_10.m4a', 'audio_11.m4a', - 'audio_12.m4a' + 'audio_12.m4a', + 'audio_13.m4a', + 'audio_14.m4a', + 'audio_15.m4a', + 'audio_16.m4a', + 'audio_17.m4a', + 'audio_18.m4a', + 'audio_19.m4a', + 'audio_20.m4a', + 'audio_21.m4a', + 'audio_22.m4a', + 'audio_23.m4a', + 'audio_24.m4a', + 'audio_25.m4a', + 'audio_26.m4a', + 'audio_27.m4a', + 'audio_28.m4a', + 'audio_29.m4a', + 'audio_30.m4a', + 'audio_31.m4a', + 'audio_32.m4a', + 'audio_33.m4a', + 'audio_34.m4a', + 'audio_35.m4a', + 'audio_36.m4a', + 'audio_37.m4a', + 'audio_38.m4a', + 'audio_39.m4a', + 'audio_40.m4a', + 'audio_41.m4a', + 'audio_42.m4a', + 'audio_43.m4a', + 'av_audio_n1.m4a', + 'av_audio_n2.m4a', + 'av_audio_n3.m4a', + 'av_audio_n4.m4a', + 'av_audio_n5.m4a', + 'av_audio_n6.m4a', + 'av_audio_n7.m4a', + 'av_audio_n8.m4a', + 'av_audio_n9.m4a', + 'av_audio_n10.m4a', + 'av_audio_n11.m4a', + 'av_audio_n12.m4a', + 'av_audio_n13.m4a', + 'av_audio_n14.m4a', + 'av_audio_n15.m4a', + 'av_audio_n16.m4a', + 'av_audio_n17.m4a', + 'av_audio_n18.m4a', + 'av_audio_n19.m4a', + 'av_audio_n20.m4a', + 'av_audio_n21.m4a', + 'av_audio_n22.m4a', + 'av_audio_n23.m4a', + 'av_audio_n24.m4a', + 'av_audio_n25.m4a', + 'av_audio_n26.m4a', + 'av_audio_n27.m4a', + 'av_audio_n28.m4a', + 'av_audio_n29.m4a', + 'av_audio_n30.m4a', + 'av_audio_n31.m4a', + 'av_audio_n32.m4a', + 'av_audio_n33.m4a', + 'av_audio_n34.m4a', + 'av_audio_n35.m4a', + 'av_audio_n36.m4a', + 'av_audio_n37.m4a', + 'av_audio_n38.m4a', + 'av_audio_n39.m4a', + 'av_audio_n40.m4a', + 'av_audio_n41.m4a', + 'av_audio_n42.m4a', + 'av_audio_n43.m4a', + 'av_audio_n44.m4a', + 'av_audio_n45.m4a', + 'av_audio_n46.m4a', + 'av_audio_n47.m4a', + 'av_audio_n48.m4a', + 'av_audio_n49.m4a', + 'av_audio_n50.m4a', + 'av_audio_n51.m4a', + 'av_audio_n52.m4a', + 'av_audio_n53.m4a', + 'av_audio_n54.m4a', + 'av_audio_n55.m4a', + 'av_audio_n56.m4a' ] const RECORDER_TIME = 3000; + const RECORDER_LONG_TIME = 3600000; + const LOOP_TIMES = 1000; const FORMAT_M4A = media.ContainerFormatType.CFT_MPEG_4A; const ENCORDER_AAC = media.CodecMimeType.AUDIO_AAC; const ONLYAUDIO_TYPE = 'only_audio'; @@ -45,7 +134,7 @@ export default function avRecorderTest() { let fdObject; let fdPath; - let TAG = "[AudioRecorderLocalTest] "; + let TAG = "[AvRecorderLocalTest] "; let avProfile = { audioBitrate : 48000, audioChannels : 2, @@ -69,16 +158,25 @@ export default function avRecorderTest() { let permissionName4 = 'ohos.permission.WRITE_MEDIA'; let permissionNames = [permissionName1, permissionName2, permissionName3, permissionName4]; await mediaTestBase.getPermission(permissionNames); - await mediaTestBase.msleepAsync(5000); + await mediaTestBase.driveFn(2) + await mediaTestBase.msleepAsync(3000); console.info('beforeAll out'); }) - beforeEach(function () { + beforeEach(async function () { console.info('beforeEach case'); + await avRecorderTestBase.sleep(3000); }) afterEach(async function () { console.info('afterEach case'); + if (avRecorder != null) { + avRecorder.release().then(() => { + console.info(TAG + 'this testCase execution completed') + }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); + } + await avRecorderTestBase.sleep(1000); + console.info('afterEach case'); }) afterAll(function () { @@ -89,7 +187,7 @@ export default function avRecorderTest() { /* * * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0100 * @tc.name : 001.test pause - * @tc.desc : Local Video 001.pause + * @tc.desc : Recorder audio 001.pause * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level2 @@ -106,14 +204,14 @@ export default function avRecorderTest() { /* * * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0100 * @tc.name : 001.test pause->prepare - * @tc.desc : Local Video 01.pause->prepare + * @tc.desc : Recorder pause->prepare * @tc.size : MediumTest - * @tc.type : Function test + * @tc.type : Reliabilit test * @tc.level : Level2 */ it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0100', 0, async function (done) { console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0100 start') - fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[1], "audio"); + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[43], "audio"); fdPath = "fd://" + fdObject.fdNumber; avConfig.url = fdPath; avRecorderTestBase.avRecorderReliabilitTest01(avConfig, avRecorder, RECORDER_TIME, done); @@ -122,15 +220,15 @@ export default function avRecorderTest() { /* * * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0200 - * @tc.name : 001.test prepare without callback - * @tc.desc : Local Video prepare without callback + * @tc.name : 001.test channel + * @tc.desc : Recorder audio channel * @tc.size : MediumTest - * @tc.type : Function test + * @tc.type : Reliabilit test * @tc.level : Level2 */ it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0200', 0, async function (done) { console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0200 start') - fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[2], "audio"); + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[44], "audio"); fdPath = "fd://" + fdObject.fdNumber; avConfig.url = fdPath; avRecorderTestBase.avRecorderReliabilitTest02(avConfig, avRecorder, RECORDER_TIME, done); @@ -139,20 +237,768 @@ export default function avRecorderTest() { /* * * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0300 - * @tc.name : 001.test prepare with callback - * @tc.desc : Local Video prepare with callback + * @tc.name : 001.test channel + * @tc.desc : Recorder audio channel * @tc.size : MediumTest - * @tc.type : Function test + * @tc.type : Reliabilit test * @tc.level : Level2 */ it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0300', 0, async function (done) { console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0300 start') - fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[3], "audio"); + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[45], "audio"); fdPath = "fd://" + fdObject.fdNumber; avConfig.url = fdPath; avRecorderTestBase.avRecorderReliabilitTest03(avConfig, avRecorder, RECORDER_TIME, done); console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0300 end') }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400 + * @tc.name : 001.test resume->prepare + * @tc.desc : Recorder audio resume->prepare + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[46], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest04(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0500 + * @tc.name : 001.test channel + * @tc.desc : Recorder audio channel + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0500 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[47], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest05(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0600 + * @tc.name : 001.test pause->start + * @tc.desc : Recorder audio pause->start + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0600 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[48], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest06(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0700 + * @tc.name : 001.test resume->start + * @tc.desc : Recorder audio resume->start + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0700 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[49], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest07(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_0800 + * @tc.name : 001.test creatAVRecorder->pause + * @tc.desc : Recorder audio creatAVRecorder->pause + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_0800 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[50], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest08(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_0800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0900 + * @tc.name : 001.test prepare->pause + * @tc.desc : Recorder audio prepare->pause + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0900', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0900 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[51], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest09(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0900 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1000 + * @tc.name : 001.test start->pause + * @tc.desc : Recorder audio start->pause + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1000', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1000 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[52], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest10(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1000 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1100 + * @tc.name : 001.test resume->pause + * @tc.desc : Recorder audio resume->pause + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1100 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[53], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest11(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1200 + * @tc.name : 001.test stop->pause + * @tc.desc : Recorder audio stop->pause + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1200 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[54], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest12(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1300 + * @tc.name : 001.test reset->pause + * @tc.desc : Recorder audio reset->pause + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1300 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[55], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest13(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1400 + * @tc.name : 001.test all step->pause + * @tc.desc : Recorder audio all step->pause + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1400 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[56], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest14(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1500 + * @tc.name : 001.test pause three times + * @tc.desc : Recorder audio pause three times + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1500 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[57], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest15(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1600 + * @tc.name : 001.test creatAVRecorder->resume + * @tc.desc : Recorder audio creatAVRecorder->resume + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1600 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[58], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest16(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1700 + * @tc.name : 001.test prepare->resume + * @tc.desc : Recorder audio prepare->resume + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1700 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[59], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest17(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1800 + * @tc.name : 001.test start->resume + * @tc.desc : Recorder audio start->resume + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1800 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[60], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest18(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1900 + * @tc.name : 001.test pause->resume + * @tc.desc : Recorder audio pause->resume + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1900', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1900 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[61], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest19(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1900 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2000 + * @tc.name : 001.test stop->resume + * @tc.desc : Recorder audio stop->resume + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2000', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2000 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[62], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest20(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2000 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2100 + * @tc.name : 001.test reset->resume + * @tc.desc : Recorder audio reset->resume + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2100 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[63], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest21(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2200 + * @tc.name : 001.test all->resume + * @tc.desc : Recorder audio all->resume + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2200 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[64], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest22(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2300 + * @tc.name : 001.test resume threee times + * @tc.desc : Recorder audio resume threee times + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2300 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[65], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest23(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2400 + * @tc.name : 001.test pause->stop + * @tc.desc : Recorder audio pause->stop + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2400 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[66], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest24(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2500 + * @tc.name : 001.test resume->stop + * @tc.desc : Recorder audio resume->stop + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2500 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[67], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest25(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2600 + * @tc.name : 001.test pause->reset + * @tc.desc : Recorder audio pause->reset + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2600 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[68], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest26(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2700 + * @tc.name : 001.test resume->reset + * @tc.desc : Recorder audio resume->reset + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2700 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[69], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest27(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2800 + * @tc.name : 001.test pause->release + * @tc.desc : Recorder audio pause->release + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2800 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[70], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest28(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2900 + * @tc.name : 001.test resume->release + * @tc.desc : Recorder audio resume->release + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2900', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2900 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[71], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest29(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2900 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_3000 + * @tc.name : 001.test release 3 times + * @tc.desc : Recorder audio release 3 times + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_3000', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_3000 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[72], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest30(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_3000 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3100 + * @tc.name : 001.test create->getInputSurface + * @tc.desc : Recorder audio create->getInputSurface + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3100 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[73], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest31(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3200 + * @tc.name : 001.test prepare->getInputSurface + * @tc.desc : Recorder audio prepare->getInputSurface + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3200 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[74], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest32(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3300 + * @tc.name : 001.test start->getInputSurface + * @tc.desc : Recorder audio start->getInputSurface + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3300 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[75], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest33(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3400 + * @tc.name : 001.test pause->getInputSurface + * @tc.desc : Recorder audio pause->getInputSurface + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3400 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[76], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest34(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3500 + * @tc.name : 001.test resume->getInputSurface + * @tc.desc : Recorder audio resume->getInputSurface + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3500 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[77], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest35(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3600 + * @tc.name : 001.test stop->getInputSurface + * @tc.desc : Recorder audio stop->getInputSurface + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3600 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[78], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest36(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3700 + * @tc.name : 001.test reset->getInputSurface + * @tc.desc : Recorder audio reset->getInputSurface + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3700 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[79], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest37(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3800 + * @tc.name : 001.test getInputSurface 3 times + * @tc.desc : Recorder audio getInputSurface 3 times + * @tc.size : MediumTest + * @tc.type : Reliabilit test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3800 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[80], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest38(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0100 + * @tc.name : 001.test createAVRecorder + * @tc.desc : Recorder audio createAVRecorder + * @tc.size : MediumTest + * @tc.type : Performance test + * @tc.level : Level 4 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0100 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[81], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.createTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0200 + * @tc.name : 02.AvRecorder.prepare + * @tc.desc : Recorder audio AvRecorder.prepare + * @tc.size : MediumTest + * @tc.type : Performance test + * @tc.level : Level 4 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0200 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[82], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.prepareTimeCallback(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0300 + * @tc.name : 03.AvRecorder.getInputSurface + * @tc.desc : AvRecorder.getInputSurface + * @tc.size : MediumTest + * @tc.type : Performance test + * @tc.level : Level 4 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0300 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[83], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.getInputSurfaceTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0400 + * @tc.name : 04.AvRecorder.start + * @tc.desc : AvRecorder.start + * @tc.size : MediumTest + * @tc.type : Performance test + * @tc.level : Level 4 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0400 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[84], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.startTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0500 + * @tc.name : 05.AvRecorder.pause + * @tc.desc : AvRecorder.pause + * @tc.size : MediumTest + * @tc.type : Performance test + * @tc.level : Level 4 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0500 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[85], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.pauseTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0600 + * @tc.name : 06.AvRecorder.resume + * @tc.desc : AvRecorder.resume + * @tc.size : MediumTest + * @tc.type : Performance test + * @tc.level : Level 4 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0600 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[86], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.resumeTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0700 + * @tc.name : 07.AvRecorder.stop + * @tc.desc : AvRecorder.stop + * @tc.size : MediumTest + * @tc.type : Performance test + * @tc.level : Level 4 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0700 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[87], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.stopTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0800 + * @tc.name : 08.AvRecorder.reset + * @tc.desc : AvRecorder.reset + * @tc.size : MediumTest + * @tc.type : Performance test + * @tc.level : Level 4 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0800 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[88], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.resetTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0900 + * @tc.name : 09.AvRecorder.release + * @tc.desc : AvRecorder.release + * @tc.size : MediumTest + * @tc.type : Performance test + * @tc.level : Level 4 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0900', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0900 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[89], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.releaseTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0900 end') + }) }) }