未验证 提交 6b2ec4b9 编写于 作者: F FULIZHONG 提交者: Gitee

open recorder js testcase

Signed-off-by: FULIZHONG<fulizhong@huawei.com>
上级 6f484b46
......@@ -20,6 +20,7 @@ group("multimedia") {
"audio/audio_js_standard/audioManager:audio_manager_js_hap",
"audio/audio_js_standard/audioPlayer:audio_player_js_hap",
"audio/audio_js_standard/audioPlayer_API:audio_player_api_js_hap",
"audio/audio_js_standard/audioRecorder:audio_recorder_js_hap",
"media/media_cpp_test_standard:ActsMediaCppStandardTest",
]
} else {
......
......@@ -10,6 +10,27 @@
{
"type": "ShellKit",
"run-command": [
"mkdir -p /data/accounts/account_0/appdata/recorder",
"touch /data/accounts/account_0/appdata/recorder/test1.m4a",
"touch /data/accounts/account_0/appdata/recorder/test2.m4a",
"touch /data/accounts/account_0/appdata/recorder/test3.m4a",
"touch /data/accounts/account_0/appdata/recorder/test4.m4a",
"touch /data/accounts/account_0/appdata/recorder/test5.mp4",
"touch /data/accounts/account_0/appdata/recorder/test6.mp4",
"touch /data/accounts/account_0/appdata/recorder/test7.m4a",
"touch /data/accounts/account_0/appdata/recorder/test8.m4a",
"touch /data/accounts/account_0/appdata/recorder/test9.mp4",
"touch /data/accounts/account_0/appdata/recorder/test10.mp4",
"touch /data/accounts/account_0/appdata/recorder/test11.m4a",
"touch /data/accounts/account_0/appdata/recorder/test12.m4a",
"touch /data/accounts/account_0/appdata/recorder/test13.m4a",
"touch /data/accounts/account_0/appdata/recorder/test14.mp4",
"touch /data/accounts/account_0/appdata/recorder/test15.m4a",
"touch /data/accounts/account_0/appdata/recorder/test16.m4a",
"touch /data/accounts/account_0/appdata/recorder/test17.m4a",
"touch /data/accounts/account_0/appdata/recorder/test18.mp4",
"touch /data/accounts/account_0/appdata/recorder/test19.m4a",
"touch /data/accounts/account_0/appdata/recorder/testAPI.m4a",
"chmod -R 777 /data/accounts/account_0/appdata/recorder/*",
"setenforce 0"
],
......
......@@ -18,7 +18,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe('RecorderLocalTestAudioAPI', function () {
let audioRecorder = media.createAudioRecorder();
let isTimeOut = false;
const END_STATE = 0;
const PRE_STATE = 1;
const START_STATE = 2;
......@@ -28,11 +27,11 @@ describe('RecorderLocalTestAudioAPI', function () {
const RESET_STATE = 6;
const RELEASE_STATE = 7;
const ERROR_STATE = 8;
const TIME_OUT = 15000; // 15s
const FORMAT_M4A = 6;
const SOURCE_TYPE = 1;
const ENCORDER_AACLC = 3;
const CHANNEL_TWO = 2;
const RECORDER_TIME = 1000;
let audioConfig = {
audioSourceType : SOURCE_TYPE,
audioEncoder : ENCORDER_AACLC,
......@@ -44,6 +43,10 @@ describe('RecorderLocalTestAudioAPI', function () {
location : { latitude : 1, longitude : 1 },
}
function sleep(time) {
for(let t = Date.now();Date.now() - t <= time;);
};
function initAudioRecorder() {
if (typeof (audioRecorder) != 'undefined') {
audioRecorder.release();
......@@ -86,6 +89,7 @@ describe('RecorderLocalTestAudioAPI', function () {
case RELEASE_STATE:
console.info('case to release');
audioRecorder.release();
audioRecorder = undefined;
break;
case ERROR_STATE:
console.info('case to wait error callback');
......@@ -103,7 +107,7 @@ describe('RecorderLocalTestAudioAPI', function () {
});
audioRecorder.on('start', () => {
console.info('setCallback start() case callback is called');
console.info('setCallback start() case callback is called 111');
sleep(RECORDER_TIME);
mySteps.shift();
nextStep(mySteps,done);
......@@ -154,7 +158,6 @@ describe('RecorderLocalTestAudioAPI', function () {
})
beforeEach(function () {
isTimeOut = false;
console.info('beforeEach case');
})
......@@ -586,6 +589,7 @@ describe('RecorderLocalTestAudioAPI', function () {
let mySteps = new Array(RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
audioRecorder.release();
audioRecorder = undefined;
})
/* *
......
......@@ -18,7 +18,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe('RecorderLocalTestAudioFUNC', function () {
let audioRecorder = media.createAudioRecorder();
let isTimeOut = false;
const BASIC_PATH = 'file:///data/accounts/account_0/appdata/recorder/'
const END_STATE = 0;
const PRE_STATE = 1;
......@@ -29,8 +28,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
const RESET_STATE = 6;
const RELEASE_STATE = 7;
const ERROR_STATE = 8;
const RECORDER_TIME = 5000;
const TIME_OUT = 20000; // 20s
const RECORDER_TIME = 1000;
const CHANNEL_ONE = 1;
const CHANNEL_TWO = 2;
const FORMAT_MP4 = 2;
......@@ -65,7 +63,6 @@ describe('RecorderLocalTestAudioFUNC', function () {
})
beforeEach(function () {
isTimeOut = false;
console.info('beforeEach case');
})
......@@ -111,6 +108,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
case RELEASE_STATE:
console.info('case to release');
audioRecorder.release();
audioRecorder = undefined;
break;
case ERROR_STATE:
console.info('case to wait error callback');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册