From 1bdb34e1e8e9d188c3724ba42e33326f34ef7e2f Mon Sep 17 00:00:00 2001 From: ling990 Date: Mon, 25 Apr 2022 15:24:48 +0800 Subject: [PATCH] modify testcases Signed-off-by: ling990 Signed-off-by: ling990 --- .../src/main/js/test/AudioDecoderFuncCallbackTest.test.js | 7 ++++--- .../src/main/js/test/AudioEncoderFuncCallbackTest.test.js | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncCallbackTest.test.js b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncCallbackTest.test.js index da36d3479..4f8515f6c 100644 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncCallbackTest.test.js +++ b/multimedia/media/media_js_standard/audioDecoder/src/main/js/test/AudioDecoderFuncCallbackTest.test.js @@ -748,10 +748,11 @@ describe('AudioDecoderFuncCallback', function () { }) }); eventEmitter.on('start', () => { - audioDecodeProcessor.start((err) => { + audioDecodeProcessor.start(async(err) => { expect(err).assertUndefined(); console.info(`case start 1`); - setTimeout(() => {eventEmitter.emit('flush')},2000) + await sleep(2000); + eventEmitter.emit('flush'); }) }); eventEmitter.on('flush', () => { @@ -759,7 +760,7 @@ describe('AudioDecoderFuncCallback', function () { outputQueue = []; audioDecodeProcessor.flush((err) => { expect(err).assertUndefined(); - console.info(`case flush after 2s`); + console.info(`case flush after 2s success`); }) }); media.createAudioDecoderByMime('audio/mp4a-latm', (err, processor) => { diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncCallbackTest.test.js b/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncCallbackTest.test.js index 9ca826d35..6951f4987 100644 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncCallbackTest.test.js +++ b/multimedia/media/media_js_standard/audioEncoder/src/main/js/test/AudioEncoderFuncCallbackTest.test.js @@ -582,10 +582,11 @@ describe('AudioEncoderFuncCallback', function () { }) }); eventEmitter.on('start', () => { - audioEncodeProcessor.start((err) => { + audioEncodeProcessor.start(async(err) => { expect(err).assertUndefined(); console.info(`case start 1`); - setTimeout(() => {eventEmitter.emit('flush')},5000) + await sleep(2000); + eventEmitter.emit('flush'); }) }); eventEmitter.on('flush', () => { @@ -593,7 +594,7 @@ describe('AudioEncoderFuncCallback', function () { outputQueue = []; audioEncodeProcessor.flush((err) => { expect(err).assertUndefined(); - console.info(`case flush after 5s`); + console.info(`case flush after 2s success`); }) }); media.createAudioEncoderByMime('audio/mp4a-latm', (err, processor) => { -- GitLab