提交 5c7ee5ee 编写于 作者: O openharmony_ci 提交者: Gitee

!1028 multmedia子系统测试套适配更新

Merge pull request !1028 from tianfenxia/master
......@@ -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",
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiomanager",
"version": {
"code": 1,
"name": "1.0"
"code": 1000000,
"name": "1.0.0"
}
},
"apiVersion": {
"compatible": 6,
"target": 5
"deviceConfig": {
"default": {
"debug": true
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.multimedia.audio.audiomanager",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"iconId": 16777218,
"skills": [
{
"entities": [
......@@ -35,15 +31,33 @@
]
}
],
"descriptionId": 16777217,
"visible": true,
"name": "ohos.acts.multimedia.audio.audiomanager.MainAbility",
"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"
}
],
"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": [
......
/*
* 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();
}
}
......@@ -19,10 +19,10 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe('audioApiResponseTime', function () {
console.info('AudioFrameworkTestPerf: Running AudioManger API Perfomance Test');
var audioMedia = 3;
var audioRingtone = 2;
var maxVol = 15;
var lowVol = 5;
var AUDIO_MEDIA = 3;
var AUDIO_RINGTONE = 2;
var MAX_VOL = 15;
var LOW_VOL = 5;
var MAXNUM = 1000;
var err;
......@@ -50,11 +50,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_001', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.setVolume(audioRingtone,maxVol);
audioManagerPerf.setVolume(AUDIO_RINGTONE,MAX_VOL);
};
let waitTime = new Date().getTime()-startTime;
let avgTime = waitTime/MAXNUM;
......@@ -79,11 +80,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_002', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.setVolume(audioMedia,lowVol,(err, value) => {
audioManagerPerf.setVolume(AUDIO_MEDIA,LOW_VOL,(err, value) => {
if (err) {
console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`);
expect(false).assertTrue();
......@@ -113,11 +115,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_003', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.getVolume(audioRingtone);
audioManagerPerf.getVolume(AUDIO_RINGTONE);
};
let waitTime = new Date().getTime()-startTime;
let avgTime = waitTime/MAXNUM;
......@@ -142,11 +145,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_004', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.getVolume(audioMedia,(err, value) => {
audioManagerPerf.getVolume(AUDIO_MEDIA,(err, value) => {
if (err) {
console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`);
expect(false).assertTrue();
......@@ -176,11 +180,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_005', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.getMinVolume(audioMedia);
audioManagerPerf.getMinVolume(AUDIO_MEDIA);
};
let waitTime = new Date().getTime()-startTime;
let avgTime = waitTime/MAXNUM;
......@@ -205,11 +210,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_006', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.getMinVolume(audioRingtone,(err, value) => {
audioManagerPerf.getMinVolume(AUDIO_RINGTONE,(err, value) => {
if (err) {
console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`);
expect(false).assertTrue();
......@@ -239,11 +245,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_007', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.getMaxVolume(audioMedia);
audioManagerPerf.getMaxVolume(AUDIO_MEDIA);
};
let waitTime = new Date().getTime()-startTime;
let avgTime = waitTime/MAXNUM;
......@@ -268,11 +275,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_008', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.getMaxVolume(audioRingtone,(err, value) => {
audioManagerPerf.getMaxVolume(AUDIO_RINGTONE,(err, value) => {
if (err) {
console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`);
expect(false).assertTrue();
......@@ -302,11 +310,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_009', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.mute(audioMedia,true);
audioManagerPerf.mute(AUDIO_MEDIA,true);
};
let waitTime = new Date().getTime()-startTime;
let avgTime = waitTime/MAXNUM;
......@@ -331,11 +340,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_010', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.mute(audioRingtone,true,(err, value) => {
audioManagerPerf.mute(AUDIO_RINGTONE,true,(err, value) => {
if (err) {
console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`);
expect(false).assertTrue();
......@@ -365,11 +375,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_011', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.isMute(audioMedia);
audioManagerPerf.isMute(AUDIO_MEDIA);
};
let waitTime = new Date().getTime()-startTime;
let avgTime = waitTime/MAXNUM;
......@@ -394,11 +405,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_012', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.isMute(audioRingtone,(err, value) => {
audioManagerPerf.isMute(AUDIO_RINGTONE,(err, value) => {
if (err) {
console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`);
expect(false).assertTrue();
......@@ -428,11 +440,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_013', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.isActive(audioMedia);
audioManagerPerf.isActive(AUDIO_MEDIA);
};
let waitTime = new Date().getTime()-startTime;
let avgTime = waitTime/MAXNUM;
......@@ -457,11 +470,12 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_014', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) {
audioManagerPerf.isActive(audioRingtone,(err, value) => {
audioManagerPerf.isActive(AUDIO_RINGTONE,(err, value) => {
if (err) {
console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`);
expect(false).assertTrue();
......@@ -491,6 +505,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_015', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -520,6 +535,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_016', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -554,6 +570,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_017', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -583,6 +600,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_018', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -617,6 +635,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_019', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -646,6 +665,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_020', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -680,6 +700,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_021', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -709,6 +730,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_022', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -743,6 +765,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_023', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -772,6 +795,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_024', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -806,6 +830,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_025', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -835,6 +860,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_026', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -869,6 +895,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_027', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -898,6 +925,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_028', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -932,6 +960,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_029', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -961,6 +990,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_030', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -995,6 +1025,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_031', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......@@ -1024,6 +1055,7 @@ describe('audioApiResponseTime', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_Performance_032', 0, function (done) {
let audioManagerPerf = audio.getAudioManager();
let startTime = new Date().getTime();
......
......@@ -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,7 +2,7 @@
"description": "Configuration for audioPlayer Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "3000000",
"test-timeout": "2000000",
"package": "ohos.acts.multimedia.audio.audioplayer",
"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": [
"AudioPlayerJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
......@@ -54,6 +47,13 @@
"teardown-command":[
"setenforce 1"
]
},
{
"test-file-name": [
"AudioPlayerJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "ohos.acts.multimedia.audio.audioplayer",
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audioplayer",
"version": {
"code": 1,
"name": "1.0"
"code": 1000000,
"name": "1.0.0"
}
},
"apiVersion": {
"compatible": 6,
"target": 5
"deviceConfig": {
"default": {
"debug": true
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.multimedia.audio.audioplayer",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"iconId": 16777218,
"skills": [
{
"entities": [
......@@ -35,15 +31,33 @@
]
}
],
"descriptionId": 16777217,
"visible": true,
"name": "ohos.acts.multimedia.audio.audioplayer.MainAbility",
"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"
}
],
"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": [
......
/*
* 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);
})
......
/*
* 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();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册