From 4e3b8f617d6fa58dc6a889153c84659d86a0e879 Mon Sep 17 00:00:00 2001 From: fulizhong Date: Thu, 16 Jun 2022 16:19:58 +0800 Subject: [PATCH] modify videoPlayer and videoRecorder testcases Signed-off-by: FULIZHONG Signed-off-by: fulizhong --- .../media_js_standard/VideoPlayerTestBase.js | 10 ---- .../test/VideoPlayerFuncCallbackTest.test.js | 3 +- .../test/VideoPlayerFuncPromiseTest.test.js | 3 +- .../VideoRecorderFuncCallbackTest.test.js | 6 +- .../test/VideoRecorderFuncPromiseTest.test.js | 57 +++++++++---------- 5 files changed, 33 insertions(+), 46 deletions(-) diff --git a/multimedia/media/media_js_standard/VideoPlayerTestBase.js b/multimedia/media/media_js_standard/VideoPlayerTestBase.js index 723fa3f28..365e2bfae 100644 --- a/multimedia/media/media_js_standard/VideoPlayerTestBase.js +++ b/multimedia/media/media_js_standard/VideoPlayerTestBase.js @@ -16,16 +16,6 @@ import media from '@ohos.multimedia.media' import * as mediaTestBase from './MediaTestBase.js'; -export function checkDescription(actualDescription, descriptionKey, descriptionValue) { - for (let i = 0; i < descriptionKey.length; i++) { - let property = actualDescription[descriptionKey[i]]; - console.info('case key is '+ descriptionKey[i]); - console.info('case actual value is '+ property); - console.info('case hope value is '+ descriptionValue[i]); - expect(property).assertEqual(descriptionValue[i]); - } -} - export async function playVideoSource(url, width, height, duration, playTime, done) { console.info(`case media source url: ${url}`) let videoPlayer = null; diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js index b368c332d..ccaf7bba6 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js @@ -15,7 +15,6 @@ import media from '@ohos.multimedia.media' import * as mediaTestBase from '../../../../../MediaTestBase.js'; -import * as videoPlayerBase from '../../../../../VideoPlayerTestBase.js'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('VideoPlayerFuncCallbackTest', function () { @@ -232,7 +231,7 @@ describe('VideoPlayerFuncCallbackTest', function () { videoPlayer.getTrackDescription((err, arrlist) => { if (typeof (err) == 'undefined') { for (let i = 0; i < arrlist.length; i++) { - videoPlayerBase.checkDescription(arrlist[i], descriptionKey[i], descriptionValue[i]); + mediaTestBase.checkDescription(arrlist[i], descriptionKey[i], descriptionValue[i]); } toNextStep(videoPlayer, steps, done); } else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) { diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js index 2b5d89f54..f952832df 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js @@ -15,7 +15,6 @@ import media from '@ohos.multimedia.media' import * as mediaTestBase from '../../../../../MediaTestBase.js'; -import * as videoPlayerBase from '../../../../../VideoPlayerTestBase.js'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('VideoPlayerFuncPromiseTest', function () { @@ -485,7 +484,7 @@ describe('VideoPlayerFuncPromiseTest', function () { }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); for (let i = 0; i < arrayDescription.length; i++) { - videoPlayerBase.checkDescription(arrayDescription[i], descriptionKey[i], descriptionValue[i]); + mediaTestBase.checkDescription(arrayDescription[i], descriptionKey[i], descriptionValue[i]); } await videoPlayer.release().then(() => { diff --git a/multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncCallbackTest.test.js index 9a798810b..f8d581fda 100644 --- a/multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncCallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncCallbackTest.test.js @@ -758,7 +758,7 @@ describe('VideoRecorderFuncCallbackTest', function () { fdObject = await mediaTestBase.getFd('recorder_callback_22.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); videoConfig.url = fdPath; - videoConfig.videoFrameRate = 20; + configFile.videoFrameRate = 20; let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let videoRecorder = null; let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, @@ -778,7 +778,7 @@ describe('VideoRecorderFuncCallbackTest', function () { fdObject = await mediaTestBase.getFd('recorder_callback_23.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); videoConfig.url = fdPath; - videoConfig.videoFrameRate = 30; + configFile.videoFrameRate = 30; let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let videoRecorder = null; let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, @@ -798,7 +798,7 @@ describe('VideoRecorderFuncCallbackTest', function () { fdObject = await mediaTestBase.getFd('recorder_callback_24.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); videoConfig.url = fdPath; - videoConfig.videoFrameRate = 60; + configFile.videoFrameRate = 60; let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); let videoRecorder = null; let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, diff --git a/multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js b/multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js index 2a1509d8e..2e574de1c 100644 --- a/multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js +++ b/multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js @@ -22,7 +22,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' describe('VideoRecorderFuncPromiseTest', function () { const RECORDER_TIME = 3000; const PAUSE_TIME = 1000; - const DELTA_TIME = 1000; const ONLYVIDEO_TYPE = 'only_video'; const AUDIO_VIDEO_TYPE = 'audio_video'; let cameraManager; @@ -189,7 +188,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -250,7 +249,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -315,7 +314,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -389,7 +388,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -453,7 +452,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -517,7 +516,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -589,7 +588,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -660,7 +659,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -739,7 +738,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -817,7 +816,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -886,7 +885,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -955,7 +954,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1024,7 +1023,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1093,7 +1092,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1151,7 +1150,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1218,7 +1217,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1291,7 +1290,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1355,7 +1354,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1419,7 +1418,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1478,7 +1477,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1536,7 +1535,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1594,7 +1593,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1616,7 +1615,7 @@ describe('VideoRecorderFuncPromiseTest', function () { fdObject = await mediaTestBase.getFd('recorder_promise_22.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); videoConfig.url = fdPath; - videoConfig.videoFrameRate = 20; + configFile.videoFrameRate = 20; let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); await media.createVideoRecorder().then((recorder) => { console.info('case createVideoRecorder called'); @@ -1652,7 +1651,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1674,7 +1673,7 @@ describe('VideoRecorderFuncPromiseTest', function () { fdObject = await mediaTestBase.getFd('recorder_promise_23.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); videoConfig.url = fdPath; - videoConfig.videoFrameRate = 30; + configFile.videoFrameRate = 30; let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); await media.createVideoRecorder().then((recorder) => { console.info('case createVideoRecorder called'); @@ -1710,7 +1709,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); @@ -1732,7 +1731,7 @@ describe('VideoRecorderFuncPromiseTest', function () { fdObject = await mediaTestBase.getFd('recorder_promise_24.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); videoConfig.url = fdPath; - videoConfig.videoFrameRate = 60; + configFile.videoFrameRate = 60; let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile); await media.createVideoRecorder().then((recorder) => { console.info('case createVideoRecorder called'); @@ -1768,7 +1767,7 @@ describe('VideoRecorderFuncPromiseTest', function () { await videoOutput.release().then(() => { console.info('[camera] case videoOutput release success'); }); - videoOutPut = undefined; + videoOutput = undefined; await videoRecorderBase.stopCaptureSession(captureSession); await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId); await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber); -- GitLab