diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index f1b661e8d0b863c0a3777cbab01f1cf5ba2f6443..77617e5fde975eb2af8bfa4aded5b885fa373de9 100644 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -21,6 +21,7 @@ group("multimedia") { "audio/audio_js_standard/AudioCapturerChangeInfo:audio_capturerchangeInfo_js_hap", "audio/audio_js_standard/AudioEventManagement:audio_eventmanagement_js_hap", "audio/audio_js_standard/AudioRendererChangeInfo:audio_rendererchangeInfo_js_hap", + "audio/audio_js_standard/AudioTonePlayer:audio_tone_player_js_hap", "audio/audio_js_standard/audioManager:audio_manager_js_hap", "audio/audio_js_standard/audioRenderer:audio_renderer_js_hap", "audio/audio_js_standard/audioVoip:audio_voip_js_hap", diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/BUILD.gn b/multimedia/audio/audio_js_standard/AudioTonePlayer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..128bfcf9af10bd608a9420f1e709630cca51232c --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/BUILD.gn @@ -0,0 +1,33 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("audio_tone_player_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":audio_tone_player_js_assets", + ":audio_tone_player_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAudioTonePlayerJsTest" + subsystem_name = "multimedia" + part_name = "multimedia_audio_framework" +} +ohos_js_assets("audio_tone_player_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("audio_tone_player_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/Test.json b/multimedia/audio/audio_js_standard/AudioTonePlayer/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5bf368da5b074d41ed823e0a491b9e2bd0d5e376 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for audio toneplayer Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "1500000", + "package": "ohos.acts.multimedia.audio.toneplayer", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAudioTonePlayerJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/signature/openharmony_sx.p7b b/multimedia/audio/audio_js_standard/AudioTonePlayer/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..0e9c4376f4c0ea2f256882a2170cd4e81ac135d7 Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioTonePlayer/signature/openharmony_sx.p7b differ diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/config.json b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..e252224e0c43d2d0ac25ddf4b3c27c9e7e80e077 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/config.json @@ -0,0 +1,85 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.audio.toneplayer", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.audio.toneplayer.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "default", + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": "ohos.acts.multimedia.audio.toneplayer.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "ohos.acts.multimedia.audio.toneplayer", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.MICROPHONE", + "reason": "use ohos.permission.MICROPHONE" + } + ] + } + } \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..830070d196d86b127cea947d168bfd116f446205 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/i18n/en-US.json b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/i18n/zh-CN.json b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("/common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/pages/index/index.hml b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..67f8b8567ccc4932331b7a18a6b947340d84fb40 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/test/AudioTonePlayer.test.js b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/test/AudioTonePlayer.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7ed81ae397239aff9ca9fe9c511504b4c55ab2d3 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/test/AudioTonePlayer.test.js @@ -0,0 +1,1131 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http:// www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import audio from '@ohos.multimedia.audio'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +describe('audioTonePlayer',function() { + let tonePlayerCallback = null; + let name; + beforeAll(function(){ + console.log('beforeAll test suit is executed'); + }) + beforeEach(function(){ + console.log('beforeEach test suit is executed'); + }) + beforeEach(function(){ + console.log('beforeEach test suit is executed'); + }) + + afterEach(function(){ + console.log('afterEach test suit is executed'); + }) + afterAll(function(){ + console.log('afterAll test suit is executed'); + }) + + async function recCallBack(info, type, name, done) { + console.info('AudioFrameworkRecLog: recCallBack : TonePlayer Function '+ JSON.stringify(name) + ', type: ' + type); + audio.createTonePlayer(info, async (err, data) => { + console.info('AudioFrameworkRecLog: TonePlayer : CREATE SUCCESS'); + if (err) { + console.error(`callback call createTonePlayer return error: ${err.message}`); + expect(true).assertFalse(); + console.info('createTonePlayer fail'); + done(); + return; + } else { + tonePlayerCallback = data; + console.error("callback call createTonePlayer return tonePlayer:" + JSON.stringify(tonePlayerCallback)); + } + tonePlayerCallback.load(type, async (err) => { + console.info('AudioFrameworkRecLog: TonePlayer : LOAD SUCCESS type: ' + type); + if (err) { + console.error(`callback call load failed error: ${err.message}`); + expect(true).assertFalse(); + console.error('callback load fail'); + done(); + return; + } else { + console.info(`callback call load success `); + } + tonePlayerCallback.start((err) => { + console.info('AudioFrameworkRecLog: TonePlayer : START SUCCESS'); + if (err) { + console.error(`callback call start failed error. ${err.message}`); + expect(true).assertFalse(); + console.error('start fail'); + done(); + return; + } else { + console.info(`callback call start success `); + } + console.error("callback stop -------------start"); + tonePlayerCallback.stop((err) => { + console.info('AudioFrameworkRecLog: TonePlayer : STOP SUCCESS'); + if (err) { + console.error(`callback call stop error. ${err.message}`); + expect(true).assertFalse(); + console.error('callback stop fail'); + done(); + return; + } else { + console.info(`callback call stop success `); + } + console.info("callback release -------------start"); + tonePlayerCallback.release((err) => { + console.info('AudioFrameworkRecLog: TonePlayer : RELEASE SUCCESS'); + if (err) { + console.error(`callback call release failed error. ${err.message}`); + expect(true).assertFalse(); + console.error('callback release fail'); + done(); + return; + } else { + console.info(`callback call release success `); + expect(true).assertTrue(); + console.info('RELEASE SUCCESS'); + done(); + } + }); //release + }); //stop + }); //start + }); //load + }); + } + + async function recPromise(audioRendererInfo, type, name) { + console.info('AudioFrameworkRecLog recPromise: promise : TonePlayer Function '+ JSON.stringify(name) + ', type: ' + type); + let resultFlag = true; + let tPlayer = null; + await audio.createTonePlayer(audioRendererInfo).then((result) => { + console.info('AudioFrameworkRecLog promise call createTonePlayer-----result: ' + JSON.stringify(result)); + tPlayer = result; + }).catch((err) => { + console.error('promise call createTonePlayer fail tPlayer: '+ tPlayer); + console.error(`promise call createTonePlayer ---fail error. ${err.message}`); + resultFlag = false; + }); + if (resultFlag == false) { + console.error('AudioFrameworkRecLog: createTonePlayer resultFlag : ' + resultFlag); + return resultFlag; + } + await tPlayer.load(type).then(() => { + console.info('AudioFrameworkRecLog: TonePlayer : LOAD SUCCESS'); + console.info('AudioFrameworkRecLog: ---------LOAD---------'); + }).catch((err) => { + resultFlag = false; + console.error(`promise call load ---fail error. ${err.message}`); + }); + if (resultFlag == false) { + console.error('AudioFrameworkRecLog: load resultFlag : ' + resultFlag); + return resultFlag; + } + await tPlayer.start().then(() => { + console.info('AudioFrameworkRecLog: TonePlayer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + }).catch((err) => { + resultFlag = false; + console.error(`promise call start ---fail error. ${err.message}`); + }); + if (resultFlag == false) { + console.error('AudioFrameworkRecLog: start resultFlag : ' + resultFlag); + return resultFlag; + } + await tPlayer.stop().then(() => { + console.info('AudioFrameworkRecLog: TonePlayer : STOP SUCCESS'); + console.info('AudioFrameworkRecLog: ---------STOP---------'); + }).catch((err) => { + resultFlag = false; + console.error(`promise call stop ---fail error. ${err.message}`); + }); + if (resultFlag == false) { + console.error('AudioFrameworkRecLog: stop resultFlag : ' + resultFlag); + return resultFlag; + } + await tPlayer.release().then(() => { + console.info('AudioFrameworkRecLog: TonePlayer : RELEASE SUCCESS'); + console.info('AudioFrameworkRecLog: ---------RELEASE---------'); + }).catch((err) => { + resultFlag = false; + console.error(`promise call release ---fail error. ${err.message}`); + }); + if (resultFlag == false) { + console.error('AudioFrameworkRecLog: release resultFlag : ' + resultFlag); + return resultFlag; + } + console.info('promise resultFlag : ' + resultFlag); + return resultFlag; + } + + async function recPromiseStartFail(audioRendererInfo, type, name) { + console.info('recPromiseFail: promise : TonePlayer Function '+ JSON.stringify(name) + ', type: ' + type); + let resultFlag = true; + let tPlayer = null; + console.info('AudioFrameworkRecLog: recPromiseFail : TonePlayer Function ' + JSON.stringify(name)); + await audio.createTonePlayer(audioRendererInfo).then((result) => { + console.info("recPromiseFail call createTonePlayer-----result:" + JSON.stringify(result)); + tPlayer = result; + }).catch((err) => { + console.error("recPromiseFail call createTonePlayer fail err: "+ JSON.stringify(err)+ ' tPlayer: '+ tPlayer); + console.error("recPromiseFail call createTonePlayer ---fail"); + resultFlag = false; + }); + if (resultFlag == false) { + console.error('recPromiseFail: createTonePlayer resultFlag : ' + resultFlag); + return resultFlag; + } + await tPlayer.start().then(() => { + console.info('recPromiseFail start TonePlayer : START SUCCESS'); + console.info('recPromiseFail ---------START---------'); + }).catch(() => { + resultFlag = false; + console.error("recPromiseFail call start fail"); + }); + if (resultFlag == false) { + console.error('recPromiseFail resultFlag : ' + resultFlag); + return resultFlag; + } + await tPlayer.release().then(() => { + console.info('recPromiseFail TonePlayer : RELEASE SUCCESS'); + console.info('recPromiseFail ---------RELEASE---------'); + }).catch((err) => { + resultFlag = false; + console.error("recPromiseFail call release fail " + JSON.stringify(err)); + }); + if (resultFlag == false) { + console.error('recPromiseFail resultFlag : ' + resultFlag); + return resultFlag; + } + console.info('recPromiseFail resultFlag : ' + resultFlag); + return resultFlag; + } + + async function recPromiseLoadStopSuccess(audioRendererInfo, type, name) { + console.info('recPromiseFail: promise : TonePlayer Function '+ JSON.stringify(name) + ', type: ' + type); + let resultFlag = true; + let tPlayer = null; + console.info('AudioFrameworkRecLog: recPromiseFail : TonePlayer Function ' + JSON.stringify(name)); + await audio.createTonePlayer(audioRendererInfo).then((result) => { + console.info("recPromiseFail call createTonePlayer-----result:" + JSON.stringify(result)); + tPlayer = result; + }).catch((err) => { + console.error("recPromiseFail call createTonePlayer fail err: "+ JSON.stringify(err)+ ' tPlayer: '+ tPlayer); + console.error("recPromiseFail call createTonePlayer ---fail"); + resultFlag = false; + }); + if (resultFlag == false) { + console.error('recPromiseFail: createTonePlayer resultFlag : ' + resultFlag); + return resultFlag; + } + await tPlayer.load(type).then(() => { + console.info('AudioFrameworkRecLog: TonePlayer : LOAD SUCCESS'); + console.info('AudioFrameworkRecLog: ---------LOAD---------'); + }).catch((err) => { + resultFlag = false; + console.error(`promise call load ---fail error. ${err.message}`); + }); + if (resultFlag == false) { + console.error('AudioFrameworkRecLog: load resultFlag : ' + resultFlag); + return resultFlag; + } + await tPlayer.stop().then(() => { + console.info('AudioFrameworkRecLog: TonePlayer : STOP SUCCESS'); + console.info('AudioFrameworkRecLog: ---------STOP---------'); + }).catch((err) => { + resultFlag = false; + console.error(`promise call stop ---fail error. ${err.message}`); + }); + if (resultFlag == false) { + console.error('AudioFrameworkRecLog: stop resultFlag : ' + resultFlag); + return resultFlag; + } + await tPlayer.release().then(() => { + console.info('recPromiseFail TonePlayer : RELEASE SUCCESS'); + console.info('recPromiseFail ---------RELEASE---------'); + }).catch((err) => { + resultFlag = false; + console.error("recPromiseFail call release fail " + JSON.stringify(err)); + }); + if (resultFlag == false) { + console.error('recPromiseFail resultFlag : ' + resultFlag); + return resultFlag; + } + console.info('recPromiseFail resultFlag : ' + resultFlag); + return resultFlag; + } + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_CALLBACK_ALL_0100 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : Callback test case of AudioTonePlayer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_CALLBACK_ALL_0100', 0, async function(done) { + let time1 = (new Date()).getTime(); + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + recCallBack(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_0, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_CALLBACK_ALL_0100', done); + let time2 = (new Date).getTime(); + console.info('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_CALLBACK_ALL_0100 finish time: ' + (time2 - time1)); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_CALLBACK_ALL_0200 + *@tc.name : AudioTonePlayer-create + *@tc.desc : Creation of AudioTonePlayer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_TTONEPLAYER_CALLBACK_ALL_0200', 1, async function(done) { + let time1 = (new Date()).getTime(); + audio.createTonePlayer(null, async (err, data) => { + console.info('SUB_MULTIMEDIA_AUDIO_TTONEPLAYER_CALLBACK_ALL_0200 param is null'); + if (err) { + console.error('callback call createTonePlayer return error:'+ JSON.stringify(err)); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + expect(false).assertFalse(); + done(); + } else { + tonePlayerCallback = data; + expect(true).assertFalse(); + done(); + console.error("callback call createTonePlayer return tonePlayer:" + JSON.stringify(tonePlayerCallback)); + } + console.error("callback create end----------- tonePlayerCallback:" + JSON.stringify(tonePlayerCallback)); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0100 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0100', 1, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_1, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0100'); + console.info('ArecPromise 01 resultFlag : ' + resultFlag); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 01 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0200 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 2 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0200', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_2, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0200'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 02 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0300 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 3 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0300', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_3, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0300'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 03 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0400 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 4 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0400', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_4, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0400'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 04 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0500 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 5 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0500', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_5, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0500'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 05 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0600 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 6 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0600', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_6, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0600'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 06 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0700 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 7 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0700', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_7, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0700'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 07 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0800 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 8 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0800', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_8, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0800'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 08 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0900 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 9 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0900', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_9, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_0900'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 09 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1000 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key * + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1000', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_S, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1000'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 10 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1100 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key # + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1100', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_P, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1100'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 11 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1200 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key A + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1200', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_A, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1200'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 12 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1300 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key B + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1300', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_B, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1300'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 13 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1400 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key C + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1400', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_C, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1400'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 14 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1500 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key D + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1500', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_D, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1500'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 15 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1600 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : AudioTonePlayer Dial Monitoring Tone Promise Success Test Case + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1600', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_SUPERVISORY_DIAL, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1600'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 16 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1700 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : AudioTonePlayer Busy Tone Promise Successful Test Case + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1700', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_SUPERVISORY_BUSY, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1700'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 17 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1800 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : AudioTonePlayer Congestion Promise Success Test Case + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1800', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_SUPERVISORY_CONGESTION, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1800'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 18 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1900 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : AudioTonePlayer Wireless Circuit Path Confirmation Monitoring Tone Promise Success Test Case + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1900', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_SUPERVISORY_RADIO_ACK, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_1900'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 19 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2000 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : AudioTonePlayer radio unavailable promise success test case + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2000', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_SUPERVISORY_RADIO_NOT_AVAILABLE, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2000'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 20 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2100 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : AudioTonePlayer Call Waiting Promise Success Test Case + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2100', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_SUPERVISORY_CALL_WAITING, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2100'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 21 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2200 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : AudioTonePlayer ring tone promise success test case + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2200', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_SUPERVISORY_RINGTONE, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2200'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 22 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2300 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : Promise success test case of AudioTonePlayer special beep + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2300', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_PROPRIETARY_BEEP, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2300'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 23 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2400 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : AudioTonePlayer positively approves the successful test case of a promise in a proprietary tone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2400', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_PROPRIETARY_ACK, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2400'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 24 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2500 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : AudioTonePlayer prompts the successful promise test case of the special tone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2500', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_PROPRIETARY_PROMPT, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2500'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 25 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2600 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : Success Test Case of Promise of AudioTonePlayer Dedicated Double Beep + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2600', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, audio.ToneType.TONE_TYPE_COMMON_PROPRIETARY_DOUBLE_BEEP, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2600'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 26 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2700 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : Promise test case of AudioTonePlayer error parameter - 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2700', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, -1, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2700'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 27 resultFlag : ' + resultFlag); + expect(resultFlag).assertFalse(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2800 + *@tc.name : AudioTonePlayer-create-load-start-stop-release + *@tc.desc : Promise test case with null AudioTonePlayer error parameter + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2800', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromise(audioRendererInfo, null, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2800'); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 28 resultFlag : ' + resultFlag); + expect(resultFlag).assertFalse(); + done(); + }, 1000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2900 + *@tc.name : AudioTonePlayer-create-stop-release fail + *@tc.desc : Test Case for Promise Failure of Dial Tone of AudioTonePlayer Key 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2900', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromiseStartFail(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_1, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_2900'); + console.info('ArecPromise 01 resultFlag : ' + resultFlag); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 29 resultFlag : ' + resultFlag); + expect(resultFlag).assertFalse(); + done(); + }, 2000) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_3000 + *@tc.name : AudioTonePlayer-create-load-stop-release success + *@tc.desc : The successful test case of the promise of the dial tone of AudioTonePlayer key 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_3000', 2, async function(done) { + let time1 = (new Date()).getTime(); + let resultFlag = false; + let audioRendererInfo = { + "contentType": audio.ContentType.CONTENT_TYPE_SONIFICATION, + "streamUsage": audio.StreamUsage.STREAM_USAGE_MEDIA, + "rendererFlags": 0 + } + + resultFlag = await recPromiseLoadStopSuccess(audioRendererInfo, audio.ToneType.TONE_TYPE_DIAL_1, 'SUB_MULTIMEDIA_AUDIO_TONEPLAYER_PROMISE_ALL_3000'); + console.info('ArecPromise 01 resultFlag : ' + resultFlag); + let time2 = (new Date).getTime(); + console.info('time: ' + (time2 - time1)); + setTimeout(function() { + console.info('AudioFrameworkRenderLog: callback all 30 resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }, 2000) + }) + +}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9ade1eab8c7ba3f12e4aa93d390bb1c6a36471f2 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/js/test/List.test.js @@ -0,0 +1,18 @@ +/** + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +require('./AudioTonePlayer.test.js') + + diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/resources/base/media/icon.png b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioTonePlayer/src/main/resources/base/media/icon.png differ