提交 e4c3d1d6 编写于 作者: F fulizhong

modify videoRecorder testcases Signed-off-by: FULIZHONG<fulizhong@huawei.com>

Signed-off-by: Nfulizhong <fulizhong@huawei.com>
上级 af28f521
...@@ -18,12 +18,14 @@ group("multimedia") { ...@@ -18,12 +18,14 @@ group("multimedia") {
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"audio/audio_js_standard/audioManager:audio_manager_js_hap", "audio/audio_js_standard/audioManager:audio_manager_js_hap",
"media/media_js_standard/audioDecoder:audio_decoder_js_hap",
"media/media_js_standard/audioEncoder:audio_encoder_js_hap",
"media/media_js_standard/audioPlayer:audio_player_js_hap", "media/media_js_standard/audioPlayer:audio_player_js_hap",
"media/media_js_standard/videoPlayer:video_player_js_hap",
"media/media_js_standard/videoRecorder:video_recorder_js_hap",
"medialibrary/mediaLibrary_js_standard:mediaLibrary_js_hap", "medialibrary/mediaLibrary_js_standard:mediaLibrary_js_hap",
#"media/media_js_standard/audioRecorder:audio_recorder_js_hap", #"media/media_js_standard/audioRecorder:audio_recorder_js_hap",
#"media/media_js_standard/audioDecoder:audio_decoder_js_hap",
#"media/media_js_standard/audioEncoder:audio_encoder_js_hap",
] ]
} else { } else {
deps = [ deps = [
......
...@@ -1143,16 +1143,6 @@ describe('VideoPlayerFuncPromiseTest', function () { ...@@ -1143,16 +1143,6 @@ describe('VideoPlayerFuncPromiseTest', function () {
console.info('case reset called!!'); console.info('case reset called!!');
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoPlayer.getDisplaySurface().then((outSurface) => {
videoPlayer.url = AUDIO_SOURCE;
surfaceID = outSurface;
}, failureCallback).catch(catchCallback);
await videoPlayer.setDisplaySurface(surfaceID).then(() => {
expect(videoPlayer.state).assertEqual('idle');
console.info('case setDisplaySurface success');
}, failureCallback).catch(catchCallback);
await videoPlayer.prepare().then(() => { await videoPlayer.prepare().then(() => {
expect(videoPlayer.state).assertEqual('prepared'); expect(videoPlayer.state).assertEqual('prepared');
expect(videoPlayer.duration).assertEqual(DURATION_TIME); expect(videoPlayer.duration).assertEqual(DURATION_TIME);
......
...@@ -52,6 +52,12 @@ ...@@ -52,6 +52,12 @@
"touch /data/media/40.mp4", "touch /data/media/40.mp4",
"touch /data/media/41.mp4", "touch /data/media/41.mp4",
"touch /data/media/42.mp4", "touch /data/media/42.mp4",
"touch /data/media/43.mp4",
"touch /data/media/44.mp4",
"touch /data/media/45.mp4",
"touch /data/media/46.mp4",
"touch /data/media/47.mp4",
"touch /data/media/48.mp4",
"touch /data/media/API.mp4", "touch /data/media/API.mp4",
"chmod -R 777 /data/media", "chmod -R 777 /data/media",
"setenforce 0" "setenforce 0"
......
...@@ -403,7 +403,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -403,7 +403,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0200', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0200', 0, async function (done) {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PREPARE_EVENT, ERROR_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -434,7 +434,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -434,7 +434,7 @@ describe('VideoRecorderAPICallbackTest', function () {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART, RESUME_EVENT, START_EVENT, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART, RESUME_EVENT,
PREPARE_EVENT, ERROR_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -464,7 +464,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -464,7 +464,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0600', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0600', 0, async function (done) {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, RESET_EVENT, CLOSE_STREAM, PREPARE_EVENT, RELEASE_EVENT, END_EVENT); START_EVENT, CLOSE_STREAM, RESET_EVENT, PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -523,7 +523,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -523,7 +523,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0200', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0200', 0, async function (done) {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -538,7 +538,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -538,7 +538,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0300', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, SETPAUSE, PAUSE_EVENT, START_EVENT, ERROR_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, SETPAUSE, PAUSE_EVENT, START_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -554,7 +554,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -554,7 +554,7 @@ describe('VideoRecorderAPICallbackTest', function () {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART, RESUME_EVENT, START_EVENT, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART, RESUME_EVENT,
START_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -599,7 +599,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -599,7 +599,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0700', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0700', 0, async function (done) {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -614,7 +614,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -614,7 +614,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0800', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0800', 0, async function (done) {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, START_EVENT, START_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, START_EVENT, START_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -776,7 +776,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -776,7 +776,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0300', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, RESUME_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, RESUME_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -792,7 +792,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -792,7 +792,7 @@ describe('VideoRecorderAPICallbackTest', function () {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART, START_EVENT, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART,
RESUME_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); RESUME_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -853,7 +853,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -853,7 +853,7 @@ describe('VideoRecorderAPICallbackTest', function () {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART, START_EVENT, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART,
RESUME_EVENT, RESUME_EVENT, RESUME_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); RESUME_EVENT, RESUME_EVENT, RESUME_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -1134,7 +1134,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -1134,7 +1134,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0300', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT,
GETSURFACE_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); GETSURFACE_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -1149,7 +1149,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -1149,7 +1149,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0400', 0, async function (done) {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT,
SETPAUSE, PAUSE_EVENT, GETSURFACE_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); SETPAUSE, PAUSE_EVENT, GETSURFACE_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -1165,7 +1165,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -1165,7 +1165,7 @@ describe('VideoRecorderAPICallbackTest', function () {
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT,
SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART, RESUME_EVENT, GETSURFACE_EVENT, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART, RESUME_EVENT, GETSURFACE_EVENT,
CLOSE_STREAM, RELEASE_EVENT, END_EVENT); RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
......
...@@ -304,14 +304,6 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -304,14 +304,6 @@ describe('RecorderLocalTestVideoFUNC', function () {
eventEmitter.on(RELEASE_EVENT, async (videoRecorder, steps, done) => { eventEmitter.on(RELEASE_EVENT, async (videoRecorder, steps, done) => {
steps.shift(); steps.shift();
await videoOutput.stop().then(() => {
console.info('case videoOutput stop success');
});
await videoOutput.release().then(() => {
console.info('case videoOutput release success');
});
videoOutput = undefined;
await stopCaptureSession();
videoRecorder.release((err) => { videoRecorder.release((err) => {
if (typeof (err) == 'undefined') { if (typeof (err) == 'undefined') {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
...@@ -321,6 +313,14 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -321,6 +313,14 @@ describe('RecorderLocalTestVideoFUNC', function () {
printfError(err, done); printfError(err, done);
} }
}); });
await videoOutput.stop().then(() => {
console.info('case videoOutput stop success');
});
await videoOutput.release().then(() => {
console.info('case videoOutput release success');
});
videoOutput = undefined;
await stopCaptureSession();
}); });
/* * /* *
...@@ -675,4 +675,52 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -675,4 +675,52 @@ describe('RecorderLocalTestVideoFUNC', function () {
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT); let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
/* *
* @tc.number : SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2200
* @tc.name : 22.videoFrameRate 20 (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2200', 0, async function (done) {
videoConfig.url = 'file:///data/media/46.mp4';
videoConfig.videoFrameRate = 20;
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2300
* @tc.name : 23.videoFrameRate 30 (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2300', 0, async function (done) {
videoConfig.url = 'file:///data/media/47.mp4';
videoConfig.videoFrameRate = 30;
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2400
* @tc.name : 24.videoFrameRate 60 (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2400', 0, async function (done) {
videoConfig.url = 'file:///data/media/48.mp4';
videoConfig.videoFrameRate = 60;
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
}) })
...@@ -219,11 +219,12 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -219,11 +219,12 @@ describe('RecorderLocalTestVideoFUNC', function () {
console.info('case start called'); console.info('case start called');
sleep(RECORDER_TIME); sleep(RECORDER_TIME);
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => { await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await stopVideoOutput(videoOutput); await stopVideoOutput(videoOutput);
done(); done();
}) })
...@@ -270,7 +271,6 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -270,7 +271,6 @@ describe('RecorderLocalTestVideoFUNC', function () {
sleep(RECORDER_TIME); sleep(RECORDER_TIME);
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await videoRecorder.pause().then(() => { await videoRecorder.pause().then(() => {
console.info('case pause called'); console.info('case pause called');
sleep(PAUSE_TIME); sleep(PAUSE_TIME);
...@@ -280,6 +280,7 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -280,6 +280,7 @@ describe('RecorderLocalTestVideoFUNC', function () {
console.info('case release '); console.info('case release ');
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await stopVideoOutput(videoOutput); await stopVideoOutput(videoOutput);
done(); done();
}) })
...@@ -343,6 +344,7 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -343,6 +344,7 @@ describe('RecorderLocalTestVideoFUNC', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await stopVideoOutput(videoOutput); await stopVideoOutput(videoOutput);
done(); done();
}) })
...@@ -388,12 +390,12 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -388,12 +390,12 @@ describe('RecorderLocalTestVideoFUNC', function () {
sleep(RECORDER_TIME); sleep(RECORDER_TIME);
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await videoRecorder.stop().then(() => { await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped'); expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called'); console.info('case stop called');
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => { await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
...@@ -442,12 +444,12 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -442,12 +444,12 @@ describe('RecorderLocalTestVideoFUNC', function () {
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
sleep(RECORDER_TIME); sleep(RECORDER_TIME);
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await videoRecorder.reset().then(() => { await videoRecorder.reset().then(() => {
console.info('case reset called'); console.info('case reset called');
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => { await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
...@@ -642,6 +644,7 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -642,6 +644,7 @@ describe('RecorderLocalTestVideoFUNC', function () {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release '); console.info('case release ');
}, failureCallback).catch(catchCallback); }, failureCallback).catch(catchCallback);
await videoOutput.stop();
await stopVideoOutput(videoOutput); await stopVideoOutput(videoOutput);
done(); done();
}) })
...@@ -1369,4 +1372,148 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1369,4 +1372,148 @@ describe('RecorderLocalTestVideoFUNC', function () {
await stopVideoOutput(videoOutput); await stopVideoOutput(videoOutput);
done(); done();
}) })
/* *
* @tc.number : SUB_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2200
* @tc.name : 22.videoFrameRate 20 (promise)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2200', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
videoConfig.url = 'file:///data/media/43.mp4';
videoConfig.videoFrameRate = 20;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
}, failureCallback).catch(catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, failureCallback).catch(catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
sleep(RECORDER_TIME);
}, failureCallback).catch(catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, failureCallback).catch(catchCallback);
await stopVideoOutput(videoOutput);
done();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2300
* @tc.name : 23.videoFrameRate 30 (promise)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2300', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
videoConfig.url = 'file:///data/media/44.mp4';
videoConfig.videoFrameRate = 30;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
}, failureCallback).catch(catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, failureCallback).catch(catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
sleep(RECORDER_TIME);
}, failureCallback).catch(catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, failureCallback).catch(catchCallback);
await stopVideoOutput(videoOutput);
done();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2400
* @tc.name : 24.videoFrameRate 60 (promise)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2400', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
videoConfig.url = 'file:///data/media/45.mp4';
videoConfig.videoFrameRate = 60;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, failureCallback).catch(catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
}, failureCallback).catch(catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, failureCallback).catch(catchCallback);
videoOutput = await camera.createVideoOutput(surfaceID);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
sleep(RECORDER_TIME);
}, failureCallback).catch(catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, failureCallback).catch(catchCallback);
await stopVideoOutput(videoOutput);
done();
})
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册