提交 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();
}
}
......@@ -18,19 +18,19 @@ import audio from '@ohos.multimedia.audio';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
describe('audioManger', function () {
console.info('AudioFrameworkTest: Create AudioManger Object JS Framework');
console.info('Create AudioManger Object JS Framework');
const audioManager = audio.getAudioManager();
var deviceRoleValue = null;
var deviceTypeValue = null;
var volErrorMesg = 'Error, Operation not supported or Failed';
var audioMedia = 3;
var audioRingtone = 2;
var minVol = 0;
var maxVol = 15;
var lowVol = 5;
var highVol = 14;
var outOfRangeVol = 28;
var longValue = '28374837458743875804735081439085918459801437584738967509184509813904850914375904790589104801843';
var DEVICE_ROLE_VALUE = null;
var DEVICE_TYPE_VALUE = null;
var VOL_ERROR_MESG = 'Error, Operation not supported or Failed';
var AUDIO_MEDIA = 3;
var AUDIO_RINGTONE = 2;
var MIN_VOL = 0;
var MAX_VOL = 15;
var LOW_VOL = 5;
var HIGH_VOL = 14;
var OUT_OF_RANGE_VOL = 28;
var LONG_VALUE = '28374837458743875804735081439085918459801437584738967509184509813904850914375904790589104801843';
function displayDeviceProp(value, index, array) {
var devRoleName;
......@@ -68,26 +68,26 @@ describe('audioManger', function () {
}
console.info(`AudioFrameworkTest: device role: ${devRoleName}`);
deviceRoleValue = value.deviceRole;
DEVICE_ROLE_VALUE = value.deviceRole;
console.info(`AudioFrameworkTest: device type: ${devTypeName}`);
deviceTypeValue = value.deviceType;
DEVICE_TYPE_VALUE = value.deviceType;
}
beforeAll(function () {
console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level');
console.info('beforeAll: Prerequisites at the test suite level');
})
beforeEach(function () {
console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level');
console.info('beforeEach: Prerequisites at the test case level');
})
afterEach(function () {
console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions');
console.info('afterEach: Test case-level clearance conditions');
})
afterAll(function () {
console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition');
console.info('afterAll: Test suite-level cleanup condition');
})
/* *
......@@ -98,16 +98,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioManger_001', 0, function (done) {
it('SUB_AUDIO_MANAGER_getAudioManger_001', 0, function () {
if(audioManager!=null){
console.info('AudioFrameworkTest: getAudioManger : PASS');
console.info('getAudioManger : PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: getAudioManger : FAIL');
console.info('getAudioManger : FAIL');
expect(false).assertTrue();
}
done();
})
/* *
......@@ -118,6 +118,7 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioManger_002', 0, async function (done) {
const audioManager1 = audio.getAudioManager();
const audioManager2 = audio.getAudioManager();
......@@ -129,40 +130,40 @@ describe('audioManger', function () {
const audioManager8 = audio.getAudioManager();
const audioManager9 = audio.getAudioManager();
const audioManager10 = audio.getAudioManager();
const promise = audioManager.setVolume(audioMedia,lowVol);
const promise = audioManager.setVolume(AUDIO_MEDIA,LOW_VOL);
promise.then(function () {
console.info('AudioFrameworkTest: Media setVolume promise: successful');
audioManager1.setVolume(audioMedia,highVol);
console.info('Media setVolume promise: successful');
audioManager1.setVolume(AUDIO_MEDIA,HIGH_VOL);
console.info('AudioFrameworkTest:audioManager1 : Media setVolume promise: successful');
audioManager2.setVolume(audioMedia,highVol);
audioManager2.setVolume(AUDIO_MEDIA,HIGH_VOL);
console.info('AudioFrameworkTest:audioManager2 : Media setVolume promise: successful');
audioManager3.setVolume(audioMedia,highVol);
audioManager3.setVolume(AUDIO_MEDIA,HIGH_VOL);
console.info('AudioFrameworkTest:audioManager3 : Media setVolume promise: successful');
audioManager4.setVolume(audioMedia,lowVol);
audioManager4.setVolume(AUDIO_MEDIA,LOW_VOL);
console.info('AudioFrameworkTest:audioManager4 : Media setVolume promise: successful');
audioManager5.setVolume(audioMedia,highVol);
audioManager5.setVolume(AUDIO_MEDIA,HIGH_VOL);
console.info('AudioFrameworkTest:audioManager5 : Media setVolume promise: successful');
audioManager6.setVolume(audioMedia,lowVol);
audioManager6.setVolume(AUDIO_MEDIA,LOW_VOL);
console.info('AudioFrameworkTest:audioManager6 : Media setVolume promise: successful');
audioManager7.setVolume(audioMedia,highVol);
audioManager7.setVolume(AUDIO_MEDIA,HIGH_VOL);
console.info('AudioFrameworkTest:audioManager7 : Media setVolume promise: successful');
audioManager8.setVolume(audioMedia,lowVol);
audioManager8.setVolume(AUDIO_MEDIA,LOW_VOL);
console.info('AudioFrameworkTest:audioManager8 : Media setVolume promise: successful');
audioManager9.setVolume(audioMedia,highVol);
audioManager9.setVolume(AUDIO_MEDIA,HIGH_VOL);
console.info('AudioFrameworkTest:audioManager9 : Media setVolume promise: successful');
audioManager10.setVolume(audioMedia,lowVol);
audioManager10.setVolume(AUDIO_MEDIA,LOW_VOL);
console.info('AudioFrameworkTest:audioManager10 : Media setVolume promise: successful');
audioManager.getVolume(audioMedia).then(function (data) {
if(data == lowVol){
console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data);
audioManager.getVolume(AUDIO_MEDIA).then(function (data) {
if(data == LOW_VOL){
console.info('Media getVolume Promise: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data);
console.info('Media getVolume Promise: FAIL :' + data);
expect(false).assertTrue();
}
}).catch((err) => {
console.info('AudioFrameworkTest: Media getVolume Promise: Error :' + err.message);
console.info('Media getVolume Promise: Error :' + err.message);
});
});
await promise;
......@@ -177,17 +178,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_001', 0, async function (done) {
const promise = audioManager.setVolume(audioMedia,lowVol);
const promise = audioManager.setVolume(AUDIO_MEDIA,LOW_VOL);
promise.then(function () {
console.info('AudioFrameworkTest: Media setVolume promise: successful');
audioManager.getVolume(audioMedia).then(function (data) {
if(data == lowVol){
console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data);
console.info('Media setVolume promise: successful');
audioManager.getVolume(AUDIO_MEDIA).then(function (data) {
if(data == LOW_VOL){
console.info('Media getVolume Promise: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data);
console.info('Media getVolume Promise: FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -204,17 +206,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_002', 0, async function (done) {
const promise = audioManager.setVolume(audioMedia,maxVol);
const promise = audioManager.setVolume(AUDIO_MEDIA,MAX_VOL);
promise.then(function () {
console.info('AudioFrameworkTest: Media setVolume promise: successful');
audioManager.getVolume(audioMedia).then(function (data) {
if(data == maxVol){
console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data);
console.info('Media setVolume promise: successful');
audioManager.getVolume(AUDIO_MEDIA).then(function (data) {
if(data == MAX_VOL){
console.info('Media getVolume Promise: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data);
console.info('Media getVolume Promise: FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -231,18 +234,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_003', 0, async function (done) {
const promise = audioManager.setVolume(audioMedia,minVol);
const promise = audioManager.setVolume(AUDIO_MEDIA,MIN_VOL);
promise.then(function () {
console.info('AudioFrameworkTest: Media setVolume promise: successful');
console.info('Media setVolume promise: successful');
audioManager.getVolume(audioMedia).then(function (data) {
if(data == minVol){
console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data);
audioManager.getVolume(AUDIO_MEDIA).then(function (data) {
if(data == MIN_VOL){
console.info('Media getVolume Promise: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data);
console.info('Media getVolume Promise: FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -259,14 +263,15 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_004', 0, async function (done) {
console.info('AudioFrameworkTest: Media setVolume Promise:Out of range: Setvol 100');
await audioManager.setVolume(audioMedia,outOfRangeVol).then(() => {
console.info('AudioFrameworkTest: Media setVolume Promise:Out of range: FAIL');
console.info('Media setVolume Promise:Out of range: Setvol 100');
await audioManager.setVolume(AUDIO_MEDIA,OUT_OF_RANGE_VOL).then(() => {
console.info('Media setVolume Promise:Out of range: FAIL');
expect(false).assertTrue();
}).catch((err) => {
console.info('AudioFrameworkTest: Media setVolume Promise:Out of range: PASS :' + err.message);
expect(volErrorMesg).assertEqual(err.message);
console.info('Media setVolume Promise:Out of range: PASS :' + err.message);
expect(VOL_ERROR_MESG).assertEqual(err.message);
});
done();
})
......@@ -279,26 +284,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_005', 0, async function (done) {
audioManager.setVolume(audioMedia,highVol, (err) => {
audioManager.setVolume(AUDIO_MEDIA,HIGH_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`);
console.error(`failed to set volume: Callback: ${err.message}`);
expect(false).assertTrue();
}
else
{
console.info(`AudioFrameworkTest: callback : Media setVolume successful `);
audioManager.getVolume(audioMedia, (err, value) => {
audioManager.getVolume(AUDIO_MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`);
console.error(`Media: failed to get volume ${err.message}`);
expect(false).assertTrue();
}
else if(value == highVol){
console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value);
else if(value == HIGH_VOL){
console.info('callback : Media getVolume: PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value);
console.info('callback : Media getVolume: FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -316,26 +322,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_006', 0, async function (done) {
audioManager.setVolume(audioMedia,maxVol, (err) => {
audioManager.setVolume(AUDIO_MEDIA,MAX_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`);
console.error(`failed to set volume: Callback: ${err.message}`);
expect(false).assertTrue();
}
else
{
console.info(`AudioFrameworkTest: callback : Media setVolume successful `);
audioManager.getVolume(audioMedia, (err, value) => {
audioManager.getVolume(AUDIO_MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`);
console.error(`Media: failed to get volume ${err.message}`);
expect(false).assertTrue();
}
else if(value == maxVol){
console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value);
else if(value == MAX_VOL){
console.info('callback : Media getVolume: PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value);
console.info('callback : Media getVolume: FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -353,26 +360,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_007', 0, async function (done) {
audioManager.setVolume(audioMedia,minVol, (err) => {
audioManager.setVolume(AUDIO_MEDIA,MIN_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`);
console.error(`failed to set volume: Callback: ${err.message}`);
expect(false).assertTrue();
}
else
{
console.info(`AudioFrameworkTest: callback : Media setVolume successful `);
audioManager.getVolume(audioMedia, (err, value) => {
audioManager.getVolume(AUDIO_MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`);
console.error(`Media: failed to get volume ${err.message}`);
expect(false).assertTrue();
}
else if(value == minVol){
console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value);
else if(value == MIN_VOL){
console.info('callback : Media getVolume: PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value);
console.info('callback : Media getVolume: FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -390,14 +398,15 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_008', 0, async function (done) {
audioManager.setVolume(audioMedia,outOfRangeVol, (err) => {
audioManager.setVolume(AUDIO_MEDIA,OUT_OF_RANGE_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: setVolume: Out of range: Callback: PASS: ${err.message}`);
expect(volErrorMesg).assertEqual(err.message);
console.error(`setVolume: Out of range: Callback: PASS: ${err.message}`);
expect(VOL_ERROR_MESG).assertEqual(err.message);
}
else{
console.info('AudioFrameworkTest: setVolume: callback : Media Out of range: FAIL');
console.info('setVolume: callback : Media Out of range: FAIL');
expect(false).assertTrue();
}
done();
......@@ -412,17 +421,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_009', 0, async function (done) {
const promise = audioManager.setVolume(audioRingtone,lowVol);
const promise = audioManager.setVolume(AUDIO_RINGTONE,LOW_VOL);
promise.then(function () {
console.info('AudioFrameworkTest: Ringtone setVolume promise: successful');
audioManager.getVolume(audioRingtone).then(function (data) {
if(data == lowVol){
console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data);
console.info('Ringtone setVolume promise: successful');
audioManager.getVolume(AUDIO_RINGTONE).then(function (data) {
if(data == LOW_VOL){
console.info('Ringtone getVolume Promise: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data);
console.info('Ringtone getVolume Promise: FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -439,17 +449,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_010', 0, async function (done) {
const promise = audioManager.setVolume(audioRingtone,maxVol);
const promise = audioManager.setVolume(AUDIO_RINGTONE,MAX_VOL);
promise.then(function () {
console.info('AudioFrameworkTest: Ringtone setVolume promise: successful');
audioManager.getVolume(audioRingtone).then(function (data) {
if(data == maxVol){
console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data);
console.info('Ringtone setVolume promise: successful');
audioManager.getVolume(AUDIO_RINGTONE).then(function (data) {
if(data == MAX_VOL){
console.info('Ringtone getVolume Promise: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data);
console.info('Ringtone getVolume Promise: FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -466,17 +477,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_011', 0, async function (done) {
const promise = audioManager.setVolume(audioRingtone,minVol);
const promise = audioManager.setVolume(AUDIO_RINGTONE,MIN_VOL);
promise.then(function () {
console.info('AudioFrameworkTest: Ringtone setVolume promise: successful');
audioManager.getVolume(audioRingtone).then(function (data) {
if(data == minVol){
console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data);
console.info('Ringtone setVolume promise: successful');
audioManager.getVolume(AUDIO_RINGTONE).then(function (data) {
if(data == MIN_VOL){
console.info('Ringtone getVolume Promise: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data);
console.info('Ringtone getVolume Promise: FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -493,14 +505,15 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_012', 0, async function (done) {
console.info('AudioFrameworkTest: Ringtone setVolume Promise: Out of range: Setvol 30');
await audioManager.setVolume(audioRingtone,outOfRangeVol).then(() => {
console.info('AudioFrameworkTest: Ringtone setVolume Promise:Out of range: FAIL');
console.info('Ringtone setVolume Promise: Out of range: Setvol 30');
await audioManager.setVolume(AUDIO_RINGTONE,OUT_OF_RANGE_VOL).then(() => {
console.info('Ringtone setVolume Promise:Out of range: FAIL');
expect(false).assertTrue();
}).catch((err) => {
console.info('AudioFrameworkTest: Ringtone setVolume Promise:Out of range: PASS :' + (err.message));
expect(volErrorMesg).assertEqual(err.message);
console.info('Ringtone setVolume Promise:Out of range: PASS :' + (err.message));
expect(VOL_ERROR_MESG).assertEqual(err.message);
});
done();
})
......@@ -513,25 +526,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_013', 0, async function (done) {
audioManager.setVolume(audioRingtone,highVol, (err) => {
audioManager.setVolume(AUDIO_RINGTONE,HIGH_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`);
console.error(`failed to set volume: Callback: ${err.message}`);
expect(false).assertTrue();
}
else{
console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `);
audioManager.getVolume(audioRingtone, (err, value) => {
audioManager.getVolume(AUDIO_RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`);
console.error(`Ringtone: failed to get volume ${err.message}`);
expect(false).assertTrue();
}
else if(value == highVol){
console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value);
else if(value == HIGH_VOL){
console.info('callback : Ringtone getVolume: PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value);
console.info('callback : Ringtone getVolume: FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -549,26 +563,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_014', 0, async function (done) {
audioManager.setVolume(audioRingtone,maxVol, (err) => {
audioManager.setVolume(AUDIO_RINGTONE,MAX_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`);
console.error(`failed to set volume: Callback: ${err.message}`);
expect(false).assertTrue();
}
else{
console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `);
audioManager.getVolume(audioRingtone, (err, value) => {
audioManager.getVolume(AUDIO_RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`);
console.error(`Ringtone: failed to get volume ${err.message}`);
expect(false).assertTrue();
}
else if(value == maxVol){
console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value);
else if(value == MAX_VOL){
console.info('callback : Ringtone getVolume: PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value);
console.info('callback : Ringtone getVolume: FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -586,25 +601,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_015', 0, async function (done) {
audioManager.setVolume(audioRingtone,minVol, (err) => {
audioManager.setVolume(AUDIO_RINGTONE,MIN_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`);
console.error(`failed to set volume: Callback: ${err.message}`);
expect(false).assertTrue();
}
else{
console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `);
audioManager.getVolume(audioRingtone, (err, value) => {
audioManager.getVolume(AUDIO_RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`);
console.error(`Ringtone: failed to get volume ${err.message}`);
expect(false).assertTrue();
}
else if(value == minVol){
console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value);
else if(value == MIN_VOL){
console.info('callback : Ringtone getVolume: PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value);
console.info('callback : Ringtone getVolume: FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -622,14 +638,15 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_016', 0, async function (done) {
audioManager.setVolume(audioRingtone,outOfRangeVol, (err) => {
audioManager.setVolume(AUDIO_RINGTONE,OUT_OF_RANGE_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Out of range Volume: Callback: ${err.message}`);
expect(volErrorMesg).assertEqual(err.message);
console.error(`Out of range Volume: Callback: ${err.message}`);
expect(VOL_ERROR_MESG).assertEqual(err.message);
}
else{
console.info('AudioFrameworkTest: Out of range Volume: callback : Ringtone set volume: FAIL');
console.info('Out of range Volume: callback : Ringtone set volume: FAIL');
expect(false).assertTrue();
}
done();
......@@ -644,15 +661,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_017', 0, async function (done) {
console.info('AudioFrameworkTest: Media setVolume promise: Negative Value -1');
await audioManager.setVolume(audioMedia,-1).then(() => {
console.info('Media setVolume promise: Negative Value -1');
await audioManager.setVolume(AUDIO_MEDIA,-1).then(() => {
// Setting negative audio volume for error Scenario
console.info('AudioFrameworkTest: Media setVolume Promise:Negative: FAIL');
console.info('Media setVolume Promise:Negative: FAIL');
expect(false).assertTrue();
}).catch((err) => {
console.info('AudioFrameworkTest: Media setVolume Promise:Negative: PASS : ' + (err.message));
expect(volErrorMesg).assertEqual(err.message);
console.info('Media setVolume Promise:Negative: PASS : ' + (err.message));
expect(VOL_ERROR_MESG).assertEqual(err.message);
});
done();
})
......@@ -665,15 +683,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_018', 0, async function (done) {
audioManager.setVolume(audioMedia,-1, (err) => {
audioManager.setVolume(AUDIO_MEDIA,-1, (err) => {
// Setting negative audio volume for error Scenario
if (err) {
console.error(`AudioFrameworkTest: setVolume Callback: Negative: PASS: ${err.message}`);
expect(volErrorMesg).assertEqual(err.message);
console.error(`setVolume Callback: Negative: PASS: ${err.message}`);
expect(VOL_ERROR_MESG).assertEqual(err.message);
}
else{
console.info('AudioFrameworkTest: setVolume callback : Media Negative: FAIL');
console.info('setVolume callback : Media Negative: FAIL');
expect(false).assertTrue();
}
done();
......@@ -688,15 +707,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_019', 0, async function (done) {
console.info('AudioFrameworkTest: Ringtone setVolume promise: Negative');
await audioManager.setVolume(audioRingtone,-1).then(() => {
console.info('Ringtone setVolume promise: Negative');
await audioManager.setVolume(AUDIO_RINGTONE,-1).then(() => {
// Setting negative audio volume for error Scenario
console.info('AudioFrameworkTest: Ringtone setVolume Promise:Negative: FAIL');
console.info('Ringtone setVolume Promise:Negative: FAIL');
expect(false).assertTrue();
}).catch((err) => {
console.info('AudioFrameworkTest: Ringtone setVolume Promise:Negative: PASS :' + (err.message));
expect(volErrorMesg).assertEqual(err.message);
console.info('Ringtone setVolume Promise:Negative: PASS :' + (err.message));
expect(VOL_ERROR_MESG).assertEqual(err.message);
});
done();
})
......@@ -709,15 +729,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_020', 0, async function (done) {
audioManager.setVolume(audioRingtone,-1, (err) => {
audioManager.setVolume(AUDIO_RINGTONE,-1, (err) => {
// Setting negative audio volume for error Scenario
if (err) {
console.error(`AudioFrameworkTest:Ringtone setVolume Callback:Negative: PASS : ${err.message}`);
expect(volErrorMesg).assertEqual(err.message);
expect(VOL_ERROR_MESG).assertEqual(err.message);
}
else{
console.info('AudioFrameworkTest: setVolume: Negative: callback : Ringtone set volume: FAIL');
console.info('setVolume: Negative: callback : Ringtone set volume: FAIL');
expect(false).assertTrue();
}
done();
......@@ -732,16 +753,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_021', 0, async function (done) {
const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol);
const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA,LOW_VOL);
promise.then(function () {
audioManager.getVolume(audio.AudioVolumeType.MEDIA).then(function (data) {
if(data == lowVol){
console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data);
if(data == LOW_VOL){
console.info('Media getVolume Promise: ENAME : PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data);
console.info('Media getVolume Promise: ENAME : FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -758,25 +780,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_022', 0, async function (done) {
audioManager.setVolume(audio.AudioVolumeType.MEDIA,highVol, (err) => {
audioManager.setVolume(audio.AudioVolumeType.MEDIA,HIGH_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME : ${err.message}`);
console.error(`failed to set volume: Callback: ENAME : ${err.message}`);
expect(false).assertTrue();
}
else{
console.info(`AudioFrameworkTest: callback : ENAME : Media setVolume successful `);
audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media: ENAME : Error ${err.message}`);
console.error(`Media: ENAME : Error ${err.message}`);
expect(false).assertTrue();
}
else if(value == highVol){
console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :' + value);
else if(value == HIGH_VOL){
console.info('callback : Media getVolume: ENAME : PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :' + value);
console.info('callback : Media getVolume: ENAME : FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -794,17 +817,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_023', 0, async function (done) {
const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE,highVol);
const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE,HIGH_VOL);
promise.then(function () {
console.info('AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful');
console.info('Ringtone setVolume promise: ENAME: successful');
audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then(function (data) {
if(data == highVol){
console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data);
if(data == HIGH_VOL){
console.info('Ringtone getVolume Promise: ENAME: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data);
console.info('Ringtone getVolume Promise: ENAME: FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -821,25 +845,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_024', 0, async function (done) {
audioManager.setVolume(audio.AudioVolumeType.RINGTONE,lowVol, (err) => {
audioManager.setVolume(audio.AudioVolumeType.RINGTONE,LOW_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME: ${err.message}`);
console.error(`failed to set volume: Callback: ENAME: ${err.message}`);
expect(false).assertTrue();
}
else{
console.info(`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `);
audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume ${err.message}`);
console.error(`Ringtone: ENAME: failed to get volume ${err.message}`);
expect(false).assertTrue();
}
else if(value == lowVol){
console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :' + value);
else if(value == LOW_VOL){
console.info('callback : Ringtone getVolume: ENAME: PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :' + value);
console.info('callback : Ringtone getVolume: ENAME: FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -857,17 +882,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_025', 0, async function (done) {
const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol);
const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA,LOW_VOL);
promise.then(function () {
audioManager.setVolume(audio.AudioVolumeType.RINGTONE,maxVol);
audioManager.setVolume(audio.AudioVolumeType.RINGTONE,MAX_VOL);
audioManager.getVolume(audio.AudioVolumeType.MEDIA).then(function (data) {
if(data == lowVol){
console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data);
if(data == LOW_VOL){
console.info('Media getVolume Promise: ENAME : PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data);
console.info('Media getVolume Promise: ENAME : FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -884,26 +910,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_026', 0, async function (done) {
audioManager.setVolume(audio.AudioVolumeType.MEDIA,highVol, (err) => {
audioManager.setVolume(audio.AudioVolumeType.MEDIA,HIGH_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME : ${err.message}`);
console.error(`failed to set volume: Callback: ENAME : ${err.message}`);
expect(false).assertTrue();
}
else{
console.info(`AudioFrameworkTest: callback : ENAME : Media setVolume successful `);
audioManager.setVolume(audio.AudioVolumeType.RINGTONE,lowVol);
audioManager.setVolume(audio.AudioVolumeType.RINGTONE,LOW_VOL);
audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media: ENAME : Error: ${err.message}`);
console.error(`Media: ENAME : Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value == highVol){
console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :' + value);
else if(value == HIGH_VOL){
console.info('callback : Media getVolume: ENAME : PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :' + value);
console.info('callback : Media getVolume: ENAME : FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -921,18 +948,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_027', 0, async function (done) {
const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE,highVol);
const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE,HIGH_VOL);
promise.then(function () {
console.info('AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful');
audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol);
console.info('Ringtone setVolume promise: ENAME: successful');
audioManager.setVolume(audio.AudioVolumeType.MEDIA,LOW_VOL);
audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then(function (data) {
if(data == highVol){
console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data);
if(data == HIGH_VOL){
console.info('Ringtone getVolume Promise: ENAME: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data);
console.info('Ringtone getVolume Promise: ENAME: FAIL :' + data);
expect(false).assertTrue();
}
});
......@@ -949,26 +977,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_028', 0, async function (done) {
audioManager.setVolume(audio.AudioVolumeType.RINGTONE,lowVol, (err) => {
audioManager.setVolume(audio.AudioVolumeType.RINGTONE,LOW_VOL, (err) => {
if (err) {
console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME: ${err.message}`);
console.error(`failed to set volume: Callback: ENAME: ${err.message}`);
expect(false).assertTrue();
}
else{
console.info(`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `);
audioManager.setVolume(audio.AudioVolumeType.MEDIA,highVol);
audioManager.setVolume(audio.AudioVolumeType.MEDIA,HIGH_VOL);
audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume ${err.message}`);
console.error(`Ringtone: ENAME: failed to get volume ${err.message}`);
expect(false).assertTrue();
}
else if(value == lowVol){
console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :' + value);
else if(value == LOW_VOL){
console.info('callback : Ringtone getVolume: ENAME: PASS :' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :' + value);
console.info('callback : Ringtone getVolume: ENAME: FAIL :' + value);
expect(false).assertTrue();
}
done();
......@@ -986,15 +1015,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_001', 0, async function (done) {
const promise = audioManager.getMaxVolume(audioMedia);
const promise = audioManager.getMaxVolume(AUDIO_MEDIA);
promise.then(function (data) {
if (data==maxVol){
console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data);
if (data==MAX_VOL){
console.info('Media getMaxVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data);
console.info('Media getMaxVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1010,18 +1040,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_002', 0, async function (done) {
audioManager.getMaxVolume(audioMedia, (err, value) => {
audioManager.getMaxVolume(AUDIO_MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`);
console.error(`Media : failed to getMaxVolume ${err.message}`);
expect(false).assertTrue();
}
else if (value=maxVol){
console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value);
else if (value=MAX_VOL){
console.info('callback : Media: getMaxVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value);
console.info('callback : Media: getMaxVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1036,15 +1067,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_003', 0, async function (done) {
const promise = audioManager.getMaxVolume(audioRingtone);
const promise = audioManager.getMaxVolume(AUDIO_RINGTONE);
promise.then(function (data) {
if (data==maxVol){
console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data);
if (data==MAX_VOL){
console.info('Ringtone getMaxVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data);
console.info('Ringtone getMaxVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1060,18 +1092,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_004', 0, async function (done) {
audioManager.getMaxVolume(audioRingtone, (err, value) => {
audioManager.getMaxVolume(AUDIO_RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`);
console.error(`Ringtone : failed to getMaxVolume ${err.message}`);
expect(false).assertTrue();
}
else if (value==maxVol){
console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value);
else if (value==MAX_VOL){
console.info('callback : Ringtone: getMaxVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value);
console.info('callback : Ringtone: getMaxVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1086,16 +1119,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_005', 0, async function (done) {
audioManager.setVolume(audioRingtone,lowVol);
const promise = audioManager.getMaxVolume(audioMedia);
audioManager.setVolume(AUDIO_RINGTONE,LOW_VOL);
const promise = audioManager.getMaxVolume(AUDIO_MEDIA);
promise.then(function (data) {
if (data==maxVol){
console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data);
if (data==MAX_VOL){
console.info('Media getMaxVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data);
console.info('Media getMaxVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1111,16 +1145,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_006', 0, async function (done) {
audioManager.setVolume(audioMedia,lowVol);
const promise = audioManager.getMaxVolume(audioRingtone);
audioManager.setVolume(AUDIO_MEDIA,LOW_VOL);
const promise = audioManager.getMaxVolume(AUDIO_RINGTONE);
promise.then(function (data) {
if (data==maxVol){
console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data);
if (data==MAX_VOL){
console.info('Ringtone getMaxVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data);
console.info('Ringtone getMaxVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
......@@ -1137,20 +1172,21 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_007', 0, async function (done) {
audioManager.setVolume(audioRingtone,lowVol);
audioManager.getMaxVolume(audioMedia, (err, value) => {
audioManager.setVolume(AUDIO_RINGTONE,LOW_VOL);
audioManager.getMaxVolume(AUDIO_MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`);
console.error(`Media : failed to getMaxVolume ${err.message}`);
expect(false).assertTrue();
}
else if (value=maxVol){
console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value);
else if (value=MAX_VOL){
console.info('callback : Media: getMaxVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value);
console.info('callback : Media: getMaxVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1165,19 +1201,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_008', 0, async function (done) {
audioManager.setVolume(audioMedia,lowVol);
audioManager.getMaxVolume(audioRingtone, (err, value) => {
audioManager.setVolume(AUDIO_MEDIA,LOW_VOL);
audioManager.getMaxVolume(AUDIO_RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`);
console.error(`Ringtone : failed to getMaxVolume ${err.message}`);
expect(false).assertTrue();
}
else if (value==maxVol){
console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value);
else if (value==MAX_VOL){
console.info('callback : Ringtone: getMaxVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value);
console.info('callback : Ringtone: getMaxVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1192,16 +1229,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_009', 0, async function (done) {
audioManager.setVolume(audioMedia,lowVol);
const promise = audioManager.getMaxVolume(audioMedia);
audioManager.setVolume(AUDIO_MEDIA,LOW_VOL);
const promise = audioManager.getMaxVolume(AUDIO_MEDIA);
promise.then(function (data) {
if (data==maxVol){
console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data);
if (data==MAX_VOL){
console.info('Media getMaxVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data);
console.info('Media getMaxVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1217,16 +1255,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_010', 0, async function (done) {
audioManager.setVolume(audioRingtone,lowVol);
const promise = audioManager.getMaxVolume(audioRingtone);
audioManager.setVolume(AUDIO_RINGTONE,LOW_VOL);
const promise = audioManager.getMaxVolume(AUDIO_RINGTONE);
promise.then(function (data) {
if (data==maxVol){
console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data);
if (data==MAX_VOL){
console.info('Ringtone getMaxVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data);
console.info('Ringtone getMaxVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1242,19 +1281,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_011', 0, async function (done) {
audioManager.setVolume(audioMedia,highVol);
audioManager.getMaxVolume(audioMedia, (err, value) => {
audioManager.setVolume(AUDIO_MEDIA,HIGH_VOL);
audioManager.getMaxVolume(AUDIO_MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`);
console.error(`Media : failed to getMaxVolume ${err.message}`);
expect(false).assertTrue();
}
else if (value=maxVol){
console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value);
else if (value=MAX_VOL){
console.info('callback : Media: getMaxVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value);
console.info('callback : Media: getMaxVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1269,19 +1309,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMaxVolume_012', 0, async function (done) {
audioManager.setVolume(audioRingtone,highVol);
audioManager.getMaxVolume(audioRingtone, (err, value) => {
audioManager.setVolume(AUDIO_RINGTONE,HIGH_VOL);
audioManager.getMaxVolume(AUDIO_RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`);
console.error(`Ringtone : failed to getMaxVolume ${err.message}`);
expect(false).assertTrue();
}
else if (value==maxVol){
console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value);
else if (value==MAX_VOL){
console.info('callback : Ringtone: getMaxVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value);
console.info('callback : Ringtone: getMaxVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1296,15 +1337,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_001', 0, async function (done) {
const promise = audioManager.getMinVolume(audioMedia);
const promise = audioManager.getMinVolume(AUDIO_MEDIA);
promise.then(function (data) {
if (data==minVol){
console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data);
if (data==MIN_VOL){
console.info('Media getMinVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data);
console.info('Media getMinVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1320,18 +1362,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_002', 0, async function (done) {
audioManager.getMinVolume(audioMedia, (err, value) => {
audioManager.getMinVolume(AUDIO_MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`);
console.error(`Media : failed to getMinVolume ${err.message}`);
expect().assertFail();
}
else if (value==minVol){
console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value);
else if (value==MIN_VOL){
console.info('callback : Media: getMinVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value);
console.info('callback : Media: getMinVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1346,15 +1389,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_003', 0, async function (done) {
const promise = audioManager.getMinVolume(audioRingtone);
const promise = audioManager.getMinVolume(AUDIO_RINGTONE);
promise.then(function (data) {
if (data==minVol){
console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data);
if (data==MIN_VOL){
console.info('Ringtone getMinVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data);
console.info('Ringtone getMinVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
......@@ -1371,18 +1415,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_004', 0, async function (done) {
audioManager.getMinVolume(audioRingtone, (err, value) => {
audioManager.getMinVolume(AUDIO_RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`);
console.error(`Ringtone : failed to getMinVolume ${err.message}`);
expect().assertFail();
}
else if (value==minVol){
console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value);
else if (value==MIN_VOL){
console.info('callback : Ringtone: getMinVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value);
console.info('callback : Ringtone: getMinVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1397,16 +1442,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_005', 0, async function (done) {
audioManager.setVolume(audioRingtone,lowVol);
const promise = audioManager.getMinVolume(audioMedia);
audioManager.setVolume(AUDIO_RINGTONE,LOW_VOL);
const promise = audioManager.getMinVolume(AUDIO_MEDIA);
promise.then(function (data) {
if (data==minVol){
console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data);
if (data==MIN_VOL){
console.info('Media getMinVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data);
console.info('Media getMinVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1422,19 +1468,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_006', 0, async function (done) {
audioManager.setVolume(audioRingtone,lowVol);
audioManager.getMinVolume(audioMedia, (err, value) => {
audioManager.setVolume(AUDIO_RINGTONE,LOW_VOL);
audioManager.getMinVolume(AUDIO_MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`);
console.error(`Media : failed to getMinVolume ${err.message}`);
expect().assertFail();
}
else if (value==minVol){
console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value);
else if (value==MIN_VOL){
console.info('callback : Media: getMinVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value);
console.info('callback : Media: getMinVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1449,16 +1496,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_007', 0, async function (done) {
audioManager.setVolume(audioMedia,highVol);
const promise = audioManager.getMinVolume(audioRingtone);
audioManager.setVolume(AUDIO_MEDIA,HIGH_VOL);
const promise = audioManager.getMinVolume(AUDIO_RINGTONE);
promise.then(function (data) {
if (data==minVol){
console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data);
if (data==MIN_VOL){
console.info('Ringtone getMinVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data);
console.info('Ringtone getMinVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1474,19 +1522,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_008', 0, async function (done) {
audioManager.setVolume(audioMedia,lowVol);
audioManager.getMinVolume(audioRingtone, (err, value) => {
audioManager.setVolume(AUDIO_MEDIA,LOW_VOL);
audioManager.getMinVolume(AUDIO_RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`);
console.error(`Ringtone : failed to getMinVolume ${err.message}`);
expect().assertFail();
}
else if (value==minVol){
console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value);
else if (value==MIN_VOL){
console.info('callback : Ringtone: getMinVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value);
console.info('callback : Ringtone: getMinVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1501,16 +1550,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_009', 0, async function (done) {
audioManager.setVolume(audioMedia,lowVol);
const promise = audioManager.getMinVolume(audioMedia);
audioManager.setVolume(AUDIO_MEDIA,LOW_VOL);
const promise = audioManager.getMinVolume(AUDIO_MEDIA);
promise.then(function (data) {
if (data==minVol){
console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data);
if (data==MIN_VOL){
console.info('Media getMinVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data);
console.info('Media getMinVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1526,19 +1576,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_010', 0, async function (done) {
audioManager.setVolume(audioMedia,highVol);
audioManager.getMinVolume(audioMedia, (err, value) => {
audioManager.setVolume(AUDIO_MEDIA,HIGH_VOL);
audioManager.getMinVolume(AUDIO_MEDIA, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`);
console.error(`Media : failed to getMinVolume ${err.message}`);
expect().assertFail();
}
else if (value==minVol){
console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value);
else if (value==MIN_VOL){
console.info('callback : Media: getMinVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value);
console.info('callback : Media: getMinVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1553,16 +1604,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_011', 0, async function (done) {
audioManager.setVolume(audioRingtone,lowVol);
const promise = audioManager.getMinVolume(audioRingtone)
audioManager.setVolume(AUDIO_RINGTONE,LOW_VOL);
const promise = audioManager.getMinVolume(AUDIO_RINGTONE)
promise.then(function (data) {
if (data==minVol){
console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data);
if (data==MIN_VOL){
console.info('Ringtone getMinVolume promise : PASS:' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data);
console.info('Ringtone getMinVolume promise : FAIL: ' + data);
expect(false).assertTrue();
}
});
......@@ -1578,19 +1630,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getMinVolume_012', 0, async function (done) {
audioManager.setVolume(audioRingtone,lowVol);
audioManager.getMinVolume(audioRingtone, (err, value) => {
audioManager.setVolume(AUDIO_RINGTONE,LOW_VOL);
audioManager.getMinVolume(AUDIO_RINGTONE, (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`);
console.error(`Ringtone : failed to getMinVolume ${err.message}`);
expect().assertFail();
}
else if (value==minVol){
console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value);
else if (value==MIN_VOL){
console.info('callback : Ringtone: getMinVolume : PASS:' + value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value);
console.info('callback : Ringtone: getMinVolume : FAIL: ' + value);
expect(false).assertTrue();
}
done();
......@@ -1605,20 +1658,21 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_001', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
const promise = audioManager.getDevices(1);
// Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG
promise.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG');
console.info('Promise: getDevices OUTPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL');
console.info('Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL');
expect(false).assertTrue();
}
});
......@@ -1634,21 +1688,22 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_002', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
const promise = audioManager.getDevices(2);
// Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG
promise.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG');
console.info('Promise: getDevices INPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Promise: getDevices : INPUT_DEVICES_FLAG : PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL');
console.info('Promise: getDevices : INPUT_DEVICES_FLAG : FAIL');
expect(false).assertTrue();
}
});
......@@ -1664,22 +1719,23 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_003', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
const promise = audioManager.getDevices(3);
// Getting all devies connected 3 = ALL_DEVICES_FLAG
promise.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG');
console.info('Promise: getDevices ALL_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Promise: getDevices : ALL_DEVICES_FLAG : PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL');
console.info('Promise: getDevices : ALL_DEVICES_FLAG : FAIL');
expect(false).assertTrue();
}
});
......@@ -1694,27 +1750,28 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_004', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
audioManager.getDevices(1, (err, value) => {
// Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG
console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');
console.info('Callback: getDevices OUTPUT_DEVICES_FLAG');
if (err) {
console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`);
console.error(`Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`);
expect().assertFail();
}
else {
console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');
console.info('Callback: getDevices OUTPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL');
console.info('Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL');
expect(false).assertTrue();
}
}
......@@ -1730,28 +1787,29 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_005', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
audioManager.getDevices(2, (err, value) => {
// Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG
console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');
console.info('Callback: getDevices INPUT_DEVICES_FLAG');
if (err) {
console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`);
console.error(`Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`);
expect().assertFail();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');
console.info('Callback: getDevices INPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Callback: getDevices : INPUT_DEVICES_FLAG: PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL');
console.info('Callback: getDevices : INPUT_DEVICES_FLAG: FAIL');
expect(false).assertTrue();
}
}
......@@ -1767,28 +1825,29 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_006', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
audioManager.getDevices(3, (err, value) => {
// Getting all devies connected 3 = ALL_DEVICES_FLAG
console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');
console.info('Callback: getDevices ALL_DEVICES_FLAG');
if (err) {
console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`);
console.error(`Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`);
expect().assertFail();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');
console.info('Callback: getDevices ALL_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Callback: getDevices : ALL_DEVICES_FLAG: PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL');
console.info('Callback: getDevices : ALL_DEVICES_FLAG: FAIL');
expect(false).assertTrue();
}
}
......@@ -1804,20 +1863,21 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_007', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
const promise = audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG)
promise.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG');
console.info('Promise: getDevices OUTPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL');
console.info('Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL');
expect(false).assertTrue();
}
});
......@@ -1833,20 +1893,21 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_008', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
const promise = audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG);
promise.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG');
console.info('Promise: getDevices INPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Promise: getDevices : INPUT_DEVICES_FLAG : PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL');
console.info('Promise: getDevices : INPUT_DEVICES_FLAG : FAIL');
expect(false).assertTrue();
}
});
......@@ -1862,20 +1923,21 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_009', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
const promise = audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG);
promise.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG');
console.info('Promise: getDevices ALL_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Promise: getDevices : ALL_DEVICES_FLAG : PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL');
console.info('Promise: getDevices : ALL_DEVICES_FLAG : FAIL');
expect(false).assertTrue();
}
});
......@@ -1891,24 +1953,25 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_010', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => {
console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');
console.info('Callback: getDevices OUTPUT_DEVICES_FLAG');
if (err) {
console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`);
console.error(`Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`);
expect().assertFail();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');
console.info('Callback: getDevices OUTPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL');
console.info('Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL');
expect(false).assertTrue();
}
}
......@@ -1924,25 +1987,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_011', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG, (err, value) => {
console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');
console.info('Callback: getDevices INPUT_DEVICES_FLAG');
if (err) {
console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`);
console.error(`Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`);
expect().assertFail();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');
console.info('Callback: getDevices INPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Callback: getDevices : INPUT_DEVICES_FLAG: PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL');
console.info('Callback: getDevices : INPUT_DEVICES_FLAG: FAIL');
expect(false).assertTrue();
}
}
......@@ -1958,24 +2022,25 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getDevices_012', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
DEVICE_ROLE_VALUE = null;
DEVICE_TYPE_VALUE = null;
audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG, (err, value) => {
console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');
console.info('Callback: getDevices ALL_DEVICES_FLAG');
if (err) {
console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`);
console.error(`Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`);
expect().assertFail();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');
console.info('Callback: getDevices ALL_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null){
console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS');
if (DEVICE_TYPE_VALUE != null && DEVICE_ROLE_VALUE != null){
console.info('Callback: getDevices : ALL_DEVICES_FLAG: PASS');
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL');
console.info('Callback: getDevices : ALL_DEVICES_FLAG: FAIL');
expect(false).assertTrue();
}
}
......@@ -1991,18 +2056,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_001', 0, async function (done) {
const promise = audioManager.setRingerMode(2);
// Setting Ringtone Mode to Normal ENUM 2 = RINGER_MODE_NORMAL
promise.then(function () {
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL');
console.info('Promise: setRingerMode RINGER_MODE_NORMAL');
audioManager.getRingerMode().then(function (value){
if(value==2){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' +value);
console.info('Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value);
console.info('Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -2019,18 +2085,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_002', 0, async function (done) {
const promise = audioManager.setRingerMode(0);
// Setting Ringtone Mode to Silent ENUM 0 = RINGER_MODE_SILENT
promise.then(function (){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT');
console.info('Promise: setRingerMode RINGER_MODE_SILENT');
audioManager.getRingerMode().then(function (value){
if(value==0){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' +value);
console.info('Promise: setRingerMode RINGER_MODE_SILENT: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' +value);
console.info('Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -2047,18 +2114,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_003', 0, async function (done) {
const promise = audioManager.setRingerMode(1);
// Setting Ringtone Mode to Vibration ENUM 1 = RINGER_MODE_VIBRATE
promise.then(function (){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE');
console.info('Promise: setRingerMode RINGER_MODE_VIBRATE');
audioManager.getRingerMode().then(function (value){
if(value==1){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value);
console.info('Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value);
console.info('Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -2075,26 +2143,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_004', 0, async function (done) {
audioManager.setRingerMode(2, (err) => {
// Setting Ringtone Mode to Normal ENUM 2 = RINGER_MODE_NORMAL
console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL');
console.info('Callback : setRingerMode RINGER_MODE_NORMAL');
if (err) {
console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL: Error: ${err.message}`);
console.error(`setRingerMode RINGER_MODE_NORMAL: Error: ${err.message}`);
expect().assertFail();
}
else{
audioManager.getRingerMode((err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error: ${err.message}`);
console.error(`RINGER_MODE_NORMAL: Error: ${err.message}`);
expect().assertFail();
}
else if(value==2){
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' +value);
console.info('Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value);
console.info('Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -2112,27 +2181,28 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_005', 0, async function (done) {
audioManager.setRingerMode(0, (err) => {
// Setting Ringtone Mode to Silent ENUM 0 = RINGER_MODE_SILENT
console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT');
console.info('Callback : setRingerMode RINGER_MODE_SILENT');
if (err) {
console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT: Error: ${err.message}`);
console.error(`setRingerMode RINGER_MODE_SILENT: Error: ${err.message}`);
expect().assertFail();
}
else{
audioManager.getRingerMode((err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : RINGER_MODE_SILENT: Error: ${err.message}`);
console.error(`RINGER_MODE_SILENT: Error: ${err.message}`);
expect().assertFail();
}
if(value==0){
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' +value);
console.info('Callback: setRingerMode RINGER_MODE_SILENT: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' +value);
console.info('Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -2150,27 +2220,28 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_006', 0, async function (done) {
audioManager.setRingerMode(1, (err) => {
// Setting Ringtone Mode to Vibration ENUM 1 = RINGER_MODE_VIBRATE
console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE');
console.info('Callback : setRingerMode RINGER_MODE_VIBRATE');
if (err) {
console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE: Error: ${err.message}`);
console.error(`setRingerMode RINGER_MODE_VIBRATE: Error: ${err.message}`);
expect().assertFail();
}
else {
audioManager.getRingerMode((err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : RINGER_MODE_VIBRATE: Error: ${err.message}`);
console.error(`RINGER_MODE_VIBRATE: Error: ${err.message}`);
expect().assertFail();
}
if(value==1){
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value);
console.info('Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value);
console.info('Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -2188,17 +2259,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_007', 0, async function (done) {
const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL);
promise.then(function () {
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL');
console.info('Promise: setRingerMode RINGER_MODE_NORMAL');
audioManager.getRingerMode().then(function (value){
if(value==audio.AudioRingMode.RINGER_MODE_NORMAL){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' +value);
console.info('Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value);
console.info('Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -2215,17 +2287,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_008', 0, async function (done) {
const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_SILENT);
promise.then(function (){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT');
console.info('Promise: setRingerMode RINGER_MODE_SILENT');
audioManager.getRingerMode().then(function (value){
if(value==audio.AudioRingMode.RINGER_MODE_SILENT){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' +value);
console.info('Promise: setRingerMode RINGER_MODE_SILENT: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' +value);
console.info('Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -2242,17 +2315,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_009', 0, async function (done) {
const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE);
promise.then(function (){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE');
console.info('Promise: setRingerMode RINGER_MODE_VIBRATE');
audioManager.getRingerMode().then(function (value){
if(value==audio.AudioRingMode.RINGER_MODE_VIBRATE){
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value);
console.info('Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value);
console.info('Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -2269,25 +2343,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_010', 0, async function (done) {
audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => {
console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL');
console.info('Callback : setRingerMode RINGER_MODE_NORMAL');
if (err) {
console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL: Error: ${err.message}`);
console.error(`setRingerMode RINGER_MODE_NORMAL: Error: ${err.message}`);
expect().assertFail();
}
else {
audioManager.getRingerMode((err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error: ${err.message}`);
console.error(`RINGER_MODE_NORMAL: Error: ${err.message}`);
expect().assertFail();
}
else if(value==audio.AudioRingMode.RINGER_MODE_NORMAL){
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' +value);
console.info('Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value);
console.info('Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -2305,26 +2380,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_011', 0, async function (done) {
audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_SILENT, (err) => {
console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT');
console.info('Callback : setRingerMode RINGER_MODE_SILENT');
if (err) {
console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT: Error: ${err.message}`);
console.error(`setRingerMode RINGER_MODE_SILENT: Error: ${err.message}`);
expect().assertFail();
}
else {
audioManager.getRingerMode((err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : RINGER_MODE_SILENT: Error: ${err.message}`);
console.error(`RINGER_MODE_SILENT: Error: ${err.message}`);
expect().assertFail();
}
if(value==audio.AudioRingMode.RINGER_MODE_SILENT){
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' +value);
console.info('Callback: setRingerMode RINGER_MODE_SILENT: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' +value);
console.info('Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -2342,26 +2418,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setRingerMode_012', 0, async function (done) {
audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE, (err, value) => {
console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE');
console.info('Callback : setRingerMode RINGER_MODE_VIBRATE');
if (err) {
console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE: Error: ${err.message}`);
console.error(`setRingerMode RINGER_MODE_VIBRATE: Error: ${err.message}`);
expect().assertFail();
}
else {
audioManager.getRingerMode((err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : RINGER_MODE_VIBRATE: Error: ${err.message}`);
console.error(`RINGER_MODE_VIBRATE: Error: ${err.message}`);
expect().assertFail();
}
if(value==audio.AudioRingMode.RINGER_MODE_VIBRATE){
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value);
console.info('Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value);
console.info('Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -2379,25 +2456,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_006', 0, async function (done) {
audioManager.mute(audioMedia,false, (err) => {
audioManager.mute(AUDIO_MEDIA,false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`);
console.error(`Set Stream Mute: Media: Callback: Error : ${err.message}`);
expect(false).assertTrue();
}
else {
console.log('AudioFrameworkTest: Set Stream Mute: Media: Callback : FALSE');
audioManager.isMute(audioMedia, (err, data) => {
console.log('Set Stream Mute: Media: Callback : FALSE');
audioManager.isMute(AUDIO_MEDIA, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`);
console.error(`FALSE: Media : failed to get Mute Status ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: '+data);
console.log('Callback : Is Stream Mute Media: FALSE: PASS: '+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: '+data);
console.log('Callback : Is Stream Mute Media: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2415,21 +2493,22 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_005', 0, async function (done) {
await audioManager.mute(audioMedia,false).then(function () {
console.log('AudioFrameworkTest: Set Stream Mute: Media: Promise: FALSE');
audioManager.isMute(audioMedia).then(function (data) {
await audioManager.mute(AUDIO_MEDIA,false).then(function () {
console.log('Set Stream Mute: Media: Promise: FALSE');
audioManager.isMute(AUDIO_MEDIA).then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:'+data);
console.log('Promise: Is Stream Mute Media: FALSE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL: '+data);
console.log('Promise: Is Stream Mute Media: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: ERROR:' + err.message);
console.info('Promise: Is Stream Mute Media: FALSE: ERROR:' + err.message);
expect(false).assertTrue();
});
done();
......@@ -2443,25 +2522,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_008', 0, async function (done) {
audioManager.mute(audioRingtone,false, (err) => {
audioManager.mute(AUDIO_RINGTONE,false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`);
console.error(`Set Stream Mute: Media: Callback: Error : ${err.message}`);
expect(false).assertTrue();
}
else {
console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Callback : FALSE');
audioManager.isMute(audioRingtone, (err, data) => {
console.log('Set Stream Mute: Ringtone: Callback : FALSE');
audioManager.isMute(AUDIO_RINGTONE, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : FALSE: Ringtone : failed to get Mute Status ${err.message}`);
console.error(`FALSE: Ringtone : failed to get Mute Status ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: PASS: '+data);
console.log('Callback : Is Stream Mute Ringtone: FALSE: PASS: '+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: FAIL: '+data);
console.log('Callback : Is Stream Mute Ringtone: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2479,21 +2559,22 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_007', 0, async function (done) {
await audioManager.mute(audioRingtone,false).then(function () {
console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: FALSE');
audioManager.isMute(audioRingtone).then(function (data) {
await audioManager.mute(AUDIO_RINGTONE,false).then(function () {
console.log('Set Stream Mute: Ringtone: Promise: FALSE');
audioManager.isMute(AUDIO_RINGTONE).then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:'+data);
console.log('Promise: Is Stream Mute Ringtone: FALSE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: FAIL: '+data);
console.log('Promise: Is Stream Mute Ringtone: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Promise: Is Stream Mute Rington: FALSE: ERROR:' + err.message);
console.info('Promise: Is Stream Mute Rington: FALSE: ERROR:' + err.message);
expect(false).assertTrue();
});
done();
......@@ -2507,25 +2588,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_015', 0, async function (done) {
audioManager.mute(audio.AudioVolumeType.MEDIA,false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`);
console.error(`Set Stream Mute: Media: Callback: Error : ${err.message}`);
expect().assertFail();
}
else {
console.log('AudioFrameworkTest: Set Stream Mute: Media: ENAME: Callback : FALSE');
console.log('Set Stream Mute: Media: ENAME: Callback : FALSE');
audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : FALSE: Media : ENAME: failed to get Mute Status ${err.message}`);
console.error(`FALSE: Media : ENAME: failed to get Mute Status ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: PASS: '+data);
console.log('Callback : Is Stream Mute Media: ENAME: FALSE: PASS: '+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: FAIL: '+data);
console.log('Callback : Is Stream Mute Media: ENAME: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2543,21 +2625,22 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_011', 0, async function (done) {
await audioManager.mute(audio.AudioVolumeType.MEDIA,false).then(function () {
console.log('AudioFrameworkTest: Set Stream Mute: Media: ENAME: Promise: FALSE');
console.log('Set Stream Mute: Media: ENAME: Promise: FALSE');
audioManager.isMute(audio.AudioVolumeType.MEDIA).then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:'+data);
console.log('Promise: Is Stream Mute Media: ENAME: FALSE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: '+data);
console.log('Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: ERROR:' + err.message);
console.info('Promise: Is Stream Mute Media: ENAME: FALSE: ERROR:' + err.message);
expect(false).assertTrue();
});
done();
......@@ -2571,25 +2654,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_016', 0, async function (done) {
audioManager.mute(audio.AudioVolumeType.RINGTONE,false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`);
console.error(`Set Stream Mute: Media: Callback: Error : ${err.message}`);
expect().assertFail();
}
else {
console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: ENAME: Callback : FALSE');
console.log('Set Stream Mute: Ringtone: ENAME: Callback : FALSE');
audioManager.isMute(audio.AudioVolumeType.RINGTONE, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : FALSE: Ringtone : ENAME: failed to get Mute Status ${err.message}`);
console.error(`FALSE: Ringtone : ENAME: failed to get Mute Status ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: PASS: '+data);
console.log('Callback : Is Stream Mute Ringtone: ENAME: FALSE: PASS: '+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: FAIL: '+data);
console.log('Callback : Is Stream Mute Ringtone: ENAME: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2607,21 +2691,22 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_014', 0, async function (done) {
await audioManager.mute(audio.AudioVolumeType.MEDIA,false).then(function () {
console.log('AudioFrameworkTest: Set Stream Mute: Media: ENAME: Promise: FALSE');
console.log('Set Stream Mute: Media: ENAME: Promise: FALSE');
audioManager.isMute(audio.AudioVolumeType.MEDIA).then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:'+data);
console.log('Promise: Is Stream Mute Media: ENAME: FALSE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: '+data);
console.log('Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: ERROR:' + err.message);
console.info('Promise: Is Stream Mute Media: ENAME: FALSE: ERROR:' + err.message);
expect(false).assertTrue();
});
done();
......@@ -2635,22 +2720,23 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_017', 0, async function (done) {
await audioManager.mute(audioMedia,true).then(function () {
console.log('AudioFrameworkTest: Set Stream Mute: Media: Promise: TRUE');
audioManager.setVolume(audioMedia,lowVol);
audioManager.isMute(audioMedia).then(function (data) {
await audioManager.mute(AUDIO_MEDIA,true).then(function () {
console.log('Set Stream Mute: Media: Promise: TRUE');
audioManager.setVolume(AUDIO_MEDIA,LOW_VOL);
audioManager.isMute(AUDIO_MEDIA).then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: PASS:'+data);
console.log('Promise: Is Stream Mute Media: SetVolume: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: FAIL: '+data);
console.log('Promise: Is Stream Mute Media: SetVolume: FAIL: '+data);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: ERROR:' + err.message);
console.info('Promise: Is Stream Mute Media: SetVolume: ERROR:' + err.message);
expect(false).assertTrue();
});
done();
......@@ -2664,26 +2750,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_018', 0, async function (done) {
audioManager.mute(audioMedia,true, (err) => {
audioManager.mute(AUDIO_MEDIA,true, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to set Mute Status ${err.message}`);
console.error(`SetVolume: Media : failed to set Mute Status ${err.message}`);
expect().assertFail();
}
else{
console.log('AudioFrameworkTest: Set Stream Mute: Media: Callback : TRUE');
audioManager.setVolume(audioMedia,highVol);
audioManager.isMute(audioMedia, (err, data) => {
console.log('Set Stream Mute: Media: Callback : TRUE');
audioManager.setVolume(AUDIO_MEDIA,HIGH_VOL);
audioManager.isMute(AUDIO_MEDIA, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to get Mute Status ${err.message}`);
console.error(`SetVolume: Media : failed to get Mute Status ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: PASS: '+data);
console.log('Callback : Is Stream Mute Media: SetVolume: PASS: '+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL: '+data);
console.log('Callback : Is Stream Mute Media: SetVolume: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2701,22 +2788,23 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_019', 0, async function (done) {
await audioManager.mute(audioRingtone,true).then(function () {
console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: SetVolume');
audioManager.setVolume(audioRingtone,highVol);
audioManager.isMute(audioRingtone).then(function (data) {
await audioManager.mute(AUDIO_RINGTONE,true).then(function () {
console.log('Set Stream Mute: Ringtone: Promise: SetVolume');
audioManager.setVolume(AUDIO_RINGTONE,HIGH_VOL);
audioManager.isMute(AUDIO_RINGTONE).then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: PASS:'+data);
console.log('Promise: Is Stream Mute Ringtone: SetVolume: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: FAIL: '+data);
console.log('Promise: Is Stream Mute Ringtone: SetVolume: FAIL: '+data);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: ERROR:' + err.message);
console.info('Promise: Is Stream Mute Ringtone: SetVolume: ERROR:' + err.message);
expect(false).assertTrue();
});
done();
......@@ -2730,26 +2818,27 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_mute_020', 0, async function (done) {
audioManager.mute(audioRingtone,true, (err) => {
audioManager.mute(AUDIO_RINGTONE,true, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to set Mute Status ${err.message}`);
console.error(`SetVolume: Ringtone : failed to set Mute Status ${err.message}`);
expect().assertFail();
}
else {
console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Callback : SetVolume');
audioManager.setVolume(audioRingtone,lowVol);
audioManager.isMute(audioRingtone, (err, data) => {
console.log('Set Stream Mute: Ringtone: Callback : SetVolume');
audioManager.setVolume(AUDIO_RINGTONE,LOW_VOL);
audioManager.isMute(AUDIO_RINGTONE, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to get Mute Status ${err.message}`);
console.error(`SetVolume: Ringtone : failed to get Mute Status ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS: '+data);
console.log('Callback : Is Stream Mute Ringtone: SetVolume: PASS: '+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL: '+data);
console.log('Callback : Is Stream Mute Ringtone: SetVolume: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2767,16 +2856,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_isActive_005', 0, async function (done) {
console.log('AudioFrameworkTest: Promise : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
const promise = audioManager.isActive(audioMedia);
console.log('Promise : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
const promise = audioManager.isActive(AUDIO_MEDIA);
promise.then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: PASS:'+data);
console.log('Promise: isActive: Media: TRUE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: FAIL: '+data);
console.log('Promise: isActive: Media: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
});
......@@ -2792,19 +2882,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_isActive_006', 0, async function (done) {
console.log('AudioFrameworkTest: Callback : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
audioManager.isActive(audioMedia, (err, data) => {
console.log('Callback : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
audioManager.isActive(AUDIO_MEDIA, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : Media : isActive: failed ${err.message}`);
console.error(`Media : isActive: failed ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: PASS:'+data);
console.log('Callback: isActive: Media: TRUE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: FAIL: '+data);
console.log('Callback: isActive: Media: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2819,16 +2910,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_isActive_007', 0, async function (done) {
console.log('AudioFrameworkTest: Promise : isActive Ringtone: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
const promise = audioManager.isActive(audioRingtone);
console.log('Promise : isActive Ringtone: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
const promise = audioManager.isActive(AUDIO_RINGTONE);
promise.then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: PASS:'+data);
console.log('Promise: isActive: Ringtone: TRUE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: FAIL: '+data);
console.log('Promise: isActive: Ringtone: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
});
......@@ -2844,19 +2936,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_isActive_008', 0, async function (done) {
console.log('AudioFrameworkTest: Callback : isActive Ringtone: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
audioManager.isActive(audioRingtone, (err, data) => {
console.log('Callback : isActive Ringtone: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
audioManager.isActive(AUDIO_RINGTONE, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : Ringtone : isActive: failed ${err.message}`);
console.error(`Ringtone : isActive: failed ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: PASS:'+data);
console.log('Callback: isActive: Ringtone: TRUE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: FAIL: '+data);
console.log('Callback: isActive: Ringtone: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2871,16 +2964,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_isActive_013', 0, async function (done) {
console.log('AudioFrameworkTest: Promise : isActive Media: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
console.log('Promise : isActive Media: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
const promise = audioManager.isActive(audio.AudioVolumeType.MEDIA);
promise.then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: PASS:'+data);
console.log('Promise: isActive: Media: ENAME: TRUE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: FAIL: '+data);
console.log('Promise: isActive: Media: ENAME: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
});
......@@ -2896,19 +2990,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_isActive_014', 0, async function (done) {
console.log('AudioFrameworkTest: Callback : isActive Media: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
console.log('Callback : isActive Media: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : Media : ENAME: isActive: failed ${err.message}`);
console.error(`Media : ENAME: isActive: failed ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: PASS:'+data);
console.log('Callback: isActive: Media: ENAME: TRUE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: FAIL: '+data);
console.log('Callback: isActive: Media: ENAME: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2923,16 +3018,17 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_isActive_015', 0, async function (done) {
console.log('AudioFrameworkTest: Promise : isActive Ringtone: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
console.log('Promise : isActive Ringtone: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
const promise = audioManager.isActive(audio.AudioVolumeType.RINGTONE);
promise.then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: PASS:'+data);
console.log('Promise: isActive: Ringtone: ENAME: TRUE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: FAIL: '+data);
console.log('Promise: isActive: Ringtone: ENAME: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
});
......@@ -2948,19 +3044,20 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_isActive_016', 0, async function (done) {
console.log('AudioFrameworkTest: Callback : isActive Ringtone: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
console.log('Callback : isActive Ringtone: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS');
audioManager.isActive(audio.AudioVolumeType.RINGTONE, (err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : Ringtone : ENAME: isActive: failed ${err.message}`);
console.error(`Ringtone : ENAME: isActive: failed ${err.message}`);
expect().assertFail();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: PASS:'+data);
console.log('Callback: isActive: Ringtone: ENAME: TRUE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: FAIL: '+data);
console.log('Callback: isActive: Ringtone: ENAME: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -2975,21 +3072,22 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setMicrophoneMute_001', 0, async function (done) {
await audioManager.setMicrophoneMute(true).then(function () {
console.log('AudioFrameworkTest: setMicrophoneMute: Promise: TRUE');
console.log('setMicrophoneMute: Promise: TRUE');
audioManager.isMicrophoneMute().then(function (data) {
if(data==true){
console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: PASS:'+data);
console.log('Promise: isMicrophoneMute: TRUE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: FAIL: '+data);
console.log('Promise: isMicrophoneMute: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Promise: setMicrophoneMute: TRUE: FAIL: Error :' + err.message);
console.info('Promise: setMicrophoneMute: TRUE: FAIL: Error :' + err.message);
expect(false).assertTrue();
});
done();
......@@ -3003,21 +3101,22 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setMicrophoneMute_002', 0, async function (done) {
await audioManager.setMicrophoneMute(false).then(function () {
console.log('AudioFrameworkTest: setMicrophoneMute: Promise: FALSE');
console.log('setMicrophoneMute: Promise: FALSE');
audioManager.isMicrophoneMute().then(function (data) {
if(data==false){
console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: PASS:'+data);
console.log('Promise: isMicrophoneMute: FALSE: PASS:'+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: FAIL: '+data);
console.log('Promise: isMicrophoneMute: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Promise: setMicrophoneMute: FALSE: FAIL: Error :' + err.message);
console.info('Promise: setMicrophoneMute: FALSE: FAIL: Error :' + err.message);
expect(false).assertTrue();
});
done();
......@@ -3031,25 +3130,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setMicrophoneMute_003', 0, async function (done) {
audioManager.setMicrophoneMute(true, (err) => {
if (err) {
console.error(`AudioFrameworkTest: setMicrophoneMute: Callback : TRUE: Error : ${err.message}`);
console.error(`setMicrophoneMute: Callback : TRUE: Error : ${err.message}`);
expect(false).assertTrue();
}
else {
console.log('AudioFrameworkTest: setMicrophoneMute: Callback : TRUE');
console.log('setMicrophoneMute: Callback : TRUE');
audioManager.isMicrophoneMute((err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : TRUE: isMicrophoneMute : Error ${err.message}`);
console.error(`TRUE: isMicrophoneMute : Error ${err.message}`);
expect(false).assertTrue();
}
else if(data==true){
console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: PASS: '+data);
console.log('Callback : isMicrophoneMute: TRUE: PASS: '+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: FAIL: '+data);
console.log('Callback : isMicrophoneMute: TRUE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -3067,25 +3167,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setMicrophoneMute_004', 0, async function (done) {
audioManager.setMicrophoneMute(false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: setMicrophoneMute: Callback : FALSE: Error : ${err.message}`);
console.error(`setMicrophoneMute: Callback : FALSE: Error : ${err.message}`);
expect(false).assertTrue();
}
else {
console.log('AudioFrameworkTest: setMicrophoneMute: Callback : FALSE');
console.log('setMicrophoneMute: Callback : FALSE');
audioManager.isMicrophoneMute((err, data) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : FALSE: isMicrophoneMute : Error ${err.message}`);
console.error(`FALSE: isMicrophoneMute : Error ${err.message}`);
expect(false).assertTrue();
}
else if(data==false){
console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: PASS: '+data);
console.log('Callback : isMicrophoneMute: FALSE: PASS: '+data);
expect(true).assertTrue();
}
else{
console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: FAIL: '+data);
console.log('Callback : isMicrophoneMute: FALSE: FAIL: '+data);
expect(false).assertTrue();
}
done();
......@@ -3103,21 +3204,22 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_001', 0, async function (done) {
await audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Activate');
console.info('Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Activate');
audioManager.isDeviceActive(7).then(function (value){
if(value==true){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : PASS :' +value);
console.info('Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL :' +value);
console.info('Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL : Error :' + err.message);
console.info('Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL : Error :' + err.message);
expect(false).assertTrue();
});
done();
......@@ -3131,22 +3233,23 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_002', 0, async function (done) {
await audioManager.setDeviceActive(2,false).then(function (){
// Setting device active ENUM 2 = SPEAKER
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate');
console.info('Device Test: Promise : setDeviceActive : SPEAKER: Deactivate');
audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value){
if(value==false){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' +value);
console.info('Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value);
console.info('Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message);
console.info('Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message);
expect(false).assertTrue();
});
done();
......@@ -3160,21 +3263,22 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_003', 0, async function (done) {
await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate');
console.info('Device Test: Promise : setDeviceActive : SPEAKER: Activate');
audioManager.isDeviceActive(2).then(function (value){
if(value==true){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' +value);
console.info('Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' +value);
console.info('Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message);
console.info('Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message);
expect(false).assertTrue();
});
done();
......@@ -3188,22 +3292,23 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_004', 0, async function (done) {
await audioManager.setDeviceActive(7,false).then(function (){
// Setting device active ENUM 3 = BLUETOOTH_SCO
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Deactivate');
console.info('Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Deactivate');
audioManager.isDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO).then(function (value){
if(value==false){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
console.info('Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
console.info('Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL : Error :' + err.message);
console.info('Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL : Error :' + err.message);
expect(false).assertTrue();
});
done();
......@@ -3217,25 +3322,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_005', 0, async function (done) {
audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
console.error(`Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
console.info('Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
audioManager.isDeviceActive(7,(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
console.error(`Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==true){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : PASS :' +value);
console.info('Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : FAIL :' +value);
console.info('Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3253,25 +3359,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_006', 0, async function (done) {
audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`);
console.error(`Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active');
console.info('Device Test: Callback : setDeviceActive : SPEAKER: Active');
audioManager.isDeviceActive(2,(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`);
console.error(`Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==false){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' +value);
console.info('Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value);
console.info('Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3289,25 +3396,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_007', 0, async function (done) {
audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active: Error: ${err.message}`);
console.error(`Device Test: Callback : setDeviceActive : SPEAKER: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active');
console.info('Device Test: Callback : setDeviceActive : SPEAKER: Active');
audioManager.isDeviceActive(2,(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active: Error: ${err.message}`);
console.error(`Device Test: Callback : isDeviceActive : SPEAKER: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==true){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' +value);
console.info('Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' +value);
console.info('Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3325,25 +3433,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_008', 0, async function (done) {
audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
console.error(`Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
console.info('Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
audioManager.isDeviceActive(7,(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
console.error(`Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==false){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
console.info('Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
console.info('Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3361,17 +3470,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_001', 0, async function (done) {
const promise = audioManager.setAudioParameter('PBits per sample', '8 bit');
promise.then(function () {
console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter');
console.info('Audio Parameter Test: Promise : setAudioParameter');
audioManager.getAudioParameter('PBits per sample').then(function (value){
if(value=='8 bit'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' +value);
console.info('Promise: getAudioParameter: Bits per sample : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' +value);
console.info('Promise: getAudioParameter : Bits per sample : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3388,17 +3498,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_002', 0, async function (done) {
const promise = audioManager.setAudioParameter('PNumber', '4800');
promise.then(function () {
console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter');
console.info('Audio Parameter Test: Promise : setAudioParameter');
audioManager.getAudioParameter('PNumber').then(function (value){
if(value=='4800'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: PNumber : PASS :' +value);
console.info('Promise: getAudioParameter: PNumber : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : PNumber : FAIL :' +value);
console.info('Promise: getAudioParameter : PNumber : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3415,17 +3526,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_003', 0, async function (done) {
const promise = audioManager.setAudioParameter('PLNumber',longValue);
const promise = audioManager.setAudioParameter('PLNumber',LONG_VALUE);
promise.then(function () {
console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter');
console.info('Audio Parameter Test: Promise : setAudioParameter');
audioManager.getAudioParameter('PLNumber').then(function (value){
if(value==longValue){
console.info('AudioFrameworkTest: Promise: getAudioParameter: PLNumber : PASS :' +value);
if(value==LONG_VALUE){
console.info('Promise: getAudioParameter: PLNumber : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : PLNumber : FAIL :' +value);
console.info('Promise: getAudioParameter : PLNumber : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3442,17 +3554,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_004', 0, async function (done) {
const promise = audioManager.setAudioParameter('PDecimal', '10.000000234324324324');
promise.then(function () {
console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter');
console.info('Audio Parameter Test: Promise : setAudioParameter');
audioManager.getAudioParameter('PDecimal').then(function (value){
if(value=='10.000000234324324324'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: PDecimal : PASS :' +value);
console.info('Promise: getAudioParameter: PDecimal : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : PDecimal : FAIL :' +value);
console.info('Promise: getAudioParameter : PDecimal : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3472,14 +3585,14 @@ describe('audioManger', function () {
it('SUB_AUDIO_MANAGER_setAudioParameter_005', 0, async function (done) {
const promise = audioManager.setAudioParameter('1212', 'PPNumber');
promise.then(function () {
console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter');
console.info('Audio Parameter Test: Promise : setAudioParameter');
audioManager.getAudioParameter('1212').then(function (value){
if(value=='PPNumber'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: 1212 : PASS :' +value);
console.info('Promise: getAudioParameter: 1212 : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : 1212 : FAIL :' +value);
console.info('Promise: getAudioParameter : 1212 : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3496,17 +3609,18 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_006', 0, async function (done) {
const promise = audioManager.setAudioParameter('PSpecial', '[]\:";<>?,./~!@#$%^*()_+-={}|');
promise.then(function () {
console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter');
console.info('Audio Parameter Test: Promise : setAudioParameter');
audioManager.getAudioParameter('PSpecial').then(function (value){
if(value=='[]\:";<>?,./~!@#$%^*()_+-={}|'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: PSpecial : PASS :' +value);
console.info('Promise: getAudioParameter: PSpecial : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : PSpecial : FAIL :' +value);
console.info('Promise: getAudioParameter : PSpecial : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3523,25 +3637,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_007', 0, async function (done) {
audioManager.setAudioParameter('CBSample Rate', '16 bit', (err) => {
console.info('AudioFrameworkTest: Audio Parameter Test: Callback : setAudioParameter');
console.info('Audio Parameter Test: Callback : setAudioParameter');
if (err) {
console.error(`AudioFrameworkTest: Callback : setAudioParameter: CBSample Rate : Error: ${err.message}`);
console.error(`setAudioParameter: CBSample Rate : Error: ${err.message}`);
expect(false).assertTrue();
}
else{
audioManager.getAudioParameter('CBSample Rate', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBSample Rate: Error: ${err.message}`);
console.error(`getAudioParameter: CBSample Rate: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='16 bit'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: PASS :' +value);
console.info('Callback: getAudioParameter: CBSample Rate: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: FAIL :' +value);
console.info('Callback: getAudioParameter: CBSample Rate: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3559,25 +3674,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_008', 0, async function (done) {
audioManager.setAudioParameter('Special', '~!@#$%^*()_+-={}|[]\:";<>?,./', (err) => {
console.info('AudioFrameworkTest: Audio Parameter Test: Callback : setAudioParameter');
console.info('Audio Parameter Test: Callback : setAudioParameter');
if (err) {
console.error(`AudioFrameworkTest: Callback : setAudioParameter: Special : Error: ${err.message}`);
console.error(`setAudioParameter: Special : Error: ${err.message}`);
expect(false).assertTrue();
}
else{
audioManager.getAudioParameter('Special', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParam: Special: Error: ${err.message}`);
console.error(`getAudioParam: Special: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='~!@#$%^*()_+-={}|[]\:";<>?,./'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: PASS :' +value);
console.info('Callback: getAudioParameter: Special: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: FAIL :' +value);
console.info('Callback: getAudioParameter: Special: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3595,25 +3711,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_009', 0, async function (done) {
audioManager.setAudioParameter('CBDecimal', '10000.21321432432432', (err) => {
console.info('AudioFrameworkTest: Audio Parameter Test: Callback : setAudioParameter');
console.info('Audio Parameter Test: Callback : setAudioParameter');
if (err) {
console.error(`AudioFrameworkTest: Callback : setAudioParameter: CBDecimal : Error: ${err.message}`);
console.error(`setAudioParameter: CBDecimal : Error: ${err.message}`);
expect(false).assertTrue();
}
else{
audioManager.getAudioParameter('CBDecimal', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback :getAudioParm: CBDecimal:Error: ${err.message}`);
console.error(`getAudioParm: CBDecimal:Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='10000.21321432432432'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: PASS :' +value);
console.info('Callback: getAudioParameter: CBDecimal: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: FAIL :' +value);
console.info('Callback: getAudioParameter: CBDecimal: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3631,25 +3748,26 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_010', 0, async function (done) {
audioManager.setAudioParameter('CBNumber', '5454', (err) => {
console.info('AudioFrameworkTest: Audio Parameter Test: Callback :CBNumber : setAudioParameter');
console.info('Audio Parameter Test: Callback :CBNumber : setAudioParameter');
if (err) {
console.error(`AudioFrameworkTest: Callback : setAudioParameter: CBNumber : Error: ${err.message}`);
console.error(`setAudioParameter: CBNumber : Error: ${err.message}`);
expect(false).assertTrue();
}
else{
audioManager.getAudioParameter('CBNumber', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParam: CBNumber: Error: ${err.message}`);
console.error(`getAudioParam: CBNumber: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='5454'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: PASS :' +value);
console.info('Callback: getAudioParameter: CBNumber: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: FAIL :' +value);
console.info('Callback: getAudioParameter: CBNumber: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3667,24 +3785,25 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_011', 0, async function (done) {
audioManager.setAudioParameter('CBLNumber', longValue, (err) => {
console.info('AudioFrameworkTest: Audio Parameter Test: Callback :CBLNumber : setAudioParameter');
audioManager.setAudioParameter('CBLNumber', LONG_VALUE, (err) => {
console.info('Audio Parameter Test: Callback :CBLNumber : setAudioParameter');
if (err) {
console.error(`AudioFrameworkTest: Callback : setAudioParameter: CBLNumber : Error: ${err.message}`);
console.error(`setAudioParameter: CBLNumber : Error: ${err.message}`);
expect(false).assertTrue();
}
audioManager.getAudioParameter('CBLNumber', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBLNumber: Error: ${err.message}`);
console.error(`getAudioParameter: CBLNumber: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==longValue){
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: PASS :' +value);
else if(value==LONG_VALUE){
console.info('Callback: getAudioParameter: CBLNumber: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: FAIL :' +value);
console.info('Callback: getAudioParameter: CBLNumber: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3701,24 +3820,25 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setAudioParameter_012', 0, async function (done) {
audioManager.setAudioParameter('345667', 'xyza', (err) => {
console.info('AudioFrameworkTest: Audio Parameter Test: Callback :345667 : setAudioParameter');
console.info('Audio Parameter Test: Callback :345667 : setAudioParameter');
if (err) {
console.error(`AudioFrameworkTest: Callback : setAudioParameter: 345667 : Error: ${err.message}`);
console.error(`setAudioParameter: 345667 : Error: ${err.message}`);
expect(false).assertTrue();
}
audioManager.getAudioParameter('345667', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParameter: 345667: Error: ${err.message}`);
console.error(`getAudioParameter: 345667: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='xyza'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: PASS :' +value);
console.info('Callback: getAudioParameter: 345667: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: FAIL :' +value);
console.info('Callback: getAudioParameter: 345667: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3735,15 +3855,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_001', 0, async function (done) {
const promise = audioManager.getAudioParameter('PBits per sample');
promise.then(function (value){
if(value=='8 bit'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' +value);
console.info('Promise: getAudioParameter: Bits per sample : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' +value);
console.info('Promise: getAudioParameter : Bits per sample : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3759,15 +3880,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_002', 0, async function (done) {
const promise = audioManager.getAudioParameter('PNumber');
promise.then(function (value){
if(value=='4800'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: PNumber : PASS :' +value);
console.info('Promise: getAudioParameter: PNumber : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : PNumber : FAIL :' +value);
console.info('Promise: getAudioParameter : PNumber : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3783,15 +3905,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_003', 0, async function (done) {
const promise = audioManager.getAudioParameter('PLNumber');
promise.then(function (value){
if(value==longValue){
console.info('AudioFrameworkTest: Promise: getAudioParameter: PLNumber : PASS :' +value);
if(value==LONG_VALUE){
console.info('Promise: getAudioParameter: PLNumber : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : PLNumber : FAIL :' +value);
console.info('Promise: getAudioParameter : PLNumber : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3807,15 +3930,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_004', 0, async function (done) {
const promise = audioManager.getAudioParameter('PDecimal');
promise.then(function (value){
if(value=='10.000000234324324324'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: PDecimal : PASS :' +value);
console.info('Promise: getAudioParameter: PDecimal : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : PDecimal : FAIL :' +value);
console.info('Promise: getAudioParameter : PDecimal : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3835,11 +3959,11 @@ describe('audioManger', function () {
const promise = audioManager.getAudioParameter('1212');
promise.then(function (value){
if(value=='PPNumber'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: 1212 : PASS :' +value);
console.info('Promise: getAudioParameter: 1212 : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : 1212 : FAIL :' +value);
console.info('Promise: getAudioParameter : 1212 : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3855,15 +3979,16 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_006', 0, async function (done) {
const promise = audioManager.getAudioParameter('PSpecial');
promise.then(function (value){
if(value=='[]\:";<>?,./~!@#$%^*()_+-={}|'){
console.info('AudioFrameworkTest: Promise: getAudioParameter: PSpecial : PASS :' +value);
console.info('Promise: getAudioParameter: PSpecial : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Promise: getAudioParameter : PSpecial : FAIL :' +value);
console.info('Promise: getAudioParameter : PSpecial : FAIL :' +value);
expect(false).assertTrue();
}
});
......@@ -3879,18 +4004,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_007', 0, async function (done) {
audioManager.getAudioParameter('CBSample Rate', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBSample Rate: Error: ${err.message}`);
console.error(`getAudioParameter: CBSample Rate: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='16 bit'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: PASS :' +value);
console.info('Callback: getAudioParameter: CBSample Rate: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: FAIL :' +value);
console.info('Callback: getAudioParameter: CBSample Rate: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3905,18 +4031,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_008', 0, async function (done) {
audioManager.getAudioParameter('Special', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParameter: Special: Error: ${err.message}`);
console.error(`getAudioParameter: Special: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='~!@#$%^*()_+-={}|[]\:";<>?,./'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: PASS :' +value);
console.info('Callback: getAudioParameter: Special: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: FAIL :' +value);
console.info('Callback: getAudioParameter: Special: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3931,18 +4058,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_009', 0, async function (done) {
audioManager.getAudioParameter('CBDecimal', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBDecimal: Error: ${err.message}`);
console.error(`getAudioParameter: CBDecimal: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='10000.21321432432432'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: PASS :' +value);
console.info('Callback: getAudioParameter: CBDecimal: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: FAIL :' +value);
console.info('Callback: getAudioParameter: CBDecimal: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3957,18 +4085,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_010', 0, async function (done) {
audioManager.getAudioParameter('CBNumber', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBNumber: Error: ${err.message}`);
console.error(`getAudioParameter: CBNumber: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='5454'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: PASS :' +value);
console.info('Callback: getAudioParameter: CBNumber: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: FAIL :' +value);
console.info('Callback: getAudioParameter: CBNumber: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -3983,18 +4112,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_011', 0, async function (done) {
audioManager.getAudioParameter('CBLNumber', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBLNumber: Error: ${err.message}`);
console.error(`getAudioParameter: CBLNumber: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==longValue){
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: PASS :' +value);
else if(value==LONG_VALUE){
console.info('Callback: getAudioParameter: CBLNumber: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: FAIL :' +value);
console.info('Callback: getAudioParameter: CBLNumber: FAIL :' +value);
expect(false).assertTrue();
}
done();
......@@ -4009,18 +4139,19 @@ describe('audioManger', function () {
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_getAudioParameter_012', 0, async function (done) {
audioManager.getAudioParameter('345667', (err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Callback : getAudioParameter: 345667: Error: ${err.message}`);
console.error(`getAudioParameter: 345667: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value=='xyza'){
console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: PASS :' +value);
console.info('Callback: getAudioParameter: 345667: PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: FAIL :' +value);
console.info('Callback: getAudioParameter: 345667: FAIL :' +value);
expect(false).assertTrue();
}
done();
......
......@@ -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);
})
......
......@@ -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",
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audioplayerapi",
"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.audioplayerapi",
"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.audioplayerapi.MainAbility",
"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"
}
],
"deviceType": [
"phone",
"tablet",
"tv",
"wearable"
],
"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": [
......
/*
* 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",
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiorecorder",
"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.audiorecorder",
"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.audiorecorder.MainAbility",
"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"
}
],
"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": [
......
/*
* 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) {
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);
});
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);
});
setErrorCallback(mySteps);
setTimeout(function() {
if (!isTimeOut) {
console.info('case is time out!');
expect(isTimeOut).assertTrue();
}
mySteps = undefined;
done();
}, TIME_OUT);
}
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]) {
......@@ -119,71 +120,58 @@ describe('RecorderLocalTestAudioFUNC', 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}`);
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);
});
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);
});
setErrorCallback(mySteps);
setTimeout(function() {
if (!isTimeOut) {
console.info('case is time out!');
expect(isTimeOut).assertTrue();
}
mySteps = undefined;
done();
}, TIME_OUT);
}
/* *
......@@ -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.
先完成此消息的编辑!
想要评论请 注册