From b53af881188c3a2503fd43dc73ab36abf8d213d5 Mon Sep 17 00:00:00 2001 From: Geevarghese V K Date: Tue, 17 May 2022 17:06:34 +0530 Subject: [PATCH] xts test case updation Signed-off-by: Geevarghese V K --- .../audio_js_standard/audioManager/Test.json | 31 + .../audioManager/src/main/config.json | 44 +- .../src/main/js/test/AudioCall.test.js | 1643 +- ...000GHLLV.test.js => AudioCapturer.test.js} | 1222 +- ...N.test.js => AudioEventManagement.test.js} | 0 .../src/main/js/test/AudioPerf.test.js | 1085 -- .../src/main/js/test/AudioRenderer.test.js | 16036 ++++++++-------- .../src/main/js/test/AudioVOIP.test.js | 858 +- .../src/main/js/test/List.test.js | 13 +- .../src/main/js/test/RingtonePlayer.test.js | 4016 ---- .../src/main/js/test/getPermission.test.js | 69 + 11 files changed, 8658 insertions(+), 16359 deletions(-) rename multimedia/audio/audio_js_standard/audioManager/src/main/js/test/{SR000GHLLV.test.js => AudioCapturer.test.js} (83%) rename multimedia/audio/audio_js_standard/audioManager/src/main/js/test/{SR000GHQBN.test.js => AudioEventManagement.test.js} (100%) delete mode 100644 multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioPerf.test.js delete mode 100644 multimedia/audio/audio_js_standard/audioManager/src/main/js/test/RingtonePlayer.test.js create mode 100644 multimedia/audio/audio_js_standard/audioManager/src/main/js/test/getPermission.test.js diff --git a/multimedia/audio/audio_js_standard/audioManager/Test.json b/multimedia/audio/audio_js_standard/audioManager/Test.json index ee1050591..770de42cc 100755 --- a/multimedia/audio/audio_js_standard/audioManager/Test.json +++ b/multimedia/audio/audio_js_standard/audioManager/Test.json @@ -12,7 +12,38 @@ "ActsAudioManagerJsTest.hap" ], "type": "AppInstallKit", + "run-command": [ + "chmod 777 /data/*", + "chmod 777 /data -R", + "mkdir /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media" + ], "cleanup-apps": true + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/audio/audioManager/Believer.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/Believer60s.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-1C-8000-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-1C-16000-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-1C-32000-1SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-1C-64000-3SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-1C-96000-4SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-2C-11025-1SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-2C-12000-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", + "./resource/audio/audioManager/Believer.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media", + "./resource/audio/audioManager/file_example_WAV_1MG.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media", + "./resource/audio/audioManager/safe_and_sound_32.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media", + "./resource/audio/audioManager/test.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media", + "./resource/audio/audioManager/test.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media" + ] } ] } \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/config.json b/multimedia/audio/audio_js_standard/audioManager/src/main/config.json index cc29d5d6c..9bed2c591 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/config.json +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/config.json @@ -69,6 +69,48 @@ "autoDesignWidth": true } } - ] + ], + "reqPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", + "reason": "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.MEDIA_LOCATION", + "reason": "use ohos.permission.MEDIA_LOCATION" + }, + { + "name": "ohos.permission.READ_MEDIA", + "reason": "use ohos.permission.READ_MEDIA" + }, + { + "name": "ohos.permission.WRITE_MEDIA", + "reason": "use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.MICROPHONE", + "reason": "use ohos.permission.MICROPHONE" + }, + { + "name": "ohos.permission.ACCESS_NOTIFICATION_POLICY", + "reason": "use ohos.permission.ACCESS_NOTIFICATION_POLICY" + }, + { + "name": "ohos.permission.MODIFY_AUDIO_SETTINGS", + "reason": "use ohos.permission.MODIFY_AUDIO_SETTINGS" + } + ] } } \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js index 4502a2a7a..af3a71f78 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js @@ -17,14 +17,18 @@ import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; import ability_featureAbility from '@ohos.ability.featureAbility'; +import app from '@system.app'; +import bundle from '@ohos.bundle'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import featureAbility from '@ohos.ability.featureAbility' +import resourceManager from '@ohos.resourceManager'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; describe('audioCall', function () { var mediaDir; - var dateTime; - var dirPath; - var fpath; + let fdRead; + let readpath; var resultFlagRec; var resultFlagRen; const audioManager = audio.getAudioManager(); @@ -33,8 +37,8 @@ describe('audioCall', function () { const audioManagerRec = audio.getAudioManager(); console.info('AudioFrameworkRecLog: Create AudioManger Object JS Framework'); - async function getPathName(){ - var path1 = '/data/accounts/account_0/applications/'; + /*async function getPathName(){ + var path1 = '/data/accounts/account_0/appdata/'; var packageName; var context = ability_featureAbility.getContext(); await context.getBundleName() @@ -45,22 +49,17 @@ describe('audioCall', function () { console.error('AudioFrameworkRenderLog: Failed to obtain the cache directory. Cause:' + error.message); }); await sleep(200); - var mediaDirTemp = '/data' + //var mediaDirTemp = path1 + packageName + '/' + packageName + '/assets/entry/resources/rawfile'; + var mediaDirTemp = path1+packageName console.info('AudioFrameworkRenderLog: Resource DIR Path : '+mediaDirTemp); return mediaDirTemp; - } + }*/ beforeAll(async function () { + await applyPermission(); console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - mediaDir = await getPathName(); - dateTime = new Date().getTime(); - dirPath = '/data/accounts/account_0/applications'+'/RecTest'+dateTime; - console.info('AudioFrameworkRecLog: Recording files Path: '+dirPath); - fpath = dirPath+'/capture_js.pcm'; - await sleep(100); - fileio.mkdirSync(dirPath); - console.info('AudioFrameworkTest: beforeAll: END'); + mediaDir = '/data/storage/el2/base/haps/entry/cache'; }) beforeEach(async function () { @@ -81,7 +80,71 @@ describe('audioCall', function () { return new Promise(resolve => setTimeout(resolve, ms)); } - async function playbackPromise (AudioRendererOptions, fpath, AudioScene) { + async function getFileDescriptor(fileName) { + let fileDescriptor = undefined; + await resourceManager.getResourceManager().then(async (mgr) => { + await mgr.getRawFileDescriptor(fileName).then(value => { + fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length }; + }).catch(error => { + console.log('AudioFrameworkRenderLog:case getRawFileDescriptor err: ' + error); + }); + }); + return fileDescriptor; + } + + async function closeFileDescriptor(fileName) { + await resourceManager.getResourceManager().then(async (mgr) => { + await mgr.closeRawFileDescriptor(fileName).then(value => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:' + fileName); + }).catch(error => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor err: ' + error); + }); + }); + } + async function getFdRead(pathName, done) { + await getFileDescriptor(pathName).then((res) => { + if (res == undefined) { + expect().assertFail(); + console.info('AudioFrameworkRenderLog:case error fileDescriptor undefined, open file fail'); + done(); + } else { + fdRead = res.fd; + console.info("AudioFrameworkRenderLog:case 0 fdRead is: " + fdRead); + } + }) + } + + async function applyPermission() { + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('AudioFrameworkRenderLog:[permission] case accessTokenID is ' + tokenID); + let permissionName1 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName2 = 'ohos.permission.READ_MEDIA'; + let permissionName3 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :' + err); + }); + } else { + console.info('AudioFrameworkRenderLog:[permission] case apply permission failed, createAtManager failed'); + } + } + + + async function playbackPromise (AudioRendererOptions, pathName, AudioScene) { resultFlagRen = 'new'; console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); @@ -94,27 +157,6 @@ describe('audioCall', function () { resultFlagRen=false; return resultFlagRen; }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioManager.setAudioScene(AudioScene).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRenderLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlagRen=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - resultFlagRen=false; - }); - if (resultFlagRen == false){ - console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); - return resultFlagRen; - } console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); await audioRen.getStreamInfo().then(async function (audioParamsGet) { @@ -172,25 +214,25 @@ describe('audioCall', function () { return resultFlagRen; } - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case2: File Path: ' + ss); let discardHeader = new ArrayBuffer(44); ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case3: File totalSize size: ' +totalSize); totalSize = totalSize-44; console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); let rlen = 0; - while (rlen < totalSize) { + while (rlen < totalSize/4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); await audioRen.write(buf); if (rlen > (totalSize/2)){ await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : '+data); }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); resultFlagRen=false; }); } @@ -254,22 +296,6 @@ describe('audioCall', function () { console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); - await audioManagerRec.setAudioScene(AudioScene).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - resultFlagRec=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - resultFlagRec=false; - }); - if (resultFlagRec == false){ - console.info('AudioFrameworkRecLog: resultFlagRec : '+resultFlagRec); - return resultFlagRec; - } await audioCap.getStreamInfo().then(async function (audioParamsGet) { console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); @@ -335,7 +361,7 @@ describe('audioCall', function () { return resultFlagRec; } - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { var buffer = await audioCap.read(bufferSize, true); var number = fileio.writeSync(fd, buffer); @@ -372,8 +398,8 @@ describe('audioCall', function () { /* * * @tc.number : SUB_AUDIO_VOIP_Play_001 - * @tc.name : SetAudioScene during playback - * @tc.desc : SetAudioScene during playback + * @tc.name : + * @tc.desc : * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 @@ -398,19 +424,20 @@ describe('audioCall', function () { rendererInfo: AudioRendererInfo } - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-1C-44100-2SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + readpath = 'StarWars10s-1C-44100-2SW.wav'; + await getFdRead(readpath,done); + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - + await closeFileDescriptor(readpath); done(); }) /* * * @tc.number : SUB_AUDIO_VOIP_Rec_001 - * @tc.name : SetAudioScene during Recording - * @tc.desc : SetAudioScene during Recording + * @tc.name : + * @tc.desc : * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 @@ -434,20 +461,19 @@ describe('audioCall', function () { capturerInfo: AudioCapturerInfo } - var resultFlag = await recPromise(AudioCapturerOptions, dirPath+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + var resultFlag = await recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); expect(resultFlag).assertTrue(); - done(); }) /* * * @tc.number : SUB_AUDIO_VOIP_RecPlay_001 - * @tc.name : Record & play at same time - setAudioScene - * @tc.desc : Record & play at same time - setAudioScene + * @tc.name : + * @tc.desc : * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 @@ -488,10 +514,12 @@ describe('audioCall', function () { streamInfo: AudioStreamInfoRen, rendererInfo: AudioRendererInfo } - recPromise(AudioCapturerOptions, dirPath+'/capture_js-44100-2C-16B-2.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(500); - await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-1C-44100-2SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B-2.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(500); + readpath = 'StarWars10s-1C-44100-2SW.wav'; + await getFdRead(readpath,done); + await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(1000); console.info('AudioFrameworkRecLog: resultFlag : Capturer : '+resultFlagRec); console.info('AudioFrameworkRenderLog: resultFlag : Renderer : '+resultFlagRen); @@ -501,1469 +529,8 @@ describe('audioCall', function () { else{ expect(false).assertTrue(); } - + await closeFileDescriptor(readpath); done(); }) - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_001 - * @tc.name : setAudioScene as VOIP - Promise - ENUM - * @tc.desc : setAudioScene as VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_001', 0, async function (done) { - - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_002 - * @tc.name : getAudioScene as VOIP - Promise - ENUM - * @tc.desc : getAudioScene as VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_002', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_003 - * @tc.name : getAudioScene as VOIP to Ringtone - Promise - ENUM - * @tc.desc : getAudioScene as VOIP to Ringtone - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_003', 0, async function (done) { - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_RINGING).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_RINGING){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_004 - * @tc.name : setAudioScene as VOIP - Promise - ENUM - * @tc.desc : setAudioScene as VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_004', 0, async function (done) { - - await audioManager.setAudioScene(3).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_005 - * @tc.name : getAudioScene as VOIP - Promise - ENUM - * @tc.desc : getAudioScene as VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_005', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_006 - * @tc.name : getAudioScene as VOIP to Ringtone - Promise - ENUM - * @tc.desc : getAudioScene as VOIP to Ringtone - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_006', 0, async function (done) { - await audioManager.setAudioScene(1).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == 1){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_007 - * @tc.name : setAudioScene as VOIP - Callback - ENAME - * @tc.desc : setAudioScene as VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_007', 0, async function (done) { - - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); - - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_008 - * @tc.name : getAudioScene as VOIP - Callback - ENAME - * @tc.desc : getAudioScene as VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_008', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_009 - * @tc.name : getAudioScene as VOIP to Ringtone - Callback - ENAME - * @tc.desc : getAudioScene as VOIP to Ringtone - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_009', 0, async function (done) { - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_RINGING,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_RINGING){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_010 - * @tc.name : setAudioScene as VOIP - Callback - ENUM - * @tc.desc : setAudioScene as VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_010', 0, async function (done) { - - audioManager.setAudioScene(3, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); - - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_011 - * @tc.name : getAudioScene as VOIP - Callback - ENUM - * @tc.desc : getAudioScene as VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_011', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_012 - * @tc.name : getAudioScene as VOIP to Ringtone - Callback - ENUM - * @tc.desc : getAudioScene as VOIP to Ringtone - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_012', 0, async function (done) { - audioManager.setAudioScene(1,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 1){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_013 - * @tc.name : setAudioScene as VOIP - Promise - Out Of Range - * @tc.desc : setAudioScene as VOIP - Out Of Range - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_013', 0, async function (done) { - - await audioManager.setAudioScene(10).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(false).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(true).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_014 - * @tc.name : setAudioScene as VOIP - Callback - Out Of Range - * @tc.desc : setAudioScene as VOIP - Out Of Range - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_014', 0, async function (done) { - - audioManager.setAudioScene(-1, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(true).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(false).assertTrue(); - } - }); - - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_015 - * @tc.name : setAudioScene as AUDIO_SCENE_RINGING - Promise - ENUM - * @tc.desc : setAudioScene as AUDIO_SCENE_RINGING - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_015', 0, async function (done) { - - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_RINGING).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_016 - * @tc.name : getAudioScene as AUDIO_SCENE_RINGING - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_RINGING - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_016', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_RINGING){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_017 - * @tc.name : getAudioScene as Ringtone to VOIP - Promise - ENUM - * @tc.desc : getAudioScene as Ringtone to VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_017', 0, async function (done) { - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_018 - * @tc.name : setAudioScene as AUDIO_SCENE_RINGING - Promise - ENUM - * @tc.desc : setAudioScene as AUDIO_SCENE_RINGING - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_018', 0, async function (done) { - - await audioManager.setAudioScene(1).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_019 - * @tc.name : getAudioScene as AUDIO_SCENE_RINGING - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_RINGING - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_019', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == 1){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_020 - * @tc.name : getAudioScene as Ringtone to VOIP - Promise - ENUM - * @tc.desc : getAudioScene as Ringtone to VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_020', 0, async function (done) { - await audioManager.setAudioScene(3).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_021 - * @tc.name : setAudioScene as AUDIO_SCENE_RINGING - Callback - ENAME - * @tc.desc : setAudioScene as AUDIO_SCENE_RINGING - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_021', 0, async function (done) { - - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_RINGING, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); - - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_022 - * @tc.name : getAudioScene as AUDIO_SCENE_RINGING - Callback - ENAME - * @tc.desc : getAudioScene as AUDIO_SCENE_RINGING - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_022', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_RINGING){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_023 - * @tc.name : getAudioScene as Ringtone to VOIP - Callback - ENAME - * @tc.desc : getAudioScene as Ringtone to VOIP- ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_023', 0, async function (done) { - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_024 - * @tc.name : setAudioScene as AUDIO_SCENE_RINGING - Callback - ENUM - * @tc.desc : setAudioScene as AUDIO_SCENE_RINGING - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_024', 0, async function (done) { - - audioManager.setAudioScene(1, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); - - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_025 - * @tc.name : getAudioScene as AUDIO_SCENE_RINGING - Callback - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_RINGING - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_025', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 1){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_026 - * @tc.name : getAudioScene as Ringtone to VOIP - Callback - ENUM - * @tc.desc : getAudioScene as Ringtone to VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_026', 0, async function (done) { - audioManager.setAudioScene(3,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_027 - * @tc.name : setAudioScene as AUDIO_SCENE_PHONE_CALL - Promise - ENUM - * @tc.desc : setAudioScene as AUDIO_SCENE_PHONE_CALL - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_027', 0, async function (done) { - - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_PHONE_CALL).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_028 - * @tc.name : getAudioScene as AUDIO_SCENE_PHONE_CALL - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_PHONE_CALL - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_028', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_PHONE_CALL){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_029 - * @tc.name : getAudioScene as AUDIO_SCENE_PHONE_CALL to VOIP - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_PHONE_CALL to VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_029', 0, async function (done) { - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_030 - * @tc.name : setAudioScene as AUDIO_SCENE_PHONE_CALL - Promise - ENUM - * @tc.desc : setAudioScene as AUDIO_SCENE_PHONE_CALL - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_030', 0, async function (done) { - - await audioManager.setAudioScene(2).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_031 - * @tc.name : getAudioScene as AUDIO_SCENE_PHONE_CALL - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_PHONE_CALL - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_031', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == 2){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_032 - * @tc.name : getAudioScene as AUDIO_SCENE_PHONE_CALL to VOIP - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_PHONE_CALL to VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_032', 0, async function (done) { - await audioManager.setAudioScene(3).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_033 - * @tc.name : setAudioScene as AUDIO_SCENE_PHONE_CALL - Callback - ENAME - * @tc.desc : setAudioScene as AUDIO_SCENE_PHONE_CALL - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_033', 0, async function (done) { - - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_PHONE_CALL, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); - - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_034 - * @tc.name : getAudioScene as AUDIO_SCENE_PHONE_CALL - Callback - ENAME - * @tc.desc : getAudioScene as AUDIO_SCENE_PHONE_CALL - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_034', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_PHONE_CALL){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_035 - * @tc.name : getAudioScene as AUDIO_SCENE_PHONE_CALL to VOIP - Callback - ENAME - * @tc.desc : getAudioScene as AUDIO_SCENE_PHONE_CALL to VOIP- ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_035', 0, async function (done) { - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_036 - * @tc.name : setAudioScene as AUDIO_SCENE_PHONE_CALL - Callback - ENUM - * @tc.desc : setAudioScene as AUDIO_SCENE_PHONE_CALL - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_036', 0, async function (done) { - - audioManager.setAudioScene(2, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); - - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_037 - * @tc.name : getAudioScene as AUDIO_SCENE_PHONE_CALL - Callback - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_PHONE_CALL - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_037', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 2){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_038 - * @tc.name : getAudioScene as Ringtone to VOIP - Callback - ENUM - * @tc.desc : getAudioScene as Ringtone to VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_038', 0, async function (done) { - audioManager.setAudioScene(3,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_039 - * @tc.name : setAudioScene as AUDIO_SCENE_DEFAULT - Promise - ENUM - * @tc.desc : setAudioScene as AUDIO_SCENE_DEFAULT - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_039', 0, async function (done) { - - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_DEFAULT).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_040 - * @tc.name : getAudioScene as AUDIO_SCENE_DEFAULT - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_DEFAULT - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_040', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_DEFAULT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_041 - * @tc.name : getAudioScene as AUDIO_SCENE_DEFAULT to VOIP - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_DEFAULT to VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_041', 0, async function (done) { - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_042 - * @tc.name : setAudioScene as AUDIO_SCENE_DEFAULT - Promise - ENUM - * @tc.desc : setAudioScene as AUDIO_SCENE_DEFAULT - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_042', 0, async function (done) { - - await audioManager.setAudioScene(0).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_043 - * @tc.name : getAudioScene as AUDIO_SCENE_DEFAULT - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_DEFAULT - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_043', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == 0){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_044 - * @tc.name : getAudioScene as AUDIO_SCENE_DEFAULT to VOIP - Promise - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_DEFAULT to VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_044', 0, async function (done) { - await audioManager.setAudioScene(3).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_045 - * @tc.name : setAudioScene as AUDIO_SCENE_DEFAULT - Callback - ENAME - * @tc.desc : setAudioScene as AUDIO_SCENE_DEFAULT - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_045', 0, async function (done) { - - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_DEFAULT, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); - - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_046 - * @tc.name : getAudioScene as AUDIO_SCENE_DEFAULT - Callback - ENAME - * @tc.desc : getAudioScene as AUDIO_SCENE_DEFAULT - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_046', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_DEFAULT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_047 - * @tc.name : getAudioScene as AUDIO_SCENE_DEFAULT to VOIP - Callback - ENAME - * @tc.desc : getAudioScene as AUDIO_SCENE_DEFAULT to VOIP- ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_047', 0, async function (done) { - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_048 - * @tc.name : setAudioScene as AUDIO_SCENE_DEFAULT - Callback - ENUM - * @tc.desc : setAudioScene as AUDIO_SCENE_DEFAULT - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_048', 0, async function (done) { - - audioManager.setAudioScene(0, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); - - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_049 - * @tc.name : getAudioScene as AUDIO_SCENE_DEFAULT - Callback - ENUM - * @tc.desc : getAudioScene as AUDIO_SCENE_DEFAULT - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_049', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 0){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_CALL_AudioScene_050 - * @tc.name : getAudioScene as Ringtone to VOIP - Callback - ENUM - * @tc.desc : getAudioScene as Ringtone to VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_AudioScene_050', 0, async function (done) { - audioManager.setAudioScene(3,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); - done(); - }) - - - }) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHLLV.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js similarity index 83% rename from multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHLLV.test.js rename to multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js index 54af9a89a..8de1f48aa 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHLLV.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js @@ -15,17 +15,41 @@ import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; +import ability_featureAbility from '@ohos.ability.featureAbility'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; describe('audioCapturer', function () { + var dateTime = new Date().getTime(); - const dirPath = '/data/accounts/account_0/appdata/RecTest'+dateTime; - var fpath = dirPath+'/capture_js.pcm'; + //const dirPath = '/data/accounts/account_0/appdata/RecTest'+dateTime; + //var fpath = dirPath+'/capture_js.pcm'; var audioCapCallBack; var audioCapPromise; - console.info('AudioFrameworkRecLog: Recording files Path: '+dirPath); + var dirPath; + var mediaDir; + var fpath; + //console.info('AudioFrameworkRecLog: Recording files Path: '+dirPath); + + /* async function getPathName(){ + /* var path1 = '/data/accounts/account_0/appdata/'; + var packageName; + var context = ability_featureAbility.getContext(); + await context.getBundleName() + .then((data) => { + console.info('AudioFrameworkRenderLog: Cache directory obtained. Data: ' + data); + packageName = data; + }).catch((error) => { + console.error('AudioFrameworkRenderLog: Failed to obtain the cache directory. Cause:' + error.message); + }); + await sleep(200); + //var mediaDirTemp = path1 + packageName + '/' + packageName + '/assets/entry/resources/rawfile'; + var mediaDirTemp ='/data/storage/el2/base/haps/entry/cache/'// path1+packageName + console.info('AudioFrameworkRenderLog: Resource DIR Path : '+mediaDirTemp); + return mediaDirTemp; + + }*/ const audioManager = audio.getAudioManager(); console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); @@ -33,9 +57,16 @@ describe('audioCapturer', function () { const audioManagerRec = audio.getAudioManager(); console.info('AudioFrameworkRecLog: Create AudioManger Object JS Framework'); - beforeAll(function () { + beforeAll(async function () { console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - fileio.mkdirSync(dirPath); + dirPath = '/data/storage/el2/base/haps/entry/cache' + /*dateTime = new Date().getTime(); + dirPath = mediaDir+'/files/RecTest'+dateTime;*/ + console.info('AudioFrameworkRecLog: Recording files Path: '+dirPath); + fpath = dirPath+'/capture_js.pcm'; + await sleep(100); + // fileio.mkdirSync(fPath); + console.info('AudioFrameworkTest: beforeAll: END'); }) beforeEach(async function () { @@ -48,11 +79,11 @@ describe('audioCapturer', function () { }) afterAll(async function () { - fileio.rmdir(dirPath, function(err){ + /*fileio.rmdir(dirPath, function(err){ if (!err) { console.info('AudioFrameworkTest: Recorded files are deleted successfully'); } - }); + });*/ await sleep(1000); console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); }) @@ -81,23 +112,6 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); - await audioManagerRec.setAudioScene(AudioScene).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - if (resultFlag == false){ - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); - return resultFlag; - } - await audioCap.getStreamInfo().then(async function (audioParamsGet) { if (audioParamsGet != undefined) { console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); @@ -174,14 +188,14 @@ describe('audioCapturer', function () { return resultFlag; } await sleep(100); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------READ BUFFER---------'); var buffer = await audioCap.read(bufferSize, true); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); - console.info('BufferRecLog: data written: ' + number); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); await sleep(50); numBuffersToCapture--; } @@ -238,20 +252,7 @@ describe('audioCapturer', function () { } }); await sleep(1000); - await audioManagerRec.setAudioScene(AudioScene,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - resultFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - } - }); + audioCapCallBack.getStreamInfo(async(err,audioParamsGet) => { console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); console.log('AudioFrameworkRecLog: Entered getStreamInfo'); @@ -315,14 +316,14 @@ describe('audioCapturer', function () { return resultFlag; } - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------READ BUFFER---------'); var buffer = await audioCapCallBack.read(bufferSize, true); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); - console.info('BufferRecLog: data written: ' + number); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); await sleep(50); numBuffersToCapture--; } @@ -392,27 +393,19 @@ describe('audioCapturer', function () { } else { audioCapCallBack = value; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - } - }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO PREPARED STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == audio.AudioState.STATE_PREPARED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: INVALID:'+audio.AudioState.STATE_INVALID); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: NEW:'+audio.AudioState.STATE_NEW); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: PREPARED:'+audio.AudioState.STATE_PREPARED); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: START:'+audio.AudioState.STATE_START); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: STOP:'+audio.AudioState.STATE_STOPPED); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: RELEASE:'+audio.AudioState.STATE_RELEASED); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: RUNNING:'+audio.AudioState.STATE_RUNNING); + if ((audioCapCallBack.state == audio.AudioState.STATE_PREPARED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } } }); @@ -453,27 +446,13 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); } }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO PREPARED STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } - } - }); + + if ((audioCapCallBack.state == 1)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } }) @@ -512,20 +491,6 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); } }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - } - }); await audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -597,20 +562,6 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); } }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - } - }); await audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -682,23 +633,7 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); + await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); @@ -786,22 +721,6 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - stateFlag = true; - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -885,23 +804,6 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); @@ -990,23 +892,7 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); + await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); @@ -1095,23 +981,6 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); @@ -1198,23 +1067,6 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); @@ -1252,7 +1104,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -1265,14 +1117,14 @@ describe('audioCapturer', function () { await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); - console.info('BufferRecLog: data written: ' + number); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); await sleep(100); stateFlag=true; } }); numBuffersToCapture--; } - await sleep(3000); + await sleep(1000); audioCapCallBack.release(async(err,value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); if (err){ @@ -1327,29 +1179,13 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); return stateFlag; }); - - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO PREPARED STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapPromise.state == audio.AudioState.STATE_PREPARED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - + + if ((audioCapPromise.state == audio.AudioState.STATE_PREPARED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } }) /* * @@ -1386,28 +1222,13 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); return stateFlag; }); - - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO PREPARED STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapPromise.state == 1)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - }); + + if ((audioCapPromise.state == 1)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } }) @@ -1446,20 +1267,6 @@ describe('audioCapturer', function () { return stateFlag; }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - - await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); @@ -1525,20 +1332,6 @@ describe('audioCapturer', function () { return stateFlag; }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - - await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); @@ -1604,20 +1397,6 @@ describe('audioCapturer', function () { return stateFlag; }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - - await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); @@ -1694,20 +1473,6 @@ describe('audioCapturer', function () { return stateFlag; }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - - await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); @@ -1784,20 +1549,6 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : ' + data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : ' + err.message); - stateFlag = false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : ' + err.message); - stateFlag = false; - }); - - await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); @@ -1872,21 +1623,7 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); return stateFlag; }); - - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - - + await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); @@ -1961,18 +1698,6 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); return stateFlag; }); - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - }); await sleep(1000); await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); @@ -2007,7 +1732,7 @@ describe('audioCapturer', function () { done(); } }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: ERROR : '+err.message); stateFlag=false; }); await sleep(1000); @@ -2049,21 +1774,6 @@ describe('audioCapturer', function () { return stateFlag; }); await sleep(1000); - - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - await audioManagerRec.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - }); - await sleep(1000); - await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); @@ -2100,7 +1810,7 @@ describe('audioCapturer', function () { stateFlag=false; } //await sleep(1000); - var numBuffersToCapture = 500; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE PROMISE READ ---------'); console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); @@ -3027,316 +2737,60 @@ describe('audioCapturer', function () { channels: audio.AudioChannel.CHANNEL_1, sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo44100 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, - } - var audioCapturerOptions44100 = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - var resultFlag = await recPromise(audioCapturerOptions44100, dirPath+'/capture_js-44100-1C-16LE.pcm', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RECORD_Promise_AUDIO_SCENE_DEFAULT_ENUM_048 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_RECORD_Promise_AUDIO_SCENE_DEFAULT_ENUM_048', 0, async function (done) { - var audioStreamInfo44100 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo44100 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, - } - var audioCapturerOptions44100 = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - var resultFlag = await recPromise(audioCapturerOptions44100, dirPath+'/capture_js-44100-1C-16LE.pcm', 0); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_PROMISE_RECORD_AUDIO_SCENE_RINGING_049 - * @tc.name : AudioRec-Set2 - * @tc.desc : record audio with parameter set 2 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_PROMISE_RECORD_AUDIO_SCENE_RINGING_049', 0, async function (done) { - var audioStreamInfo96000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo96000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, - } - var audioCapturerOptions96000 = { - streamInfo: audioStreamInfo96000, - capturerInfo: audioCapturerInfo96000, - } - - var resultFlag = await recPromise(audioCapturerOptions96000, dirPath+'/capture_js-96000-1C-S24LE.pcm', audio.AudioScene.AUDIO_SCENE_RINGING); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_PROMISE_RECORD_AUDIO_SCENE_RINGING_ENUM_050 - * @tc.name : AudioRec-Set2 - * @tc.desc : record audio with parameter set 2 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_PROMISE_RECORD_AUDIO_SCENE_RINGING_ENUM_050', 0, async function (done) { - var audioStreamInfo96000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo96000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, - } - var audioCapturerOptions96000 = { - streamInfo: audioStreamInfo96000, - capturerInfo: audioCapturerInfo96000, - } - - var resultFlag = await recPromise(audioCapturerOptions96000, dirPath+'/capture_js-96000-1C-S24LE.pcm', 1); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RECORD_PROMISE_AUDIO_SCENE_PHONE_CALL_Audio_051 - * @tc.name : AudioRec-Set3 - * @tc.desc : record audio with parameter set 3 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_RECORD_PROMISE_AUDIO_SCENE_PHONE_CALL_Audio_051', 0, async function (done) { - var audioStreamInfo48000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo48000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, - } - var audioCapturerOptions48000 = { - streamInfo: audioStreamInfo48000, - capturerInfo: audioCapturerInfo48000, - } - - var resultFlag = await recPromise(audioCapturerOptions48000, dirPath+'/capture_js-48000-2C-1S32LE.pcm', audio.AudioScene.AUDIO_SCENE_PHONE_CALL); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RECORD_PROMISE_AUDIO_SCENE_PHONE_CALL_Audio_ENUM_052 - * @tc.name : AudioRec-Set3 - * @tc.desc : record audio with parameter set 3 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_RECORD_PROMISE_AUDIO_SCENE_PHONE_CALL_Audio_ENUM_052', 0, async function (done) { - var audioStreamInfo48000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo48000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, - } - var audioCapturerOptions48000 = { - streamInfo: audioStreamInfo48000, - capturerInfo: audioCapturerInfo48000, - } - - var resultFlag = await recPromise(audioCapturerOptions48000, dirPath+'/capture_js-48000-2C-1S32LE.pcm', audio.AudioScene.AUDIO_SCENE_PHONE_CALL); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_053 - * @tc.name : AudioRec-Set11 - * @tc.desc : record audio with parameter set 011 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_053', 0, async function (done) { - var audioStreamInfo64000 = { - samplingRate: 64000, - channels: 2, - sampleFormat: 3, - encodingType: 0, - }; - var audioCapturerInfo64000 = { - source: 1, - capturerFlags : 1, - } - var audioCapturerOptions64000 = { - streamInfo: audioStreamInfo64000, - capturerInfo: audioCapturerInfo64000, - } - - var resultFlag = await recPromise(audioCapturerOptions64000, dirPath+'/capture_js-64000-2C-32B.pcm', 3); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_BEFORE_START_054 - * @tc.name : AudioCapturer-GET_AUDIO_TIME - * @tc.desc : AudioCapturer GET_AUDIO_TIME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_BEFORE_START_054', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 1 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - } - }); - await sleep(1000); - await audioCapCallBack.getAudioTime().then(async function (audioTime) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime : Success' + audioTime ); - if (audioTime == 0) { - stateFlag = true; - expect(stateFlag).assertTrue(); - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); - }); - if (stateFlag == true) { - audioCapCallBack.release(async(err,value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; - } else {console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } else { - audioCapCallBack.release(async(err,value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; - } else {console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); + }; + var audioCapturerInfo44100 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags : 1, + } + var audioCapturerOptions44100 = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + var resultFlag = await recPromise(audioCapturerOptions44100, dirPath+'/capture_js-44100-1C-16LE.pcm', audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RECORD_Promise_AUDIO_SCENE_DEFAULT_ENUM_048 + * @tc.name : AudioRec-Set1 + * @tc.desc : record audio with parameter set 1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0*/ + + + it('SUB_AUDIO_RECORD_Promise_AUDIO_SCENE_DEFAULT_ENUM_048', 0, async function (done) { + var audioStreamInfo44100 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + var audioCapturerInfo44100 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags : 1, + } + var audioCapturerOptions44100 = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, } + var resultFlag = await recPromise(audioCapturerOptions44100, dirPath+'/capture_js-44100-1C-16LE.pcm', 0); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + expect(resultFlag).assertTrue(); + + done(); }) + /* * * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_START_055 * @tc.name : AudioCapturer-GET_AUDIO_TIME @@ -3374,24 +2828,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -3490,24 +2926,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -3555,7 +2973,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -3654,24 +3072,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -3719,7 +3119,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -4782,23 +4182,6 @@ describe('audioCapturer', function () { break; } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag == true; - } - } - }); await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); @@ -4914,23 +4297,6 @@ describe('audioCapturer', function () { break; } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT, async (err, setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err) { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : ' + setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag == true; - } - } - }); await sleep(1000); audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); @@ -5012,23 +4378,6 @@ describe('audioCapturer', function () { break; } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT, async (err, setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err) { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : ' + setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag == true; - } - } - }); await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); @@ -5126,23 +4475,6 @@ describe('audioCapturer', function () { break; } }); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT, async (err, setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err) { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : ' + setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag == true; - } - } - }); await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); @@ -5245,24 +4577,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -5299,7 +4613,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -5397,24 +4711,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -5451,7 +4747,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -5542,24 +4838,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -5596,7 +4874,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -5688,24 +4966,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -5742,7 +5002,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -5834,24 +5094,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -5888,7 +5130,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -5981,24 +5223,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -6035,7 +5259,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -6128,24 +5352,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -6182,7 +5388,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -6274,24 +5480,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -6328,7 +5516,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -6421,24 +5609,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -6475,7 +5645,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -6566,24 +5736,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -6620,7 +5772,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -6733,24 +5885,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -6787,7 +5921,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -6900,24 +6034,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -6954,7 +6070,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -7068,24 +6184,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -7122,7 +6220,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { @@ -7235,24 +6333,6 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { - console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); - if (err){ - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue); - console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait'); - console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); - if ((audioCapCallBack.state == 1)) { - stateFlag = true; - } - } - }); - await sleep(1000); audioCapCallBack.start(async (err,value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); @@ -7289,7 +6369,7 @@ describe('audioCapturer', function () { stateFlag=false; } await sleep(1000); - var numBuffersToCapture = 250; + var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); audioCapCallBack.read(bufferSize, true,async(err,buffer) => { diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js similarity index 100% rename from multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js rename to multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioPerf.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioPerf.test.js deleted file mode 100644 index 37a29f75b..000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioPerf.test.js +++ /dev/null @@ -1,1085 +0,0 @@ -/* - * 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. - */ - -import audio from '@ohos.multimedia.audio'; - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('audioApiResponseTime', function () { - console.info('AudioFrameworkTestPerf: Running AudioManger API Perfomance Test'); - var AUDIO_MEDIA = 3; - var AUDIO_RINGTONE = 2; - var MAX_VOL = 15; - var LOW_VOL = 5; - var MAXNUM = 1000; - var err; - - beforeAll(function () { - console.info('AudioFrameworkTestPerf: beforeAll: Prerequisites at the test suite level'); - }) - - beforeEach(function () { - console.info('AudioFrameworkTestPerf: beforeEach: Prerequisites at the test case level'); - }) - - afterEach(function () { - console.info('AudioFrameworkTestPerf: afterEach: Test case-level clearance conditions'); - }) - - afterAll(function () { - console.info('AudioFrameworkTestPerf: afterAll: Test suite-level cleanup condition'); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_001 - * @tc.name : API Response - setVolume - Promise - * @tc.desc : Check setVolume API Response time - * @tc.size : MEDIUM - * @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(AUDIO_RINGTONE,MAX_VOL); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise: setVolume Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: setVolume Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: setVolume Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_002 - * @tc.name : API Response - setVolume - CallBack - * @tc.desc : Check setVolume API Response time - * @tc.size : MEDIUM - * @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(AUDIO_MEDIA,LOW_VOL,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: setVolume Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: setVolume Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: setVolume Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_003 - * @tc.name : API Response - getVolume - Promise - * @tc.desc : Check getVolume API Response time - * @tc.size : MEDIUM - * @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(AUDIO_RINGTONE); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise: getVolume Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: getVolume Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: getVolume Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_004 - * @tc.name : API Response - getVolume - CallBack - * @tc.desc : Check getVolume API Response time - * @tc.size : MEDIUM - * @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(AUDIO_MEDIA,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: getVolume Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: getVolume Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: getVolume Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_005 - * @tc.name : API Response - getMinVolume - Promise - * @tc.desc : Check getMinVolume API Response time - * @tc.size : MEDIUM - * @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(AUDIO_MEDIA); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : getMinVolume Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: getMinVolume Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: getMinVolume Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_006 - * @tc.name : API Response - getMinVolume - CallBack - * @tc.desc : Check getMinVolume API Response time - * @tc.size : MEDIUM - * @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(AUDIO_RINGTONE,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: getMinVolume Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: getMinVolume Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: getMinVolume Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_007 - * @tc.name : API Response - getMaxVolume - Promise - * @tc.desc : Check getMaxVolume API Response time - * @tc.size : MEDIUM - * @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(AUDIO_MEDIA); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : getMaxVolume Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: getMaxVolume Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: getMaxVolume Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_008 - * @tc.name : API Response - getMaxVolume - CallBack - * @tc.desc : Check getMaxVolume API Response time - * @tc.size : MEDIUM - * @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(AUDIO_RINGTONE,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: getMaxVolume Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: getMaxVolume Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: getMaxVolume Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_009 - * @tc.name : API Response - mute - Promise - * @tc.desc : Check mute API Response time - * @tc.size : MEDIUM - * @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(AUDIO_MEDIA,true); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : mute Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: mute Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: mute Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_010 - * @tc.name : API Response - mute - CallBack - * @tc.desc : Check mute API Response time - * @tc.size : MEDIUM - * @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(AUDIO_RINGTONE,true,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: mute Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: mute Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: mute Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_011 - * @tc.name : API Response - isMute - Promise - * @tc.desc : Check isMute API Response time - * @tc.size : MEDIUM - * @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(AUDIO_MEDIA); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : isMute Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: isMute Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: isMute Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_012 - * @tc.name : API Response - isMute - CallBack - * @tc.desc : Check isMute API Response time - * @tc.size : MEDIUM - * @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(AUDIO_RINGTONE,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: isMute Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: isMute Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: isMute Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_013 - * @tc.name : API Response - isActive - Promise - * @tc.desc : Check isActive API Response time - * @tc.size : MEDIUM - * @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(AUDIO_MEDIA); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : isActive Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: isActive Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: isActive Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_014 - * @tc.name : API Response - isActive - CallBack - * @tc.desc : Check isActive API Response time - * @tc.size : MEDIUM - * @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(AUDIO_RINGTONE,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: isActive Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: isActive Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: isActive Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_015 - * @tc.name : API Response - setMicrophoneMute - Promise - * @tc.desc : Check setMicrophoneMute API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.setMicrophoneMute(true); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : setMicrophoneMute Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: setMicrophoneMute Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: setMicrophoneMute Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_016 - * @tc.name : API Response - setMicrophoneMute - CallBack - * @tc.desc : Check setMicrophoneMute API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.setMicrophoneMute(false,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: setMicrophoneMute Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: setMicrophoneMute Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: setMicrophoneMute Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_017 - * @tc.name : API Response - isMicrophoneMute - Promise - * @tc.desc : Check isMicrophoneMute API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.isMicrophoneMute(); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : isMicrophoneMute Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: isMicrophoneMute Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: isMicrophoneMute Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_018 - * @tc.name : API Response - isMicrophoneMute - CallBack - * @tc.desc : Check isMicrophoneMute API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.isMicrophoneMute((err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: isMicrophoneMute Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: isMicrophoneMute Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: isMicrophoneMute Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_019 - * @tc.name : API Response - setRingerMode - Promise - * @tc.desc : Check setRingerMode API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : setRingerMode Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: setRingerMode Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: setRingerMode Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_020 - * @tc.name : API Response - setRingerMode - CallBack - * @tc.desc : Check setRingerMode API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: setRingerMode Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: setRingerMode Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: setRingerMode Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_021 - * @tc.name : API Response - getRingerMode - Promise - * @tc.desc : Check getRingerMode API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.getRingerMode(); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : getRingerMode Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: getRingerMode Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: getRingerMode Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_022 - * @tc.name : API Response - getRingerMode - CallBack - * @tc.desc : Check getRingerMode API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.getRingerMode((err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: getRingerMode Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: getRingerMode Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: getRingerMode Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_023 - * @tc.name : API Response - setAudioParameter - Promise - * @tc.desc : Check setAudioParameter API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.setAudioParameter('AudioPerTemp1', '8 bit'); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : setAudioParameter Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: setAudioParameter Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: setAudioParameter Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_024 - * @tc.name : API Response - setAudioParameter - CallBack - * @tc.desc : Check setAudioParameter API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.setAudioParameter('AudioPerTemp2', '44100',(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: setAudioParameter Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: setAudioParameter Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: setAudioParameter Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_025 - * @tc.name : API Response - getAudioParameter - Promise - * @tc.desc : Check getAudioParameter API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.getAudioParameter('AudioPerTemp1'); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : getAudioParameter Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: getAudioParameter Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: getAudioParameter Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_026 - * @tc.name : API Response - getAudioParameter - CallBack - * @tc.desc : Check getAudioParameter API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.getAudioParameter('AudioPerTemp2',(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: getAudioParameter Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: getAudioParameter Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: getAudioParameter Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_027 - * @tc.name : API Response - getDevices - Promise - * @tc.desc : Check getDevices API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : getDevices Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: getDevices Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: getDevices Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_028 - * @tc.name : API Response - getDevices - CallBack - * @tc.desc : Check getDevices API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: getDevices Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: getDevices Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: getDevices Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_029 - * @tc.name : API Response - setDeviceActive - Promise - * @tc.desc : Check setDeviceActive API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : setDeviceActive Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: setDeviceActive Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: setDeviceActive Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_030 - * @tc.name : API Response - setDeviceActive - CallBack - * @tc.desc : Check setDeviceActive API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: setDeviceActive Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: setDeviceActive Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: setDeviceActive Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_031 - * @tc.name : API Response - isDeviceActive - Promise - * @tc.desc : Check isDeviceActive API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.isDeviceActive(audio.ActiveDeviceType.SPEAKER); - }; - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: Promise : isDeviceActive Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: Promise: isDeviceActive Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: Promise: isDeviceActive Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_Performance_032 - * @tc.name : API Response - isDeviceActive - CallBack - * @tc.desc : Check isDeviceActive API Response time - * @tc.size : MEDIUM - * @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(); - for (let i = 0; i < MAXNUM; i++) { - audioManagerPerf.isDeviceActive(audio.ActiveDeviceType.SPEAKER,(err, value) => { - if (err) { - console.error(`AudioFrameworkTestPerf: callback : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - }); - } - let waitTime = new Date().getTime()-startTime; - let avgTime = waitTime/MAXNUM; - console.info(`AudioFrameworkTestPerf: CallBack: isDeviceActive Wait Time : ${waitTime}`); - if (avgTime<10) - { - console.info(`AudioFrameworkTestPerf: CallBack: isDeviceActive Average Time: PASS : ${avgTime}`); - expect(true).assertTrue(); - } - else{ - console.info(`AudioFrameworkTestPerf: CallBack: isDeviceActive Average Time: FAIL : ${avgTime}`); - expect(false).assertTrue(); - } - done(); - }) - -}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js index 1bf8be062..cd6c51fdf 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js @@ -1,8100 +1,7938 @@ -/* - * 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. - */ - -import audio from '@ohos.multimedia.audio'; -import fileio from '@ohos.fileio'; -import app from '@system.app'; -import ability_featureAbility from '@ohos.ability.featureAbility'; - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('audioRenderer', function () { - - const audioManager = audio.getAudioManager(); - console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); - var mediaDir; - - async function getPathName(){ - var path1 = '/data/accounts/account_0/applications/'; - var packageName; - var context = ability_featureAbility.getContext(); - await context.getBundleName() - .then((data) => { - console.info('AudioFrameworkRenderLog: Cache directory obtained. Data: ' + data); - packageName = data; - }).catch((error) => { - console.error('AudioFrameworkRenderLog: Failed to obtain the cache directory. Cause:' + error.message); - }); - await sleep(200); - //var mediaDirTemp = path1 + packageName + '/' + packageName + '/assets/entry/resources/rawfile'; - var mediaDirTemp = '/data' - console.info('AudioFrameworkRenderLog: Resource DIR Path : '+mediaDirTemp); - return mediaDirTemp; - - } - - beforeAll(async function () { - console.info('AudioFrameworkRenderLog: beforeAll: Prerequisites at the test suite level'); - mediaDir = await getPathName(); - }) - - beforeEach(async function () { - console.info('AudioFrameworkRenderLog: beforeEach: Prerequisites at the test case level'); - await sleep(1000); - }) - - afterEach(function () { - console.info('AudioFrameworkRenderLog: afterEach: Test case-level clearance conditions'); - }) - - afterAll(async function () { - console.info('AudioFrameworkRenderLog: afterAll: Test suite-level cleanup condition'); - }) - - function sleep (ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function playbackPromise (AudioRendererOptions, fpath, AudioScene) { - var resultFlag = 'new'; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - return resultFlag; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); - resultFlag = false; - }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; - }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - if (rlen > (totalSize/2)){ - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - resultFlag=false; - }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - resultFlag=true; - console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlag); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - return resultFlag; - } - - async function playbackCB (AudioRendererOptions, fpath){ - - var resultFlag = 'new'; - - console.info('AudioFrameworkRenderLog: CALLBACK : Audio Playback Function'); - - var audioRen; - - audio.createAudioRenderer(AudioRendererOptions,(err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: AudioRender Created : Error: ${err.message}`); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : SUCCESS'); - audioRen = data; - } - }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - - await sleep(100); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: Callback : Audio Playback Function'); - - audioRen.start((err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Renderer start failed: Error: ${err.message}`); - resultFlag=false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer started'); - } - }); - await sleep(100); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var samplingRate; - audioRen.getStreamInfo(async (err, audioParamsGet) => { - await sleep(100); - if (err) { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - samplingRate = audioParamsGet.samplingRate; - } - }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - - audioRen.getRendererInfo(async (err, audioParamsGet) => { - await sleep(100); - if (err) { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - } - }); - await sleep(100); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - - var bufferSize; - await audioRen.getBufferSize((err,data)=> { - if (err) { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; - } - else { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; - } - }); - await sleep(100); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - let rlen = 0; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - await sleep(100); -// var waitTime = (totalSize/88200); - var waitTime; - switch (samplingRate) { - case 44100: - waitTime = 45; - break; - case 8000: - waitTime = 60; - break; - case 32000: - waitTime = 45; - break; - case 64000: - waitTime = 45; - break; - case 96000: - waitTime = 45; - break; - case 11025: - waitTime = 45; - break; - case 12000: - waitTime = 45; - break; - case 16000: - waitTime = 45; - break; - case 22050: - waitTime = 45; - break; - case 24000: - waitTime = 45; - break; - case 48000: - waitTime = 45; - break; - default: - waitTime = 45; - break - } - - await sleep(100); - console.info('AudioFrameworkRenderLog: waitTime : ' +waitTime); - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf,(err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Buff write: Error: ${err.message}`); - resultFlag=false; - } - else { - console.info('BufferAudioFramework: Buff write successful : '); - resultFlag=true; - } - }); - await sleep(waitTime); - } - await sleep(2000); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - ss.closeSync(); - audioRen.drain((err, state) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Renderer drain failed: Error: ${err.message}`); - resultFlag=false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer drained'); - } - }); - await sleep(100); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - audioRen.stop((err, state) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Renderer stop failed: Error: ${err.message}`); - resultFlag=false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer stopped'); - resultFlag=true; - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - } - }); - await sleep(100); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - return resultFlag; - } - audioRen.release((err, state) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Renderer release failed: Error: ${err.message}`); - resultFlag=false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer released'); - } - }); - await sleep(100); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - return resultFlag; - - } - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_001 - * @tc.name : AudioRenderer-Set1-Media - * @tc.desc : AudioRenderer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_001', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-1C-44100-2SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_002 - * @tc.name : AudioRenderer-Set2-Media - * @tc.desc : AudioRenderer with parameter set 2 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_002', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-1C-8000-2SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_003 - * @tc.name : AudioRenderer-Set3-Media - * @tc.desc : AudioRenderer with parameter set 3 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_003', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-1C-32000-1SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_004 - * @tc.name : AudioRenderer-Set4-Media - * @tc.desc : AudioRenderer with parameter set 4 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_004', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_64000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-1C-64000-3SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_005 - * @tc.name : AudioRenderer-Set5-Media - * @tc.desc : AudioRenderer with parameter set 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_005', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-1C-96000-4SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_006 - * @tc.name : AudioRenderer-Set6-Media - * @tc.desc : AudioRenderer with parameter set 6 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_006', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_11025, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-11025-1SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_007 - * @tc.name : AudioRenderer-Set7-Media - * @tc.desc : AudioRenderer with parameter set 7 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_007', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_12000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-12000-2SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_008 - * @tc.name : AudioRenderer-Set8-Media - * @tc.desc : AudioRenderer with parameter set 8 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_008', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-16000-3SW.wav', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_009 - * @tc.name : AudioRenderer-Set9-Media - * @tc.desc : AudioRenderer with parameter set 9 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_009', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_22050, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-22050-2SW.wav', audio.AudioScene.AUDIO_SCENE_PHONE_CALL); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_010 - * @tc.name : AudioRenderer-Set10-Media - * @tc.desc : AudioRenderer with parameter set 10 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_010', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-24000-3SW.wav', audio.AudioScene.AUDIO_SCENE_RINGING); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_011 - * @tc.name : AudioRenderer-Set11-Media - * @tc.desc : AudioRenderer with parameter set 11 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_011', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_012 - * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_012', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_013 - * @tc.name : AudioRenderer-isStreamActive - SPEECH - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - SPEECH - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_013', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_014 - * @tc.name : AudioRenderer-isStreamActive - MUSIC - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - MUSIC - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_014', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_015 - * @tc.name : AudioRenderer-isStreamActive - MOVIE - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - MOVIE - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_015', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_016 - * @tc.name : AudioRenderer-isStreamActive - SONIFICATION - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - SONIFICATION - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_016', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_017 - * @tc.name : AudioRenderer-isStreamActive - RINGTONE - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_017', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_018 - * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_018', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_019 - * @tc.name : AudioRenderer-isStreamActive - SPEECH - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - SPEECH - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_019', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_020 - * @tc.name : AudioRenderer-isStreamActive - MUSIC - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - MUSIC - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_020', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_021 - * @tc.name : AudioRenderer-isStreamActive - MOVIE - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - MOVIE - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_021', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_022 - * @tc.name : AudioRenderer-isStreamActive - SONIFICATION - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_022', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_023 - * @tc.name : AudioRenderer-isStreamActive - RINGTONE - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_023', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_024 - * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_024', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_025 - * @tc.name : AudioRenderer-isStreamActive - SPEECH - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - SPEECH - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_025', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.VOICE_CALL).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive VOICE_CALL: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive VOICE_CALL: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_026 - * @tc.name : AudioRenderer-isStreamActive - MUSIC - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - MUSIC - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_026', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_027 - * @tc.name : AudioRenderer-isStreamActive - MOVIE - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - MOVIE - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_027', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_028 - * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_028', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive MEDIA: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive MEDIA: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_029 - * @tc.name : AudioRenderer-isStreamActive - RINGTONE - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_029', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive MEDIA: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive MEDIA: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_030 - * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_030', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_031 - * @tc.name : AudioRenderer-isStreamActive - SPEECH - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - SPEECH - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_031', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive MEDIA: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive MEDIA: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_032 - * @tc.name : AudioRenderer-isStreamActive - MUSIC - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - MUSIC - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_032', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive RENGITONE: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_033 - * @tc.name : AudioRenderer-isStreamActive - MOVIE - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - MOVIE - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_033', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_034 - * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_034', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive MEDIA: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive MEDIA: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_035 - * @tc.name : AudioRenderer-isStreamActive - RINGTONE - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_035', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == true){ - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); - //resultFlag = true; - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - - }); - - await sleep(9000); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_036 - // * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - VOICE_ASSISTANT - // * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - VOICE_ASSISTANT - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_036', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - - // var resultFlag=false; - // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - // await sleep(2000); - - // audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - // if(data == true){ - // console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - // resultFlag = true; - // } - // else { - // console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - // } - - // }); - - // await sleep(9000); - - // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_037 - // * @tc.name : AudioRenderer-isStreamActive - SPEECH - VOICE_ASSISTANT - // * @tc.desc : AudioRenderer-isStreamActive - SPEECH - VOICE_ASSISTANT - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_037', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_SPEECH, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - - // var resultFlag=false; - // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - // await sleep(2000); - - // audioManager.isActive(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { - // if(data == true){ - // console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: PASS :'+data); - // resultFlag = true; - // } - // else { - // console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: FAIL :'+data); - // } - - // }); - - // await sleep(9000); - - // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_038 - // * @tc.name : AudioRenderer-isStreamActive - MUSIC - VOICE_ASSISTANT - // * @tc.desc : AudioRenderer-isStreamActive - MUSIC - VOICE_ASSISTANT - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_038', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_MUSIC, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - - // var resultFlag=false; - // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - // await sleep(2000); - - // audioManager.isActive(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { - // if(data == true){ - // console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: PASS :'+data); - // resultFlag = true; - // } - // else { - // console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: FAIL :'+data); - // } - - // }); - - // await sleep(9000); - - // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_039 - // * @tc.name : AudioRenderer-isStreamActive - MOVIE - VOICE_ASSISTANT - // * @tc.desc : AudioRenderer-isStreamActive - MOVIE - VOICE_ASSISTANT - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_039', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_MOVIE, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - - // var resultFlag=false; - // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - // await sleep(2000); - - // audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - // if(data == true){ - // console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); - // resultFlag = true; - // } - // else { - // console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - // } - - // }); - - // await sleep(9000); - - // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_040 - // * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_ASSISTANT - // * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_ASSISTANT - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_040', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - - // var resultFlag=false; - // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - // await sleep(2000); - - // audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - // if(data == true){ - // console.log('AudioFrameworkTest: Promise : isActive MEDIA: PASS :'+data); - // resultFlag = true; - // } - // else { - // console.log('AudioFrameworkTest: Promise : isActive MEDIA: FAIL :'+data); - // } - - // }); - - // await sleep(9000); - - // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_041 - // * @tc.name : AudioRenderer-isStreamActive - RINGTONE - VOICE_ASSISTANT - // * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - VOICE_ASSISTANT - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_041', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_RINGTONE, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - - // var resultFlag=false; - // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); - // await sleep(2000); - - // audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - // if(data == true){ - // console.log('AudioFrameworkTest: Promise : isActive MEDIA: PASS :'+data); - // resultFlag = true; - // } - // else { - // console.log('AudioFrameworkTest: Promise : isActive MEDIA: FAIL :'+data); - // } - - // }); - - // await sleep(9000); - - // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_042 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set1 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_042', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_043 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set2 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set2 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_043', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_044 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set3 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set3 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_044', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_045 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set4 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set4 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_045', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_046 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set5 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_046', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_047 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set6 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set6 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_047', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_048 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set7 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set7 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_048', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_049 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set8 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set8 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_049', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_050 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set9 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set9 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_050', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_051 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set10 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set10 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_051', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_052 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set11 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set11 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_052', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_053 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set12 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set12 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_053', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_054 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set13 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set13 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_054', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_055 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set14 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set14 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_055', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_056 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set15 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set15 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_056', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_057 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set16 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set16 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_057', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_058 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set17 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set17 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_058', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_059 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set18 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set18 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_059', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_060 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set19 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set19 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_060', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_061 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set20 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set20 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_061', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_062 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set21 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set21 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_062', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_063 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set22 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set22 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_063', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_064 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set23 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set23 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_064', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_065 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set24 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set24 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_065', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag=true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content){ - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_066 - // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set25 - // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set25 - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_066', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - - // var resultFlag=true; - - // var audioRen; - // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - // audioRen = data; - // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - // }).catch((err) => { - // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - // resultFlag = false; - // }); - - // await audioRen.getRendererInfo().then(async function (audioParamsGet) { - // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - // if (audioParamsGet.content == AudioRendererInfo.content){ - // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - // resultFlag = false; - // } - // if (audioParamsGet.usage == AudioRendererInfo.usage){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - // resultFlag = false; - // } - // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - // resultFlag = false; - // } - // }).catch((err) => { - // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - // resultFlag = false; - // }); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_067 - // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set26 - // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set26 - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_067', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_SPEECH, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - - // var resultFlag=true; - - // var audioRen; - // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - // audioRen = data; - // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - // }).catch((err) => { - // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - // resultFlag = false; - // }); - - // await audioRen.getRendererInfo().then(async function (audioParamsGet) { - // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - // if (audioParamsGet.content == AudioRendererInfo.content){ - // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - // resultFlag = false; - // } - // if (audioParamsGet.usage == AudioRendererInfo.usage){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - // resultFlag = false; - // } - // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - // resultFlag = false; - // } - // }).catch((err) => { - // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - // resultFlag = false; - // }); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_068 - // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set27 - // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set27 - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_068', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_MUSIC, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - // var resultFlag=true; - - // var audioRen; - // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - // audioRen = data; - // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - // }).catch((err) => { - // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - // resultFlag = false; - // }); - - // await audioRen.getRendererInfo().then(async function (audioParamsGet) { - // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - // if (audioParamsGet.content == AudioRendererInfo.content){ - // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - // resultFlag = false; - // } - // if (audioParamsGet.usage == AudioRendererInfo.usage){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - // resultFlag = false; - // } - // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - // resultFlag = false; - // } - // }).catch((err) => { - // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - // resultFlag = false; - // }); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_069 - // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set28 - // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set28 - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_069', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_MOVIE, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - // var resultFlag=true; - - // var audioRen; - // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - // audioRen = data; - // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - // }).catch((err) => { - // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - // resultFlag = false; - // }); - - // await audioRen.getRendererInfo().then(async function (audioParamsGet) { - // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - // if (audioParamsGet.content == AudioRendererInfo.content){ - // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - // resultFlag = false; - // } - // if (audioParamsGet.usage == AudioRendererInfo.usage){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - // resultFlag = false; - // } - // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - // resultFlag = false; - // } - // }).catch((err) => { - // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - // resultFlag = false; - // }); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_070 - // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set29 - // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set29 - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_070', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - // var resultFlag=true; - - // var audioRen; - // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - // audioRen = data; - // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - // }).catch((err) => { - // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - // resultFlag = false; - // }); - - // await audioRen.getRendererInfo().then(async function (audioParamsGet) { - // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - // if (audioParamsGet.content == AudioRendererInfo.content){ - // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - // resultFlag = false; - // } - // if (audioParamsGet.usage == AudioRendererInfo.usage){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - // resultFlag = false; - // } - // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - // resultFlag = false; - // } - // }).catch((err) => { - // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - // resultFlag = false; - // }); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_071 - // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set30 - // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set30 - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_071', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_RINGTONE, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - // var resultFlag=true; - - // var audioRen; - // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - // audioRen = data; - // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - // }).catch((err) => { - // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - // resultFlag = false; - // }); - - // await audioRen.getRendererInfo().then(async function (audioParamsGet) { - // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - // if (audioParamsGet.content == AudioRendererInfo.content){ - // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - // resultFlag = false; - // } - // if (audioParamsGet.usage == AudioRendererInfo.usage){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - // resultFlag = false; - // } - // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - // } - // else{ - // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - // resultFlag = false; - // } - // }).catch((err) => { - // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - // resultFlag = false; - // }); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - // /* * - // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_072 - // * @tc.name : AudioRenderer - STATE_NEW - // * @tc.desc : AudioRenderer - STATE_NEW - // * @tc.size : MEDIUM - // * @tc.type : Function - // * @tc.level : Level 0 - // */ - // it('SUB_AUDIO_RENDERER_Play_audio_072', 0,async function (done) { - // var AudioStreamInfo = { - // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - // channels: audio.AudioChannel.CHANNEL_2, - // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - // } - - // var AudioRendererInfo = { - // content: audio.ContentType.CONTENT_TYPE_RINGTONE, - // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - // rendererFlags: 1 - // } - - // var AudioRendererOptions = { - // streamInfo: AudioStreamInfo, - // rendererInfo: AudioRendererInfo - // } - // var resultFlag = true; - - // var audioRen; - // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - // audioRen = data; - // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - // }).catch((err) => { - // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - // resultFlag = false; - // }); - - // if (audioRen.state==audio.AudioState.STATE_NEW) { - // console.info('AudioFrameworkRenderLog: Audio State : STATE_NEW : PASS : ' + audioRen.state); - // } - // else { - // console.info('AudioFrameworkRenderLog: Audio State : STATE_NEW : FAIL : ' + audioRen.state); - // resultFlag = false; - // } - - // await audioRen.release().then(async function () { - // console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - // }).catch((err) => { - // console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - // }); - - // expect(resultFlag).assertTrue(); - - // done(); - - // }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_073 - * @tc.name : AudioRenderer - STATE_PREPARED - * @tc.desc : AudioRenderer - STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_073', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - if (audioRen.state==audio.AudioState.STATE_PREPARED) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_PREPARED : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_PREPARED : FAIL : ' + audioRen.state); - resultFlag = false; - } - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_074 - * @tc.name : AudioRenderer - STATE_RUNNING - * @tc.desc : AudioRenderer - STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_074', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - - if (audioRen.state==audio.AudioState.STATE_RUNNING) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_RUNNING : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_RUNNING : FAIL : ' + audioRen.state); - resultFlag = false; - } - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_075 - * @tc.name : AudioRenderer - STATE_STOPPED - * @tc.desc : AudioRenderer - STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_075', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlag=false; - }); - await sleep(500); - - if (audioRen.state==audio.AudioState.STATE_STOPPED) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_STOPPED : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_STOPPED : FAIL : ' + audioRen.state); - resultFlag = false; - } - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_076 - * @tc.name : AudioRenderer - STATE_RELEASED - * @tc.desc : AudioRenderer - STATE_RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_076', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlag=false; - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - await sleep(500); - - if (audioRen.state==audio.AudioState.STATE_RELEASED) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_RELEASED : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_RELEASED : FAIL : ' + audioRen.state); - resultFlag = false; - } - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_077 - * @tc.name : AudioRenderer - STATE_PAUSED - * @tc.desc : AudioRenderer - STATE_PAUSED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_077', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - - await audioRen.pause().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - - if (audioRen.state==audio.AudioState.STATE_PAUSED) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_PAUSED : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_PAUSED : FAIL : ' + audioRen.state); - resultFlag = false; - } - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_078 - * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_078', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - if (rlen > (totalSize/2)){ - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - } - if (rlen > (totalSize/2)){ - await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE).then(async function () { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); - resultFlag=false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - await audioRen.getRenderRate().then(async function (data) { - if (data == audio.AudioRendererRate.RENDER_RATE_DOUBLE){ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS : '+data); - } - else{ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL : '+data); - resultFlag=false; - } - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); - resultFlag=false; - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_079 - * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_HALF - * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_HALF - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_079', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - if (rlen > (totalSize/2)){ - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - } - if (rlen > (totalSize/2)){ - await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_HALF).then(async function () { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_HALF : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_HALF : ERROR : '+err.message); - resultFlag=false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - await audioRen.getRenderRate().then(async function (data) { - if (data == audio.AudioRendererRate.RENDER_RATE_HALF){ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_HALF : PASS : '+data); - } - else{ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_HALF : FAIL : '+data); - resultFlag=false; - } - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_HALF : ERROR : '+err.message); - resultFlag=false; - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_080 - * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_NORMAL - * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_NORMAL - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_080', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - if (rlen > (totalSize/2)){ - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - } - if (rlen > (totalSize/2)){ - await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE).then(async function () { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); - resultFlag=false; - }); - } - } - - await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(async function () { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_NORMAL : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_NORMAL : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: Renderer after read'); - await audioRen.getRenderRate().then(async function (data) { - if (data == audio.AudioRendererRate.RENDER_RATE_NORMAL){ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : PASS : '+data); - } - else{ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : FAIL : '+data); - resultFlag=false; - } - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_NORMAL : ERROR : '+err.message); - resultFlag=false; - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_081 - * @tc.name : AudioRenderer - SetRenderRate - DEFAULT - RENDER_RATE_NORMAL - * @tc.desc : AudioRenderer - SetRenderRate - DEFAULT - RENDER_RATE_NORMAL - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_081', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - if (rlen > (totalSize/2)){ - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - await audioRen.getRenderRate().then(async function (data) { - if (data == audio.AudioRendererRate.RENDER_RATE_NORMAL){ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : PASS : '+data); - } - else{ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : FAIL : '+data); - resultFlag=false; - } - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_NORMAL : ERROR : '+err.message); - resultFlag=false; - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_082 - * @tc.name : AudioRenderer-Set11-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 11 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_082', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_083 - * @tc.name : AudioRenderer-Set1-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_083', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-1C-44100-2SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_084 - * @tc.name : AudioRenderer-Set2-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 2 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_084', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-1C-8000-2SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_085 - * @tc.name : AudioRenderer-Set3-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 3 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_085', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-1C-32000-1SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_086 - * @tc.name : AudioRenderer-Set4-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 4 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_086', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_64000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-1C-64000-3SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_087 - * @tc.name : AudioRenderer-Set5-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_087', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-1C-96000-4SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_088 - * @tc.name : AudioRenderer-Set6-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 6 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_088', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_11025, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-2C-11025-1SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_089 - * @tc.name : AudioRenderer-Set7-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 7 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_089', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_12000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-2C-12000-2SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_090 - * @tc.name : AudioRenderer-Set8-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 8 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_090', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-2C-16000-3SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_091 - * @tc.name : AudioRenderer-Set9-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 9 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_091', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_22050, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-2C-22050-2SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_092 - * @tc.name : AudioRenderer-Set10-Media - CALLBACK - * @tc.desc : AudioRenderer with parameter set 10 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_092', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = await playbackCB(AudioRendererOptions, mediaDir+'/StarWars10s-2C-24000-3SW.wav'); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_093 - * @tc.name : AudioRenderer - getAudioTime - Play - * @tc.desc : AudioRenderer - getAudioTime - Play - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_093', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - let audioTime = Date.now(); - let audioTimeStart; - let audioTimeEnd; - let audioTimeMiddle; - console.info('AudioFrameworkRenderLog: Current Time in NANOSeconds : '+audioTime); - - await audioRen.getAudioTime().then(async function (data) { - audioTime = Date.now(); - audioTimeStart = (data-audioTime)/1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: '+audioTimeStart); - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : ORG: '+data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - if (rlen > (totalSize/3) && rlen < (totalSize/2)){ - console.info('AudioFrameworkRenderLog: getAudioTime : ENTER'); - await audioRen.getAudioTime().then(async function (data) { - audioTime = Date.now(); - audioTimeMiddle = (data-audioTime)/1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : Play iteration: Converted: '+audioTime); - console.info(`AudioFrameworkRenderLog: getAudioTime : Play iteration: ${rlen} value : ${data}`); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); - resultFlag=false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - var gettime = audioTimeMiddle-audioTimeStart; - if (gettime > 3 && gettime < 5){ - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+gettime); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+gettime); - resultFlag=false; - } - - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - - await audioRen.getAudioTime().then(async function (data) { - audioTime = Date.now(); - audioTimeEnd = (data-audioTime)/1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Stop : Converted: '+audioTimeEnd); - console.info('AudioFrameworkRenderLog: getAudioTime : After Stop : ORG : '+data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); - resultFlag=false; - }); - let totalAudioTime = audioTimeEnd-audioTimeStart; - console.info('AudioFrameworkRenderLog: Audio Length in Sec: '+totalAudioTime); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_094 - * @tc.name : AudioRenderer - getAudioTime - Before Play - * @tc.desc : AudioRenderer - getAudioTime - Before Play - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_094', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - let audioTime = Date.now(); - let audioTimeStart; - let audioTimeEnd; - let audioTimeMiddle; - console.info('AudioFrameworkRenderLog: Current Time in NANOSeconds : '+audioTime); - - await audioRen.getAudioTime().then(async function (data) { - audioTime = Date.now(); - audioTimeStart = (data-audioTime)/1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: '+audioTimeStart); - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : ORG: '+data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - var gettime = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - await audioRen.getAudioTime().then(async function (data) { - audioTime = Date.now(); - audioTimeEnd = (data-audioTime)/1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Stop : Converted: '+audioTimeEnd); - console.info('AudioFrameworkRenderLog: getAudioTime : After Stop : ORG : '+data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); - resultFlag=false; - }); - let totalAudioTime = audioTimeStart-audioTimeEnd; - - if (totalAudioTime < 0){ - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+totalAudioTime); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+totalAudioTime); - resultFlag=false; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_095 - * @tc.name : AudioRenderer - getAudioTime - after Play - * @tc.desc : AudioRenderer - getAudioTime - after Play - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_095', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - let audioTime = Date.now(); - let audioTimeStart; - let audioTimeEnd; - let audioTimeMiddle; - console.info('AudioFrameworkRenderLog: Current Time in NANOSeconds : '+audioTime); - - await audioRen.getAudioTime().then(async function (data) { - audioTime = Date.now(); - audioTimeStart = (data-audioTime)/1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: '+audioTimeStart); - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : ORG: '+data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); - resultFlag=false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - var gettime = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - await audioRen.getAudioTime().then(async function (data) { - audioTime = Date.now(); - audioTimeEnd = (data-audioTime)/1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Stop : Converted: '+audioTimeEnd); - console.info('AudioFrameworkRenderLog: getAudioTime : After Stop : ORG : '+data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); - resultFlag=false; - }); - let totalAudioTime = audioTimeEnd-audioTimeStart; - - if (totalAudioTime > 9 && gettime < 10){ - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+totalAudioTime); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+totalAudioTime); - resultFlag=false; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_096 - * @tc.name : AudioRenderer - getAudioTime - Error - * @tc.desc : AudioRenderer - getAudioTime - Error - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_096', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag=false; - }); - - await audioRen.getAudioTime().then(async function (data) { - console.info('AudioFrameworkRenderLog: getAudioTime : Value : '+data); - resultFlag=true; - if (data > 0){ - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+data); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+data); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - await sleep(500); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_097 - * @tc.name : AudioRenderer - STATE_PREPARED -Callback - * @tc.desc : AudioRenderer - STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_097', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - audioRen.on('stateChange',(AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_PREPARED: - console.info('AudioFrameworkTest: state : STATE_NEW'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : '+AudioState); - break; - } - }); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - await sleep(1000); - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_098 - * @tc.name : AudioRenderer - STATE_RUNNING - Callback - * @tc.desc : AudioRenderer - STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_098', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - audioRen.on('stateChange',(AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_RUNNING: - console.info('AudioFrameworkTest: state : STATE_RUNNING'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : '+AudioState); - break; - } - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - await sleep(1000); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_099 - * @tc.name : AudioRenderer - STATE_STOPPED - Callback - * @tc.desc : AudioRenderer - STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_099', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - audioRen.on('stateChange',(AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_STOPPED: - console.info('AudioFrameworkTest: state : STATE_STOPPED'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : '+AudioState); - break; - } - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlag=false; - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - await sleep(500); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_100 - * @tc.name : AudioRenderer - STATE_RELEASED - Callback - * @tc.desc : AudioRenderer - STATE_RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_100', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - - audioRen.on('stateChange',(AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_RELEASED: - console.info('AudioFrameworkTest: state : STATE_RELEASED'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : '+AudioState); - break; - } - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlag=false; - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - await sleep(500); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_101 - * @tc.name : AudioRenderer - STATE_PAUSED - Callback - * @tc.desc : AudioRenderer - STATE_PAUSED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_101', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - audioRen.on('stateChange',(AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_PAUSED: - console.info('AudioFrameworkTest: state : STATE_PAUSED'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : '+AudioState); - break; - } - }); - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - - await audioRen.pause().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(500); - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_102 - * @tc.name : AudioRenderer - markReached - On - * @tc.desc : AudioRenderer - markReached - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_102', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - }); - audioRen.on('markReach',55, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : '+position); - resultFlag = true; - - }) - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; - }); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_103 - * @tc.name : AudioRenderer - markReached - On - off -on - * @tc.desc : AudioRenderer - markReached - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_103', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - }); - audioRen.on('markReach',55, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : '+position); -// resultFlag = true; - audioRen.off('markReach'); - audioRen.on('markReach',100, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : '+position); - resultFlag = true; - - }); - - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; - }); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_104 - * @tc.name : AudioRenderer - markReached - on - on - * @tc.desc : AudioRenderer - markReached - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_104', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - }); - audioRen.on('markReach',55, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : '+position); - resultFlag = true; - audioRen.on('markReach',73, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : '+position); - resultFlag = false; - }); - }); - - - - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; - }); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_105 - * @tc.name : AudioRenderer - periodReach - On - * @tc.desc : AudioRenderer - periodReach - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_105', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - }); - audioRen.on('periodReach',55, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : '+position); - resultFlag = true; - audioRen.off('periodReach'); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; - }); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_106 - * @tc.name : AudioRenderer - periodReach - On - off -on - * @tc.desc : AudioRenderer - periodReach - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_106', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - }); - audioRen.on('periodReach',55, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : '+position); - // resultFlag = true; - audioRen.off('periodReach'); - audioRen.on('periodReach',100, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : '+position); - resultFlag = true; - audioRen.off('periodReach'); - }); - - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; - }); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_107 - * @tc.name : AudioRenderer - periodReach - on - on - * @tc.desc : AudioRenderer - periodReach - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_107', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - }); - audioRen.on('periodReach',55, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : '+position); - resultFlag = true; - audioRen.on('periodReach',73, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : '+position); - resultFlag = false; - }); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; - }); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_108 - * @tc.name : AudioState - STATE_INVALID - * @tc.desc : AudioState - STATE_INVALID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_108', 0, async function (done) { - - expect(audio.AudioState.STATE_INVALID).assertEqual(-1); - await sleep(50); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_109 - * @tc.name : AudioState - STATE_NEW - * @tc.desc : AudioState - STATE_NEW - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_109', 0, async function (done) { - - expect(audio.AudioState.STATE_NEW).assertEqual(0); - await sleep(50); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_110 - * @tc.name : AudioSampleFormat - STATE_FORMAT_INVALID - * @tc.desc : AudioSampleFormat - STATE_FORMAT_INVALID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_110', 0, async function (done) { - - expect(audio.AudioSampleFormat.SAMPLE_FORMAT_INVALID).assertEqual(-1); - await sleep(50); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_111 - * @tc.name : SourceType - SOURCE_TYPE_INVALID - * @tc.desc : SourceType - SOURCE_TYPE_INVALID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_111', 0, async function (done) { - - expect(audio.SourceType.SOURCE_TYPE_INVALID).assertEqual(-1); - await sleep(50); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_112 - * @tc.name : AudioRenderer - Pause - Callback - * @tc.desc : AudioRenderer - Pause - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_112', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag = false; - }); - audioRen.on('stateChange',(AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_PAUSED: - console.info('AudioFrameworkTest: state : STATE_PAUSED'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : '+AudioState); - break; - } - }); - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - await sleep(2000); - - audioRen.pause((err) => { - if (err) { - console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : '+err.message); - resultFlag=false; - } - else{ - console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); - } - }); - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_113 - * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback - * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_113', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlag=false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlag=false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); - totalSize = totalSize-44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); - let rlen = 0; - while (rlen < totalSize) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); - await audioRen.write(buf); - if (rlen > (totalSize/2)){ - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - } - if (rlen > (totalSize/2)){ - - audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE, (err) => { - if (err) { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); - resultFlag=false; - } - else { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); - } - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - audioRen.getRenderRate((err, data) => { - if (err) { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); - resultFlag=false; - } - else if (data == audio.AudioRendererRate.RENDER_RATE_DOUBLE){ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS : '+data); - } - else{ - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL : '+data); - resultFlag=false; - } - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_114 - * @tc.name : AudioEncodingType - ENCODING_TYPE_INVALID - * @tc.desc : AudioEncodingType - ENCODING_TYPE_INVALID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_114', 0, async function (done) { - - expect(audio.AudioEncodingType.ENCODING_TYPE_INVALID).assertEqual(-1); - await sleep(50); - done(); - }) - +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http:// www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; +import app from '@system.app'; +import bundle from '@ohos.bundle'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import featureAbility from '@ohos.ability.featureAbility' +import ability_featureAbility from '@ohos.ability.featureAbility'; +import resourceManager from '@ohos.resourceManager'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +describe('audioRenderer', function () { + + let fdRead; + let readpath; + const audioManager = audio.getAudioManager(); + console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); + /*async function getPathName(){ + // var path1 = '/data/accounts/account_0/appdata/'; + var path1 = '/data/app/el1/bundle/public/'; + var packageName; + var context = ability_featureAbility.getContext(); + await context.getBundleName() + .then((data) => { + console.info('AudioFrameworkRenderLog: Cache directory obtained. Data: ' + data); + packageName = data; + }).catch((error) => { + console.error('AudioFrameworkRenderLog: Failed to obtain the cache directory. Cause:' + error.message); + }); + await sleep(200); + var mediaDirTemp = path1 + packageName + '/' + packageName + '/assets/entry/resources/rawfile'; + // var mediaDirTemp = path1+packageName+'/files' + console.info('AudioFrameworkRenderLog: Resource DIR Path : '+mediaDirTemp); + return mediaDirTemp; + + }*/ + + beforeAll(async function () { + await applyPermission(); + console.info('AudioFrameworkRenderLog: beforeAll: Prerequisites at the test suite level'); + // mediaDir = await getPathName(); + }) + + beforeEach(async function () { + console.info('AudioFrameworkRenderLog: beforeEach: Prerequisites at the test case level'); + await sleep(1000); + }) + + afterEach(function () { + console.info('AudioFrameworkRenderLog: afterEach: Test case-level clearance conditions'); + }) + + afterAll(async function () { + console.info('AudioFrameworkRenderLog: afterAll: Test suite-level cleanup condition'); + }) + + function sleep (ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + async function getFileDescriptor(fileName) { + let fileDescriptor = undefined; + await resourceManager.getResourceManager().then(async (mgr) => { + await mgr.getRawFileDescriptor(fileName).then(value => { + fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length }; + }).catch(error => { + console.log('AudioFrameworkRenderLog:case getRawFileDescriptor err: ' + error); + }); + }); + return fileDescriptor; + } + + async function closeFileDescriptor(fileName) { + await resourceManager.getResourceManager().then(async (mgr) => { + await mgr.closeRawFileDescriptor(fileName).then(value => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:' + fileName); + }).catch(error => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor err: ' + error); + }); + }); + } + async function getFdRead(pathName, done) { + await getFileDescriptor(pathName).then((res) => { + if (res == undefined) { + expect().assertFail(); + console.info('AudioFrameworkRenderLog:case error fileDescriptor undefined, open file fail'); + done(); + } else { + fdRead = res.fd; + console.info("AudioFrameworkRenderLog:case 0 fdRead is: " + fdRead); + } + }) + } + async function applyPermission() { + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('AudioFrameworkRenderLog:[permission] case accessTokenID is ' + tokenID); + let permissionName1 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName2 = 'ohos.permission.READ_MEDIA'; + let permissionName3 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :' + err); + }); + } else { + console.info('AudioFrameworkRenderLog:[permission] case apply permission failed, createAtManager failed'); + } + } + + async function playbackPromise (AudioRendererOptions, pathName, AudioScene) { + var resultFlag = 'new'; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + return resultFlag; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+pathName); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + }); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); + bufferSize=data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + resultFlag=false; + }); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case2: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case3: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + if (rlen > (totalSize/2)){ + await audioManager.getAudioScene().then(async function (data) { + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : '+data); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); + resultFlag=false; + }); + } + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + resultFlag=false; + }); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + resultFlag=true; + console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlag); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + return resultFlag; + } + + async function playbackPromise_93 (AudioRendererOptions, pathName, AudioScene) { + var resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + //let audioTime = Date.now(); + let audioTimeStart; + /*let audioTimeEnd; + let audioTimeMiddle;*/ + // console.info('AudioFrameworkRenderLog: Current Time in NANOSeconds : '+audioTime); + + await audioRen.getAudioTime().then(async function (data) { + // audioTime = Date.now(); + audioTimeStart = data/1000000000;//-audioTime)/1000000000; + console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: '+audioTimeStart); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + //var gettime = audioTimeMiddle-audioTimeStart; + if (audioTimeStart != 0){ + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+audioTimeStart); + } + else{ + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+audioTimeStart); + resultFlag=false; + } + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + async function playbackPromise_94 (AudioRendererOptions, pathName, AudioScene) { + var resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + // let audioTime = Date.now(); + let audioTimeStart; + //let audioTimeEnd; + //let audioTimeMiddle; + //console.info('AudioFrameworkRenderLog: Current Time in NANOSeconds : '+audioTime); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + var gettime = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + await audioRen.getAudioTime().then(async function (data) { + audioTimeStart = data/1000000000; + console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: '+audioTimeStart); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); + resultFlag=false; + }); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + if (audioTimeStart != 0){ + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+audioTimeStart); + } + else{ + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+audioTimeStart); + resultFlag=false; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + async function playbackPromise_95 (AudioRendererOptions, pathName, AudioScene) { + var resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + let audioTimeStart; + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + } + + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + await audioRen.getAudioTime().then(async function (data) { + audioTimeStart = data/1000000000; + console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: '+audioTimeStart); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); + resultFlag=false; + }); + + if (audioTimeStart !=0){ + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+audioTimeStart); + } + else{ + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+audioTimeStart); + resultFlag=false; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + async function playbackPromise_102 (AudioRendererOptions, pathName) { + var resultFlag = false; + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + }); + audioRen.on('markReach',55, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : '+position); + resultFlag = true; + }) + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); + bufferSize=data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + resultFlag=false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + console.info('AudioFrameworkRenderLog:case 2-1:AudioFrameworkRenderLog: File Path: '); + ss.readSync(discardHeader); + console.info('AudioFrameworkRenderLog:case 2-2:AudioFrameworkRenderLog: File Path: '); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + } + + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + return resultFlag; + } + + async function playbackPromise_103 (AudioRendererOptions , pathName ) { + var resultFlag = false; + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + }); + audioRen.on('markReach',55, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : '+position); + audioRen.off('markReach'); + audioRen.on('markReach',100, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : '+position); + resultFlag = true; + }); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); + bufferSize=data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + resultFlag=false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + return resultFlag; + } + + async function playbackPromise_104 ( AudioRendererOptions , pathName ) { + var resultFlag = false; + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + }); + audioRen.on('markReach',55, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : '+position); + resultFlag = true; + audioRen.on('markReach',73, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : '+position); + resultFlag = false; + }); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); + bufferSize=data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + resultFlag=false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + return resultFlag; + } + + async function playbackPromise_105 (AudioRendererOptions , pathName) { + var resultFlag = false; + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + }); + audioRen.on('periodReach',55, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : '+position); + resultFlag = true; + audioRen.off('periodReach'); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); + bufferSize=data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + resultFlag=false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + } + + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + return resultFlag; + } + + async function playbackPromise_106 (AudioRendererOptions , pathName) { + var resultFlag = false; + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + }); + audioRen.on('periodReach',55, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : '+position); + // resultFlag = true; + audioRen.off('periodReach'); + audioRen.on('periodReach',100, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : '+position); + resultFlag = true; + audioRen.off('periodReach'); + }); + + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); + bufferSize=data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + resultFlag=false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + return resultFlag; + } + + async function playbackPromise_107 (AudioRendererOptions, pathName) { + var resultFlag = false; + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + }); + audioRen.on('periodReach',55, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : '+position); + resultFlag = true; + audioRen.on('periodReach',73, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : '+position); + resultFlag = false; + }); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); + bufferSize=data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + resultFlag=false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + return resultFlag; + } + + async function playbackPromise_113(AudioRendererOptions, pathName) { + var resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + if (rlen > (totalSize/8)){ + await audioManager.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); + resultFlag=false; + }); + } + if (rlen > (totalSize/8)){ + + audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE, (err) => { + if (err) { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); + resultFlag=false; + } + else { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); + } + }); + } + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + audioRen.getRenderRate((err, data) => { + if (err) { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); + resultFlag=false; + } + else if (data == audio.AudioRendererRate.RENDER_RATE_DOUBLE){ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS : '+data); + } + else{ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL : '+data); + resultFlag=false; + } + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + async function playbackCB (AudioRendererOptions, pathName){ + + var resultFlag = 'new'; + + console.info('AudioFrameworkRenderLog: CALLBACK : Audio Playback Function'); + + var audioRen; + + audio.createAudioRenderer(AudioRendererOptions,(err, data) => { + if (err) { + console.error(`AudioFrameworkRenderLog: AudioRender Created : Error: ${err.message}`); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : SUCCESS'); + audioRen = data; + } + }); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + await sleep(100); + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+pathName); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: Callback : Audio Playback Function'); + + audioRen.start((err) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Renderer start failed: Error: ${err.message}`); + resultFlag=false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer started'); + } + }); + await sleep(100); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var samplingRate; + audioRen.getStreamInfo(async (err, audioParamsGet) => { + await sleep(100); + if (err) { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + samplingRate = audioParamsGet.samplingRate; + } + }); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + audioRen.getRendererInfo(async (err, audioParamsGet) => { + await sleep(100); + if (err) { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + } + }); + await sleep(100); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + var bufferSize; + await audioRen.getBufferSize((err,data)=> { + if (err) { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + resultFlag=false; + } + else { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); + bufferSize=data; + } + }); + await sleep(100); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 4: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + let aa = fileio.fstatSync(fdRead); + console.log('case 6 : '+aa); + console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + let rlen = 0; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + await sleep(100); + // var waitTime = (totalSize/88200); + var waitTime; + switch (samplingRate) { + case 44100: + waitTime = 45; + break; + case 8000: + waitTime = 60; + break; + case 32000: + waitTime = 45; + break; + case 64000: + waitTime = 45; + break; + case 96000: + waitTime = 45; + break; + case 11025: + waitTime = 45; + break; + case 12000: + waitTime = 45; + break; + case 16000: + waitTime = 45; + break; + case 22050: + waitTime = 45; + break; + case 24000: + waitTime = 45; + break; + case 48000: + waitTime = 45; + break; + default: + waitTime = 45; + break + } + + await sleep(100); + console.info('AudioFrameworkRenderLog: waitTime : ' +waitTime); + while (rlen < totalSize/10) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf,(err, data) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Buff write: Error: ${err.message}`); + resultFlag=false; + } + else { + console.info('BufferAudioFramework: Buff write successful : '); + resultFlag=true; + } + }); + await sleep(waitTime); + } + await sleep(2000); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + ss.closeSync(); + audioRen.drain((err, state) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Renderer drain failed: Error: ${err.message}`); + resultFlag=false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer drained'); + } + }); + await sleep(100); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + audioRen.stop((err, state) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Renderer stop failed: Error: ${err.message}`); + resultFlag=false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer stopped'); + resultFlag=true; + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + } + }); + await sleep(100); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } + audioRen.release((err, state) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Renderer release failed: Error: ${err.message}`); + resultFlag=false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer released'); + } + }); + await sleep(100); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + return resultFlag; + + } + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_001 + * @tc.name : AudioRenderer-Set1-Media + * @tc.desc : AudioRenderer with parameter set 1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_001', 0, async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-44100-2SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_093 + * @tc.name : AudioRenderer - getAudioTime -Before Play + * @tc.desc : AudioRenderer - getAudioTime -Before Play + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_093', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-24000-3SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackPromise_93(AudioRendererOptions, readpath,audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_094 + * @tc.name : AudioRenderer - getAudioTime - During Play + * @tc.desc : AudioRenderer - getAudioTime - During Play + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_094', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-24000-3SW.wav' + await getFdRead(readpath,done); + var resultFlag = await playbackPromise_94(AudioRendererOptions, readpath,audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_095 + * @tc.name : AudioRenderer - getAudioTime - after Play + * @tc.desc : AudioRenderer - getAudioTime - after Play + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_095', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-24000-3SW.wav' + await getFdRead(readpath,done); + var resultFlag = await playbackPromise_95(AudioRendererOptions, readpath,audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_102 + * @tc.name : AudioRenderer - markReached - On + * @tc.desc : AudioRenderer - markReached + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_102', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath,done); + var resultFlag = await playbackPromise_102(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_103 + * @tc.name : AudioRenderer - markReached - On - off -on + * @tc.desc : AudioRenderer - markReached + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_103', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath,done); + var resultFlag = await playbackPromise_103(AudioRendererOptions, readpath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_104 + * @tc.name : AudioRenderer - markReached - on - on + * @tc.desc : AudioRenderer - markReached + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_104', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readpath,done); + var resultFlag = await playbackPromise_104(AudioRendererOptions, readpath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_105 + * @tc.name : AudioRenderer - periodReach - On + * @tc.desc : AudioRenderer - periodReach + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_105', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + readpath ='StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readpath,done); + var resultFlag = await playbackPromise_105(AudioRendererOptions, readpath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_106 + * @tc.name : AudioRenderer - periodReach - On - off -on + * @tc.desc : AudioRenderer - periodReach + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_106', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readpath,done); + var resultFlag = await playbackPromise_106(AudioRendererOptions, readpath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_107 + * @tc.name : AudioRenderer - periodReach - on - on + * @tc.desc : AudioRenderer - periodReach + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_107', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readpath,done); + var resultFlag = await playbackPromise_107(AudioRendererOptions, readpath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_002 + * @tc.name : AudioRenderer-Set2-Media + * @tc.desc : AudioRenderer with parameter set 2 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_002', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-8000-2SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_003 + * @tc.name : AudioRenderer-Set3-Media + * @tc.desc : AudioRenderer with parameter set 3 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_003', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-32000-1SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_004 + * @tc.name : AudioRenderer-Set4-Media + * @tc.desc : AudioRenderer with parameter set 4 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_004', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_64000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-64000-3SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_005 + * @tc.name : AudioRenderer-Set5-Media + * @tc.desc : AudioRenderer with parameter set 5 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_005', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-96000-4SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_006 + * @tc.name : AudioRenderer-Set6-Media + * @tc.desc : AudioRenderer with parameter set 6 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_006', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_11025, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-11025-1SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_007 + * @tc.name : AudioRenderer-Set7-Media + * @tc.desc : AudioRenderer with parameter set 7 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_007', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_12000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-12000-2SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_011 + * @tc.name : AudioRenderer-Set11-Media + * @tc.desc : AudioRenderer with parameter set 11 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_011', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_012 + * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_012', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_013 + * @tc.name : AudioRenderer-isStreamActive - SPEECH - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - SPEECH - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_013', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_014 + * @tc.name : AudioRenderer-isStreamActive - MUSIC - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - MUSIC - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_014', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_015 + * @tc.name : AudioRenderer-isStreamActive - MOVIE - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - MOVIE - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_015', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_016 + * @tc.name : AudioRenderer-isStreamActive - SONIFICATION - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - SONIFICATION - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_016', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_017 + * @tc.name : AudioRenderer-isStreamActive - RINGTONE - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_017', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_018 + * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_018', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_019 + * @tc.name : AudioRenderer-isStreamActive - SPEECH - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - SPEECH - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_019', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_020 + * @tc.name : AudioRenderer-isStreamActive - MUSIC - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - MUSIC - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_020', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_021 + * @tc.name : AudioRenderer-isStreamActive - MOVIE - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - MOVIE - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_021', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_022 + * @tc.name : AudioRenderer-isStreamActive - SONIFICATION - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_022', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_023 + * @tc.name : AudioRenderer-isStreamActive - RINGTONE - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_023', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_024 + * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_024', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_025 + * @tc.name : AudioRenderer-isStreamActive - SPEECH - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - SPEECH - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_025', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.VOICE_CALL).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive VOICE_CALL: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive VOICE_CALL: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_026 + * @tc.name : AudioRenderer-isStreamActive - MUSIC - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - MUSIC - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_026', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_027 + * @tc.name : AudioRenderer-isStreamActive - MOVIE - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - MOVIE - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_027', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_028 + * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_028', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_029 + * @tc.name : AudioRenderer-isStreamActive - RINGTONE - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_029', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_030 + * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_030', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_031 + * @tc.name : AudioRenderer-isStreamActive - SPEECH - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - SPEECH - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_031', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_032 + * @tc.name : AudioRenderer-isStreamActive - MUSIC - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - MUSIC - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_032', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive RENGITONE: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_033 + * @tc.name : AudioRenderer-isStreamActive - MOVIE - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - MOVIE - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_033', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_034 + * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_034', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_035 + * @tc.name : AudioRenderer-isStreamActive - RINGTONE - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_035', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if(data == true){ + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :'+data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_036 + // * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - VOICE_ASSISTANT + // * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - VOICE_ASSISTANT + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_036', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + + // var resultFlag=false; + // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); + // await sleep(2000); + + // audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + // if(data == true){ + // console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + // resultFlag = true; + // } + // else { + // console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + // } + + // }); + + // await sleep(9000); + + // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_037 + // * @tc.name : AudioRenderer-isStreamActive - SPEECH - VOICE_ASSISTANT + // * @tc.desc : AudioRenderer-isStreamActive - SPEECH - VOICE_ASSISTANT + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_037', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_SPEECH, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + + // var resultFlag=false; + // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); + // await sleep(2000); + + // audioManager.isActive(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { + // if(data == true){ + // console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: PASS :'+data); + // resultFlag = true; + // } + // else { + // console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: FAIL :'+data); + // } + + // }); + + // await sleep(9000); + + // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_038 + // * @tc.name : AudioRenderer-isStreamActive - MUSIC - VOICE_ASSISTANT + // * @tc.desc : AudioRenderer-isStreamActive - MUSIC - VOICE_ASSISTANT + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_038', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_MUSIC, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + + // var resultFlag=false; + // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); + // await sleep(2000); + + // audioManager.isActive(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { + // if(data == true){ + // console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: PASS :'+data); + // resultFlag = true; + // } + // else { + // console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: FAIL :'+data); + // } + + // }); + + // await sleep(9000); + + // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_039 + // * @tc.name : AudioRenderer-isStreamActive - MOVIE - VOICE_ASSISTANT + // * @tc.desc : AudioRenderer-isStreamActive - MOVIE - VOICE_ASSISTANT + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_039', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_MOVIE, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + + // var resultFlag=false; + // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); + // await sleep(2000); + + // audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + // if(data == true){ + // console.log('AudioFrameworkTest: Promise : isActive Media: PASS :'+data); + // resultFlag = true; + // } + // else { + // console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + // } + + // }); + + // await sleep(9000); + + // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_040 + // * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_ASSISTANT + // * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_ASSISTANT + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_040', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + + // var resultFlag=false; + // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); + // await sleep(2000); + + // audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + // if(data == true){ + // console.log('AudioFrameworkTest: Promise : isActive MEDIA: PASS :'+data); + // resultFlag = true; + // } + // else { + // console.log('AudioFrameworkTest: Promise : isActive MEDIA: FAIL :'+data); + // } + + // }); + + // await sleep(9000); + + // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_041 + // * @tc.name : AudioRenderer-isStreamActive - RINGTONE - VOICE_ASSISTANT + // * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - VOICE_ASSISTANT + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_041', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_RINGTONE, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + + // var resultFlag=false; + // playbackPromise(AudioRendererOptions, mediaDir+'/StarWars10s-2C-48000-4SW.wav', audio.AudioScene.AUDIO_SCENE_DEFAULT); + // await sleep(2000); + + // audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + // if(data == true){ + // console.log('AudioFrameworkTest: Promise : isActive MEDIA: PASS :'+data); + // resultFlag = true; + // } + // else { + // console.log('AudioFrameworkTest: Promise : isActive MEDIA: FAIL :'+data); + // } + + // }); + + // await sleep(9000); + + // console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_042 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set1 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_042', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_043 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set2 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set2 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_043', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_044 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set3 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set3 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_044', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_045 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set4 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set4 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_045', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_046 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set5 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set5 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_046', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_047 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set6 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set6 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_047', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_048 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set7 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set7 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_048', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_049 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set8 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set8 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_049', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_050 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set9 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set9 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_050', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_051 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set10 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set10 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_051', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_052 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set11 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set11 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_052', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_053 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set12 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set12 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_053', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_054 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set13 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set13 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_054', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_055 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set14 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set14 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_055', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_056 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set15 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set15 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_056', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_057 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set16 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set16 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_057', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_058 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set17 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set17 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_058', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_059 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set18 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set18 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_059', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_060 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set19 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set19 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_060', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_061 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set20 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set20 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_061', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_062 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set21 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set21 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_062', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_063 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set22 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set22 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_063', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_064 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set23 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set23 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_064', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_065 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set24 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set24 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_065', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + var resultFlag=true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content){ + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else{ + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_066 + // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set25 + // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set25 + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_066', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + + // var resultFlag=true; + + // var audioRen; + // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + // audioRen = data; + // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + // }).catch((err) => { + // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + // resultFlag = false; + // }); + + // await audioRen.getRendererInfo().then(async function (audioParamsGet) { + // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + // if (audioParamsGet.content == AudioRendererInfo.content){ + // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + // resultFlag = false; + // } + // if (audioParamsGet.usage == AudioRendererInfo.usage){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + // resultFlag = false; + // } + // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + // resultFlag = false; + // } + // }).catch((err) => { + // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + // resultFlag = false; + // }); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_067 + // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set26 + // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set26 + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_067', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_SPEECH, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + + // var resultFlag=true; + + // var audioRen; + // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + // audioRen = data; + // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + // }).catch((err) => { + // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + // resultFlag = false; + // }); + + // await audioRen.getRendererInfo().then(async function (audioParamsGet) { + // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + // if (audioParamsGet.content == AudioRendererInfo.content){ + // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + // resultFlag = false; + // } + // if (audioParamsGet.usage == AudioRendererInfo.usage){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + // resultFlag = false; + // } + // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + // resultFlag = false; + // } + // }).catch((err) => { + // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + // resultFlag = false; + // }); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_068 + // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set27 + // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set27 + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_068', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_MUSIC, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + // var resultFlag=true; + + // var audioRen; + // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + // audioRen = data; + // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + // }).catch((err) => { + // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + // resultFlag = false; + // }); + + // await audioRen.getRendererInfo().then(async function (audioParamsGet) { + // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + // if (audioParamsGet.content == AudioRendererInfo.content){ + // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + // resultFlag = false; + // } + // if (audioParamsGet.usage == AudioRendererInfo.usage){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + // resultFlag = false; + // } + // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + // resultFlag = false; + // } + // }).catch((err) => { + // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + // resultFlag = false; + // }); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_069 + // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set28 + // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set28 + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_069', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_MOVIE, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + // var resultFlag=true; + + // var audioRen; + // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + // audioRen = data; + // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + // }).catch((err) => { + // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + // resultFlag = false; + // }); + + // await audioRen.getRendererInfo().then(async function (audioParamsGet) { + // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + // if (audioParamsGet.content == AudioRendererInfo.content){ + // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + // resultFlag = false; + // } + // if (audioParamsGet.usage == AudioRendererInfo.usage){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + // resultFlag = false; + // } + // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + // resultFlag = false; + // } + // }).catch((err) => { + // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + // resultFlag = false; + // }); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_070 + // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set29 + // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set29 + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_070', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + // var resultFlag=true; + + // var audioRen; + // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + // audioRen = data; + // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + // }).catch((err) => { + // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + // resultFlag = false; + // }); + + // await audioRen.getRendererInfo().then(async function (audioParamsGet) { + // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + // if (audioParamsGet.content == AudioRendererInfo.content){ + // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + // resultFlag = false; + // } + // if (audioParamsGet.usage == AudioRendererInfo.usage){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + // resultFlag = false; + // } + // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + // resultFlag = false; + // } + // }).catch((err) => { + // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + // resultFlag = false; + // }); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_071 + // * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set30 + // * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set30 + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_071', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_RINGTONE, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + // var resultFlag=true; + + // var audioRen; + // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + // audioRen = data; + // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + // }).catch((err) => { + // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + // resultFlag = false; + // }); + + // await audioRen.getRendererInfo().then(async function (audioParamsGet) { + // console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + // console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + // console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + // console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + // if (audioParamsGet.content == AudioRendererInfo.content){ + // console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + // resultFlag = false; + // } + // if (audioParamsGet.usage == AudioRendererInfo.usage){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + // resultFlag = false; + // } + // if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ + // console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + // } + // else{ + // console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + // resultFlag = false; + // } + // }).catch((err) => { + // console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + // resultFlag = false; + // }); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + // /* * + // * @tc.number : SUB_AUDIO_RENDERER_Play_audio_072 + // * @tc.name : AudioRenderer - STATE_NEW + // * @tc.desc : AudioRenderer - STATE_NEW + // * @tc.size : MEDIUM + // * @tc.type : Function + // * @tc.level : Level 0 + // */ + // it('SUB_AUDIO_RENDERER_Play_audio_072', 0,async function (done) { + // var AudioStreamInfo = { + // samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + // channels: audio.AudioChannel.CHANNEL_2, + // sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + // encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + // } + + // var AudioRendererInfo = { + // content: audio.ContentType.CONTENT_TYPE_RINGTONE, + // usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + // rendererFlags: 1 + // } + + // var AudioRendererOptions = { + // streamInfo: AudioStreamInfo, + // rendererInfo: AudioRendererInfo + // } + // var resultFlag = true; + + // var audioRen; + // await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + // audioRen = data; + // console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + // }).catch((err) => { + // console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + // resultFlag = false; + // }); + + // if (audioRen.state==audio.AudioState.STATE_NEW) { + // console.info('AudioFrameworkRenderLog: Audio State : STATE_NEW : PASS : ' + audioRen.state); + // } + // else { + // console.info('AudioFrameworkRenderLog: Audio State : STATE_NEW : FAIL : ' + audioRen.state); + // resultFlag = false; + // } + + // await audioRen.release().then(async function () { + // console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + // }).catch((err) => { + // console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + // }); + + // expect(resultFlag).assertTrue(); + + // done(); + + // }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_073 + * @tc.name : AudioRenderer - STATE_PREPARED + * @tc.desc : AudioRenderer - STATE_PREPARED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_073', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + if (audioRen.state==audio.AudioState.STATE_PREPARED) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_PREPARED : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_PREPARED : FAIL : ' + audioRen.state); + resultFlag = false; + } + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_074 + * @tc.name : AudioRenderer - STATE_RUNNING + * @tc.desc : AudioRenderer - STATE_RUNNING + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_074', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + + if (audioRen.state==audio.AudioState.STATE_RUNNING) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_RUNNING : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_RUNNING : FAIL : ' + audioRen.state); + resultFlag = false; + } + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_075 + * @tc.name : AudioRenderer - STATE_STOPPED + * @tc.desc : AudioRenderer - STATE_STOPPED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_075', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + resultFlag=false; + }); + await sleep(500); + + if (audioRen.state==audio.AudioState.STATE_STOPPED) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_STOPPED : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_STOPPED : FAIL : ' + audioRen.state); + resultFlag = false; + } + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_076 + * @tc.name : AudioRenderer - STATE_RELEASED + * @tc.desc : AudioRenderer - STATE_RELEASED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_076', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + resultFlag=false; + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + await sleep(500); + + if (audioRen.state==audio.AudioState.STATE_RELEASED) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_RELEASED : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_RELEASED : FAIL : ' + audioRen.state); + resultFlag = false; + } + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_077 + * @tc.name : AudioRenderer - STATE_PAUSED + * @tc.desc : AudioRenderer - STATE_PAUSED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_077', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = true; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + + await audioRen.pause().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + + if (audioRen.state==audio.AudioState.STATE_PAUSED) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_PAUSED : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_PAUSED : FAIL : ' + audioRen.state); + resultFlag = false; + } + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + await sleep(500) + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_078 + * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE + * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_078', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + // var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath='StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readpath, done); + var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; + + var resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+readpath); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + if (rlen > (totalSize/8)){ + await audioManager.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); + resultFlag=false; + }); + } + if (rlen > (totalSize/8)){ + await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE).then(async function () { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); + resultFlag=false; + }); + } + } + + console.info('AudioFrameworkRenderLog: Renderer after read'); + await audioRen.getRenderRate().then(async function (data) { + if (data == audio.AudioRendererRate.RENDER_RATE_DOUBLE){ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS : '+data); + } + else{ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL : '+data); + resultFlag=false; + } + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); + resultFlag=false; + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + await sleep(500) + + expect(resultFlag).assertTrue(); + + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_079 + * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_HALF + * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_HALF + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_079', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath='StarWars10s-2C-24000-3SW.wav' + await getFdRead(readpath,done); + var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; + + var resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+readpath); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + if (rlen > (totalSize / 8)) { + await audioManager.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + }); + } + if (rlen > (totalSize/8)){ + await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_HALF).then(async function () { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_HALF : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_HALF : ERROR : '+err.message); + resultFlag=false; + }); + } + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + await audioRen.getRenderRate().then(async function (data) { + if (data == audio.AudioRendererRate.RENDER_RATE_HALF){ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_HALF : PASS : '+data); + } + else{ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_HALF : FAIL : '+data); + resultFlag=false; + } + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_HALF : ERROR : '+err.message); + resultFlag=false; + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + await sleep(500) + + expect(resultFlag).assertTrue(); + + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_080 + * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_NORMAL + * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_NORMAL + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_080', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath='StarWars10s-1C-44100-2SW.wav' + await getFdRead(readpath,done); + var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; + + var resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+readpath); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + if (rlen > (totalSize / 8)) { + await audioManager.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + }); + } + if (rlen > (totalSize/8)){ + await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE).then(async function () { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); + resultFlag=false; + }); + } + } + await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(async function () { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_NORMAL : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_NORMAL : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: Renderer after read'); + await audioRen.getRenderRate().then(async function (data) { + if (data == audio.AudioRendererRate.RENDER_RATE_NORMAL){ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : PASS : '+data); + } + else{ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : FAIL : '+data); + resultFlag=false; + } + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_NORMAL : ERROR : '+err.message); + resultFlag=false; + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + await sleep(500) + + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_081 + * @tc.name : AudioRenderer - SetRenderRate - DEFAULT - RENDER_RATE_NORMAL + * @tc.desc : AudioRenderer - SetRenderRate - DEFAULT - RENDER_RATE_NORMAL + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_081', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + // var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath='StarWars10s-1C-96000-4SW.wav' + await getFdRead(readpath, done); + var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; + + var resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag=false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+readpath); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + var bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + totalSize = totalSize-44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); + let rlen = 0; + while (rlen < totalSize/4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + await audioRen.write(buf); + if (rlen > (totalSize/2)){ + await audioManager.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); + resultFlag=false; + }); + } + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + await audioRen.getRenderRate().then(async function (data) { + if (data == audio.AudioRendererRate.RENDER_RATE_NORMAL){ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : PASS : '+data); + } + else{ + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : FAIL : '+data); + resultFlag=false; + } + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_NORMAL : ERROR : '+err.message); + resultFlag=false; + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + await sleep(500) + + expect(resultFlag).assertTrue(); + + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_113 + * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback + * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_113', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readpath='StarWars10s-1C-32000-1SW.wav' + await getFdRead(readpath,done); + var resultFlag = await playbackPromise_113 (AudioRendererOptions , readpath ); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_096 + * @tc.name : AudioRenderer - getAudioTime - Error + * @tc.desc : AudioRenderer - getAudioTime - Error + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_096', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + + readpath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readpath,done); + var resultFlag = true; + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+readpath); + + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag=false; + }); + + await audioRen.getAudioTime().then(async function (data) { + console.info('AudioFrameworkRenderLog: getAudioTime : Value : '+data); + resultFlag=true; + if (data > 0){ + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+data); + } + else{ + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+data); + } + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); + }); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + + await sleep(500); + + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_097 + * @tc.name : AudioRenderer - STATE_PREPARED -Callback + * @tc.desc : AudioRenderer - STATE_PREPARED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_097', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = false; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + audioRen.on('stateChange',(AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_PREPARED: + console.info('AudioFrameworkTest: state : STATE_NEW'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : '+AudioState); + break; + } + }); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + await sleep(1000); + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_098 + * @tc.name : AudioRenderer - STATE_RUNNING - Callback + * @tc.desc : AudioRenderer - STATE_RUNNING + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_098', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = false; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + audioRen.on('stateChange',(AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_RUNNING: + console.info('AudioFrameworkTest: state : STATE_RUNNING'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : '+AudioState); + break; + } + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + await sleep(1000); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_099 + * @tc.name : AudioRenderer - STATE_STOPPED - Callback + * @tc.desc : AudioRenderer - STATE_STOPPED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_099', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = false; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + audioRen.on('stateChange',(AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_STOPPED: + console.info('AudioFrameworkTest: state : STATE_STOPPED'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : '+AudioState); + break; + } + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + resultFlag=false; + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + await sleep(500); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_100 + * @tc.name : AudioRenderer - STATE_RELEASED - Callback + * @tc.desc : AudioRenderer - STATE_RELEASED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_100', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = false; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + + audioRen.on('stateChange',(AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_RELEASED: + console.info('AudioFrameworkTest: state : STATE_RELEASED'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : '+AudioState); + break; + } + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + resultFlag=false; + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + await sleep(500); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_101 + * @tc.name : AudioRenderer - STATE_PAUSED - Callback + * @tc.desc : AudioRenderer - STATE_PAUSED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_101', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = false; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + audioRen.on('stateChange',(AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_PAUSED: + console.info('AudioFrameworkTest: state : STATE_PAUSED'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : '+AudioState); + break; + } + }); + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + + await audioRen.pause().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(500); + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + await sleep(500) + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_108 + * @tc.name : AudioState - STATE_INVALID + * @tc.desc : AudioState - STATE_INVALID + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_108', 0, async function (done) { + + expect(audio.AudioState.STATE_INVALID).assertEqual(-1); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_109 + * @tc.name : AudioState - STATE_NEW + * @tc.desc : AudioState - STATE_NEW + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_109', 0, async function (done) { + + expect(audio.AudioState.STATE_NEW).assertEqual(0); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_110 + * @tc.name : AudioSampleFormat - STATE_FORMAT_INVALID + * @tc.desc : AudioSampleFormat - STATE_FORMAT_INVALID + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_110', 0, async function (done) { + + expect(audio.AudioSampleFormat.SAMPLE_FORMAT_INVALID).assertEqual(-1); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_111 + * @tc.name : SourceType - SOURCE_TYPE_INVALID + * @tc.desc : SourceType - SOURCE_TYPE_INVALID + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_111', 0, async function (done) { + + expect(audio.SourceType.SOURCE_TYPE_INVALID).assertEqual(-1); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_112 + * @tc.name : AudioRenderer - Pause - Callback + * @tc.desc : AudioRenderer - Pause - Callback + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_112', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = false; + + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + resultFlag = false; + }); + audioRen.on('stateChange',(AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_PAUSED: + console.info('AudioFrameworkTest: state : STATE_PAUSED'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : '+AudioState); + break; + } + }); + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); + resultFlag=false; + }); + + await sleep(2000); + + audioRen.pause((err) => { + if (err) { + console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : '+err.message); + resultFlag=false; + } + else{ + console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); + } + }); + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); + }); + await sleep(500) + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_114 + * @tc.name : AudioEncodingType - ENCODING_TYPE_INVALID + * @tc.desc : AudioEncodingType - ENCODING_TYPE_INVALID + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_114', 0, async function (done) { + + expect(audio.AudioEncodingType.ENCODING_TYPE_INVALID).assertEqual(-1); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_082 + * @tc.name : AudioRenderer-Set11-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 11 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_082', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-48000-4SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + await sleep(9000); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_083 + * @tc.name : AudioRenderer-Set1-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_083', 0, async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-44100-2SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + await sleep(5000); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_084 + * @tc.name : AudioRenderer-Set2-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 2 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_084', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-8000-2SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_085 + * @tc.name : AudioRenderer-Set3-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 3 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_085', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-32000-1SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_086 + * @tc.name : AudioRenderer-Set4-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 4 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_086', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_64000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-64000-3SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_087 + * @tc.name : AudioRenderer-Set5-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 5 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_087', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-1C-96000-4SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_088 + * @tc.name : AudioRenderer-Set6-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 6 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_088', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_11025, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-11025-1SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_089 + * @tc.name : AudioRenderer-Set7-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 7 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_089', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_12000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-12000-2SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_090 + * @tc.name : AudioRenderer-Set8-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 8 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_090', 0,async function (done) { + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-16000-3SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_091 + * @tc.name : AudioRenderer-Set9-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 9 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_091', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_22050, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-22050-2SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_RENDERER_Play_audio_092 + * @tc.name : AudioRenderer-Set10-Media - CALLBACK + * @tc.desc : AudioRenderer with parameter set 10 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_RENDERER_Play_audio_092', 0,async function (done) { + + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath='StarWars10s-2C-24000-3SW.wav' + await getFdRead(readpath, done) + var resultFlag = await playbackCB(AudioRendererOptions, readpath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + }) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioVOIP.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioVOIP.test.js index 1be3ba62c..f50e380f7 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioVOIP.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioVOIP.test.js @@ -16,15 +16,35 @@ import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; - +import ability_featureAbility from '@ohos.ability.featureAbility'; +import app from '@system.app'; +import bundle from '@ohos.bundle'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import featureAbility from '@ohos.ability.featureAbility' +import resourceManager from '@ohos.resourceManager'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; describe('audioRenderer', function () { - - var dateTime = new Date().getTime(); - const dirPath = '/data/media/RecTest'+dateTime; - var fpath = dirPath+'/capture_js.pcm'; - console.info('AudioFrameworkRecLog: Recording files Path: '+dirPath); + var mediaDir; + let fdRead; + let readpath; + /*async function getPathName(){ + var path1 = '/data/app/el1/bundle/public/'; + var packageName; + var context = ability_featureAbility.getContext(); + await context.getBundleName() + .then((data) => { + console.info('AudioFrameworkRenderLog: Cache directory obtained. Data: ' + data); + packageName = data; + }).catch((error) => { + console.error('AudioFrameworkRenderLog: Failed to obtain the cache directory. Cause:' + error.message); + }); + await sleep(200); + var mediaDirTemp = path1 + packageName + '/ohos.acts.multimedia.audio.audiomanager.filedescriptor/assets/entry/resources/rawfile'; + //var mediaDirTemp = path1+packageName+'/files' + console.info('AudioFrameworkRenderLog: Resource DIR Path : '+mediaDirTemp); + return mediaDirTemp; + }*/ const audioManager = audio.getAudioManager(); console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); @@ -32,18 +52,19 @@ describe('audioRenderer', function () { const audioManagerRec = audio.getAudioManager(); console.info('AudioFrameworkRecLog: Create AudioManger Object JS Framework'); - beforeAll(function () { + beforeAll(async function () { + await applyPermission(); console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - fileio.mkdirSync(dirPath); + mediaDir = '/data/storage/el2/base/haps/entry/cache'; }) beforeEach(async function () { console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level'); + await sleep(1000); }) - afterEach(async function () { + afterEach(function () { console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions'); - await sleep(1000); }) afterAll(async function () { @@ -54,39 +75,94 @@ describe('audioRenderer', function () { return new Promise(resolve => setTimeout(resolve, ms)); } + async function getFileDescriptor(fileName) { + let fileDescriptor = undefined; + await resourceManager.getResourceManager().then(async (mgr) => { + await mgr.getRawFileDescriptor(fileName).then(value => { + fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length }; + }).catch(error => { + console.log('AudioFrameworkRenderLog:case getRawFileDescriptor err: ' + error); + }); + }); + return fileDescriptor; + } + + async function closeFileDescriptor(fileName) { + await resourceManager.getResourceManager().then(async (mgr) => { + await mgr.closeRawFileDescriptor(fileName).then(value => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:' + fileName); + }).catch(error => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor err: ' + error); + }); + }); + } + async function getFdRead(pathName, done) { + await getFileDescriptor(pathName).then((res) => { + if (res == undefined) { + expect().assertFail(); + console.info('AudioFrameworkRenderLog:case error fileDescriptor undefined, open file fail'); + done(); + } else { + fdRead = res.fd; + console.info("AudioFrameworkRenderLog:case 0 fdRead is: " + fdRead); + } + }) + } - async function playbackPromise (audioParams, fpath, streamType) { + async function applyPermission() { + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('AudioFrameworkRenderLog:[permission] case accessTokenID is ' + tokenID); + let permissionName1 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName2 = 'ohos.permission.READ_MEDIA'; + let permissionName3 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :' + err); + }); + } else { + console.info('AudioFrameworkRenderLog:[permission] case apply permission failed, createAtManager failed'); + } + } + + async function playbackPromise (AudioRendererOptions, pathName, AudioScene) { var resultFlag = 'new'; console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - const audioRen = audio.createAudioRenderer(streamType); - console.info('AudioFrameworkRenderLog: AudioRenderer instance created: Success : Stream Type: '+streamType); - - await audioRen.setParams(audioParams).then(async function () { - console.info('AudioFrameworkRenderLog: setParams Success '); + var audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: setParams failed : ERROR : '+err.message); - resultFlag = false; - }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); return resultFlag; - } + }); - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath); + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+pathName); - await audioRen.getParams().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer GetParams:'); - console.info('AudioFrameworkRenderLog: Renderer format:' + audioParamsGet.format); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encoding:' + audioParamsGet.encoding); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.contentType); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer device role:' + audioParamsGet.deviceRole); - console.info('AudioFrameworkRenderLog: Renderer device type:' + audioParamsGet.deviceType); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); }).catch((err) => { - console.log('AudioFrameworkRenderLog: getParams :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); resultFlag = false; }); if (resultFlag == false){ @@ -94,21 +170,24 @@ describe('audioRenderer', function () { return resultFlag; } - await audioRen.start().then(async function (started) { - console.info('AudioFrameworkRenderLog: renderInstant started '+started); + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start failed : '+err.message); - resultFlag=false; + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + resultFlag = false; }); if (resultFlag == false){ console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); return resultFlag; } - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); resultFlag=false; }); if (resultFlag == false){ @@ -116,12 +195,14 @@ describe('audioRenderer', function () { return resultFlag; } + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + var bufferSize; await audioRen.getBufferSize().then(async function (data) { - bufferSize = data; - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); + bufferSize=data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: buffer size: ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); resultFlag=false; }); if (resultFlag == false){ @@ -129,88 +210,121 @@ describe('audioRenderer', function () { return resultFlag; } - let ss = fileio.createStreamSync(fpath, 'r'); - console.info('AudioFrameworkRenderLog: File Path: ' + fpath); + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case2: File Path: ' + ss); let discardHeader = new ArrayBuffer(44); ss.readSync(discardHeader); - let totalSize = fileio.statSync(fpath).size; - console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case3: File totalSize size: ' +totalSize); totalSize = totalSize-44; console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); let rlen = 0; - while (rlen < (totalSize/3)) { + while (rlen < totalSize/4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); await audioRen.write(buf); - if(rlen > (totalSize/4) && rlen < (totalSize/3.5)) { + if (rlen > (totalSize/2)){ await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT) { - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : ' + data); - resultFlag=true; - } - else { - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : ' + data); - resultFlag=false; - } + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : '+data); }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : ' + err.message); - resultFlag = false; + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); + resultFlag=false; }); } } console.info('AudioFrameworkRenderLog: Renderer after read'); - await audioRen.drain().then(async function (drained) { - console.info('AudioFrameworkRenderLog: Renderer drained : '+drained); + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain failed : '+err.message); + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); resultFlag=false; }); + if (resultFlag == false){ + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; + } - await audioRen.stop().then(async function (stopped) { - console.info('AudioFrameworkRenderLog: Renderer stopped : '+stopped); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + resultFlag=true; + console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlag); }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop failed : '+err.message); + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); resultFlag=false; }); - await audioRen.release().then(async function (data) { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS : '+data); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); }).catch((err) => { console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); resultFlag=false; }); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + return resultFlag; } - async function recPromise (audioParams, fpath, streamType) { + async function recPromise (AudioCapturerOptions, fpath, AudioScene) { var resultFlag = 'new'; console.info('AudioFrameworkRecLog: Promise : Audio Recording Function'); - var audioCapturer = audio.createAudioCapturer(streamType); - console.info('AudioFrameworkRecLog: capturer instance created as : '+streamType); - - console.info('AudioFrameworkRecLog: audio param object created'); - await audioCapturer.setParams(audioParams); - console.info('AudioFrameworkRecLog: setParams Success '); - - console.info('AudioFrameworkRecLog: Capturer : Path : '+fpath); - - await audioCapturer.getParams().then(async function (audioParamsGet) { - console.info('AudioFrameworkRecLog: Capturer GetParams:'); - console.info('AudioFrameworkRecLog: Capturer format:' + audioParamsGet.format); - console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRecLog: Capturer encoding:' + audioParamsGet.encoding); - console.info('AudioFrameworkRecLog: Capturer contentType:' + audioParamsGet.contentType); - console.info('AudioFrameworkRecLog: Capturer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRecLog: Capturer deviceRole:' + audioParamsGet.deviceRole); - console.info('AudioFrameworkRecLog: Capturer deviceType:' + audioParamsGet.deviceType); + var audioCap; + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + return resultFlag; + }); + + console.info('AudioFrameworkRecLog: AudioCapturer : Path : '+fpath); + + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + + await audioCap.getStreamInfo().then(async function (audioParamsGet) { + if (audioParamsGet != undefined) { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); + console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); + } else { + console.info('AudioFrameworkRecLog: audioParamsGet is : '+audioParamsGet); + console.info('AudioFrameworkRecLog: audioParams getStreamInfo are incorrect: '); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); + resultFlag = false; + }); + if (resultFlag == false){ + console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + return resultFlag; + } + + await audioCap.getCapturerInfo().then(async function (audioParamsGet) { + if (audioParamsGet != undefined) { + console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); + console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); + console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); + }else { + console.info('AudioFrameworkRecLog: audioParamsGet is : '+audioParamsGet); + console.info('AudioFrameworkRecLog: audioParams getCapturerInfo are incorrect: '); + resultFlag = false; + } }).catch((err) => { - console.log('AudioFrameworkRecLog: getParams :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); resultFlag = false; }); if (resultFlag == false){ @@ -218,10 +332,10 @@ describe('audioRenderer', function () { return resultFlag; } - await audioCapturer.start().then(async function (started) { - console.info('AudioFrameworkRecLog: Capturer started '+started); + await audioCap.start().then(async function () { + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog Capturer started failed : '+err.message); + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); resultFlag=false; }); if (resultFlag == false){ @@ -229,7 +343,9 @@ describe('audioRenderer', function () { return resultFlag; } - var bufferSize = await audioCapturer.getBufferSize(); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + + var bufferSize = await audioCap.getBufferSize(); console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); var fd = fileio.openSync(fpath, 0o102, 0o777); @@ -237,19 +353,8 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRecLog: file fd created'); } else{ - console.info('AudioFrameworkRecLog: file fd create : FAILED'); - expect(false).assertTrue(); - return; - } - - await audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); resultFlag=false; - }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); return resultFlag; } @@ -259,512 +364,177 @@ describe('audioRenderer', function () { } else{ console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - expect(false).assertTrue(); - return; + resultFlag=false; + return resultFlag; } - - var numBuffersToCapture = 370; + await sleep(100); + var numBuffersToCapture = 45; while (numBuffersToCapture) { - var buffer = await audioCapturer.read(bufferSize, true); - if (typeof(buffer) == undefined) { - console.info('BufferRecLog: read buffer failed : '+buffer); - } else { - var number = fileio.writeSync(fd, buffer); - console.info('BufferRecLog: data written: ' + number); - numBuffersToCapture--; - } - if(numBuffersToCapture > 250 && numBuffersToCapture < 255) { - await audioManagerRec.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT) { - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : ' + data); - resultFlag=true; - } - else { - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : ' + data); - resultFlag=false; - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : ' + err.message); - resultFlag = false; - }); - } + console.info('AudioFrameworkRecLog: ---------READ BUFFER---------'); + var buffer = await audioCap.read(bufferSize, true); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + var number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(50); + numBuffersToCapture--; } - console.info('AudioFrameworkRecLog: Capturer after read'); + await sleep(1000); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); - await audioCapturer.stop().then(async function (data) { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS : '+data); + await audioCap.stop().then(async function () { + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + resultFlag=true; + console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); }).catch((err) => { console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); resultFlag=false; }); - await audioCapturer.release().then(async function (data) { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS : '+data); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + + await audioCap.release().then(async function () { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); }).catch((err) => { console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); resultFlag=false; }); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + return resultFlag; } - /* * * @tc.number : SUB_AUDIO_VOIP_Play_001 - * @tc.name : SetAudioScene during playback - * @tc.desc : SetAudioScene during playback + * @tc.name : AudioRenderer-Set1-Media + * @tc.desc : AudioRenderer with parameter set 1 * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('SUB_AUDIO_VOIP_Play_001', 0, async function (done) { - var audioParams = { - format: audio.AudioSampleFormat.SAMPLE_S16LE, - channels: audio.AudioChannel.STEREO, + var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - encoding: audio.AudioEncodingType.ENCODING_PCM, - }; + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var resultFlag = await playbackPromise(audioParams, '/data/Believer60s.wav', audio.AudioVolumeType.VOICE_CALL); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readpath = 'StarWars10s-1C-44100-2SW.wav'; + await getFdRead(readpath,done); + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - + await closeFileDescriptor(readpath); done(); }) /* * * @tc.number : SUB_AUDIO_VOIP_Rec_001 - * @tc.name : SetAudioScene during Recording - * @tc.desc : SetAudioScene during Recording + * @tc.name : AudioCapturer-Set1-Media + * @tc.desc : AudioCapturer with parameter set 1 * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ it('SUB_AUDIO_VOIP_Rec_001', 0, async function (done) { - var audioParams = { - format: audio.AudioSampleFormat.SAMPLE_S32LE, - channels: audio.AudioChannel.STEREO, - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - encoding: audio.AudioEncodingType.ENCODING_PCM, - contentType: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - deviceRole: audio.DeviceRole.INPUT_DEVICE, - deviceType: audio.DeviceType.MIC - }; - - - var resultFlag = await recPromise(audioParams, dirPath+'/capture_js-48000-2C-32B.pcm', audio.AudioVolumeType.VOICE_CALL); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - - /* * - * @tc.number : SUB_AUDIO_VOIP_RecPlay_001 - * @tc.name : Record & play at same time - setAudioScene - * @tc.desc : Record & play at same time - setAudioScene - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_RecPlay_001', 0, async function (done) { - - var audioParamsRen = { - format: audio.AudioSampleFormat.SAMPLE_S16LE, - channels: audio.AudioChannel.STEREO, - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - encoding: audio.AudioEncodingType.ENCODING_PCM, - }; - - var audioParamsRec = { - format: audio.AudioSampleFormat.SAMPLE_S32LE, - channels: audio.AudioChannel.STEREO, - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - encoding: audio.AudioEncodingType.ENCODING_PCM, - contentType: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - deviceRole: audio.DeviceRole.INPUT_DEVICE, - deviceType: audio.DeviceType.MIC - }; - - var resultFlagRec = recPromise(audioParamsRec, dirPath+'/capture_js-48000-2C-32B-2.pcm', audio.AudioVolumeType.VOICE_CALL); - - var resultFlagRen = await playbackPromise(audioParamsRen, '/data/Believer60s.wav', audio.AudioVolumeType.VOICE_CALL); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : Renderer : '+resultFlagRec); - console.info('AudioFrameworkRenderLog: resultFlag : Capturer : '+resultFlagRen); - - if (resultFlagRec = true){ - expect(resultFlagRen).assertTrue(); - } - else{ - expect(false).assertTrue(); + var AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_001 - * @tc.name : setAudioScene as VOIP - Promise - ENUM - * @tc.desc : setAudioScene as VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_001', 0, async function (done) { - - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_002 - * @tc.name : getAudioScene as VOIP - Promise - ENUM - * @tc.desc : getAudioScene as VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_002', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_003 - * @tc.name : getAudioScene as VOIP to Ringtone - Promise - ENUM - * @tc.desc : getAudioScene as VOIP to Ringtone - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_003', 0, async function (done) { - await audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_RINGING).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == audio.AudioScene.AUDIO_SCENE_RINGING){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_004 - * @tc.name : setAudioScene as VOIP - Promise - ENUM - * @tc.desc : setAudioScene as VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_004', 0, async function (done) { - - await audioManager.setAudioScene(3).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_005 - * @tc.name : getAudioScene as VOIP - Promise - ENUM - * @tc.desc : getAudioScene as VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_005', 0, async function (done) { - - await audioManager.getAudioScene().then(async function (data) { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - done(); - }) + var AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 1 + } - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_006 - * @tc.name : getAudioScene as VOIP to Ringtone - Promise - ENUM - * @tc.desc : getAudioScene as VOIP to Ringtone - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_006', 0, async function (done) { - await audioManager.setAudioScene(1).then(async function () { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - await audioManager.getAudioScene().then(async function (data) { - if (data == 1){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message); - expect(false).assertTrue(); - }); + var AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + var resultFlag = await recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); done(); }) /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_007 - * @tc.name : setAudioScene as VOIP - Callback - ENAME - * @tc.desc : setAudioScene as VOIP - ENAME + * @tc.number : SUB_AUDIO_VOIP_RecPlay_001 + * @tc.name : AudioCapturer-Set1-Media + * @tc.desc : AudioCapturer with parameter set 1 * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_VOIP_AudioScene_007', 0, async function (done) { - - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); - - await sleep(100); - done(); - }) + it('SUB_AUDIO_VOIP_RecPlay_001', 0, async function (done) { - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_008 - * @tc.name : getAudioScene as VOIP - Callback - ENAME - * @tc.desc : getAudioScene as VOIP - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_008', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_VOICE_CHAT){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); + var AudioStreamInfoCap = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } - done(); - }) + var AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 1 + } - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_009 - * @tc.name : getAudioScene as VOIP to Ringtone - Callback - ENAME - * @tc.desc : getAudioScene as VOIP to Ringtone - ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_009', 0, async function (done) { - audioManager.setAudioScene(audio.AudioScene.AUDIO_SCENE_RINGING,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == audio.AudioScene.AUDIO_SCENE_RINGING){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); + var AudioCapturerOptions = { + streamInfo: AudioStreamInfoCap, + capturerInfo: AudioCapturerInfo + } - done(); - }) + var AudioStreamInfoRen = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_010 - * @tc.name : setAudioScene as VOIP - Callback - ENUM - * @tc.desc : setAudioScene as VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_010', 0, async function (done) { + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - audioManager.setAudioScene(3, (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - expect(true).assertTrue(); - } - }); + var AudioRendererOptions = { + streamInfo: AudioStreamInfoRen, + rendererInfo: AudioRendererInfo + } - await sleep(100); - done(); - }) + recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B-2.pcm', audio.AudioScene.AUDIO_SCENE_PHONE_CHAT); + await sleep(500); - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_011 - * @tc.name : getAudioScene as VOIP - Callback - ENUM - * @tc.desc : getAudioScene as VOIP - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_011', 0, async function (done) { - - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 3){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); + readpath = 'StarWars10s-1C-44100-2SW.wav'; + await getFdRead(readpath,done); + var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - + console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath,done); done(); }) - /* * - * @tc.number : SUB_AUDIO_VOIP_AudioScene_012 - * @tc.name : getAudioScene as VOIP to Ringtone - Callback - ENUM - * @tc.desc : getAudioScene as VOIP to Ringtone - ENUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_AudioScene_012', 0, async function (done) { - audioManager.setAudioScene(1,async (err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else - { - await sleep(100); - console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS '); - audioManager.getAudioScene((err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: setAudioScene : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 1){ - console.info('AudioFrameworkRenderLog: getAudioScene : PASS : '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkRenderLog: getAudioScene : FAIL : '+data); - expect(false).assertTrue(); - } - } - }); - await sleep(100); - } - }); - done(); - }) }) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js index 49baf81e3..fe05387b0 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js @@ -1,4 +1,4 @@ -/* +/** * 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. @@ -13,8 +13,11 @@ * limitations under the License. */ +require('./getPermission.test.js') require('./AudioFramework.test.js') -//require('./AudioRenderer.test.js') -//require('./SR000GHLLV.test.js') -//require('./AudioCall.test.js') -require('./SR000GHQBN.test.js') \ No newline at end of file +require('./AudioVOIP.test.js') +require('./AudioCall.test.js') +require('./AudioCapturer.test.js') +require('./AudioEventManagement.test.js') +require('./AudioRenderer.test.js') + diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/RingtonePlayer.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/RingtonePlayer.test.js deleted file mode 100644 index 73f2e2855..000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/RingtonePlayer.test.js +++ /dev/null @@ -1,4016 +0,0 @@ -/* - * 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. - */ - -import audio from '@ohos.multimedia.audio'; -import mediaLibrary from '@ohos.multimedia.medialibrary'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('audioManager',async function () { - console.info('AudioFrameworkTest: Create systemSoundManager Object JS Framework'); - const systemSoundManager = audio.getSystemSoundManager(); - const mediaLibInstance = mediaLibrary.getMediaLibrary(); - let ringtonePlayer; - var minVol = 0; - var maxVol = 1; - var lowVol = 0.1; - var highVol = 0.9; - var outOfRangeVol = 28; - var defaultRingtoneType=0; - var multiSIM=1; - var volErrorMesg = 'Error, Operation not supported or Failed'; - - function sleep (ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - beforeAll(async function () { - console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - console.info('AudioFrameworkTest: before get scanner instance'); - let scannerObj = mediaLibrary.getScannerInstance(); - let path = "/storage/media/100/local/files/media"; - console.info('AudioFrameworkTest: before scan file'); - const scanPromise = await scannerObj.scanDir(path); - console.info('AudioFrameworkTest: before scan file'); - console.info("AudioFrameworkTest: scan promise: " + scanPromise); - console.info("AudioFrameworkTest: promise status: " + scanPromise.status); - }) - - beforeEach(async function () { - console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level'); - await sleep(1000); - }) - - afterEach(async function () { - console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions'); - await sleep(1000); - - }) - - afterAll(async function () { - console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); - await ringtonePlayer.stop(); - await sleep(100); - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - await ringtonePlayer.release(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_001 - * @tc.name : getSystemSoundManager - * @tc.desc : Check getSystemSoundManager is not empty - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_001', 0, function (done) { - const systemSoundManager = audio.getSystemSoundManager(); - if(systemSoundManager!=null){ - console.info('AudioFrameworkTestSSM: get systemSoundManager : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM: get systemSoundManager : FAIL'); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_002 - * @tc.name : setSystemRingtoneUri -Promise-RINGTONE_TYPE_DEFAULT enum - * @tc.desc : setSystemRingtoneUri - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager002', 0,async function(done){ - console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0).then(function(){ - console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); - expect(true).assertTrue(); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_003 - * @tc.name : getSystemRingtoneUri - promise RINGTONE_TYPE_DEFAULT enum=0 - * @tc.desc : getSystemRingtoneUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_003', 0,async function(done){ - const promise = systemSoundManager.getSystemRingtoneUri(null, 0); - promise.then(function (data) { - if (data != null) { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: enum Ringtone Get Ringtone ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_004 - * @tc.name : setSystemRingtoneUri - Promise RINGTONE_TYPE_MULTISIM enum 1 - * @tc.desc : setSystemRingtoneUri - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_004', 0,async function(done){ - console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',multiSIM).then(function(){ - console.info('AudioFrameworkTestSSM: enum: Set Ringtone Uri : SUCCESS: '); - expect(true).assertTrue(); - }).catch((err) => { - console.error('AudioFrameworkTestSSM: enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_005 - * @tc.name : getSystemRingtoneUri - promise RINGTONE_TYPE_MULTISIM enum 1 - * @tc.desc : getSystemRingtoneUri - promise enum 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_005', 0,async function(done){ - const promise = systemSoundManager.getSystemRingtoneUri(null,multiSIM); - promise.then(function (data) { - if (data != null) { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: enum Ringtone Get SRC Path ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_006 - * @tc.name : setSystemRingtoneUri - Promise RINGTONE_TYPE_DEFAULT ENAME - * @tc.desc : setSystemRingtoneUri - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_006', 0,async function(done){ - console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ - console.info('AudioFrameworkTestSSM:ENAME: Set Ringtone Uri : SUCCESS: '); - expect(true).assertTrue(); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:ENAME: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_007 - * @tc.name : getSystemRingtoneUri - promise RINGTONE_TYPE_MULTISIM enum - * @tc.desc : getSystemRingtoneUri - promise set enum 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_011', 0,async function(done){ - const promise = systemSoundManager.getSystemRingtoneUri(null,1); - promise.then(function (data) { - if (data != null) { - console.info('AudioFrameworkTestSSM: Get Ringtone Uri : MULTISIM : SUCCESS: ' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTestSSM: Get Ringtone Uri :MULTISIM: FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone Get Ringtone uri: ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_008 - * @tc.name : getSystemRingtoneUri - Callback RINGTONE_TYPE_DEFAULT ENAME - * @tc.desc : getSystemRingtoneUri - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_008', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Uri'); - systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT,async(err,data) => { - if(err) { - console.error('AudioFrameworkTestRM: Callback :enum: Get System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else if(data!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Uri : SUCCESS: '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Uri : FAIL: '+data); - expect(false).ssertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_009 - * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_MULTISIM ENAME - * @tc.desc : setSystemRingtoneUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_009', 0,async function(done){ - console.log('AudioFrameworkTestSSM: Set System Ringtone Uri'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then( function() { - console.info('AudioFrameworkTestSSM:Callback : ENAME: Set Ringtone Uri : SUCCESS: '); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM:Callback : ENAME: Set Ringtone Uri : ERROR:' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_010 - * @tc.name : getSystemRingtonePlayer - promise RINGTONE_TYPE_MULTISIM enum - * @tc.desc : getSystemRingtonePlayer - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_010', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,1).then(async function(data) { - ringtonePlayer = data; - if (ringtonePlayer !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_011 - * @tc.name : getSystemRingtonePlayer - promise RINGTONE_TYPE_DEFAULT ENAME - * @tc.desc : getSystemRingtonePlayer - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_011', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayer = data; - if (ringtonePlayer !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' +(err.message)); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_012 - * @tc.name : getSystemRingtonePlayer - promise RINGTONE_TYPE_MULTISIM enum - * @tc.desc : getSystemRingtonePlayer - promise set enum 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_012', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,1).then(async function(data) { - ringtonePlayer = data; - if (ringtonePlayer !=null) { - console.info('AudioFrameworkTestSSM:enum: get Ringtone Player : SUCCESS: ' + data.state); - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_013 - * @tc.name : setSystemRingtoneUri - Callback RINGTONE_TYPE_MULTISIM enum - * @tc.desc : setSystemRingtoneUri - Callback set enum 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_013', 0,async function(done){ - console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',1,async(err) => { - if(err) { - console.error('AudioFrameworkTestSSM :enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM :enum: Set Ringtone Uri : SUCCESS: '); - expect(true).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_014 - * @tc.name : setSystemRingtoneUri - Callback - * @tc.desc : RINGTONE_TYPE_DEFAULT enum 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_014', 0,async function(done){ - console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0,async(err) => { - if(err) { - console.error('AudioFrameworkTestSSM: Callback :enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: Set Ringtone Uri : SUCCESS: '); - expect(true).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_015 - * @tc.name : getSystemRingtoneUri - Callback - * @tc.desc : getSystemRingtoneUri - Callback set enum 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_015', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Uri'); - systemSoundManager.getSystemRingtoneUri(null,1,async(err,data) => { - if(err) { - console.error('AudioFrameworkTestSSM: Callback :enum: get System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else if(data!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Uri : SUCCESS: '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Uri : FAIL: '+data); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_016 - * @tc.name : getSystemRingtoneUri - Callback RINGTONE_TYPE_DEFAULT - * @tc.desc : getSystemRingtoneUri - Callback set enum 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_016', 0,async function(done){ - console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); - systemSoundManager.getSystemRingtoneUri(null,defaultRingtoneType,async(err,data) => { - if(err) { - console.error('AudioFrameworkTestSSM: Callback :enum: get System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else if(data!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Uri : SUCCESS: '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Uri : FAIL: '+data); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_017 - * @tc.name : getSystemRingtoneUri - Callback RINGTONE_TYPE_MULTISIM - * @tc.desc : getSystemRingtoneUri - Callback ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_017', 0,async function(done){ - console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); - systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async(err,data) => { - if(err) { - console.error('AudioFrameworkTestSSM: Callback :enum: get System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else if(data!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Uri : SUCCESS: '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Uri : FAIL: '+data); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_018 - * @tc.name : getSystemRingtoneUri - promise RINGTONE_TYPE_MULTISIM - * @tc.desc : getSystemRingtoneUri - promise ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_018', 0,async function(done){ - const promise = systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM); - promise.then(function (data) { - if (data != null) { - console.info('AudioFrameworkTestSSM: Get Ringtone Uri : MULTISIM : SUCCESS: ' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTestSSM: Get Ringtone Uri :MULTISIM: FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Get Ringtone Uri: ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_019 - * @tc.name : setSystemRingtoneUri - Callback RINGTONE_TYPE_MULTISIM - * @tc.desc : setSystemRingtoneUri - Callback ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_019', 0,async function(done){ - console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async(err) => { - if(err) { - console.error('AudioFrameworkTestSSM: Callback :ENAME: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :ENAME: Set Ringtone Uri : SUCCESS: '); - expect(true).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_020 - * @tc.name : getSystemRingtonePlayer -Callback RINGTONE_TYPE_MULTISIM - * @tc.desc : getSystemRingtonePlayer -Callback ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_020', 0,async function(done){ - console.log('AudioFrameworkTestRM: get System Ringtone Player'); - systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async(err,data)=> { - ringtonePlayer=data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : Pass: '+data.state); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : Fail: '+data.state); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_021 - * @tc.name : getSystemRingtonePlayer -Callback RINGTONE_TYPE_DEFAULT - * @tc.desc : getSystemRingtonePlayer -Callback ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_021', 0,async function(done){ - console.log('AudioFrameworkTestRM: get System Ringtone Player'); - systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT,async(err,data)=> { - ringtonePlayer=data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : Pass: '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : Fail: '+data); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_022 - * @tc.name : getSystemRingtonePlayer -Callback RINGTONE_TYPE_MULTISIM enum - * @tc.desc : getSystemRingtonePlayer -Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_022', 0,async function(done){ - console.log('AudioFrameworkTestRM: get System Ringtone Player'); - systemSoundManager.getSystemRingtonePlayer(null,multiSIM,async(err,data)=> { - ringtonePlayer=data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Pass: '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Fail: '+data); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_023 - * @tc.name : setSystemNotificationUri - promise - ENAME - * @tc.desc : setSystemNotificationUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_023', 0,async function(done){ - console.log('AudioFrameworkTestSSM: setSystemNotificationUri'); - await systemSoundManager.setSystemNotificationUri(null,'/storage/media/100/local/files/media/test.mp3').then( function() { - console.info('AudioFrameworkTestSSM:Callback : setSystemNotificationUri : SUCCESS'); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM:Callback : setSystemNotificationUri : ERROR:' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_024 - * @tc.name : getSystemNotificationUri - promise - * @tc.desc : getSystemNotificationUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_024', 0,async function(done){ - console.log('AudioFrameworkTestRM: getSystemNotificationUri'); - await systemSoundManager.getSystemNotificationUri(null).then(async function(data) { - if (data == '/storage/media/100/local/files/media/test.mp3') { - console.info('AudioFrameworkTestSSM:enum: getSystemNotificationUri : SUCCESS : '+data); - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:enum: getSystemNotificationUri : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_025 - * @tc.name : setSystemNotificationUri - promise - NULL - * @tc.desc : setSystemNotificationUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_025', 0,async function(done){ - console.log('AudioFrameworkTestSSM: setSystemNotificationUri'); - await systemSoundManager.setSystemNotificationUri(null,null).then( function() { - console.info('AudioFrameworkTestSSM:Callback : setSystemNotificationUri : SUCCESS'); - expect(false).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM:Callback : setSystemNotificationUri : ERROR:' + err.message); - expect(true).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_026 - * @tc.name : setSystemNotificationUri - Callback - * @tc.desc : setSystemNotificationUri - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_026', 0,async function(done){ - console.log('AudioFrameworkTestRM: setSystemNotificationUri'); - systemSoundManager.setSystemNotificationUri(null,'/storage/media/100/local/files/media/test.mp4',async(err) => { - if(err) { - console.error('AudioFrameworkTestSSM : setSystemNotificationUri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM : setSystemNotificationUri : SUCCESS: '); - expect(true).assertTrue(); - } - await sleep(100); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_027 - * @tc.name : getSystemNotificationUri - Callback - * @tc.desc : getSystemNotificationUri - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_027', 0,async function(done){ - console.log('AudioFrameworkTestRM: getSystemNotificationUri'); - systemSoundManager.getSystemNotificationUri(null,async(err,data) => { - if(err) { - console.error('AudioFrameworkTestSSM: Callback : getSystemNotificationUri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else if(data == '/storage/media/100/local/files/media/test.mp4'){ - console.info('AudioFrameworkTestSSM:Callback : getSystemNotificationUri : SUCCESS: '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback : getSystemNotificationUri : FAIL: '+data); - expect(false).assertTrue(); - } - await sleep(100); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_028 - * @tc.name : setSystemNotificationUri - Callback - NULL - * @tc.desc : setSystemNotificationUri - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_028', 0,async function(done){ - console.log('AudioFrameworkTestRM: setSystemNotificationUri'); - systemSoundManager.setSystemNotificationUri(null,null,async(err) => { - if(err) { - console.error('AudioFrameworkTestSSM : setSystemNotificationUri :ERROR: '+err.message); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM : setSystemNotificationUri : SUCCESS'); - expect(false).assertTrue(); - } - await sleep(100); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_029 - * @tc.name : setSystemAlarmUri - promise - ENAME - * @tc.desc : setSystemAlarmUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_029', 0,async function(done){ - console.log('AudioFrameworkTestSSM: setSystemAlarmUri'); - await systemSoundManager.setSystemAlarmUri(null,'/storage/media/100/local/files/media/test.mp3').then( function() { - console.info('AudioFrameworkTestSSM:Callback : setSystemAlarmUri : SUCCESS'); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM:Callback : setSystemAlarmUri : ERROR:' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_030 - * @tc.name : getSystemNotificationUri - promise - * @tc.desc : getSystemNotificationUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_030', 0,async function(done){ - console.log('AudioFrameworkTestRM: getSystemAlarmUri'); - await systemSoundManager.getSystemAlarmUri(null).then(async function(data) { - if (data == '/storage/media/100/local/files/media/test.mp3') { - console.info('AudioFrameworkTestSSM:enum: getSystemAlarmUri : SUCCESS :'+data); - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:enum: getSystemAlarmUri : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_031 - * @tc.name : setSystemAlarmUri - promise - NULL - * @tc.desc : setSystemAlarmUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_031', 0,async function(done){ - console.log('AudioFrameworkTestSSM: setSystemAlarmUri'); - await systemSoundManager.setSystemAlarmUri(null,null).then( function() { - console.info('AudioFrameworkTestSSM:Callback : setSystemAlarmUri : SUCCESS '); - expect(false).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM:Callback : setSystemAlarmUri : ERROR:' + err.message); - expect(true).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_032 - * @tc.name : setSystemAlarmUri - Callback - * @tc.desc : setSystemAlarmUri - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_032', 0,async function(done){ - console.log('AudioFrameworkTestRM: setSystemAlarmUri'); - systemSoundManager.setSystemAlarmUri(null,'/storage/media/100/local/files/media/test.mp4',async(err) => { - if(err) { - console.error('AudioFrameworkTestSSM : setSystemAlarmUri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM : setSystemAlarmUri : SUCCESS: '); - expect(true).assertTrue(); - } - await sleep(100); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_033 - * @tc.name : getSystemAlarmUri - Callback - * @tc.desc : getSystemAlarmUri - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_033', 0,async function(done){ - console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); - systemSoundManager.getSystemAlarmUri(null,async(err,data) => { - if(err) { - console.error('AudioFrameworkTestSSM: Callback : getSystemAlarmUri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else if(data == '/storage/media/100/local/files/media/test.mp4'){ - console.info('AudioFrameworkTestSSM:Callback : getSystemAlarmUri : SUCCESS: '+data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback : getSystemAlarmUri : FAIL: '+data); - expect(false).assertTrue(); - } - await sleep(100); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_034 - * @tc.name : setSystemAlarmUri - Callback - NULL - * @tc.desc : setSystemAlarmUri - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_034', 0,async function(done){ - console.log('AudioFrameworkTestRM: setSystemAlarmUri'); - systemSoundManager.setSystemAlarmUri(null,null,async(err) => { - if(err) { - console.error('AudioFrameworkTestSSM : setSystemAlarmUri :ERROR: '+err.message); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM : setSystemAlarmUri : SUCCESS: '); - expect(false).assertTrue(); - } - await sleep(100); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_035 - * @tc.name : getSystemRingtonePlayer - ERROR - Negative - * @tc.desc : getSystemRingtonePlayer - ERROR - Negative - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_035', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,-1).then(async function(data) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - expect(false).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(true).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_036 - * @tc.name : getSystemRingtonePlayer - ERROR - OutOfRange - * @tc.desc : getSystemRingtonePlayer - ERROR - OutOfRange - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SystemSoundManager_036', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,2).then(async function(data) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - expect(false).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(true).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_001 - * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_DEFAULT ENAME - * @tc.desc : setSystemRingtoneUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_001', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT); - promise.then(function () { - systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { - if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') - { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set SUCCESS: ' + data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone Get SRC Path : ERROR: ' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone set SRC Path : ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_002 - * @tc.name : getSystemRingtonePlayer - promise RINGTONE_TYPE_DEFAULT enum - * @tc.desc : getSystemRingtonePlayer - promise get state ,enum 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_002', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,0).then(async function(data) { - ringtonePlayer = data; - if (ringtonePlayer !=null) { - console.info('AudioFrameworkTestSSM :enum: get Ringtone Player : SUCCESS: ' + data.state); - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_003 - * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_MULTISIM ENAME - * @tc.desc : setSystemRingtoneUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_003', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT); - promise.then(function () { - systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then(function (data) { - if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') - { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set SUCCESS: ' + data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone Get SRC Path ERROR: ' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_004 - * @tc.name : Configure - promise - Volume=maxVol ,Disable loop - * @tc.desc : Configure - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_004', 0,async function(done){ - let ringtoneOptions = { - volume: maxVol, - loop: false - }; - sleep(100); - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : lowVol: Loop False'); - await ringtonePlayer.configure(ringtoneOptions).then(function() { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : ' +ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestRM: Configure RingtonePlayer : FAIL:' + err.message); - expect(false).assertTrue(); - }); - sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_005 - * @tc.name : configure- promise Volume=maxVol ,enable loop - * @tc.desc : configure- promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_005', 0,async function(done){ - - let ringtoneOptions = { - volume: maxVol, - loop: true - }; - await sleep(100); - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : maxVol : Loop True'); - await ringtonePlayer.configure(ringtoneOptions).then(function() { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS: ' +ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestRM: Configure RingtonePlayer : FAIL:' + err.message); - expect(false).assertTrue(); - }); - sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_006 - * @tc.name : stop - promise - * @tc.desc : stop - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_006', 0,async function(done){ - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await sleep(1000); - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayer.stop().then(function () { - console.log('AudioFrameworkTestRM: Stop RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_007 - * @tc.name : release - promise - * @tc.desc : release - promise - Get State_RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_007', 0,async function(done){ - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - await ringtonePlayer.release().then(function () { - console.log('AudioFrameworkTestRM: Release RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Release RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_008 - * @tc.name : getSystemRingtonePlayer - promise RINGTONE_TYPE_MULTISIM enum - * @tc.desc : getSystemRingtonePlayer - promise -NEW set enum 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_008', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,1).then(async function(data) { - ringtonePlayer = data; - if (ringtonePlayer !=null) { - console.info('AudioFrameworkTestSSM:enum: get Ringtone Player : SUCCESS: ' + data.state); - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_009 - * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_DEFAULT enum 0 - * @tc.desc : setSystemRingtoneUri - promise set enum 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_009', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0); - promise.then(function () { - systemSoundManager.getSystemRingtoneUri(null,0).then(function (data) { - if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') - { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone Get SRC Path :enum ERROR: ' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set : enum ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_010 - * @tc.name : configure -start-Stop - Promise -Volume=highVol ,Enable loop - * @tc.desc : configure -start-Stop - promise- Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_010', 0,async function(done){ - - let ringtoneOptions = { - volume:highVol, - loop: true - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : highVol : Loop true'); - await ringtonePlayer.configure(ringtoneOptions); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - await sleep(1000); - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - ringtonePlayer.stop().then(function () { - console.log('AudioFrameworkTestRM: Stop RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_011 - * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE enum - * @tc.desc : setSystemRingtoneUri - promise enum -1 Negative value - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_011',0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1).then(function () { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set : enum : SUCCESS: '); - expect(false).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set enum : ERROR: ' + err.message); - expect(true).assertTrue(); - }); - await Promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_012 - * @tc.name : setSystemRingtoneUri - promise - RINGTONE_TYPE_DEFAULT enum - * @tc.desc : setSystemRingtoneUri - promise - Null Uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_012', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - await systemSoundManager.setSystemRingtoneUri(null,null,0).then(function () { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum : SUCCESS: ' ); - expect(false).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum : ERROR: ' + err.message); - expect(true).assertTrue(); - }); - await Promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_013 - * @tc.name : setSystemRingtoneUri - promise - RINGTONE_TYPE_DEFAULT enum - * @tc.desc : setSystemRingtoneUri - promise - Invalid uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_013', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - const promise = systemSoundManager.setSystemRingtoneUri(null,'xyz@123',0); - promise.then(function () { - systemSoundManager.getSystemRingtoneUri(null,0).then(function (data) { - if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') - { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone Get SRC Path :enum : ERROR: ' + err.message); - expect(true).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set : enum : ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_014 - * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_DEFAULT -ENAME - * @tc.desc : setSystemRingtoneUri - promise DEFAULT ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_014', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT); - promise.then(function () { - systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { - if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') - { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME SUCCESS: ' + data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone Get SRC Path :ENAME : ERROR: ' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set : ENAME :ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_015 - * @tc.name : getSystemRingtonePlayer - promise RINGTONE_TYPE_DEFAULT enum - * @tc.desc : getSystemRingtonePlayer - promise -NEW - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_015', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,0).then(async function(data) { - ringtonePlayer = data; - if (ringtonePlayer !=null) { - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : SUCCESS: ' + data.state); - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_016 - * @tc.name : Configure - Volume=highVol ,Disable loop start - promise - * @tc.desc : Configure-Start - promise -Get State - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_016', 0,async function(done){ - - let ringtoneOptions = { - volume:highVol, - loop: false - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : highVol : Loop False'); - await ringtonePlayer.configure(ringtoneOptions); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start().then(function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_017 - * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_MULTISIM -ENAME - * @tc.desc : setSystemRingtoneUri - promise ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_017', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM); - promise.then(function () { - systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then(function (data) { - if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') - { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME SUCCESS: ' + data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone Get SRC Path :ENAME ERROR: ' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set : ENAME ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_018 - * @tc.name : configure -start - promise - Volume=minVol ,Disable loop - * @tc.desc : Configure-Start -promise -Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_018', 0,async function(done){ - - let ringtoneOptions = { - volume:minVol, - loop: false - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : minVol : Loop False'); - await ringtonePlayer.configure(ringtoneOptions); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start().then(function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_019 - * @tc.name : Stop - promise - * @tc.desc : Stop - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_019', 0,async function(done){ - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayer.stop().then(async function () { - console.log('AudioFrameworkTestRM: Stop RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_020 - * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE enum (2) - * @tc.desc : setSystemRingtoneUri - promise -enum (2) invalid value - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_020', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',2).then(function (){ - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone set SRC Path set: enum ERROR: ' + err.message); - expect(true).assertTrue(); - }); - await Promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_021 - * @tc.name : setSystemRingtoneUri - promise - uri Null,MULTISIM ENAME - * @tc.desc : setSystemRingtoneUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_021', 0,async function(done){ - await systemSoundManager.setSystemRingtoneUri(null,null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then(function () { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :Success : FAIL'); - expect(false).assertTrue(); - - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set : ENAME ERROR: ' +err.message); - expect(true).assertTrue(); - }); - await Promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_022 - * @tc.name : getSystemRingtoneUri - promise - RINGTONE_TYPE enum 1 - * @tc.desc : getSystemRingtoneUri - promise set enum 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_022', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',1); - promise.then(function () { - systemSoundManager.getSystemRingtoneUri(null,1).then(function (data) { - if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') - { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone Get SRC Path set :enum : ERROR: ' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone set SRC Path set:enum : ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_023 - * @tc.name : Configure - promise - Volume=highVol ,Enable loop - * @tc.desc : Configure - promise - Get state -PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_023', 0,async function(done){ - - let ringtoneOptions = { - volume: highVol, - loop: true - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : Vol highVol : Loop True'); - await ringtonePlayer.configure(ringtoneOptions).then(async function() { - await sleep(500); - if (ringtonePlayer.state == 1){ - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : State: PASS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : State: Fail : '+ringtonePlayer.state); - expect(false).assertTrue(); - } - - }).catch((err) => { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_024 - * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_MULTISIM enum - * @tc.desc : setSystemRingtoneUri - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_024', 0,async function(done){ - console.info('AudioFrameworkTestSSM: Starting Set RM path'); - const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',multiSIM); - promise.then(function () { - systemSoundManager.getSystemRingtoneUri(null,multiSIM).then(function (data) { - if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') - { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum FAIL: ' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone Get SRC Path set :enum : ERROR: ' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone SRC Path set: enum : ERROR: ' + err.message); - expect(false).assertTrue(); - }); - await promise; - await sleep(100); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_025 - * @tc.name : start-stop - promise Configure-highVol,Enable loop - * @tc.desc : start-stop - promise ,Configure- Get State - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_AUDIO_MANAGER_RingtoneManager_025', 0,async function(done){ - - let ringtoneOptions = { - volume: highVol, - loop: true - }; - - await sleep(100); - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : Vol highVol : Loop True'); - await ringtonePlayer.configure(ringtoneOptions); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - await sleep(2000); - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayer.stop().then(async function () { - await sleep(100); - console.log('AudioFrameworkTestRM: Stop RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_026 - * @tc.name : Configure minVol ,disable loop - promise - Get state (START -STOP) - * @tc.desc : Configure-Start-Stop -Promise -Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_026', 0,async function(done){ - - let ringtoneOptions = { - volume: minVol, - loop: false - }; - await sleep(100); - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : minVol : Loop false'); - await ringtonePlayer.configure(ringtoneOptions); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - await sleep(2000); - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayer.stop().then(function () { - console.log('AudioFrameworkTestRM: Stop RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_027 - * @tc.name : Configure Start -Promise highVol ,Disable loop - * @tc.desc : Configure - Start -Promise -Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_027', 0,async function(done){ - - let ringtoneOptions = { - volume: highVol, - loop: false - }; - await sleep(100); - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : highVol: Loop false'); - await ringtonePlayer.configure(ringtoneOptions); - await sleep(100); - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayer.start().then(async function () { - await sleep(2000); - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_028 - * @tc.name : getSystemRingtonePlayer - promise RINGTONE_TYPE_DEFAULT ENAME - * @tc.desc : getSystemRingtonePlayer - promise - Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_028', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayer = data; - if (ringtonePlayer !=null) { - console.info('AudioFrameworkTestSSM: ENAME: get Ringtone Player : SUCCESS: ' + data.state); - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_029 - * @tc.name : Configure - lowVol ,Disable loop- promise - * @tc.desc : Configure - Get State - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_029', 0,async function(done){ - - let ringtoneOptions = { - volume: lowVol, - loop: false - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : lowVol: Loop False'); - await ringtonePlayer.configure(ringtoneOptions).then(function() { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_030 - * @tc.name : Configure - promise outOfRangeVol ,Disable loop - * @tc.desc : Configure - promise Get State - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_030', 0,async function(done){ - - let ringtoneOptions = { - volume:outOfRangeVol, - loop: false - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : Vol outOfRangeVol : Loop False'); - await ringtonePlayer.configure(ringtoneOptions).then(function() { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS :FAIL '+ringtonePlayer.state); - expect(false).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer :ERROR: '+err.message); - expect(volErrorMesg).assertEqual(err.message); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_031 - * @tc.name : Configure - promise outOfRangeVol ,Enable loop - * @tc.desc : Configure - promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_031', 0,async function(done){ - - let ringtoneOptions = { - volume:outOfRangeVol, - loop: true - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : Vol outOfRangeVol : Loop True'); - await ringtonePlayer.configure(ringtoneOptions).then(function() { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(false).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer :ERROR: '+err.message); - expect(volErrorMesg).assertEqual(err.message); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_032 - * @tc.name : Configure - Start-Stop-Start - promise minVol ,Enable loop - * @tc.desc : Configure - (Start-Stop-Start) promise - Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_032', 0,async function(done){ - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - await sleep(2000); - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayer.stop().then(async function () { - console.log('AudioFrameworkTestRM: Stop RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - await sleep(1000); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - await sleep(1000); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_033 - * @tc.name : Stop -Promise -STOPPED - * @tc.desc : Stop-Promise-STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_033', 0,async function(done){ - console.log('AudioFrameworkTestRM: STOP RingtonePlayer '+ringtonePlayer.state); - await ringtonePlayer.stop().then(function(){ - console.log('AudioFrameworkTestRM: Get RingtonePlayer State :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Get RingtonePlayer State :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_034 - * @tc.name : start - promise - Without Configure - * @tc.desc : Start -Promise - Get State - Without configure - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_034', 0,async function(done){ - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await sleep(2000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_035 - * @tc.name : Configure -maxVol ,enable loop -start - * @tc.desc : Configure-Start-Promise (Start in running state) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_035', 0,async function(done){ - - let ringtoneOptions = { - volume:maxVol, - loop: false - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : maxVol : Loop True'); - await ringtonePlayer.configure(ringtoneOptions); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start().then(function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(false).assertTrue(); - - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(true).assertTrue(); - }); - done(); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_036 - * @tc.name : setSystemRingtoneUri - Callback RINGTONE_TYPE_DEFAULT - * @tc.desc : setSystemRingtoneUri - Callback ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_036', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT,(err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); - } - else{ - console.info('AudioFrameworkTestRM :Callback: Set system Ringtone SUCCESS'); - systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT, async(err,data)=>{ - if (err){ - console.error('AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR '+err.message); - expect(false).assertTrue(); - } - else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') { - console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : SUCCESS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : FAIL'); - expect(false).assertTrue(); - } - await sleep(1000); - done(); - }); - } - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_037 - * @tc.name : getSystemRingtonePlayer -Callback RINGTONE_TYPE_DEFAULT - * @tc.desc : getSystemRingtonePlayer -Callback enum - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_037', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,0,async(err,data)=> { - ringtonePlayer = data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Pass: '+data.state); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Fail: '+data.state); - expect(false).assertTrue(); - } - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_038 - * @tc.name : Configure -maxVol ,Disable loop - Callback -Get state -PREPARED - * @tc.desc : Configure -Callback - Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_038', 0,async function(done){ - - let ringtoneOptions = { - volume: maxVol, - loop: false - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : lowVol: Loop False'); - ringtonePlayer.configure(ringtoneOptions,async(err)=> { - if (err){ - console.error('AudioFrameworkTestRM:Callback: Configure RingtonePlayer : ERROR:' + err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM:Callback: Configure RingtonePlayer : SUCCESS'); - await sleep(500) - if (ringtonePlayer.state == 1){ - console.log('AudioFrameworkTestRM:Callback: Configure RingtonePlayer : PREPARED:PASS: State : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM:Callback: Configure RingtonePlayer : PREPARED:FAIL: State : '+ringtonePlayer.state); - expect(false).assertTrue(); - } - } - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_039 - * @tc.name : Configure - maxVol ,enable loop Callback - START - * @tc.desc : Configure-Start-Callback - Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_039', 0,async function(done){ - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async (err) => { - await sleep(2000); - if (err){ - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - if (ringtonePlayer.state == 2){ - console.log('AudioFrameworkTestRM:Callback: Configure RingtonePlayer : START:PASS: State : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM:Callback: Configure RingtonePlayer : START:FAIL: State : '+ringtonePlayer.state); - expect(false).assertTrue(); - } - await sleep(1000); - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayer.stop(); - } - done(); - }); - await sleep(1000); - done(); - }); - - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_040 - * @tc.name : STOP Callback -Get state - * @tc.desc : STOP -Callback -STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_040', 0,async function(done){ - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async (err) => { - await sleep(2000); - if (err){ - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - } - await sleep(1000); - console.log('AudioFrameworkTestRM: STOP RingtonePlayer'); - ringtonePlayer.stop(async (err) => { - await sleep(1000); - if (err){ - console.error('AudioFrameworkTestRM: STOP RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: STOP RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - if (ringtonePlayer.state == 3){ - console.log('AudioFrameworkTestRM:Callback: Configure RingtonePlayer : STOP:PASS: State : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM:Callback: Configure RingtonePlayer : STOP:FAIL: State : '+ringtonePlayer.state); - expect(false).assertTrue(); - } - } - done(); - }); - }); - await sleep(2000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_041 - * @tc.name : RELEASE Callback -Get state - * @tc.desc : RELEASE - Callback -RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_041', 0,async function(done){ - console.log('AudioFrameworkTestRM: RingtonePlayer - Release'); - await ringtonePlayer.release(async(err) => { - if(err){ - console.error('AudioFrameworkTestRM: Release RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Release RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(1000); - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_042 - * @tc.name : getSystemRingtonePlayer -Callback RINGTONE_TYPE_MULTISIM - * @tc.desc : getSystemRingtonePlayer -Callback -NEW- enum - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_042', 0,async function(done){ - console.log('AudioFrameworkTestRM: get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,1,async(err,data)=> { - ringtonePlayer = data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Pass: '+data.state); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Fail: '+data.state); - expect(false).assertTrue(); - } - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_043 - * @tc.name : setSystemRingtoneUri - Callback RINGTONE_TYPE_DEFAULT - enum - * @tc.desc : setSystemRingtoneUri - Callback - enum - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_043', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0,(err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: Set system Ringtone SUCCESS'); - systemSoundManager.getSystemRingtoneUri(null,0,async(err,data) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback: enum: Get system Ringtone Uri: ERROR '+err.message); - expect(false).assertTrue(); - } - else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') { - console.info('AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: enum: Get system Ringtone Uri : FAIL'); - expect(false).assertTrue(); - } - await sleep(100); - done(); - }); - } - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_044 - * @tc.name : Configure-highVol,Enable loop- Callback -Get state -(START -STOP) - * @tc.desc : Configure-START-STOP - Callback - Get State - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_044', 0,async function(done){ - - let ringtoneOptions = { - volume: highVol, - loop: true - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : highVol: Loop False'); - ringtonePlayer.configure(ringtoneOptions); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - await sleep(1000); - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - ringtonePlayer.stop((err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback: Stop RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - done(); - }); - } - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_045 - * @tc.name : setSystemRingtoneUri - Callback RINGTONE_TYPE_DEFAULT - enum - Negative value - * @tc.desc : setSystemRingtoneUri - Callback enum - Negative value - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_045', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1,async(err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: enum: Get system Ringtone Uri : FAIL'); - expect(false).assertTrue(); - } - await sleep(1000); - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_046 - * @tc.name : setSystemRingtoneUri - Callback- Null uri -RINGTONE_TYPE_DEFAULT - * @tc.desc : setSystemRingtoneUri - Callback set null uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_046', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT,async(err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: Set system Ringtone SUCCESS'); - expect(false).assertTrue(); - } - await sleep(1000); - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_047 - * @tc.name : getSystemRingtonePlayer -Callback Get State RINGTONE_TYPE_MULTISIM - * @tc.desc : getSystemRingtonePlayer -Callback- enum Get State - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_047', 0,async function(done){ - console.log('AudioFrameworkTestRM: get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,1,async(err,data)=> { - ringtonePlayer = data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Pass: '+data.state); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Fail: '+data.state); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_048 - * @tc.name : getSystemRingtonePlayer -Callback Get State RINGTONE_TYPE_DEFAULT - * @tc.desc : getSystemRingtonePlayer -Callback- enum Get State - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_048', 0,async function(done){ - console.log('AudioFrameworkTestRM: get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,0,async(err,data)=> { - ringtonePlayer = data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Pass: '+data.state); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Fail: '+data.state); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_049 - * @tc.name : getSystemRingtonePlayer -Callback Get State -NEW RINGTONE_TYPE_MULTISIM ENAME - * @tc.desc : getSystemRingtonePlayer -Callback -NEW - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_049', 0,async function(done){ - console.log('AudioFrameworkTestRM: get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async(err,data)=> { - ringtonePlayer = data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : ERROR :' + err.message); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : Pass: '+data.state); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : Fail: '+data.state); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_050 - * @tc.name : Configure minVol ,Disable loop - Start - callback - * @tc.desc : Configure - Start - callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_050', 0,async function(done){ - - let ringtoneOptions = { - volume: minVol, - loop: false - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : minVol: Loop False'); - ringtonePlayer.configure(ringtoneOptions,(err) => { - if(err){ - console.error('AudioFrameworkTestRM :Callback : Failed to Configure Ringtone Player'); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback : Configure RingtonePlayer SUCCESS'); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback : Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(1000); - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_051 - * @tc.name : Stop - Callback -Get state - * @tc.desc : Stop - Callback Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_051', 0,async function(done){ - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - ringtonePlayer.stop(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Stop RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(1000); - done(); - }); - }); - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_052 - * @tc.name : setSystemRingtoneUri - Callback RINGTONE_TYPE enum 2 - * @tc.desc : setSystemRingtoneUri - Callback Ename - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_052', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',2,async(err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback:enum: Set system Ringtone Uri : SUCCESS'); - expect(false).assertTrue(); - } - await sleep(1000); - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_053 - * @tc.name : setSystemRingtoneUri - Callback null RINGTONE_TYPE_MULTISIM -ENAME - * @tc.desc : setSystemRingtoneUri - Callback set null uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_053', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async(err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback :ENAME: Failed to set system ringtone '+err.message); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: ENAME: Get system Ringtone Uri : SUCCESS'); - expect(false).assertTrue(); - } - await sleep(1000); - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_054 - * @tc.name : setSystemRingtoneUri - Callback Invalid RINGTONE_TYPE_MULTISIM - * @tc.desc : setSystemRingtoneUri - Callback set Invalid uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_054', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,'xyz123',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,(err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: Set system Ringtone SUCCESS'); - systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async(err,data) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR '+err.message); - expect(true).assertTrue(); - } - else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') { - console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : PASS'); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : FAIL'); - expect(false).assertTrue(); - } - await sleep(1000); - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_055 - * @tc.name : setSystemRingtoneUri - Callback RINGTONE_TYPE enum 1 - * @tc.desc : setSystemRingtoneUri - Callback set enum = 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_055', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',1,(err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); - } - else{ - console.info('AudioFrameworkTestRM :Callback: Set system Ringtone SUCCESS'); - systemSoundManager.getSystemRingtoneUri(null,1,async(err,data) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback: enum: Failed to get system Ringtone Uri: ERROR '+err.message); - expect(false).assertTrue(); - } - else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav'){ - console.info('AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: enum: Get system Ringtone Uri : FAIL'); - expect(false).assertTrue(); - } - await sleep(100); - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_056 - * @tc.name : Configure - minVol ,Enable loop - Callback - * @tc.desc : Configure - Callback -Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_056', 0,async function(done){ - - let ringtoneOptions = { - volume: minVol, - loop: true - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : minVol: Loop true'); - ringtonePlayer.configure(ringtoneOptions,async(err) => { - if(err){ - console.error('AudioFrameworkTestRM :Callback : Failed to Configure Ringtone Player'); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback : Configure RingtonePlayer SUCCESS'); - expect(true).assertTrue(); - } - await sleep(1000); - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_057 - * @tc.name : getSystemRingtonePlayer -Callback Get State -NEW RINGTONE_TYPE_DEFAULT ENAME - * @tc.desc : getSystemRingtonePlayer -Callback Get State -NEW - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_057', 0,async function(done){ - console.log('AudioFrameworkTestRM: get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT,async(err,data)=> { - ringtonePlayer = data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Pass: '+data.state); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: get Ringtone Player : Fail: '+data.state); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_058 - * @tc.name : Configure highVol ,Disable loop Start - Callback - * @tc.desc : Configure - Start - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_058', 0,async function(done){ - - let ringtoneOptions = { - volume: highVol, - loop: false - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : highVol: Loop false'); - ringtonePlayer.configure(ringtoneOptions,(err) => { - if(err){ - console.error('AudioFrameworkTestRM :Callback : Failed to Configure Ringtone Player'); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback : Configure RingtonePlayer SUCCESS'); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback : Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(1000); - await ringtonePlayer.stop(); - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_059 - * @tc.name : Configure - highVol ,Enable loop - start Callback - * @tc.desc : Configure - start - callback - - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_059', 0,async function(done){ - - let ringtoneOptions = { - volume: highVol, - loop: true - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : highVol: Loop true'); - ringtonePlayer.configure(ringtoneOptions,(err) => { - if(err){ - console.error('AudioFrameworkTestRM :Callback : Failed to Configure Ringtone Player'); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback : Configure RingtonePlayer SUCCESS'); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback : Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(1000); - await ringtonePlayer.stop(); - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_060 - * @tc.name : getSystemRingtonePlayer -Callback Get State -NEW RINGTONE_TYPE_DEFAULT ENAME - * @tc.desc : getSystemRingtonePlayer -Callback Get State -NEW - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_060', 0,async function(done){ - console.log('AudioFrameworkTestRM: get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT,async(err,data)=> { - ringtonePlayer = data; - if(err){ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - } - else if(ringtonePlayer!= null){ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : Pass: '+data.state); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :ENAME: get Ringtone Player : Fail: '+data.state); - expect(false).assertTrue(); - } - await sleep(1000); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_061 - * @tc.name : Configure outOfRangeVol ,Enable loop -Get STATE- Callback - * @tc.desc : Configure - Start -Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_061', 0,async function(done){ - - let ringtoneOptions = { - volume: outOfRangeVol, - loop: true - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : outOfRangeVol: Loop true'); - ringtonePlayer.configure(ringtoneOptions,(err) => { - if(err){ - console.error('AudioFrameworkTestRM :Callback : Failed to Configure Ringtone Player' +err.message); - expect(volErrorMesg).assertEqual(err.message); - } - else{ - console.info('AudioFrameworkTestRM :Callback : Configure RingtonePlayer Out Of Range SUCCESS : FAIL'); - expect(false).assertTrue(); - } - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_062 - * @tc.name : Configure outOfRangeVol ,disable loop-Get STATE- Callback - * @tc.desc : Configure - Start - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_062', 0,async function(done){ - - let ringtoneOptions = { - volume: outOfRangeVol, - loop: false - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : outOfRangeVol: Loop false'); - ringtonePlayer.configure(ringtoneOptions,(err) => { - if(err){ - console.error('AudioFrameworkTestRM :Callback : Failed to Configure Ringtone Player' +err.message); - expect(volErrorMesg).assertEqual(err.message); - } - else{ - console.info('AudioFrameworkTestRM :Callback : Configure RingtonePlayer Out Of Range SUCCESS : FAIL'); - expect(false).assertTrue(); - } - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_063 - * @tc.name : setSystemRingtoneUri - Callback -RINGTONE_TYPE_MULTISIM -ENAME - * @tc.desc : setSystemRingtoneUri - Callback -Ename - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_063', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async (err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback :ENAME: Failed to set system ringtone '+err.message); - } - else{ - console.info('AudioFrameworkTestRM :Callback: Set system Ringtone SUCCESS'); - systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM, async(err,data) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback: ENAME: Failed to get system Ringtone Uri: ERROR '+err.message); - expect(false).assertTrue(); - } - else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') { - console.info('AudioFrameworkTestRM :Callback: ENAME: Get system Ringtone Uri : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: ENAME: Get system Ringtone Uri : FAIL'); - expect(false).assertTrue(); - } - await sleep(1000); - done(); - }); - } - await sleep(1000); - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_064 - * @tc.name : Configure - Callback - Get state (Start-Stop-Start) - * @tc.desc : Volume=minVol ,Enable loop - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_064', 0,async function(done){ - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - } - await sleep(2000); - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - ringtonePlayer.stop(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback: Stop RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - } - await sleep(1000); - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Start1 RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(1000); - }); - }); - }); - await sleep(6000) - done(); - }) - await sleep(1000); - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_065 - * @tc.name : Get State Stop -STOPPED - * @tc.desc : Stop - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_065', 0,async function(done){ - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - ringtonePlayer.stop(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback : Stop RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(1000); - done(); - }); - }) - await sleep(1000); - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_066 - * @tc.name : start - Callback without configure - * @tc.desc : START - Callback - without configure - Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_066', 0,async function(done){ - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer without configure :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback : Start RingtonePlayer without configure :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(2000); - done(); - }); - }) - await sleep(1000); - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_067 - * @tc.name : Configure maxVol ,enable loop - start - Callback - * @tc.desc : Configure - Start - Callback (Start when in running) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_067', 0,async function(done){ - - let ringtoneOptions = { - volume: highVol, - loop: true - }; - - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : highVol: Loop true'); - ringtonePlayer.configure(ringtoneOptions,(err) => { - if(err){ - console.error('AudioFrameworkTestRM :Callback : Failed to Configure Ringtone Player'); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback : Configure RingtonePlayer SUCCESS'); - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer :ERROR: '+err.message); - expect(true).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback : Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(false).assertTrue(); - } - await sleep(1000); - await ringtonePlayer.stop(); - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_068 - * @tc.name : Start - stop promise - (START -STOP) - * @tc.desc : Start - Stop - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_068', 0,async function(done){ - - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - await sleep(1000); - ringtonePlayer.stop().then(function () { - console.log('AudioFrameworkTestRM : Stop RingtonePlayer : SUCCESS :'+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM : Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_069 - * @tc.name : Start -Stop - Callback -Get state -(START -STOP) - * @tc.desc : Start -Stop - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_069', 0,async function(done){ - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback: Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - await sleep(1000); - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.stop(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Stop RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(1000); - done(); - }); - } - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_070 - * @tc.name : Get State Stop promise - * @tc.desc : Stop - promise (negative scenario) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_070', 0,async function(done){ - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayer.stop().then(async function() { - console.error('AudioFrameworkTestRM: Callback : Stop RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Callback : Stop RingtonePlayer :error :'+err.message); - expect(false).assertTrue(); - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_071 - * @tc.name : Stop-Callback - Get state - * @tc.desc : Stop- Callback (Negative scenario) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_071', 0,async function(done){ - console.log('AudioFrameworkTestRM: stop RingtonePlayer'); - ringtonePlayer.stop(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Stop RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback: Stop RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(true).assertTrue(); - } - await sleep(4000); - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_072 - * @tc.name : Release - Start - promise - Get state (Release -Start) - * @tc.desc : Release - Start - promise - Get state (Negative Scenario) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_072', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayer = data; - if (ringtonePlayer !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS'); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' +err.message); - expect(false).assertTrue(); - }); - - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - await ringtonePlayer.release().then(async function () { - console.log('AudioFrameworkTestRM: Release RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - await sleep(2000); - await ringtonePlayer.start().then(function () { - console.log('AudioFrameworkTestRM : Start RingtonePlayer : SUCCESS :'+ringtonePlayer.state); - expect(false).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM : Start RingtonePlayer :ERROR: '+err.message); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Release RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_073 - * @tc.name : Release - Start - Callback - Get state (Release -Start) - * @tc.desc : Release - Start - Callback - Get state (Negative Scenario) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_073', 0,async function(done){ - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayer = data; - if (ringtonePlayer !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - await sleep(100); - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - ringtonePlayer.release(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Release RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback: release RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - await sleep(1000); - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(true).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(false).assertTrue(); - } - await sleep(1000); - done(); - }); - } - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_074 - * @tc.name : setSystemRingtoneUri - Promise RINGTONE_TYPE_ enum 1 - * @tc.desc : setSystemRingtoneUri - Promise set enum value 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_074', 0,async function(done){ - console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',1).then(function(){ - console.info('AudioFrameworkTestSSM:enum:1:Set Ringtone Uri : SUCCESS: '); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum:1:Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_075 - * @tc.name : getRendererInfo()- promise - Content - * @tc.desc : getRendererInfo()- promise - Content Get Renderer info - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_075', 0,async function(done){ - await ringtonePlayer.getAudioRendererInfo().then(function(data){ - console.info('AudioFrameworkTestSSM : Ringtone info content : '+data.content); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM : Ringtone info content: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_076 - * @tc.name : getRendererInfo()- Get Renderer info- callback - * @tc.desc : getRendererInfo()- Content - callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_076', 0,async function(done){ - ringtonePlayer.getAudioRendererInfo(async(err,data) => { - if(err){ - console.error('AudioFrameworkTestRM : Ringtone info content :ERROR: '+err.message); - expect(false).assertTrue(); - } - else if (data!==null){ - console.log('AudioFrameworkTestRM : Ringtone info content: Pass :'+data.content); - expect(true).assertTrue(); - } - else{ - expect(false).assertTrue(); - await sleep(100); - } - }) - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_077 - * @tc.name : getRendererInfo()- promise - Get Renderer info - usage - * @tc.desc : getRendererInfo()- promise - Usage - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_077', 0,async function(done){ - await ringtonePlayer.getAudioRendererInfo().then(function(data){ - console.info('AudioFrameworkTestSSM : Ringtone info usage : '+data.usage); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM : Ringtone info usage: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_078 - * @tc.name : getRendererInfo()- Get Renderer info- callback -Usage - * @tc.desc : getRendererInfo()- Usage - callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_078', 0,async function(done){ - ringtonePlayer.getAudioRendererInfo(async(err,data) => { - if(err){ - console.error('AudioFrameworkTestRM : Ringtone info usage :ERROR: '+err.message); - expect(false).assertTrue(); - } - else if (data!==null){ - console.log('AudioFrameworkTestRM : Ringtone info usage: Pass :'+data.content); - expect(true).assertTrue(); - } - else{ - expect(false).assertTrue(); - await sleep(100); - } - }) - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_079 - * @tc.name : getRendererInfo()- promise - Get Renderer info - RendererFlags - * @tc.desc : getRendererInfo()- promise - RendererFlags - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_079', 0,async function(done){ - await ringtonePlayer.getAudioRendererInfo().then(function(data){ - console.info('AudioFrameworkTestRM : Ringtone info rendererFlags : '+data.rendererFlags); - expect(true).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM : Ringtone info rendererFlags : '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_080 - * @tc.name : getRendererInfo()- Get Renderer info- callback -RendererFlags - * @tc.desc : getRendererInfo()- Callback - RendererFlags - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_080', 0,async function(done){ - ringtonePlayer.getAudioRendererInfo(async(err,data) => { - if(err){ - console.error('AudioFrameworkTestRM : Ringtone info rendererFlags :ERROR: '+err.message); - expect(false).assertTrue(); - } - else if (data!==null){ - console.log('AudioFrameworkTestRM : Ringtone info rendererFlags: Pass :'+data.rendererFlags); - expect(true).assertTrue(); - } - else{ - expect(false).assertTrue(); - await sleep(100); - } - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_083 - * @tc.name : setSystemRingtoneUri - Promise invalid uri RINGTONE_TYPE_DEFAULT enum 0 - * @tc.desc : setSystemRingtoneUri - Promise set invalid uri - Start() (Negative Scenario) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_083', 0,async function(done){ - console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); - await systemSoundManager.setSystemRingtoneUri(null,'data',0).then(async function(){ - console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); - - await ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(false).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(true).assertTrue(); - }); - }).catch((err) => { - console.error('AudioFrameworkTestSSM: enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await sleep(1000); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_084 - * @tc.name : setSystemRingtoneUri - Promise RINGTONE_TYPE_ enum negative value - * @tc.desc : setSystemRingtoneUri - Promise set negative enum value -1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_084', 0,async function(done){ - console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1).then(function(){ - console.info('AudioFrameworkTestSSM:enum: Negative Value :Set Ringtone Uri : SUCCESS: '); - - ringtonePlayer.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); - expect(false).assertTrue(); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum:Negative Value :Set System Ringtone Uri :ERROR: '+err.message); - expect(true).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_085 - * @tc.name : setSystemRingtoneUri - Callback - * @tc.desc : setSystemRingtoneUri - Callback enum negative value - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_085', 0,async function(done){ - console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1,(err) => { - if(err) { - console.error('AudioFrameworkTestRM: Callback :enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(true).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback : Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(false).assertTrue(); - } - await sleep(1000); - }); - } - done(); - }) - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_085 - * @tc.name : setSystemRingtoneUri - Promise - * @tc.desc : setSystemRingtoneUri - Promise enum negative value - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_085', 0,async function(done){ - console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1).then(function () { - console.log('AudioFrameworkTestRM: Set System Ringtone Uri : SUCCESS'); - expect(false).assertTrue(); - }).catch((err) => { - console.info('AudioFrameworkTestSSM: Ringtone set SRC Path : ERROR: ' + err.message); - expect(true).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_086 - * @tc.name : setSystemRingtoneUri - Callback RINGTONE_TYPE_DEFAULT enum - * @tc.desc : setSystemRingtoneUri - Callback invalid uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_086', 0,async function(done){ - console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); - systemSoundManager.setSystemRingtoneUri(null,'xyz@123',0,(err) => { - if(err) { - console.error('AudioFrameworkTestSSM: Callback :enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestSSM:Callback :enum: Set Ringtone Uri : SUCCESS: '); - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - ringtonePlayer.start(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer :ERROR: '+err.message); - expect(true).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback : Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state); - expect(false).assertTrue(); - } - await sleep(1000); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_087 - * @tc.name : getSystemRingtoneUri - Callback RINGTONE_TYPE_MULTISIM ENAME - * @tc.desc : getSystemRingtoneUri - Callback Ename (negative scenario) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_087', 0,async function(done){ - systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,(err) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: Set system Ringtone SUCCESS'); - - systemSoundManager.getSystemRingtoneUri(null,-1,async(err,data) => { - if (err){ - console.error('AudioFrameworkTestRM :Callback: enum: Failed to get system Ringtone Uri: ERROR '+err.message); - expect(true).assertTrue(); - } - else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') { - console.info('AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS'); - expect(false).assertTrue(); - } - else{ - console.info('AudioFrameworkTestRM :Callback: enum: Get system Ringtone Uri : FAIL'); - expect(false).assertTrue(); - } - await sleep(1000); - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_088 - * @tc.name : setSystemRingtoneUri - Promise RINGTONE_TYPE_ enum 0 - * @tc.desc : setSystemRingtoneUri - Promise set enum value 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_088', 0,async function(done){ - console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0).then(function(){ - console.info('AudioFrameworkTestSSM:enum:0:Set Ringtone Uri : SUCCESS: '); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum:0:Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_089 - * @tc.name : Configure- Stop-Release Callback - * @tc.desc : Configure -Stop-Release -Callback - Get state - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_089', 0,async function(done){ - var ringtonePlayerTemp; - - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then(async function(data) { - ringtonePlayerTemp = data; - if (ringtonePlayerTemp !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - ringtonePlayerTemp.release(async(err) => { - if (err){ - console.error('AudioFrameworkTestRM: Callback : Release RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback: release RingtonePlayer :SUCCESS'); - - if (ringtonePlayerTemp.state == 4) { - console.log('AudioFrameworkTestRM: Callback: Player Status : PASS : '+ringtonePlayerTemp.state); - expect(true).assertTrue(); - } - else{ - console.log('AudioFrameworkTestRM: Callback: Player Status : FAIL : '+ringtonePlayerTemp.state); - expect(false).assertTrue(); - } - } - await sleep(1000); - done(); - }); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_090 - * @tc.name : Rintgtone-Player - mp3 - * @tc.desc : Configure start-Stop-Release - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_090', 0,async function(done){ - var ringtonePlayerTemp; - var resultFlag; - - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayerTemp = data; - if (ringtonePlayerTemp !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS'); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' +err.message); - expect(false).assertTrue(); - }); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp3',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ - console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { - if (data == '/storage/media/100/local/files/media/test.mp3') { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); - } - else { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: enum Ringtone Get Ringtone ERROR: ' + err.message); - expect(false).assertTrue(); - }); - - let ringtoneOptions = { - volume: maxVol, - loop: true - }; - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : maxVol: Loop true'); - await ringtonePlayerTemp.configure(ringtoneOptions).then(function() { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : ' +ringtonePlayerTemp.state); - }).catch((err) => { - console.info('AudioFrameworkTestRM: Configure RingtonePlayer : FAIL:' + err.message); - expect(false).assertTrue(); - }); - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayerTemp.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayerTemp.state); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await sleep(2000); - - if (ringtonePlayerTemp.state == 2) { - console.log('AudioFrameworkTestRM: Player Status RUNNING: PASS : '+ringtonePlayerTemp.state); - resultFlag = true; - } - else{ - console.log('AudioFrameworkTestRM: Player Status RUNNING: FAIL : '+ringtonePlayerTemp.state); - resultFlag = false; - } - await sleep(1000); - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayerTemp.stop(); - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - await ringtonePlayerTemp.release(); - await sleep(1000); - expect(resultFlag).assertTrue(); - - done(); - }); - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_091 - * @tc.name : Rintgtone-Player - mp4 - * @tc.desc : Configure start-Stop-Release - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_091', 0,async function(done){ - var ringtonePlayerTemp; - var resultFlag; - - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayerTemp = data; - if (ringtonePlayerTemp !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS'); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' +err.message); - expect(false).assertTrue(); - }); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp4',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ - console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { - if (data == '/storage/media/100/local/files/media/test.mp4') { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); - } - else { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: enum Ringtone Get Ringtone ERROR: ' + err.message); - expect(false).assertTrue(); - }); - - let ringtoneOptions = { - volume: maxVol, - loop: true - }; - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : maxVol: Loop true'); - await ringtonePlayerTemp.configure(ringtoneOptions).then(function() { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : ' +ringtonePlayerTemp.state); - }).catch((err) => { - console.info('AudioFrameworkTestRM: Configure RingtonePlayer : FAIL:' + err.message); - expect(false).assertTrue(); - }); - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayerTemp.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayerTemp.state); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await sleep(2000); - - if (ringtonePlayerTemp.state == 2) { - console.log('AudioFrameworkTestRM: Player Status RUNNING: PASS : '+ringtonePlayerTemp.state); - resultFlag = true; - } - else{ - console.log('AudioFrameworkTestRM: Player Status RUNNING: FAIL : '+ringtonePlayerTemp.state); - resultFlag = false; - } - await sleep(1000); - - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayerTemp.stop(); - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - await ringtonePlayerTemp.release(); - await sleep(1000); - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_092 - * @tc.name : Ringtone-Player - mp3 -Get Title - * @tc.desc : Configure & get title during playback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_092', 0,async function(done){ - var ringtonePlayerTemp; - var resultFlag; - - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayerTemp = data; - if (ringtonePlayerTemp !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp3',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ - console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { - if (data == '/storage/media/100/local/files/media/test.mp3') { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); - } - else { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: enum Ringtone Get Ringtone ERROR: ' + err.message); - expect(false).assertTrue(); - }); - - let ringtoneOptions = { - volume: maxVol, - loop: true - }; - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : maxVol: Loop true'); - await ringtonePlayerTemp.configure(ringtoneOptions).then(function() { - console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : ' +ringtonePlayerTemp.state); - }).catch((err) => { - console.info('AudioFrameworkTestRM: Configure RingtonePlayer : FAIL:' + err.message); - expect(false).assertTrue(); - }); - console.log('AudioFrameworkTestRM: Start RingtonePlayer'); - await ringtonePlayerTemp.start().then(async function () { - console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayerTemp.state); - }).catch((err) => { - console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await sleep(2000); - - await ringtonePlayerTemp.getTitle().then(async function (data) { - console.log('AudioFrameworkTestRM: RingtonePlayer : STATE : '+ringtonePlayerTemp.state); - if (data == 'Test MP3') { - console.log('AudioFrameworkTestRM: TITLE : PASS : '+data); - resultFlag = true; - } - else{ - console.log('AudioFrameworkTestRM: TITLE : FAIL : '+data); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkTestRM: getTitle :ERROR: '+err.message); - expect(false).assertTrue(); - }); - // await sleep(1000); - console.log('AudioFrameworkTestRM: Stop RingtonePlayer'); - await ringtonePlayerTemp.stop(); - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - await ringtonePlayerTemp.release(); - await sleep(1000); - expect(resultFlag).assertTrue(); - done(); - }); - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_093 - * @tc.name : Ringtone-Player - mp3 -Get Title - * @tc.desc : Configure & get title - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_093', 0,async function(done){ - var ringtonePlayerTemp; - var resultFlag; - - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayerTemp = data; - if (ringtonePlayerTemp !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp3',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ - console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { - if (data == '/storage/media/100/local/files/media/test.mp3') { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); - } - else { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: enum Ringtone Get Ringtone ERROR: ' + err.message); - expect(false).assertTrue(); - }); - - await ringtonePlayerTemp.getTitle().then(async function (data) { - console.log('AudioFrameworkTestRM: RingtonePlayer : STATE : '+ringtonePlayerTemp.state); - if (data == 'Test MP3') { - console.log('AudioFrameworkTestRM: TITLE : PASS : '+data); - resultFlag = true; - } - else{ - console.log('AudioFrameworkTestRM: TITLE : FAIL : '+data); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkTestRM: getTitle :ERROR: '+err.message); - expect(false).assertTrue(); - }); - - await sleep(100); - expect(resultFlag).assertTrue(); - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - await ringtonePlayerTemp.release(); - done(); - - }); - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_094 - * @tc.name : Ringtone-Player - mp4 -Get Title - * @tc.desc : Configure & get title - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_094', 0,async function(done){ - var ringtonePlayerTemp; - var resultFlag; - - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayerTemp = data; - if (ringtonePlayerTemp !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp4',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ - console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { - if (data == '/storage/media/100/local/files/media/test.mp4') { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); - } - else { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: enum Ringtone Get Ringtone ERROR: ' + err.message); - expect(false).assertTrue(); - }); - - await ringtonePlayerTemp.getTitle().then(async function (data) { - console.log('AudioFrameworkTestRM: RingtonePlayer : STATE : '+ringtonePlayerTemp.state); - if (data == 'Galway') { - console.log('AudioFrameworkTestRM: TITLE : PASS : '+data); - resultFlag = true; - } - else{ - console.log('AudioFrameworkTestRM: TITLE : FAIL : '+data); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkTestRM: getTitle :ERROR: '+err.message); - expect(false).assertTrue(); - }); - - await sleep(100); - expect(resultFlag).assertTrue(); - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - await ringtonePlayerTemp.release(); - done(); - }); - - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_095 - * @tc.name : Ringtone-Player - mp4 -Get Title - Callback - * @tc.desc : Configure & get title - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingtoneManager_095', 0,async function(done){ - var ringtonePlayerTemp; - var resultFlag; - - console.log('AudioFrameworkTestRM: Get System Ringtone Player'); - await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) { - ringtonePlayerTemp = data; - if (ringtonePlayerTemp !=null) { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); - expect(false).assertTrue(); - }); - await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp4',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ - console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); - }).catch((err) => { - console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); - expect(false).assertTrue(); - }); - await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { - if (data == '/storage/media/100/local/files/media/test.mp4') { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); - } - else { - console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL: ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkTestSSM: enum Ringtone Get Ringtone ERROR: ' + err.message); - expect(false).assertTrue(); - }); - - ringtonePlayerTemp.getTitle((err, data) => { - if (err) { - console.error(`AudioFrameworkTestRM: getTitle : ERROR : ${err.message}`); - expect(false).assertTrue(); - } - else { - if (data == 'Galway') { - console.log('AudioFrameworkTestRM: TITLE : PASS : ' + data); - resultFlag = true; - } - else { - console.log('AudioFrameworkTestRM: TITLE : FAIL : ' + data); - resultFlag = false; - } - } - }); - - await sleep(100); - expect(resultFlag).assertTrue(); - console.log('AudioFrameworkTestRM: Release RingtonePlayer'); - await ringtonePlayerTemp.release(); - done(); - }); - -}); - - - - - diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/getPermission.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/getPermission.test.js new file mode 100644 index 000000000..e836f8f47 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/getPermission.test.js @@ -0,0 +1,69 @@ +/* + * 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 { describe, beforeAll,afterAll, it, expect } from 'deccjsunit/index'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import bundle from '@ohos.bundle'; + +describe("get_permission", function () { + + /** + * @tc.number SUB_DF_GRANT_USER_GRANTED_PERMISSION_0000 + * @tc.name grant_user_granted_permission_async_000 + * @tc.desc Test grantUserGrantedPermission() interfaces, grant permission. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it("grant_user_granted_permission_async_000", 0, async function (done) { + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100); + let tokenID = appInfo.accessTokenId; + let atManager = abilityAccessCtrl.createAtManager(); + let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MEDIA_LOCATION",1); + let result2 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_MEDIA",1); + let result3 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_MEDIA",1); + let result4 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",1); + let result5 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",1); + let result6 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MICROPHONE",1); + let result7 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.ACCESS_NOTIFICATION_POLICY",1); + let result8 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MODIFY_AUDIO_SETTINGS",1); + let isGranted1 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MEDIA_LOCATION"); + let isGranted2 = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_MEDIA"); + let isGranted3 = await atManager.verifyAccessToken(tokenID, "ohos.permission.WRITE_MEDIA"); + let isGranted4 = await atManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); + let isGranted5 = await atManager.verifyAccessToken(tokenID, "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"); + let isGranted6 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MICROPHONE"); + let isGranted7 = await atManager.verifyAccessToken(tokenID, "ohos.permission.ACCESS_NOTIFICATION_POLICY"); + let isGranted8 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MODIFY_AUDIO_SETTINGS"); + console.info("AudioManagerLog: Perm1:"+result1); + console.info("AudioManagerLog: Perm2:"+result2); + console.info("AudioManagerLog: Perm3:"+result3); + console.info("AudioManagerLog: Perm1G:"+isGranted1); + console.info("AudioManagerLog: Perm2G:"+isGranted2); + console.info("AudioManagerLog: Perm3G:"+isGranted3); + console.info("AudioManagerLog: Perm4:"+result4); + console.info("AudioManagerLog: Perm5:"+result5); + console.info("AudioManagerLog: Perm6:"+result6); + console.info("AudioManagerLog: Perm4G:"+isGranted4); + console.info("AudioManagerLog: Perm5G:"+isGranted5); + console.info("AudioManagerLog: Perm6G:"+isGranted6); + console.info("AudioManagerLog: Perm7:"+result7); + console.info("AudioManagerLog: Perm8:"+result8); + console.info("AudioManagerLog: Perm7G:"+isGranted7); + console.info("AudioManagerLog: Perm8G:"+isGranted8); + done(); + }); +}); \ No newline at end of file -- GitLab