未验证 提交 5ec8af91 编写于 作者: O openharmony_ci 提交者: Gitee

!3172 videoRecorder 测试用例添加自动校验功能

Merge pull request !3172 from FULIZHONG/flz0512
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
import resourceManager from '@ohos.resourceManager'; import resourceManager from '@ohos.resourceManager';
import {expect} from 'deccjsunit/index' import {expect} from 'deccjsunit/index'
import router from '@system.router'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
// File operation // File operation
export async function getFileDescriptor(fileName) { export async function getFileDescriptor(fileName) {
...@@ -85,3 +89,80 @@ export function printDescription(obj) { ...@@ -85,3 +89,80 @@ export function printDescription(obj) {
description += i + " = " + property + "\n"; description += i + " = " + property + "\n";
} }
} }
export async function toNewPage(pagePath1, pagePath2, page) {
let path = '';
if (page == 0) {
path = pagePath1;
} else {
path = pagePath2;
}
let options = {
uri: path,
}
try {
await router.push(options);
} catch {
console.info('case route failed');
}
}
export async function clearRouter() {
await router.clear();
}
export async function getFd(pathName) {
let fdObject = {
fileAsset : null,
fdNumber : null
}
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
fdObject.fileAsset = await fetchFileResult.getAllObject();
fdObject.fdNumber = await fdObject.fileAsset[0].open('Rw');
console.info('case getFd number is: ' + fdObject.fdNumber);
}
return fdObject;
}
export async function closeFd(fileAsset, fdNumber) {
if (fileAsset != null) {
await fileAsset[0].close(fdNumber).then(() => {
console.info('[mediaLibrary] case close fd success');
}).catch((err) => {
console.info('[mediaLibrary] case close fd failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
}
}
// apply permission for test hap
export async function applyPermission(applictionName, permissionNames) {
let appInfo = await bundle.getApplicationInfo(applictionName, 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
for (let i = 0; i < permissionNames.length; i++) {
await atManager.grantUserGrantedPermission(tokenID, permissionNames[i], 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
}
} else {
console.info('[permission] case apply permission failed, createAtManager failed');
}
}
\ No newline at end of file
...@@ -13,31 +13,20 @@ ...@@ -13,31 +13,20 @@
* limitations under the License. * limitations under the License.
*/ */
import router from '@system.router'
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import * as mediaTestBase from './MediaTestBase.js'; import * as mediaTestBase from './MediaTestBase.js';
export async function toNewPage(pagePath1, pagePath2, page) { export function checkDescription(actualDescription, descriptionKey, descriptionValue) {
let path = ''; for (let i = 0; i < descriptionKey.length; i++) {
if (page == 0) { let property = actualDescription[descriptionKey[i]];
path = pagePath1; console.info('case key is '+ descriptionKey[i]);
} else { console.info('case actual value is '+ property);
path = pagePath2; console.info('case hope value is '+ descriptionValue[i]);
} expect(property).assertEqual(descriptionValue[i]);
let options = {
uri: path,
}
try {
await router.push(options);
} catch {
console.info('case route failed');
} }
} }
export async function clearRouter() {
await router.clear();
}
export async function playVideoSource(url, width, height, duration, playTime, done) { export async function playVideoSource(url, width, height, duration, playTime, done) {
console.info(`case media source url: ${url}`) console.info(`case media source url: ${url}`)
let videoPlayer = null; let videoPlayer = null;
...@@ -186,3 +175,4 @@ export async function playVideoSource(url, width, height, duration, playTime, do ...@@ -186,3 +175,4 @@ export async function playVideoSource(url, width, height, duration, playTime, do
console.info('case release called'); console.info('case release called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
} }
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {expect} from 'deccjsunit/index'
import camera from '@ohos.multimedia.camera'
import media from '@ohos.multimedia.media'
import * as mediaTestBase from './MediaTestBase.js';
const VIDEO_TRACK = 'video_track';
const AUDIO_TRACK = 'audio_track';
const AUDIO_VIDEO_TYPE = 'audio_video';
const DELTA_TIME = 1000;
const PLAY_TIME = 1000;
let tarckType = new Array(VIDEO_TRACK, AUDIO_TRACK);
export async function initCaptureSession(videoOutPut, cameraManager, cameras, cameraID) {
let cameraInput = await cameraManager.createCameraInput(cameras[cameraID].cameraId);
if (cameraInput != null) {
console.info('[camera] case createCameraInput success');
} else {
console.info('[camera] case createCameraInput failed');
return;
}
let captureSession = await camera.createCaptureSession(null);
await captureSession.beginConfig();
await captureSession.addInput(cameraInput);
await captureSession.addOutput(videoOutPut);
await captureSession.commitConfig();
return captureSession;
}
export async function stopCaptureSession(captureSession) {
await captureSession.release();
}
export function getTrackArray(videoType, recorderConfigFile) {
if (videoType == AUDIO_VIDEO_TYPE) {
let audioTrack = new Array(recorderConfigFile.audioBitrate, recorderConfigFile.audioChannels,
'audio/mpeg', recorderConfigFile.audioSampleRate);
let videoTrack = new Array('video/mpeg', recorderConfigFile.videoFrameHeight,
recorderConfigFile.videoFrameWidth);
let trackArray = new Array(videoTrack, audioTrack);
return trackArray;
} else {
let videoTrack = new Array('video/mpeg',
recorderConfigFile.videoFrameHeight, recorderConfigFile.videoFrameWidth);
let trackArray = new Array(videoTrack);
return trackArray;
}
}
export function checkDescription(obj, trackTpye, descriptionValue) {
let index = 0;
if (trackTpye == VIDEO_TRACK) {
console.info('case video codec_mime is '+ obj['codec_mime']);
expect(obj['codec_mime']).assertEqual(descriptionValue[index++]);
console.info('case video height is '+ obj['height']);
expect(obj['height']).assertEqual(descriptionValue[index++]);
console.info('case video width is '+ obj['width']);
expect(obj['width']).assertEqual(descriptionValue[index++]);
} else {
console.info('case audio bitrate is '+ obj['bitrate']);
expect(obj['bitrate']).assertClose(descriptionValue[index++], 2 * DELTA_TIME);
console.info('case audio channel_count is '+ obj['channel_count']);
expect(obj['channel_count']).assertEqual(descriptionValue[index++]);
console.info('case audio codec_mime is '+ obj['codec_mime']);
expect(obj['codec_mime']).assertEqual(descriptionValue[index++]);
console.info('case audio sample_rate is '+ obj['sample_rate']);
expect(obj['sample_rate']).assertEqual(descriptionValue[index++]);
}
}
export async function checkVideos(playFdPath, duration, trackArray, playerSurfaceId) {
let videoPlayer = null;
let arrayDescription = null;
await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') {
videoPlayer = video;
expect(videoPlayer.state).assertEqual('idle');
} else {
console.info('case createVideoPlayer is failed');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
console.info('[checkVideos] case checkVideos fdPath is :' + playFdPath);
videoPlayer.url = playFdPath;
await videoPlayer.setDisplaySurface(playerSurfaceId).then(() => {
console.info('case setDisplaySurface success');
expect(videoPlayer.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.prepare().then(() => {
expect(videoPlayer.state).assertEqual('prepared');
expect(videoPlayer.duration).assertClose(duration, DELTA_TIME);
console.info('case prepare called!!');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.getTrackDescription().then((arrayList) => {
console.info('case getTrackDescription called!!');
if (typeof (arrayList) != 'undefined') {
arrayDescription = arrayList;
} else {
console.info('case getTrackDescription is failed');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let startTime = videoPlayer.currentTime;
await videoPlayer.play().then(() => {
console.info('case play called!!');
mediaTestBase.msleep(PLAY_TIME);
expect(videoPlayer.state).assertEqual('playing');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
let endTime = videoPlayer.currentTime;
expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME);
await videoPlayer.stop().then(() => {
console.info('case stop called!!');
expect(videoPlayer.state).assertEqual('stopped');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoPlayer.release().then(() => {
console.info('case release called!!');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
expect(arrayDescription.length).assertEqual(trackArray.length);
for (let i = 0; i < arrayDescription.length; i++) {
checkDescription(arrayDescription[i], tarckType[i], trackArray[i]);
}
}
\ No newline at end of file
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
*/ */
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import {toNewPage, clearRouter} from '../../../../../VideoPlayerTestBase.js';
import * as mediaTestBase from '../../../../../MediaTestBase.js'; import * as mediaTestBase from '../../../../../MediaTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
...@@ -64,7 +63,7 @@ describe('VideoPlayerAPICallbackTest', function () { ...@@ -64,7 +63,7 @@ describe('VideoPlayerAPICallbackTest', function () {
await mediaTestBase.getFileDescriptor(VIDEO_SOURCE).then((res) => { await mediaTestBase.getFileDescriptor(VIDEO_SOURCE).then((res) => {
fileDescriptor = res; fileDescriptor = res;
}); });
await toNewPage(pagePath1, pagePath2, pageId); await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId);
pageId = (pageId + 1) % 2; pageId = (pageId + 1) % 2;
await mediaTestBase.msleepAsync(1000).then( await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); () => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
...@@ -74,7 +73,7 @@ describe('VideoPlayerAPICallbackTest', function () { ...@@ -74,7 +73,7 @@ describe('VideoPlayerAPICallbackTest', function () {
}) })
afterEach(async function() { afterEach(async function() {
await clearRouter(); await mediaTestBase.clearRouter();
await mediaTestBase.closeFileDescriptor(VIDEO_SOURCE); await mediaTestBase.closeFileDescriptor(VIDEO_SOURCE);
console.info('afterEach case'); console.info('afterEach case');
}) })
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
*/ */
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import {toNewPage, clearRouter} from '../../../../../VideoPlayerTestBase.js';
import * as mediaTestBase from '../../../../../MediaTestBase.js'; import * as mediaTestBase from '../../../../../MediaTestBase.js';
import * as videoPlayerBase from '../../../../../VideoPlayerTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoPlayerFuncCallbackTest', function () { describe('VideoPlayerFuncCallbackTest', function () {
...@@ -66,7 +66,7 @@ describe('VideoPlayerFuncCallbackTest', function () { ...@@ -66,7 +66,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
}) })
beforeEach(async function() { beforeEach(async function() {
await toNewPage(pagePath1, pagePath2, pageId); await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId);
pageId = (pageId + 1) % 2; pageId = (pageId + 1) % 2;
await mediaTestBase.msleepAsync(1000).then( await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); () => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
...@@ -76,7 +76,7 @@ describe('VideoPlayerFuncCallbackTest', function () { ...@@ -76,7 +76,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
}) })
afterEach(async function() { afterEach(async function() {
await clearRouter(); await mediaTestBase.clearRouter();
console.info('afterEach case'); console.info('afterEach case');
}) })
...@@ -221,10 +221,18 @@ describe('VideoPlayerFuncCallbackTest', function () { ...@@ -221,10 +221,18 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter.on(GETDESCRIPTION, (videoPlayer, steps, done) => { eventEmitter.on(GETDESCRIPTION, (videoPlayer, steps, done) => {
steps.shift(); steps.shift();
let videoTrackKey = new Array('bitrate', 'codec_mime', 'frame_rate', 'height',
'track_index', 'track_type', 'width');
let audioTrackKey = new Array('bitrate', 'channel_count', 'codec_mime', 'sample_rate',
'track_index', 'track_type');
let videoTrackValue = new Array(1366541, 'video/x-h264', 6000, 480, 0, 1, 720);
let audioTrackValue = new Array(129207, 2, 'audio/mpeg', 44100, 1, 0);
let descriptionKey = new Array(videoTrackKey, audioTrackKey);
let descriptionValue = new Array(videoTrackValue, audioTrackValue);
videoPlayer.getTrackDescription((err, arrlist) => { videoPlayer.getTrackDescription((err, arrlist) => {
if (typeof (err) == 'undefined') { if (typeof (err) == 'undefined') {
for (let i = 0; i < arrlist.length; i++) { for (let i = 0; i < arrlist.length; i++) {
mediaTestBase.printDescription(arrlist[i]); videoPlayerBase.checkDescription(arrlist[i], descriptionKey[i], descriptionValue[i]);
} }
toNextStep(videoPlayer, steps, done); toNextStep(videoPlayer, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) { } else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
*/ */
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import {toNewPage, clearRouter} from '../../../../../VideoPlayerTestBase.js';
import * as mediaTestBase from '../../../../../MediaTestBase.js'; import * as mediaTestBase from '../../../../../MediaTestBase.js';
import * as videoPlayerBase from '../../../../../VideoPlayerTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoPlayerFuncPromiseTest', function () { describe('VideoPlayerFuncPromiseTest', function () {
...@@ -44,7 +44,7 @@ describe('VideoPlayerFuncPromiseTest', function () { ...@@ -44,7 +44,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
}) })
beforeEach(async function() { beforeEach(async function() {
await toNewPage(pagePath1, pagePath2, pageId); await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId);
pageId = (pageId + 1) % 2; pageId = (pageId + 1) % 2;
await mediaTestBase.msleepAsync(1000).then( await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); () => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
...@@ -54,7 +54,7 @@ describe('VideoPlayerFuncPromiseTest', function () { ...@@ -54,7 +54,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
}) })
afterEach(async function() { afterEach(async function() {
await clearRouter(); await mediaTestBase.clearRouter();
console.info('afterEach case'); console.info('afterEach case');
}) })
...@@ -445,6 +445,14 @@ describe('VideoPlayerFuncPromiseTest', function () { ...@@ -445,6 +445,14 @@ describe('VideoPlayerFuncPromiseTest', function () {
mediaTestBase.isFileOpen(fileDescriptor, done); mediaTestBase.isFileOpen(fileDescriptor, done);
let videoPlayer = null; let videoPlayer = null;
let arrayDescription = null; let arrayDescription = null;
let videoTrackKey = new Array('bitrate', 'codec_mime', 'frame_rate', 'height',
'track_index', 'track_type', 'width');
let audioTrackKey = new Array('bitrate', 'channel_count', 'codec_mime', 'sample_rate',
'track_index', 'track_type');
let videoTrackValue = new Array(1366541, 'video/x-h264', 6000, 480, 0, 1, 720);
let audioTrackValue = new Array(129207, 2, 'audio/mpeg', 44100, 1, 0);
let descriptionKey = new Array(videoTrackKey, audioTrackKey);
let descriptionValue = new Array(videoTrackValue, audioTrackValue);
await media.createVideoPlayer().then((video) => { await media.createVideoPlayer().then((video) => {
if (typeof (video) != 'undefined') { if (typeof (video) != 'undefined') {
videoPlayer = video; videoPlayer = video;
...@@ -477,7 +485,7 @@ describe('VideoPlayerFuncPromiseTest', function () { ...@@ -477,7 +485,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
for (let i = 0; i < arrayDescription.length; i++) { for (let i = 0; i < arrayDescription.length; i++) {
mediaTestBase.printDescription(arrayDescription[i]); videoPlayerBase.checkDescription(arrayDescription[i], descriptionKey[i], descriptionValue[i]);
} }
await videoPlayer.release().then(() => { await videoPlayer.release().then(() => {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"rm -rf /storage/media/100/local/files/Videos/*"
], ],
"teardown-command":[ "teardown-command":[
] ]
......
...@@ -91,7 +91,9 @@ ...@@ -91,7 +91,9 @@
"js": [ "js": [
{ {
"pages": [ "pages": [
"pages/index/index" "pages/index/index",
"pages/surfaceTest/surfaceTest",
"pages/surfaceTest2/surfaceTest2"
], ],
"name": "default", "name": "default",
"window": { "window": {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import {Core, ExpectExtend} from 'deccjsunit/index' import {Core, ExpectExtend} from 'deccjsunit/index'
import * as mediaTestBase from '../../../../../../../MediaTestBase.js';
export default { export default {
data: { data: {
title: "" title: ""
...@@ -22,8 +22,17 @@ export default { ...@@ -22,8 +22,17 @@ export default {
onInit() { onInit() {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { async onShow() {
console.info('onShow finish') console.info('onShow finish')
let applictionName = 'ohos.acts.multimedia.video.videorecorder';
let permissionName1 = 'ohos.permission.CAMERA';
let permissionName2 = 'ohos.permission.MICROPHONE';
let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionNames = new Array(permissionName1, permissionName2, permissionName3,
permissionName4, permissionName5);
await mediaTestBase.applyPermission(applictionName, permissionNames);
const core = Core.getInstance() const core = Core.getInstance()
const expectExtend = new ExpectExtend({ const expectExtend = new ExpectExtend({
'id': 'extend' 'id': 'extend'
......
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
VideoRecorder Test
</text>
<Xcomponent id = 'XcomponentId2'
type = 'surface'
onload = 'LoadXcomponent2'
style = "width:720px;height:480px;border-color:red;border-width:5px">
</Xcomponent>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
import Fileio from '@ohos.fileio'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
},
onReady() {
},
LoadXcomponent2() {
globalThis.value = this.$element('XcomponentId2').getXComponentSurfaceId()
},
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
VideoRecorder Test
</text>
<Xcomponent id = 'XcomponentId3'
type = 'surface'
onload = 'LoadXcomponent3'
style = "width:720px;height:480px;border-color:red;border-width:5px">
</Xcomponent>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
import Fileio from '@ohos.fileio'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
},
onReady() {
},
LoadXcomponent3() {
globalThis.value = this.$element('XcomponentId3').getXComponentSurfaceId()
},
}
\ No newline at end of file
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import camera from '@ohos.multimedia.camera' import camera from '@ohos.multimedia.camera'
import mediaLibrary from '@ohos.multimedia.mediaLibrary' import * as mediaTestBase from '../../../../../MediaTestBase.js';
import * as videoRecorderBase from '../../../../../VideoRecorderTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoRecorderAPICallbackTest', function () { describe('VideoRecorderAPICallbackTest', function () {
...@@ -24,7 +25,6 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -24,7 +25,6 @@ describe('VideoRecorderAPICallbackTest', function () {
const END_EVENT = 'end'; const END_EVENT = 'end';
const CREATE_EVENT = 'create'; const CREATE_EVENT = 'create';
const PREPARE_EVENT = 'prepare'; const PREPARE_EVENT = 'prepare';
const PREPARE_OLNYVIDEO_EVENT = 'prepare_only';
const GETSURFACE_EVENT = 'getInputSurface'; const GETSURFACE_EVENT = 'getInputSurface';
const START_EVENT = 'start'; const START_EVENT = 'start';
const PAUSE_EVENT = 'pause'; const PAUSE_EVENT = 'pause';
...@@ -33,9 +33,6 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -33,9 +33,6 @@ describe('VideoRecorderAPICallbackTest', function () {
const RESET_EVENT = 'reset'; const RESET_EVENT = 'reset';
const RELEASE_EVENT = 'release'; const RELEASE_EVENT = 'release';
const START_STREEAM = 'start_stream'; const START_STREEAM = 'start_stream';
const SETEXIT = 'setExit';
const SETSTART = 'setStart';
const SETPAUSE = 'setPause';
const CLOSE_STREAM = 'close_stream'; const CLOSE_STREAM = 'close_stream';
const ERROR_EVENT = 'error'; const ERROR_EVENT = 'error';
let cameraManager; let cameraManager;
...@@ -44,63 +41,53 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -44,63 +41,53 @@ describe('VideoRecorderAPICallbackTest', function () {
let videoOutput; let videoOutput;
let surfaceID; let surfaceID;
let fdPath; let fdPath;
let fileAsset; let fdObject;
let fdNumber; let cameraID = 0;
let events = require('events'); let events = require('events');
let eventEmitter = new events.EventEmitter(); let eventEmitter = new events.EventEmitter();
let configFile = { let configFile = {
audioBitrate : 48000, audioBitrate : 48000,
audioChannels : 2, audioChannels : 2,
audioCodec : 'audio/mp4a-latm', audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000, audioSampleRate : 48000,
durationTime : 1000, durationTime : 1000,
fileFormat : 'mp4', fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 48000, videoBitrate : 48000,
videoCodec : 'video/mp4v-es', videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth : 640, videoFrameWidth : 640,
videoFrameHeight : 480, videoFrameHeight : 480,
videoFrameRate : 10 videoFrameRate : 10
} }
// rotation 0, 90, 180, 270 // rotation 0, 90, 180, 270
let videoConfig = { let videoConfig = {
audioSourceType : 1, audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : 0, videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV,
profile : configFile, profile : configFile,
url : 'file:///data/media/API.mp4', url : 'fd://',
rotation : 0, rotation : 0,
location : { latitude : 30, longitude : 130 }, location : { latitude : 30, longitude : 130 },
maxSize : 100, maxSize : 100,
maxDuration : 500 maxDuration : 500
} }
let onlyVideoProfile = { beforeAll(async function () {
durationTime : 1000, cameraManager = await camera.getCameraManager(null);
fileFormat : 'mp4', if (cameraManager != null) {
videoBitrate : 48000, console.info('[camera] case getCameraManager success');
videoCodec : 'video/mp4v-es', } else {
videoFrameWidth : 640, console.info('[camera] case getCameraManager failed');
videoFrameHeight : 480, return;
videoFrameRate : 10
}
let onlyVideoConfig = {
videoSourceType : 0,
profile : onlyVideoProfile,
url : 'file:///data/media/API.mp4',
rotation : 0,
location : { latitude : 30, longitude : 130 },
maxSize : 100,
maxDuration : 500
} }
cameras = await cameraManager.getCameras();
function sleep(time) { if (cameras != null) {
for(let t = Date.now();Date.now() - t <= time;); console.info('[camera] case getCameras success');
} else {
console.info('[camera] case getCameras failed');
} }
fdObject = await mediaTestBase.getFd('recorder_callback_api.mp4');
beforeAll(async function () { fdPath = "fd://" + fdObject.fdNumber.toString();
await initCamera(); videoConfig.url = fdPath;
await getFd('API.mp4');
console.info('beforeAll case'); console.info('beforeAll case');
}) })
...@@ -114,76 +101,10 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -114,76 +101,10 @@ describe('VideoRecorderAPICallbackTest', function () {
}) })
afterAll(async function () { afterAll(async function () {
await closeFd(); await mediaTestBase.closeFd();
console.info('afterAll case'); console.info('afterAll case');
}) })
async function getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
fileAsset = await fetchFileResult.getAllObject();
fdNumber = await fileAsset[0].open('Rw');
fdPath = "fd://" + fdNumber.toString();
}
}
async function closeFd() {
if (fileAsset != null) {
await fileAsset[0].close(fdNumber).then(() => {
console.info('[mediaLibrary] case close fd success');
}).catch((err) => {
console.info('[mediaLibrary] case close fd failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
}
}
async function initCamera() {
cameraManager = await camera.getCameraManager(null);
if (cameraManager != null) {
console.info('[camera] case getCameraManager success');
} else {
console.info('[camera] case getCameraManager failed');
return;
}
cameras = await cameraManager.getCameras();
if (cameras != null) {
console.info('[camera] case getCameras success');
} else {
console.info('[camera] case getCameras failed');
}
}
async function initCaptureSession(videoOutPut) {
let cameraInput = await cameraManager.createCameraInput(cameras[0].cameraId);
if (cameraInput != null) {
console.info('[camera] case createCameraInput success');
} else {
console.info('[camera] case createCameraInput failed');
return;
}
captureSession = await camera.createCaptureSession(null);
await captureSession.beginConfig();
await captureSession.addInput(cameraInput);
await captureSession.addOutput(videoOutPut);
await captureSession.commitConfig();
}
async function stopCaptureSession() {
await captureSession.release();
}
function printfError(error, done) { function printfError(error, done) {
expect().assertFail(); expect().assertFail();
...@@ -208,23 +129,13 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -208,23 +129,13 @@ describe('VideoRecorderAPICallbackTest', function () {
} else { } else {
console.info('[camera] case createVideoOutput success'); console.info('[camera] case createVideoOutput success');
} }
await initCaptureSession(videoOutput); captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager, cameras, cameraID);
await videoOutput.start().then(() => { await videoOutput.start().then(() => {
console.info('[camera] case videoOutput start success'); console.info('[camera] case videoOutput start success');
}); });
toNextStep(videoRecorder, steps, done); toNextStep(videoRecorder, steps, done);
}); });
eventEmitter.on(SETSTART, async (videoRecorder, steps, done) => {
steps.shift();
toNextStep(videoRecorder, steps, done);
});
eventEmitter.on(SETPAUSE, async (videoRecorder, steps, done) => {
steps.shift();
toNextStep(videoRecorder, steps, done);
});
eventEmitter.on(CLOSE_STREAM, async (videoRecorder, steps, done) => { eventEmitter.on(CLOSE_STREAM, async (videoRecorder, steps, done) => {
steps.shift(); steps.shift();
await videoOutput.stop().then(() => { await videoOutput.stop().then(() => {
...@@ -234,7 +145,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -234,7 +145,7 @@ describe('VideoRecorderAPICallbackTest', function () {
console.info('[camera] case videoOutput release success'); console.info('[camera] case videoOutput release success');
}); });
videoOutput = undefined; videoOutput = undefined;
await stopCaptureSession(); await videoRecorderBase.stopCaptureSession(captureSession);
toNextStep(videoRecorder, steps, done); toNextStep(videoRecorder, steps, done);
}); });
...@@ -273,23 +184,6 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -273,23 +184,6 @@ describe('VideoRecorderAPICallbackTest', function () {
}); });
}); });
eventEmitter.on(PREPARE_OLNYVIDEO_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.prepare(onlyVideoConfig, (err) => {
if (typeof (err) == 'undefined') {
console.info('case prepare success');
expect(videoRecorder.state).assertEqual('prepared');
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case prepare error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(GETSURFACE_EVENT, async (videoRecorder, steps, done) => { eventEmitter.on(GETSURFACE_EVENT, async (videoRecorder, steps, done) => {
steps.shift(); steps.shift();
videoRecorder.getInputSurface((err, outPutSurface) => { videoRecorder.getInputSurface((err, outPutSurface) => {
...@@ -313,7 +207,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -313,7 +207,7 @@ describe('VideoRecorderAPICallbackTest', function () {
if (typeof (err) == 'undefined') { if (typeof (err) == 'undefined') {
console.info('case start success'); console.info('case start success');
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
sleep(RECORDER_TIME); mediaTestBase.msleep(RECORDER_TIME);
toNextStep(videoRecorder, steps, done); toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) { } else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift(); steps.shift();
...@@ -330,7 +224,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -330,7 +224,7 @@ describe('VideoRecorderAPICallbackTest', function () {
videoRecorder.pause((err) => { videoRecorder.pause((err) => {
if (typeof (err) == 'undefined') { if (typeof (err) == 'undefined') {
console.info('case pause success'); console.info('case pause success');
sleep(PAUSE_TIME); mediaTestBase.msleep(PAUSE_TIME);
expect(videoRecorder.state).assertEqual('paused'); expect(videoRecorder.state).assertEqual('paused');
toNextStep(videoRecorder, steps, done); toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) { } else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
...@@ -348,7 +242,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -348,7 +242,7 @@ describe('VideoRecorderAPICallbackTest', function () {
videoRecorder.resume((err) => { videoRecorder.resume((err) => {
if (typeof (err) == 'undefined') { if (typeof (err) == 'undefined') {
console.info('case resume success'); console.info('case resume success');
sleep(RECORDER_TIME); mediaTestBase.msleep(RECORDER_TIME);
expect(videoRecorder.state).assertEqual('playing'); expect(videoRecorder.state).assertEqual('playing');
toNextStep(videoRecorder, steps, done); toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) { } else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
...@@ -421,7 +315,6 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -421,7 +315,6 @@ describe('VideoRecorderAPICallbackTest', function () {
* @tc.level : Level2 * @tc.level : Level2
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0100', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0100', 0, async function (done) {
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, RELEASE_EVENT, END_EVENT); let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
...@@ -453,7 +346,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -453,7 +346,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0300', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_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, CLOSE_STREAM, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT); START_EVENT, PAUSE_EVENT, CLOSE_STREAM, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -468,7 +361,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -468,7 +361,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0400', 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, SETPAUSE, SETSTART, RESUME_EVENT, START_EVENT, PAUSE_EVENT, RESUME_EVENT,
PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, 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);
}) })
...@@ -573,7 +466,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -573,7 +466,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, RELEASE_EVENT, CLOSE_STREAM, END_EVENT); START_EVENT, 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);
}) })
...@@ -588,7 +481,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -588,7 +481,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_START_CALLBACK_0400', 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, SETPAUSE, SETSTART, RESUME_EVENT, START_EVENT, PAUSE_EVENT, RESUME_EVENT,
START_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT); START_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -692,7 +585,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -692,7 +585,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0300', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_PAUSE_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, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, PAUSE_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -707,7 +600,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -707,7 +600,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0400', 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, SETPAUSE, SETSTART, RESUME_EVENT, SETPAUSE, START_EVENT, PAUSE_EVENT, RESUME_EVENT,
PAUSE_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); PAUSE_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -768,7 +661,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -768,7 +661,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0800', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_PAUSE_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, SETPAUSE, PAUSE_EVENT, PAUSE_EVENT, PAUSE_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, PAUSE_EVENT, PAUSE_EVENT, PAUSE_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -826,7 +719,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -826,7 +719,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0400', 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, SETPAUSE, SETSTART, START_EVENT, PAUSE_EVENT,
RESUME_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT); RESUME_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -887,7 +780,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -887,7 +780,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0800', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_RESUME_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, SETPAUSE, PAUSE_EVENT, SETPAUSE, SETSTART, START_EVENT, PAUSE_EVENT,
RESUME_EVENT, RESUME_EVENT, RESUME_EVENT, RELEASE_EVENT, CLOSE_STREAM, 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);
}) })
...@@ -946,7 +839,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -946,7 +839,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0400', 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, STOP_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, PAUSE_EVENT, STOP_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -961,7 +854,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -961,7 +854,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0500', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0500', 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, SETPAUSE, SETSTART, RESUME_EVENT, START_EVENT, PAUSE_EVENT, RESUME_EVENT,
STOP_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); STOP_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -1066,7 +959,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -1066,7 +959,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0400', 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, RESET_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); START_EVENT, PAUSE_EVENT, RESET_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -1081,7 +974,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -1081,7 +974,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0500', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0500', 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, SETPAUSE, SETSTART, RESUME_EVENT, START_EVENT, PAUSE_EVENT, RESUME_EVENT,
RESET_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT); RESET_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -1184,7 +1077,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -1184,7 +1077,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, RELEASE_EVENT, CLOSE_STREAM, END_EVENT); PAUSE_EVENT, GETSURFACE_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
...@@ -1199,7 +1092,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -1199,7 +1092,7 @@ describe('VideoRecorderAPICallbackTest', function () {
it('SUB_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0500', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0500', 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, SETPAUSE, SETSTART, RESUME_EVENT, GETSURFACE_EVENT, PAUSE_EVENT, RESUME_EVENT, GETSURFACE_EVENT,
RELEASE_EVENT, CLOSE_STREAM, END_EVENT); RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册