提交 2e326e93 编写于 作者: T tianfenxia

tianfenxia1@huawei.com

Signed-off-by: Ntianfenxia <tianfenxia1@huawei.com>
上级 02c8ccdf
......@@ -2,7 +2,7 @@
"description": "Configuration for audio manager Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "4800000",
"test-timeout": "200000",
"package": "ohos.acts.multimedia.audio.audiomanager",
"shell-timeout": "60000"
},
......
{
"app": {
"bundleName": "ohos.acts.multimedia.audio.audiomanager",
"vendor": "acts",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 6,
"target": 5
}
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiomanager",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.multimedia.audio.audiomanager",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
"abilities": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
"iconId": 16777218,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"descriptionId": 16777217,
"visible": true,
"labelId": 16777216,
"icon": "$media:icon",
"name": "ohos.acts.multimedia.audio.audiomanager.MainAbility",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"homeAbility": true,
"launchType": "standard"
}
],
"visible": true,
"name": "ohos.acts.multimedia.audio.audiomanager.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
],
"deviceType": [
"phone",
"tablet",
"tv",
"wearable"
],
"mainAbility": "ohos.acts.multimedia.audio.audiomanager.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.audio.audiomanager",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
/*
* java MainAbility
*/
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* Copyright (C) 2021 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.aafwk.ability.AbilityPackage;
/*
* java MyApplication
*/
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
......@@ -13,8 +13,5 @@
* limitations under the License.
*/
// require('./AudioPerf.test.js')
require('./AudioFramework.test.js')
//require('./AudioFramework.test-Gitee.js')
//require('./AudioCapturer.test.js')
//require('./AudioRenderer.test.js')
\ No newline at end of file
......@@ -2,9 +2,9 @@
"description": "Configuration for audioPlayer Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "3000000",
"test-timeout": "2000000",
"package": "ohos.acts.multimedia.audio.audioplayer",
"shell-timeout": "60000"
"shell-timeout": "60000"
},
"kits": [
{
......@@ -12,40 +12,33 @@
"pre-push": [
],
"push": [
"resource/audio/01.mp3 ->/data/media/",
"resource/audio/02.mp3 ->/data/media/",
"resource/audio/03.mp3 ->/data/media/",
"resource/audio/04.mp3 ->/data/media/",
"resource/audio/47.mp4 ->/data/media/",
"resource/audio/49.mp4 ->/data/media/",
"resource/audio/50.mp4 ->/data/media/",
"resource/audio/51.mp4 ->/data/media/",
"resource/audio/54.mp4 ->/data/media/",
"resource/audio/55.m4a ->/data/media/",
"resource/audio/57.m4a ->/data/media/",
"resource/audio/58.m4a ->/data/media/",
"resource/audio/59.m4a ->/data/media/",
"resource/audio/62.m4a ->/data/media/",
"resource/audio/64.mp4 ->/data/media/",
"resource/audio/65.mp4 ->/data/media/",
"resource/audio/66.mp4 ->/data/media/",
"resource/audio/67.mp4 ->/data/media/",
"resource/audio/92.mp4 ->/data/media/",
"resource/audio/93.mp4 ->/data/media/",
"resource/audio/94.mp4 ->/data/media/",
"resource/audio/96.mp4 ->/data/media/",
"resource/audio/97.mp4 ->/data/media/",
"resource/audio/98.mp4 ->/data/media/"
"./resource/audio/01.mp3 ->/data/media/",
"./resource/audio/02.mp3 ->/data/media/",
"./resource/audio/03.mp3 ->/data/media/",
"./resource/audio/04.mp3 ->/data/media/",
"./resource/audio/47.mp4 ->/data/media/",
"./resource/audio/49.mp4 ->/data/media/",
"./resource/audio/50.mp4 ->/data/media/",
"./resource/audio/51.mp4 ->/data/media/",
"./resource/audio/54.mp4 ->/data/media/",
"./resource/audio/55.m4a ->/data/media/",
"./resource/audio/57.m4a ->/data/media/",
"./resource/audio/58.m4a ->/data/media/",
"./resource/audio/59.m4a ->/data/media/",
"./resource/audio/62.m4a ->/data/media/",
"./resource/audio/64.mp4 ->/data/media/",
"./resource/audio/65.mp4 ->/data/media/",
"./resource/audio/66.mp4 ->/data/media/",
"./resource/audio/67.mp4 ->/data/media/",
"./resource/audio/92.mp4 ->/data/media/",
"./resource/audio/93.mp4 ->/data/media/",
"./resource/audio/94.mp4 ->/data/media/",
"./resource/audio/96.mp4 ->/data/media/",
"./resource/audio/97.mp4 ->/data/media/",
"./resource/audio/98.mp4 ->/data/media/"
]
},
{
"test-file-name": [
"AudioPlayerJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
{
"type": "ShellKit",
"run-command": [
"chmod -R 666 /data/media/*",
......@@ -54,6 +47,13 @@
"teardown-command":[
"setenforce 1"
]
},
{
"test-file-name": [
"AudioPlayerJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
}
{
"app": {
"bundleName": "ohos.acts.multimedia.audio.audioplayer",
"vendor": "acts",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 6,
"target": 5
}
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audioplayer",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.multimedia.audio.audioplayer",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
"abilities": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
"iconId": 16777218,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"descriptionId": 16777217,
"visible": true,
"labelId": 16777216,
"icon": "$media:icon",
"name": "ohos.acts.multimedia.audio.audioplayer.MainAbility",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"homeAbility": true,
"launchType": "standard"
}
],
"visible": true,
"name": "ohos.acts.multimedia.audio.audioplayer.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
],
"deviceType": [
"phone",
"tablet",
"tv",
"wearable"
],
"mainAbility": "ohos.acts.multimedia.audio.audioplayer.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.audio.audioplayer",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
/*
* java MainAbility
*/
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* Copyright (C) 2021 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.aafwk.ability.AbilityPackage;
/*
* java MyApplication
*/
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
......@@ -74,9 +74,10 @@ describe('PlayerLocalTestAudioFUNC', function () {
}
}
function nextStep(mySteps) {
function nextStep(mySteps,done) {
if (mySteps[0] == END_STATE) {
isTimeOut = true;
done();
console.info('case to done');
return;
}
switch (mySteps[0]) {
......@@ -125,18 +126,16 @@ describe('PlayerLocalTestAudioFUNC', function () {
}
}
function setSrcCallback(mySteps) {
function setCallback(mySteps, done) {
console.info(`case setCallback`);
audioPlayer.on('dataLoad', () => {
mySteps.shift();
console.info(`case dataLoad called`);
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('paused');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setPlayCallback(mySteps) {
audioPlayer.on('play', () => {
mySteps.shift();
console.info(`case play called`);
......@@ -148,31 +147,22 @@ describe('PlayerLocalTestAudioFUNC', function () {
return;
}
expect(audioPlayer.state).assertEqual('playing');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setPauseCallback(mySteps) {
audioPlayer.on('pause', () => {
mySteps.shift();
console.info(`case pause called`);
console.info(`case pause currentTime is ${audioPlayer.currentTime}`);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('paused');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setResetCallback(mySteps) {
audioPlayer.on('reset', () => {
mySteps.shift();
console.info(`case reset called`);
expect(audioPlayer.state).assertEqual('idle');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setStopCallback(mySteps) {
audioPlayer.on('stop', () => {
if (mySteps[0] == RESET_STATE) {
console.info(`case reset stop called`);
......@@ -183,11 +173,8 @@ describe('PlayerLocalTestAudioFUNC', function () {
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('stopped');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setSeekCallback(mySteps) {
audioPlayer.on('timeUpdate', (seekDoneTime) => {
if (typeof (seekDoneTime) == 'undefined') {
console.info(`case seek filed,errcode is ${seekDoneTime}`);
......@@ -207,12 +194,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
sleep(PLAY_STATE);
}
if ((seekDoneTime < audioPlayer.duration) || (audioPlayer.state == 'paused')) {
nextStep(mySteps);
nextStep(mySteps,done);
}
});
}
function setVolumeCallback(mySteps) {
audioPlayer.on('volumeChange', () => {
console.info(`case setvolume called`);
mySteps.shift();
......@@ -220,21 +204,15 @@ describe('PlayerLocalTestAudioFUNC', function () {
if (audioPlayer.state == 'playing') {
sleep(PLAY_TIME);
}
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setFinishCallback(mySteps) {
audioPlayer.on('finish', () => {
mySteps.shift();
expect(audioPlayer.state).assertEqual('stopped');
expect(audioPlayer.currentTime).assertClose(audioPlayer.duration, DELTA_TIME);
console.info(`case finish called`);
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setErrorCallback(mySteps) {
audioPlayer.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
......@@ -247,28 +225,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
mySteps.shift();
mySteps.shift();
}
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setCallback(mySteps, done) {
console.info(`case setCallback`);
setSrcCallback(mySteps);
setPlayCallback(mySteps);
setPauseCallback(mySteps);
setResetCallback(mySteps);
setStopCallback(mySteps);
setSeekCallback(mySteps);
setVolumeCallback(mySteps);
setFinishCallback(mySteps);
setErrorCallback(mySteps);
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect().assertFail();
}
done();
}, TIME_OUT);
};
/* *
......@@ -279,7 +238,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_0100', 0, async function (done) {
console.info(`case update`);
let mySteps = new Array(SRC_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -294,6 +255,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -309,6 +271,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -324,6 +287,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_0500', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -339,6 +303,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_0600', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, PAUSE_STATE, END_STATE);
initAudioPlayer();
......@@ -354,6 +319,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_0700', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, STOP_STATE, END_STATE);
initAudioPlayer();
......@@ -369,6 +335,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_0800', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, STOP_STATE, END_STATE);
initAudioPlayer();
......@@ -384,6 +351,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_0900', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RESET_STATE, SRC_STATE, PLAY_STATE,
PAUSE_STATE, PLAY_STATE, RESET_STATE, END_STATE);
......@@ -400,6 +368,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1000', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, STOP_STATE, RESET_STATE, SRC_STATE, PLAY_STATE,
PAUSE_STATE, RESET_STATE, END_STATE);
......@@ -416,6 +385,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RESET_STATE,
SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE);
......@@ -432,6 +402,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -447,6 +418,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
......@@ -462,6 +434,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, PAUSE_STATE, END_STATE);
initAudioPlayer();
......@@ -477,6 +450,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1500', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, DURATION_TIME,
PLAY_STATE, FINISH_STATE, END_STATE);
......@@ -493,6 +467,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1600', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, SEEK_STATE, 0, PAUSE_STATE, END_STATE);
initAudioPlayer();
......@@ -508,6 +483,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1700', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -523,6 +499,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1800', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, STOP_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -538,6 +515,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1900', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, SEEK_STATE, 0, ERROR_STATE, END_STATE);
initAudioPlayer();
......@@ -553,6 +531,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2000', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, 0, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -568,6 +547,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, DURATION_TIME / RAND_NUM,
STOP_STATE, END_STATE);
......@@ -584,6 +564,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, SEEK_STATE, 0, END_STATE);
initAudioPlayer();
......@@ -599,6 +580,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, SEEK_STATE, 0, STOP_STATE, END_STATE);
initAudioPlayer();
......@@ -614,6 +596,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, SEEK_STATE, 0, ERROR_STATE,
RESET_STATE, SRC_STATE, PLAY_STATE, END_STATE);
......@@ -630,6 +613,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2500', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, END_STATE);
initAudioPlayer();
......@@ -645,6 +629,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2600', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, SEEK_STATE, SEEK_TIME, ERROR_STATE,
PAUSE_STATE, ERROR_STATE, RESET_STATE, END_STATE);
......@@ -661,6 +646,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2700', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, SEEK_STATE, SEEK_TIME, ERROR_STATE,
RESET_STATE, SRC_STATE, PLAY_STATE, END_STATE);
......@@ -677,6 +663,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2800', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, DURATION_TIME, FINISH_STATE, END_STATE);
initAudioPlayer();
......@@ -692,6 +679,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2900', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, DURATION_TIME + DELTA_TIME,
FINISH_STATE, END_STATE);
......@@ -708,6 +696,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3000', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, DURATION_TIME / RAND_NUM, END_STATE);
initAudioPlayer();
......@@ -723,6 +712,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, 0, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -738,6 +728,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, DURATION_TIME, PLAY_STATE,
FINISH_STATE, RESET_STATE, END_STATE);
......@@ -754,6 +745,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, DURATION_TIME + DELTA_TIME, PLAY_STATE,
FINISH_STATE, RESET_STATE, END_STATE);
......@@ -770,6 +762,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level 3
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3500', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, DURATION_TIME + DELTA_TIME,
FINISH_STATE, PLAY_STATE, RESET_STATE, END_STATE);
......@@ -786,6 +779,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3600', 0, async function (done) {
let playCount = 0;
let seekCount = 0;
......@@ -852,6 +846,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3700', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, VOLUME_STATE, 0,
VOLUME_STATE, MAX_VOLUME, RESET_STATE, END_STATE);
......
......@@ -45,16 +45,15 @@ describe('PlayerLocalTestAudioFormat', function () {
for(let t = Date.now(); Date.now() - t <= time;);
}
function setSrcCallback(audioPlayer) {
function playSource(audioSource, done) {
let audioPlayer = media.createAudioPlayer();
audioPlayer.src = audioSource;
audioPlayer.on('dataLoad', () => {
console.info('case set source success');
expect(audioPlayer.state).assertEqual('paused');
expect(audioPlayer.currentTime).assertEqual(0);
audioPlayer.play();
});
}
function setPlayCallback(audioPlayer) {
audioPlayer.on('play', () => {
console.info('case start to play');
expect(audioPlayer.state).assertEqual('playing');
......@@ -65,17 +64,16 @@ describe('PlayerLocalTestAudioFormat', function () {
audioPlayer.seek(SEEK_TIME);
}
});
}
function setPauseCallback(audioPlayer) {
audioPlayer.on('pause', () => {
console.info('case now is paused');
expect(audioPlayer.state).assertEqual('paused');
audioPlayer.setVolume(MAX_VOLUME);
});
}
function setResetCallback(audioPlayer, done) {
audioPlayer.on('stop', () => {
console.info('case stop success');
expect(audioPlayer.state).assertEqual('stopped');
audioPlayer.reset();
});
audioPlayer.on('reset', () => {
console.info('case reset success');
expect(audioPlayer.state).assertEqual('idle');
......@@ -83,17 +81,6 @@ describe('PlayerLocalTestAudioFormat', function () {
audioPlayer = undefined;
done();
});
}
function setStopCallback(audioPlayer) {
audioPlayer.on('stop', () => {
console.info('case stop success');
expect(audioPlayer.state).assertEqual('stopped');
audioPlayer.reset();
});
}
function setSeekCallback(audioPlayer, done) {
audioPlayer.on('timeUpdate', (seekDoneTime) => {
if (typeof (seekDoneTime) == "undefined") {
console.info(`case seek filed,errcode is ${seekDoneTime}`);
......@@ -112,25 +99,16 @@ describe('PlayerLocalTestAudioFormat', function () {
expect(audioPlayer.duration).assertEqual(seekDoneTime);
}
});
}
function setVolumeCallback(audioPlayer) {
audioPlayer.on('volumeChange', () => {
console.info('case set volume value to ' + MAX_VOLUME);
audioPlayer.play();
isToSeek = true;
});
}
function setFinishCallback(audioPlayer) {
audioPlayer.on('finish', () => {
console.info('case play end');
expect(audioPlayer.state).assertEqual('stopped');
audioPlayer.stop();
});
}
function setErrorCallback(audioPlayer, done) {
audioPlayer.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
......@@ -141,26 +119,6 @@ describe('PlayerLocalTestAudioFormat', function () {
});
}
function playSource(audioSource, done) {
let audioPlayer = media.createAudioPlayer();
if (typeof (audioPlayer) == 'undefined') {
console.info('case create player is faild');
expect().assertFail();
done();
return;
}
setSrcCallback(audioPlayer);
setPlayCallback(audioPlayer);
setPauseCallback(audioPlayer);
setResetCallback(audioPlayer, done);
setStopCallback(audioPlayer);
setSeekCallback(audioPlayer, done);
setVolumeCallback(audioPlayer);
setFinishCallback(audioPlayer);
setErrorCallback(audioPlayer, done);
audioPlayer.src = audioSource;
}
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0100
* @tc.name : 001.Playing mp3 streams
......@@ -173,6 +131,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0100', 0, async function (done) {
playSource(BASIC_PATH + '01.mp3', done);
})
......@@ -189,6 +148,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0200', 0, async function (done) {
playSource(BASIC_PATH + '02.mp3', done);
})
......@@ -205,6 +165,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0300', 0, async function (done) {
playSource(BASIC_PATH + '03.mp3', done);
})
......@@ -221,6 +182,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0400', 0, async function (done) {
playSource(BASIC_PATH + '04.mp3', done);
})
......@@ -237,6 +199,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0100', 0, async function (done) {
playSource(BASIC_PATH + '47.mp4', done);
})
......@@ -254,6 +217,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0300', 0, async function (done) {
playSource(BASIC_PATH + '49.mp4', done);
})
......@@ -270,6 +234,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0400', 0, async function (done) {
playSource(BASIC_PATH + '50.mp4', done);
})
......@@ -286,6 +251,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0500', 0, async function (done) {
playSource(BASIC_PATH + '51.mp4', done);
})
......@@ -302,6 +268,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0600', 0, async function (done) {
playSource(BASIC_PATH + '54.mp4', done);
})
......@@ -318,6 +285,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0700', 0, async function (done) {
playSource(BASIC_PATH + '64.mp4', done);
})
......@@ -334,6 +302,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0800', 0, async function (done) {
playSource(BASIC_PATH + '65.mp4', done);
})
......@@ -350,6 +319,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0900', 0, async function (done) {
playSource(BASIC_PATH + '66.mp4', done);
})
......@@ -366,6 +336,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1000', 0, async function (done) {
playSource(BASIC_PATH + '67.mp4', done);
})
......@@ -382,6 +353,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1100', 0, async function (done) {
playSource(BASIC_PATH + '92.mp4', done);
})
......@@ -398,6 +370,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1200', 0, async function (done) {
playSource(BASIC_PATH + '93.mp4', done);
})
......@@ -414,6 +387,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1300', 0, async function (done) {
playSource(BASIC_PATH + '94.mp4', done);
})
......@@ -430,6 +404,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1400', 0, async function (done) {
playSource(BASIC_PATH + '96.mp4', done);
})
......@@ -446,6 +421,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1500', 0, async function (done) {
playSource(BASIC_PATH + '97.mp4', done);
})
......@@ -462,6 +438,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1600', 0, async function (done) {
playSource(BASIC_PATH + '98.mp4', done);
})
......@@ -478,6 +455,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0100', 0, async function (done) {
playSource(BASIC_PATH + '55.m4a', done);
})
......@@ -495,6 +473,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0300', 0, async function (done) {
playSource(BASIC_PATH + '57.m4a', done);
})
......@@ -511,6 +490,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0400', 0, async function (done) {
playSource(BASIC_PATH + '58.m4a', done);
})
......@@ -527,6 +507,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0500', 0, async function (done) {
playSource(BASIC_PATH + '59.m4a', done);
})
......@@ -543,6 +524,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0700', 0, async function (done) {
playSource(BASIC_PATH + '62.m4a', done);
})
......
......@@ -2,7 +2,7 @@
"description": "Configuration for audioPlayerApi Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "3000000",
"test-timeout": "2000000",
"package": "ohos.acts.multimedia.audio.audioplayerapi",
"shell-timeout": "60000"
},
......@@ -12,39 +12,32 @@
"pre-push": [
],
"push": [
"resource/audio/01.mp3 ->/data/media/",
"resource/audio/02.mp3 ->/data/media/",
"resource/audio/03.mp3 ->/data/media/",
"resource/audio/04.mp3 ->/data/media/",
"resource/audio/47.mp4 ->/data/media/",
"resource/audio/49.mp4 ->/data/media/",
"resource/audio/50.mp4 ->/data/media/",
"resource/audio/51.mp4 ->/data/media/",
"resource/audio/54.mp4 ->/data/media/",
"resource/audio/55.m4a ->/data/media/",
"resource/audio/57.m4a ->/data/media/",
"resource/audio/58.m4a ->/data/media/",
"resource/audio/59.m4a ->/data/media/",
"resource/audio/62.m4a ->/data/media/",
"resource/audio/64.mp4 ->/data/media/",
"resource/audio/65.mp4 ->/data/media/",
"resource/audio/66.mp4 ->/data/media/",
"resource/audio/67.mp4 ->/data/media/",
"resource/audio/92.mp4 ->/data/media/",
"resource/audio/93.mp4 ->/data/media/",
"resource/audio/94.mp4 ->/data/media/",
"resource/audio/96.mp4 ->/data/media/",
"resource/audio/97.mp4 ->/data/media/",
"resource/audio/98.mp4 ->/data/media/"
"./resource/audio/01.mp3 ->/data/media/",
"./resource/audio/02.mp3 ->/data/media/",
"./resource/audio/03.mp3 ->/data/media/",
"./resource/audio/04.mp3 ->/data/media/",
"./resource/audio/47.mp4 ->/data/media/",
"./resource/audio/49.mp4 ->/data/media/",
"./resource/audio/50.mp4 ->/data/media/",
"./resource/audio/51.mp4 ->/data/media/",
"./resource/audio/54.mp4 ->/data/media/",
"./resource/audio/55.m4a ->/data/media/",
"./resource/audio/57.m4a ->/data/media/",
"./resource/audio/58.m4a ->/data/media/",
"./resource/audio/59.m4a ->/data/media/",
"./resource/audio/62.m4a ->/data/media/",
"./resource/audio/64.mp4 ->/data/media/",
"./resource/audio/65.mp4 ->/data/media/",
"./resource/audio/66.mp4 ->/data/media/",
"./resource/audio/67.mp4 ->/data/media/",
"./resource/audio/92.mp4 ->/data/media/",
"./resource/audio/93.mp4 ->/data/media/",
"./resource/audio/94.mp4 ->/data/media/",
"./resource/audio/96.mp4 ->/data/media/",
"./resource/audio/97.mp4 ->/data/media/",
"./resource/audio/98.mp4 ->/data/media/"
]
},
{
"test-file-name": [
"AudioPlayerApiJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
......@@ -54,6 +47,13 @@
"teardown-command":[
"setenforce 1"
]
},
{
"test-file-name": [
"AudioPlayerApiJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.acts.multimedia.audio.audioplayerapi",
"vendor": "acts",
"version": {
"code": 1,
"name": "1.0"
"app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audioplayerapi",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"apiVersion": {
"compatible": 6,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.multimedia.audio.audioplayerapi",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
"deviceConfig": {
"default": {
"debug": true
}
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
"module": {
"abilities": [
{
"iconId": 16777218,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"descriptionId": 16777217,
"visible": true,
"labelId": 16777216,
"icon": "$media:icon",
"name": "ohos.acts.multimedia.audio.audioplayerapi.MainAbility",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"homeAbility": true,
"launchType": "standard"
}
],
"visible": true,
"name": "ohos.acts.multimedia.audio.audioplayerapi.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
"deviceType": [
"phone",
"tablet",
"tv",
"wearable"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
"mainAbility": "ohos.acts.multimedia.audio.audioplayerapi.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.audio.audioplayerapi",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 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.
*/
package ohos.acts.multimedia.audio.audioplayerapi;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
/*
* java MainAbility
*/
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* Copyright (C) 2021 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.
*/
package ohos.acts.multimedia.audio.audioplayerapi;
import ohos.aafwk.ability.AbilityPackage;
/*
* java MyApplication
*/
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
......@@ -74,9 +74,10 @@ describe('PlayerLocalTestAudioAPI', function () {
}
}
function nextStep(mySteps) {
function nextStep(mySteps,done) {
if (mySteps[0] == END_STATE) {
isTimeOut = true;
done();
console.info('case to done');
return;
}
switch (mySteps[0]) {
......@@ -127,21 +128,20 @@ describe('PlayerLocalTestAudioAPI', function () {
}
}
function setSrcCallback(mySteps) {
function setCallback(mySteps, done) {
console.info(`case setCallback`);
audioPlayer.on('dataLoad', () => {
mySteps.shift();
console.info(`case dataLoad called`);
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('paused');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setPlayCallback(mySteps) {
audioPlayer.on('play', () => {
mySteps.shift();
console.info(`case play called`);
sleep(PLAY_TIME);
console.info(`case play currentTime is ${audioPlayer.currentTime}`);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
if (mySteps[0] == FINISH_STATE) {
......@@ -149,31 +149,22 @@ describe('PlayerLocalTestAudioAPI', function () {
return;
}
expect(audioPlayer.state).assertEqual('playing');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setPauseCallback(mySteps) {
audioPlayer.on('pause', () => {
mySteps.shift();
console.info(`case pause called`);
console.info(`case pause currentTime is ${audioPlayer.currentTime}`);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('paused');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setResetCallback(mySteps) {
audioPlayer.on('reset', () => {
mySteps.shift();
console.info(`case reset called`);
expect(audioPlayer.state).assertEqual('idle');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setStopCallback(mySteps) {
audioPlayer.on('stop', () => {
if (mySteps[0] == RESET_STATE) {
console.info(`case reset stop called`);
......@@ -184,11 +175,8 @@ describe('PlayerLocalTestAudioAPI', function () {
expect(audioPlayer.currentTime).assertEqual(0);
expect(audioPlayer.duration).assertEqual(DURATION_TIME);
expect(audioPlayer.state).assertEqual('stopped');
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setSeekCallback(mySteps) {
audioPlayer.on('timeUpdate', (seekDoneTime) => {
if (typeof (seekDoneTime) == 'undefined') {
console.info(`case seek filed,errcode is ${seekDoneTime}`);
......@@ -208,12 +196,9 @@ describe('PlayerLocalTestAudioAPI', function () {
sleep(PLAY_STATE);
}
if ((seekDoneTime < audioPlayer.duration) || (audioPlayer.state == 'paused')) {
nextStep(mySteps);
nextStep(mySteps,done);
}
});
}
function setVolumeCallback(mySteps) {
audioPlayer.on('volumeChange', () => {
console.info(`case setvolume called`);
mySteps.shift();
......@@ -221,21 +206,15 @@ describe('PlayerLocalTestAudioAPI', function () {
if (audioPlayer.state == 'playing') {
sleep(PLAY_TIME);
}
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setFinishCallback(mySteps) {
audioPlayer.on('finish', () => {
mySteps.shift();
expect(audioPlayer.state).assertEqual('stopped');
expect(audioPlayer.currentTime).assertClose(audioPlayer.duration, DELTA_TIME);
console.info(`case finish called`);
nextStep(mySteps);
nextStep(mySteps,done);
});
}
function setErrorCallback(mySteps) {
audioPlayer.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
......@@ -252,29 +231,10 @@ describe('PlayerLocalTestAudioAPI', function () {
} else {
mySteps.shift();
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
}
});
}
function setCallback(mySteps, done) {
console.info(`case setCallback`);
setSrcCallback(mySteps);
setPlayCallback(mySteps);
setPauseCallback(mySteps);
setResetCallback(mySteps);
setStopCallback(mySteps);
setSeekCallback(mySteps);
setVolumeCallback(mySteps);
setFinishCallback(mySteps);
setErrorCallback(mySteps);
setTimeout(function() {
if (!isTimeOut) {
console.info(`case is time out!`);
expect(isTimeOut).assertTrue();
}
done();
}, TIME_OUT);
};
/* *
......@@ -285,7 +245,9 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0100', 0, async function (done) {
console.info(`case update`);
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, PLAY_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
......@@ -300,6 +262,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, PLAY_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
......@@ -315,6 +278,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, PLAY_STATE, END_STATE);
initAudioPlayer();
......@@ -330,6 +294,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, RESET_STATE, PLAY_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
......@@ -345,6 +310,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0100', 0, async function (done) {
let mySteps = new Array(PAUSE_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
......@@ -360,6 +326,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, END_STATE);
initAudioPlayer();
......@@ -375,6 +342,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0300', 0, async function (done) {
let mySteps = new Array(PLAY_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, END_STATE);
initAudioPlayer();
......@@ -390,6 +358,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, PAUSE_STATE, END_STATE);
initAudioPlayer();
......@@ -405,6 +374,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, END_STATE);
initAudioPlayer();
......@@ -420,6 +390,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, STOP_STATE, END_STATE);
initAudioPlayer();
......@@ -435,6 +406,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, STOP_STATE, END_STATE);
initAudioPlayer();
......@@ -450,6 +422,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, END_STATE);
initAudioPlayer();
......@@ -465,12 +438,14 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, SEEK_TIME, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300
* @tc.name : 03.seek(0)
......@@ -479,6 +454,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, END_STATE);
initAudioPlayer();
......@@ -494,6 +470,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -509,6 +486,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RESET_STATE, END_STATE);
initAudioPlayer();
......@@ -524,12 +502,14 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0100', 0, async function (done) {
var mySteps = new Array(VOLUME_STATE, VOLUME_VALUE, ERROR_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.setVolume(VOLUME_VALUE);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200
* @tc.name : 02.play->setVolume
......@@ -538,12 +518,14 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200', 0, async function (done) {
var mySteps = new Array(SRC_STATE, PLAY_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = AUDIO_SOURCE;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300
* @tc.name : 03.pause->setVolume
......@@ -552,6 +534,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300', 0, async function (done) {
var mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, VOLUME_STATE, VOLUME_VALUE, END_STATE);
initAudioPlayer();
......@@ -567,6 +550,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0100', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer();
......@@ -582,6 +566,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0200', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer();
......@@ -597,6 +582,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0300', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer();
......@@ -612,6 +598,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, SEEK_TIME, RELEASE_STATE, END_STATE);
initAudioPlayer();
......@@ -627,6 +614,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, RESET_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer();
......@@ -642,6 +630,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0100', 0, async function (done) {
initAudioPlayer();
expect(audioPlayer.src).assertEqual(undefined);
......@@ -660,6 +649,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0200', 0, async function (done) {
initAudioPlayer();
audioPlayer.src = AUDIO_SOURCE;
......
......@@ -2,11 +2,21 @@
"description": "Configuration for audioRecorder Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "3000000",
"test-timeout": "1000000",
"package": "ohos.acts.multimedia.audio.audiorecorder",
"shell-timeout": "60000"
},
"kits": [
{
"type": "ShellKit",
"run-command": [
"chmod -R 777 /data/accounts/account_0/appdata/recorder/*",
"setenforce 0"
],
"teardown-command":[
"setenforce 1"
]
},
{
"test-file-name": [
"AudioRecorderJsTest.hap"
......
{
"app": {
"bundleName": "ohos.acts.multimedia.audio.audiorecorder",
"vendor": "acts",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 6,
"target": 5
}
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiorecorder",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.multimedia.audio.audiorecorder",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
"abilities": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
"iconId": 16777218,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"descriptionId": 16777217,
"visible": true,
"labelId": 16777216,
"icon": "$media:icon",
"name": "ohos.acts.multimedia.audio.audiorecorder.MainAbility",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"homeAbility": true,
"launchType": "standard"
}
],
"visible": true,
"name": "ohos.acts.multimedia.audio.audiorecorder.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
],
"deviceType": [
"phone",
"tablet",
"tv",
"wearable"
],
"mainAbility": "ohos.acts.multimedia.audio.audiorecorder.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.audio.audiorecorder",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
/*
* java MainAbility
*/
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* Copyright (C) 2021 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.aafwk.ability.AbilityPackage;
/*
* java MyApplication
*/
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
......@@ -52,10 +52,10 @@ describe('RecorderLocalTestAudioAPI', function () {
audioRecorder = media.createAudioRecorder();
}
function nextStep(mySteps) {
function nextStep(mySteps,done) {
if (mySteps[0] == END_STATE) {
console.info('case end!!!');
isTimeOut = true;
done();
console.info('case to done');
return;
}
switch (mySteps[0]) {
......@@ -95,72 +95,58 @@ describe('RecorderLocalTestAudioAPI', function () {
}
}
function setErrorCallback(mySteps) {
audioRecorder.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
console.info(`case error called,errMessage is ${err.message}`);
console.info('case err returned in error() case callback');
mySteps.shift();
expect(mySteps[0]).assertEqual(ERROR_STATE);
mySteps.shift();
nextStep(mySteps);
});
}
function setCallback(mySteps, done) {
function setCallback(mySteps, done) {
audioRecorder.on('prepare', () => {
console.info('setCallback prepare() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('start', () => {
console.info('setCallback start() case callback is called');
sleep(RECORDER_TIME);
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('pause', () => {
console.info('setCallback pause() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('resume', () => {
console.info('setCallback resume() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('stop', () => {
console.info('setCallback stop() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('reset', () => {
console.info('setCallback reset() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('release', () => {
console.info('setCallback release() case callback is called');
mySteps.shift();
nextStep(mySteps);
audioRecorder = undefined;
nextStep(mySteps,done);
});
setErrorCallback(mySteps);
setTimeout(function() {
if (!isTimeOut) {
console.info('case is time out!');
expect(isTimeOut).assertTrue();
}
mySteps = undefined;
done();
}, TIME_OUT);
audioRecorder.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
console.info(`case error called,errMessage is ${err.message}`);
mySteps.shift();
expect(mySteps[0]).assertEqual(ERROR_STATE);
mySteps.shift();
nextStep(mySteps,done);
});
}
beforeAll(function () {
......@@ -188,6 +174,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_createAudioRecorder_API_0100', 0, async function (done) {
let testAudioRecorder;
expect(testAudioRecorder).assertNull();
......@@ -204,6 +191,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Prepare_API_0100', 0, async function (done) {
let testAudioRecorder= media.createAudioRecorder();
expect(testAudioRecorder != null).assertTrue();
......@@ -219,6 +207,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Prepare_API_0200', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(START_STATE, ERROR_STATE, PRE_STATE, END_STATE);
......@@ -234,6 +223,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Prepare_API_0500', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RESET_STATE, PRE_STATE, END_STATE);
......@@ -249,6 +239,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Prepare_API_0600', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, END_STATE);
......@@ -264,6 +255,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Prepare_API_0800', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PRE_STATE, ERROR_STATE, STOP_STATE,
......@@ -280,6 +272,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Prepare_API_0900', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, PRE_STATE, ERROR_STATE, PRE_STATE, ERROR_STATE, END_STATE);
......@@ -295,6 +288,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Start_API_0100', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(START_STATE, ERROR_STATE, END_STATE);
......@@ -310,6 +304,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Start_API_0200', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, END_STATE);
......@@ -325,6 +320,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Start_API_0500', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, START_STATE, ERROR_STATE, END_STATE);
......@@ -340,6 +336,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Start_API_0600', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, START_STATE, ERROR_STATE, END_STATE);
......@@ -355,6 +352,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Start_API_0800', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, START_STATE, ERROR_STATE,
......@@ -371,6 +369,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Start_API_0900', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, START_STATE, START_STATE, END_STATE);
......@@ -386,6 +385,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Stop_API_0100', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(STOP_STATE, ERROR_STATE, END_STATE);
......@@ -401,6 +401,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Stop_API_0200', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, STOP_STATE, ERROR_STATE, END_STATE);
......@@ -416,6 +417,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Stop_API_0300', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, END_STATE);
......@@ -431,6 +433,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Stop_API_0600', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, STOP_STATE, ERROR_STATE, END_STATE);
......@@ -446,6 +449,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Stop_API_0800', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, STOP_STATE, ERROR_STATE, RESET_STATE, PRE_STATE, START_STATE, STOP_STATE,
......@@ -462,6 +466,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Stop_API_0900', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, STOP_STATE, ERROR_STATE,
......@@ -478,6 +483,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Reset_API_0100', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(RESET_STATE, END_STATE);
......@@ -493,6 +499,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Reset_API_0200', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, RESET_STATE, END_STATE);
......@@ -508,6 +515,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Reset_API_0300', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, END_STATE);
......@@ -523,6 +531,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Reset_API_0600', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RESET_STATE, END_STATE);
......@@ -538,6 +547,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Reset_API_0800', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, RESET_STATE, PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, START_STATE,
......@@ -554,6 +564,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Reset_API_0900', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, RESET_STATE, RESET_STATE, END_STATE);
......@@ -569,6 +580,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Release_API_0100', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(RELEASE_STATE, END_STATE);
......@@ -584,6 +596,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Release_API_0200', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, RELEASE_STATE, END_STATE);
......@@ -599,6 +612,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Release_API_0300', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RELEASE_STATE, END_STATE);
......@@ -614,6 +628,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Release_API_0600', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
......@@ -629,6 +644,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.type : Reliability
* @tc.level : Level2
*/
it('SUB_MEDIA_RECORDER_AudioRecorder_Release_API_0700', 0, async function (done) {
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, RELEASE_STATE, END_STATE);
......
......@@ -77,9 +77,10 @@ describe('RecorderLocalTestAudioFUNC', function () {
console.info('afterAll case');
})
function nextStep(mySteps) {
function nextStep(mySteps,done) {
if (mySteps[0] == END_STATE) {
isTimeOut = true;
done();
console.info('case to done');
return;
}
switch (mySteps[0]) {
......@@ -118,72 +119,59 @@ describe('RecorderLocalTestAudioFUNC', function () {
break;
}
}
function setErrorCallback(mySteps) {
audioRecorder.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
console.info(`case error called,errMessage is ${err.message}`);
mySteps.shift();
expect(mySteps[0]).assertEqual(ERROR_STATE);
mySteps.shift();
nextStep(mySteps);
});
}
function setCallback(mySteps, done) {
audioRecorder.on('prepare', () => {
console.info('setCallback prepare() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('start', () => {
console.info('setCallback start() case callback is called');
sleep(RECORDER_TIME);
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('pause', () => {
console.info('setCallback pause() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('resume', () => {
console.info('setCallback resume() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('stop', () => {
console.info('setCallback stop() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('reset', () => {
console.info('setCallback reset() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
audioRecorder.on('release', () => {
console.info('setCallback release() case callback is called');
mySteps.shift();
nextStep(mySteps);
nextStep(mySteps,done);
});
setErrorCallback(mySteps);
setTimeout(function() {
if (!isTimeOut) {
console.info('case is time out!');
expect(isTimeOut).assertTrue();
}
mySteps = undefined;
done();
}, TIME_OUT);
audioRecorder.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
console.info(`case error called,errMessage is ${err.message}`);
mySteps.shift();
expect(mySteps[0]).assertEqual(ERROR_STATE);
mySteps.shift();
nextStep(mySteps,done);
});
}
/* *
......@@ -194,6 +182,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0100', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test1.m4a';
initAudioRecorder();
......@@ -210,6 +199,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0210', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test2.m4a';
audioConfig.numberOfChannels = CHANNEL_ONE;
......@@ -227,6 +217,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0220', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test3.m4a';
audioConfig.numberOfChannels = CHANNEL_TWO;
......@@ -244,6 +235,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0310', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test4.m4a';
audioConfig.audioSampleRate = 8000; // samplerate 8000
......@@ -262,6 +254,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0320', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test5.mp4';
audioConfig.audioSampleRate = 32000; // samplerate 32000
......@@ -281,6 +274,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0330', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test6.mp4';
audioConfig.audioSampleRate = 44100; // samplerate 44100
......@@ -300,6 +294,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0340', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test7.m4a';
audioConfig.audioSampleRate = 64000; // samplerate 64000
......@@ -319,6 +314,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0340', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test8.m4a';
audioConfig.audioSampleRate = 96000; // samplerate 96000
......@@ -338,6 +334,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0410', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test9.mp4';
audioConfig.audioSampleRate = 22050; // samplerate 22050
......@@ -358,6 +355,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0420', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test10.mp4';
audioConfig.audioSampleRate = 44100; // samplerate 44100
......@@ -378,6 +376,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0430', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test11.m4a';
audioConfig.audioSampleRate = 44100; // samplerate 44100
......@@ -398,6 +397,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0440', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test12.m4a';
audioConfig.audioSampleRate = 44100; // samplerate 44100
......@@ -418,6 +418,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Codec_AAC_Function_0450', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test13.m4a';
audioConfig.audioSampleRate = 44100; // samplerate 44100
......@@ -438,6 +439,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Format_MP4_Function_0200', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test14.mp4';
audioConfig.audioEncodeBitRate = 22050; // samplerate 22050
......@@ -458,6 +460,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_Format_MP4_Function_0200', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test15.m4a';
audioConfig.audioEncodeBitRate = 22050; // samplerate 22050
......@@ -478,6 +481,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_LOCAL_AUDIO_Function_06_0100', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test16.m4a';
audioConfig.fileFormat = FORMAT_M4A;
......@@ -495,6 +499,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_LOCAL_AUDIO_Function_06_0500', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test17.m4a';
audioConfig.fileFormat = FORMAT_M4A;
......@@ -512,6 +517,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MEDIA_RECORDER_LOCAL_AUDIO_Function_06_1100', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test18.mp4';
audioConfig.fileFormat = FORMAT_MP4;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册