diff --git a/multimedia/media/media_js_standard/AVRecorderTestBase.js b/multimedia/media/media_js_standard/AVRecorderTestBase.js index c4c78e938ef58987e6e805df5303d3967874b9f1..c5629e1759dd8d1531a95ee0c55fb8561da60bb6 100644 --- a/multimedia/media/media_js_standard/AVRecorderTestBase.js +++ b/multimedia/media/media_js_standard/AVRecorderTestBase.js @@ -1910,7 +1910,7 @@ export async function avRecorderReliabilitTest31(avConfig, avRecorder, recorderT let surfaceID = null; let result = true; avRecorder = await idle(avRecorder); - avRecorder.getInputSurface().then((surfaceId) => { + await avRecorder.getInputSurface().then((surfaceId) => { console.info('avRecorderReliabilitTest31 getInputSurface success'); surfaceID = surfaceId; }).catch((err) => { @@ -2196,6 +2196,18 @@ export async function avRecorderReliabilitTest37(avConfig, avRecorder, recorderT await preparePromise(avRecorder, avConfig) } +async function getInputSurfaceCatachError(avRecorder, result, surfaceID){ + await avRecorder.getInputSurface().then((surfaceId) => { + console.info('getInputSurfaceTest38 getInputSurface success'); + surfaceID = surfaceId; + }).catch((err) => { + console.info('getInputSurfaceTest38 getInputSurface failed and catch error is ' + err.message); + result = false + console.info('getInputSurfaceTest38 getInputSurface result is ' + result); + expect(result).assertEqual(false); + }); +} + export async function getInputSurfaceTest38(avConfig, avRecorder, recorderTime, done) { let result1 = true; let result2 = true; @@ -2208,33 +2220,9 @@ export async function getInputSurfaceTest38(avConfig, avRecorder, recorderTime, 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); + getInputSurfaceCatachError(avRecorder, result1, surfaceID) + getInputSurfaceCatachError(avRecorder, result2, surfaceID) + getInputSurfaceCatachError(avRecorder, result3, surfaceID) releasePromise(avRecorder) break; case AV_RECORDER_STATE.RELEASED: @@ -2256,6 +2244,7 @@ export async function getInputSurfaceTest38(avConfig, avRecorder, recorderTime, }); } + export async function avRecorderReliabilitTest38(avConfig, avRecorder, recorderTime, done) { avRecorder = await idle(avRecorder); getInputSurfaceTest38(avConfig, avRecorder, recorderTime, done)