diff --git a/multimedia/audio/audio_js_standard/audioManager/Test.json b/multimedia/audio/audio_js_standard/audioManager/Test.json index b57c5abf417a0edf49224a832799586714479de6..f2a05ca8207349be8d49614b61d2f61c7bf59518 100755 --- a/multimedia/audio/audio_js_standard/audioManager/Test.json +++ b/multimedia/audio/audio_js_standard/audioManager/Test.json @@ -12,41 +12,38 @@ "ActsAudioManagerJsTest.hap" ], "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", "run-command": [ - "chmod 777 /data/*", - "chmod 777 /data -R", - "mkdir /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media" - - + "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media" ], "cleanup-apps": true }, - { + { "type": "PushKit", - "pre-push": [ - ], + "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" - + "./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/Believer60s.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-8000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-16000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-32000-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-64000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-96000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-11025-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-12000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", + "./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media", + "./resource/audio/audioManager/file_example_WAV_1MG.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media", + "./resource/audio/audioManager/safe_and_sound_32.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media", + "./resource/audio/audioManager/test.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media", + "./resource/audio/audioManager/test.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media" ] } ] 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 af3a71f78bfb061df5715c4f50f927fe56c1e749..c262b6f0165e383a1ff3aeedbc8906a18947543f 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 @@ -23,7 +23,7 @@ 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'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; describe('audioCall', function () { var mediaDir; @@ -31,35 +31,19 @@ describe('audioCall', function () { let readpath; var resultFlagRec; var resultFlagRen; + let fdPath; + let filePath; const audioManager = audio.getAudioManager(); console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); const audioManagerRec = audio.getAudioManager(); console.info('AudioFrameworkRecLog: Create AudioManger Object JS Framework'); - /*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 = 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 = '/data/storage/el2/base/haps/entry/cache'; + //mediaDir = '/data/storage/el2/base/haps/entry/cache'; }) beforeEach(async function () { @@ -74,24 +58,22 @@ describe('audioCall', function () { afterAll(async function () { console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); + }) - function sleep (ms) { + 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 getAbilityInfo(fileName) { + let context = await featureAbility.getContext(); + console.info("case0 context is " + context); + await context.getFilesDir().then((data) => { + console.info("case1 getFilesDir is path " + data); + mediaDir = data + '/' + fileName; + console.info('case2 mediaDir is ' + mediaDir); + }) } - async function closeFileDescriptor(fileName) { await resourceManager.getResourceManager().then(async (mgr) => { await mgr.closeRawFileDescriptor(fileName).then(value => { @@ -101,17 +83,27 @@ describe('audioCall', function () { }); }); } - 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 getFdRead(pathName) { + let context = await featureAbility.getContext(); + console.info("case0 context is " + context); + await context.getFilesDir().then((data) => { + console.info("case1 getFilesDir is path " + data); + filePath = data + '/' + pathName; + console.info('case4 filePath is ' + filePath); + }) + fdPath = 'fd://'; + await fileio.open(filePath).then((fdNumber) => { + fdPath = fdPath + '' + fdNumber; + fdRead = fdNumber; + console.info('[fileIO]case open fd success,fdPath is ' + fdPath); + console.info('[fileIO]case open fd success,fdRead is ' + fdRead); + + }, (err) => { + console.info('[fileIO]case open fd failed'); + }).catch((err) => { + console.info('[fileIO]case catch open fd failed'); + }); } async function applyPermission() { @@ -144,7 +136,7 @@ describe('audioCall', function () { } - async function playbackPromise (AudioRendererOptions, pathName, AudioScene) { + async function playbackPromise(AudioRendererOptions, pathName, AudioScene) { resultFlagRen = 'new'; console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); @@ -153,11 +145,11 @@ describe('audioCall', function () { audioRen = data; console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); - resultFlagRen=false; + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + resultFlagRen = false; return resultFlagRen; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); await audioRen.getStreamInfo().then(async function (audioParamsGet) { console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); @@ -166,11 +158,11 @@ describe('audioCall', function () { console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); resultFlagRen = false; }); - if (resultFlagRen == false){ - console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); + if (resultFlagRen == false) { + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); return resultFlagRen; } @@ -180,37 +172,37 @@ describe('audioCall', function () { console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); resultFlagRen = false; }); - if (resultFlagRen == false){ - console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); + if (resultFlagRen == false) { + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); return resultFlagRen; } await audioRen.start().then(async function () { console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); - resultFlagRen=false; + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlagRen = false; }); - if (resultFlagRen == false){ - console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); + if (resultFlagRen == false) { + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); return resultFlagRen; } - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize; await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlagRen=false; + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlagRen = false; }); - if (resultFlagRen == false){ - console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); + if (resultFlagRen == false) { + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); return resultFlagRen; } @@ -219,21 +211,21 @@ describe('audioCall', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); - if (rlen > (totalSize/2)){ + if (rlen > (totalSize / 2)) { await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : '+data); + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : ' + data); }).catch((err) => { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); - resultFlagRen=false; + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlagRen = false; }); } } @@ -242,42 +234,42 @@ describe('audioCall', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - resultFlagRen=false; + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + resultFlagRen = false; }); - if (resultFlagRen == false){ - console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); + if (resultFlagRen == false) { + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); return resultFlagRen; } - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); await audioRen.stop().then(async function () { console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - resultFlagRen=true; - console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); + resultFlagRen = true; + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlagRen=false; + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + resultFlagRen = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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); - resultFlagRen=false; + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + resultFlagRen = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); return resultFlagRen; } - async function recPromise (AudioCapturerOptions, fpath, AudioScene) { + async function recPromise(AudioCapturerOptions, fpath, AudioScene) { resultFlagRec = 'new'; console.info('AudioFrameworkRecLog: Promise : Audio Recording Function'); @@ -288,13 +280,13 @@ describe('audioCall', function () { audioCap = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return resultFlagRec; }); - console.info('AudioFrameworkRecLog: AudioCapturer : Path : '+fpath); + console.info('AudioFrameworkRecLog: AudioCapturer : Path : ' + fpath); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); await audioCap.getStreamInfo().then(async function (audioParamsGet) { @@ -304,11 +296,11 @@ describe('audioCall', function () { console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); resultFlagRec = false; }); - if (resultFlagRec == false){ - console.info('AudioFrameworkRecLog: resultFlagRec : '+resultFlagRec); + if (resultFlagRec == false) { + console.info('AudioFrameworkRecLog: resultFlagRec : ' + resultFlagRec); return resultFlagRec; } @@ -317,26 +309,26 @@ describe('audioCall', function () { console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); }).catch((err) => { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); resultFlagRec = false; }); - if (resultFlagRec == false){ - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlagRec); + if (resultFlagRec == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlagRec); return resultFlagRec; } await audioCap.start().then(async function () { console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - resultFlagRec=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + resultFlagRec = false; }); - if (resultFlagRec == false){ - console.info('AudioFrameworkRecLog: resultFlagRec : '+resultFlagRec); + if (resultFlagRec == false) { + console.info('AudioFrameworkRecLog: resultFlagRec : ' + resultFlagRec); return resultFlagRec; } - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); var bufferSize = await audioCap.getBufferSize(); console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); @@ -345,9 +337,9 @@ describe('audioCall', function () { if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); } - else{ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - resultFlagRec=false; + else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + resultFlagRec = false; return resultFlagRec; } @@ -355,9 +347,9 @@ describe('audioCall', function () { if (fd !== null) { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } - else{ + else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - resultFlagRec=false; + resultFlagRec = false; return resultFlagRec; } @@ -369,27 +361,27 @@ describe('audioCall', function () { numBuffersToCapture--; } - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); await audioCap.stop().then(async function () { console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - resultFlagRec=true; - console.info('AudioFrameworkRecLog: resultFlagRec : '+resultFlagRec); + resultFlagRec = true; + console.info('AudioFrameworkRecLog: resultFlagRec : ' + resultFlagRec); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - resultFlagRec=false; + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + resultFlagRec = false; }); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + 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); - resultFlagRec=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + resultFlagRec = false; }); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); return resultFlagRec; @@ -404,7 +396,7 @@ describe('audioCall', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_VOIP_Play_001', 0, async function (done) { + it('SUB_AUDIO_CALL_Play_001', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, @@ -424,13 +416,12 @@ describe('audioCall', function () { 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 getFdRead("StarWars10s-1C-44100-2SW.wav"); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(filePath); done(); }) @@ -442,7 +433,7 @@ describe('audioCall', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_VOIP_Rec_001', 0, async function (done) { + it('SUB_AUDIO_CALL_Rec_001', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, @@ -460,77 +451,78 @@ describe('audioCall', function () { streamInfo: AudioStreamInfo, capturerInfo: AudioCapturerInfo } - - var resultFlag = await recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getAbilityInfo("capture_js-44100-2C-16B.pcm"); + var resultFlag = await recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); done(); }) - /* * - * @tc.number : SUB_AUDIO_VOIP_RecPlay_001 - * @tc.name : - * @tc.desc : - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_RecPlay_001', 0, async function (done) { - - 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 - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 1 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfoCap, - capturerInfo: AudioCapturerInfo - } - - 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 - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfoRen, - rendererInfo: AudioRendererInfo - } - 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); - - if (resultFlagRec == true){ + /* * + * @tc.number : SUB_AUDIO_VOIP_RecPlay_001 + * @tc.name : + * @tc.desc : + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_CALL_RecPlay_001', 0, async function (done) { + + 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 + } + + var AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 1 + } + + var AudioCapturerOptions = { + streamInfo: AudioStreamInfoCap, + capturerInfo: AudioCapturerInfo + } + + 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 + } + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfoRen, + rendererInfo: AudioRendererInfo + } + await getAbilityInfo("capture_js-44100-2C-16B-2.pcm"); + recPromise(AudioCapturerOptions, mediaDir, 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); + + if (resultFlagRec == true) { expect(resultFlagRen).assertTrue(); } - else{ + else { expect(false).assertTrue(); } await closeFileDescriptor(readpath); done(); - }) + }) }) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js index 8de1f48aad7bfbf2325ae2a4069361acd9fbd081..68f7c2ed8eb1a532196d982054229ea1dfd63581 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js @@ -15,42 +15,33 @@ import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; -import ability_featureAbility from '@ohos.ability.featureAbility'; +import featureAbility from '@ohos.ability.featureAbility' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; +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'; var audioCapCallBack; var audioCapPromise; 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; - - }*/ - + async function getAbilityInfo(fileName) { + let context = await featureAbility.getContext(); + console.info("case0 context is " + context); + await context.getFilesDir().then((data) => { + console.info("case1 getFilesDir is path " + data); + fpath = data + '/' + fileName; + console.info('case2 fpath is ' + fpath); + }) + } + async function getInfo(fileName) { + let context = await featureAbility.getContext(); + console.info("case0 context is " + context); + await context.getFilesDir().then((data) => { + console.info("case1 getFilesDir is path " + data); + dirPath = data + '/' + fileName; + console.info('case2 fpath is ' + dirPath); + }) + } const audioManager = audio.getAudioManager(); console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); @@ -59,13 +50,7 @@ describe('audioCapturer', function () { beforeAll(async function () { console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - 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'); }) @@ -79,11 +64,6 @@ describe('audioCapturer', function () { }) afterAll(async function () { - /*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'); }) @@ -93,7 +73,7 @@ describe('audioCapturer', function () { } - async function recPromise (AudioCapturerOptions, fpath, AudioScene) { + async function recPromise(AudioCapturerOptions, fpath, AudioScene) { var resultFlag = 'new'; console.info('AudioFrameworkRecLog: Promise : Audio Recording Function'); @@ -104,13 +84,13 @@ describe('audioCapturer', function () { audioCap = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return resultFlag; }); - console.info('AudioFrameworkRecLog: AudioCapturer : Path : '+fpath); + console.info('AudioFrameworkRecLog: AudioCapturer : Path : ' + fpath); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); await audioCap.getStreamInfo().then(async function (audioParamsGet) { if (audioParamsGet != undefined) { @@ -120,16 +100,16 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); } else { - console.info('AudioFrameworkRecLog: audioParamsGet is : '+audioParamsGet); + console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); console.info('AudioFrameworkRecLog: audioParams getStreamInfo are incorrect: '); resultFlag = false; } }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); return resultFlag; } @@ -138,32 +118,32 @@ describe('audioCapturer', function () { 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); + } else { + console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); console.info('AudioFrameworkRecLog: audioParams getCapturerInfo are incorrect: '); resultFlag = false; } }).catch((err) => { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); return resultFlag; } await audioCap.start().then(async function () { console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); return resultFlag; } - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); var bufferSize = await audioCap.getBufferSize(); console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); @@ -172,9 +152,9 @@ describe('audioCapturer', function () { if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); } - else{ + else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - resultFlag=false; + resultFlag = false; return resultFlag; } @@ -182,9 +162,9 @@ describe('audioCapturer', function () { if (fd !== null) { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } - else{ + else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - resultFlag=false; + resultFlag = false; return resultFlag; } await sleep(100); @@ -200,64 +180,62 @@ describe('audioCapturer', function () { numBuffersToCapture--; } await sleep(1000); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); await audioCap.stop().then(async function () { console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - resultFlag=true; - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + resultFlag = true; + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + 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: Capturer release :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); return resultFlag; } - async function recCallBack (AudioCapturerOptions, fpath, AudioScene) { + async function recCallBack(AudioCapturerOptions, fpath, AudioScene) { var resultFlag = true; console.info('AudioFrameworkRecLog: CallBack : Audio Recording Function'); - //var audioCap; - - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioManagerRec.getAudioScene(async(err,getValue) => { + audioManagerRec.getAudioScene(async (err, getValue) => { console.info('AudioFrameworkRecLog: ---------GET AUDIO SCENE---------'); - if(err){ - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : '+err.message); - resultFlag=false; - }else { - console.info('AudioFrameworkRecLog: getAudioScene : Value : '+getValue); + if (err) { + console.info('AudioFrameworkRecLog: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + } else { + console.info('AudioFrameworkRecLog: getAudioScene : Value : ' + getValue); } }); await sleep(1000); - audioCapCallBack.getStreamInfo(async(err,audioParamsGet) => { + audioCapCallBack.getStreamInfo(async (err, audioParamsGet) => { console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); console.log('AudioFrameworkRecLog: Entered getStreamInfo'); - if (err){ - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); + if (err) { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); resultFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); @@ -268,10 +246,10 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.getCapturerInfo(async(err,audioParamsGet) => { + audioCapCallBack.getCapturerInfo(async (err, audioParamsGet) => { console.info('AudioFrameworkRecLog: ---------GET CAPTURER INFO---------'); - if (err){ - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); + if (err) { + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); resultFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); @@ -280,14 +258,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - resultFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + resultFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); } @@ -301,9 +279,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR '); - resultFlag=false; + resultFlag = false; return resultFlag; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); @@ -312,7 +290,7 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - resultFlag=false; + resultFlag = false; return resultFlag; } @@ -328,35 +306,35 @@ describe('audioCapturer', function () { numBuffersToCapture--; } //await sleep(3000); - audioCapCallBack.stop(async(err,value) => { + audioCapCallBack.stop(async (err, value) => { console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - resultFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + resultFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - resultFlag=true; - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + resultFlag = true; + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); } }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - resultFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + resultFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - resultFlag=true; - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + resultFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); //return resultFlag; } }); //await sleep(3000); - console.info('AudioFrameworkRenderLog: After all check resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: After all check resultFlag : ' + resultFlag); return resultFlag; } @@ -369,7 +347,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_PREPARED_STATE_001', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -387,25 +365,25 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); - 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(); - } + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + 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(); + } } }); @@ -420,7 +398,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_PREPARED_STATE_ENUM_002', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -438,21 +416,21 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + 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(); + } }) @@ -465,7 +443,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_RUNNING_STATE_003', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -483,23 +461,23 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); - await audioCapCallBack.start(async (err,value) => { + await audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RUNNING STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); if ((audioCapCallBack.state == audio.AudioState.STATE_RUNNING)) { @@ -509,16 +487,16 @@ describe('audioCapturer', function () { } }); await sleep(1000); - await audioCapCallBack.release(async(err,value) => { + await audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); //return resultFlag; @@ -536,7 +514,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_RUNNING_STATE_EUNM_004', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -554,23 +532,23 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); - await audioCapCallBack.start(async (err,value) => { + await audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RUNNING STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); if ((audioCapCallBack.state == 2)) { @@ -580,16 +558,16 @@ describe('audioCapturer', function () { } }); await sleep(1000); - await audioCapCallBack.release(async(err,value) => { + await audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); //return resultFlag; @@ -607,7 +585,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_STOPPED_STATE_005', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -625,24 +603,24 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); if ((audioCapCallBack.state == 2)) { @@ -651,33 +629,33 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.stop(async(err,value) => { + audioCapCallBack.stop(async (err, value) => { console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); if ((audioCapCallBack.state == audio.AudioState.STATE_STOPPED)) { console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); stateFlag = true; } - console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); } }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); //return resultFlag; @@ -695,7 +673,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_STOPPED_STATE_ENUM_006', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -713,54 +691,54 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); stateFlag == true; } }); await sleep(1000); - audioCapCallBack.stop(async(err,value) => { + audioCapCallBack.stop(async (err, value) => { console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); if ((audioCapCallBack.state == 3)) { console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); stateFlag = true; } - console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); } }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); //return resultFlag; @@ -778,7 +756,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_RELEASED_STATE_007', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -796,23 +774,23 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); if ((audioCapCallBack.state == 2)) { @@ -821,34 +799,34 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.stop(async(err,value) => { + audioCapCallBack.stop(async (err, value) => { console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); if ((audioCapCallBack.state == 3)) { stateFlag = true; } - console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); } }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + 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); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); if ((audioCapCallBack.state == audio.AudioState.STATE_RELEASED)) { console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } @@ -866,7 +844,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_RELEASED_STATE_ENUM_008', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -884,24 +862,24 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); if ((audioCapCallBack.state == 2)) { @@ -910,34 +888,34 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.stop(async(err,value) => { + audioCapCallBack.stop(async (err, value) => { console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); if ((audioCapCallBack.state == 3)) { stateFlag = true; } - console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); } }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + 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); + 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); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } @@ -955,7 +933,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_GET_BUFFER_SIZE_009', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -973,23 +951,23 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); if ((audioCapCallBack.state == 2)) { @@ -999,30 +977,30 @@ describe('audioCapturer', function () { }); await sleep(1000); console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(async(err,cbbufferSize) => { - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + var bufferSize = await audioCapCallBack.getBufferSize(async (err, cbbufferSize) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK BUFFER SIZE---------'); console.info('AudioFrameworkRecLog: buffer size: ' + cbbufferSize); stateFlag = true - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); console.info('AudioFrameworkRecLog: ---------AFTER CHECK BUFFER SIZE : PASS---------') } }); console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); //return resultFlag; @@ -1040,8 +1018,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_010', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1059,23 +1037,23 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -1091,9 +1069,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -1101,45 +1079,46 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; } await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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); @@ -1154,7 +1133,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_011', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1176,16 +1155,16 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return stateFlag; }); - - if ((audioCapPromise.state == audio.AudioState.STATE_PREPARED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } + + if ((audioCapPromise.state == audio.AudioState.STATE_PREPARED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } }) /* * @@ -1197,7 +1176,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_ENUM_012', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1219,16 +1198,16 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return stateFlag; }); - - if ((audioCapPromise.state == 1)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } + + if ((audioCapPromise.state == 1)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } }) @@ -1241,7 +1220,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_013', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1263,36 +1242,36 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return stateFlag; }); await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapPromise.state == audio.AudioState.STATE_RUNNING)) { stateFlag = true; } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); await audioCapPromise.release().then(async function () { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); //return resultFlag; }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); }) @@ -1306,7 +1285,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_ENUM_014', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1328,36 +1307,36 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return stateFlag; }); await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapPromise.state == 2)) { stateFlag = true; } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); await audioCapPromise.release().then(async function () { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); //return resultFlag; }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); }) @@ -1371,7 +1350,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_015', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1393,47 +1372,47 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return stateFlag; }); await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapPromise.state == audio.AudioState.STATE_STOPPED)) { stateFlag = true; } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); await audioCapPromise.stop().then(async function () { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - if ((audioCapPromise.state == audioCapPromise.AudioState.STATE_STOPPED)){ - stateFlag=true; - console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag); + if ((audioCapPromise.state == audioCapPromise.AudioState.STATE_STOPPED)) { + stateFlag = true; + console.info('AudioFrameworkRecLog: resultFlag : ' + stateFlag); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); await audioCapPromise.release().then(async function () { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false }); await sleep(1000); }) @@ -1447,7 +1426,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_ENUM_016', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1469,48 +1448,48 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return stateFlag; }); await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapPromise.state == audio.AudioState.STATE_STOPPED)) { stateFlag = true; } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); await audioCapPromise.stop().then(async function () { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - if ((audioCapPromise.state == 3)){ - stateFlag=true; - console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag); + if ((audioCapPromise.state == 3)) { + stateFlag = true; + console.info('AudioFrameworkRecLog: resultFlag : ' + stateFlag); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); await audioCapPromise.release().then(async function () { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); //return resultFlag; }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); }) @@ -1598,7 +1577,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_RELEASED_STATE_ENUM_018', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1620,19 +1599,19 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return stateFlag; }); - + await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); stateFlag = true; }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); @@ -1641,11 +1620,11 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); stateFlag = true; }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); - await audioCapPromise.release().then(async function (){ + await audioCapPromise.release().then(async function () { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); @@ -1658,8 +1637,8 @@ describe('audioCapturer', function () { done(); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); }) @@ -1673,7 +1652,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_GET_BUFFER_SIZE_019', 0, async function (done) { - var stateFlag ; + var stateFlag; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1695,21 +1674,21 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return stateFlag; }); await sleep(1000); await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapPromise.state == 2)) { stateFlag = true; } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); @@ -1732,8 +1711,8 @@ describe('audioCapturer', function () { done(); } }).catch((err) => { - console.info('AudioFrameworkRecLog: ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); }) @@ -1747,8 +1726,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_READ_BUFFER_020', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkpromisereadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkpromisereadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -1770,21 +1749,21 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return stateFlag; }); await sleep(1000); await audioCapPromise.start().then(async function () { console.info('AudioFrameworkRecLog: ---------START---------'); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapPromise.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapPromise.state == 2)) { stateFlag = true; } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); @@ -1797,9 +1776,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -1807,7 +1786,7 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } //await sleep(1000); var numBuffersToCapture = 45; @@ -1838,8 +1817,8 @@ describe('audioCapturer', function () { done(); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); }) @@ -1871,9 +1850,10 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - var resultFlag = await recCallBack(AudioCapturerOptions, dirPath+'/capture_CB_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_CB_js-44100-2C-16B.pcm"); + var resultFlag = await recCallBack(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(1000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); done(); }) @@ -1905,9 +1885,10 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - var resultFlag = await recCallBack(AudioCapturerOptions, dirPath+'/capture_CB_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_CB_js-44100-2C-16B.pcm"); + var resultFlag = await recCallBack(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(1000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); done(); }) @@ -1941,9 +1922,10 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - var resultFlag = await recPromise(AudioCapturerOptions, dirPath+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-44100-2C-16B.pcm"); + var resultFlag = await recPromise(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -1979,9 +1961,10 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - var resultFlag = await recPromise(AudioCapturerOptions, dirPath+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-44100-2C-16B.pcm"); + var resultFlag = await recPromise(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2006,16 +1989,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions44100 = { streamInfo: audioStreamInfo44100, capturerInfo: audioCapturerInfo44100, } - var resultFlag = await recPromise(audioCapturerOptions44100, dirPath+'/capture_js-44100-1C-16LE.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-44100-1C-16LE.pcm"); + var resultFlag = await recPromise(audioCapturerOptions44100, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2040,16 +2024,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions44100 = { streamInfo: audioStreamInfo44100, capturerInfo: audioCapturerInfo44100, } - var resultFlag = await recPromise(audioCapturerOptions44100, dirPath+'/capture_js-44100-1C-16LE.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-44100-1C-16LE.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions44100, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2073,16 +2059,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo96000 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions96000 = { streamInfo: audioStreamInfo96000, capturerInfo: audioCapturerInfo96000, } - var resultFlag = await recPromise(audioCapturerOptions96000, dirPath+'/capture_js-96000-1C-S24LE.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-96000-1C-S24LE.pcm"); + var resultFlag = await recPromise(audioCapturerOptions96000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2106,16 +2093,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo96000 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions96000 = { streamInfo: audioStreamInfo96000, capturerInfo: audioCapturerInfo96000, } - var resultFlag = await recPromise(audioCapturerOptions96000, dirPath+'/capture_js-96000-1C-S24LE.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-96000-1C-S24LE.pcm"); + var resultFlag = await recPromise(audioCapturerOptions96000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2139,16 +2127,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo48000 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions48000 = { streamInfo: audioStreamInfo48000, capturerInfo: audioCapturerInfo48000, } - var resultFlag = await recPromise(audioCapturerOptions48000, dirPath+'/capture_js-48000-2C-1S32LE.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-48000-2C-1S32LE.pcm"); + var resultFlag = await recPromise(audioCapturerOptions48000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2172,16 +2161,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo48000 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions48000 = { streamInfo: audioStreamInfo48000, capturerInfo: audioCapturerInfo48000, } - var resultFlag = await recPromise(audioCapturerOptions48000, dirPath+'/capture_js-48000-2C-1S32LE.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-48000-2C-1S32LE.pcm"); + var resultFlag = await recPromise(audioCapturerOptions48000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2205,16 +2195,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo8000 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions8000 = { streamInfo: audioStreamInfo8000, capturerInfo: audioCapturerInfo8000, } - var resultFlag = await recPromise(audioCapturerOptions8000, dirPath+'/capture_js-8000-1C-8B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-8000-1C-8B.pcm"); + var resultFlag = await recPromise(audioCapturerOptions8000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2238,16 +2229,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo8000 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions8000 = { streamInfo: audioStreamInfo8000, capturerInfo: audioCapturerInfo8000, } - var resultFlag = await recPromise(audioCapturerOptions8000, dirPath+'/capture_js-8000-1C-8B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-8000-1C-8B.pcm"); + var resultFlag = await recPromise(audioCapturerOptions8000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2271,16 +2263,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo11025 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions11025 = { streamInfo: audioStreamInfo11025, capturerInfo: audioCapturerInfo11025, } - var resultFlag = await recPromise(audioCapturerOptions11025, dirPath+'/capture_js-11025-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-11025-2C-16B.pcm"); + var resultFlag = await recPromise(audioCapturerOptions11025, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2304,16 +2297,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo11025 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions11025 = { streamInfo: audioStreamInfo11025, capturerInfo: audioCapturerInfo11025, } - var resultFlag = await recPromise(audioCapturerOptions11025, dirPath+'/capture_js-11025-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-11025-2C-16B.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions11025, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2337,16 +2332,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo12000 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions12000 = { streamInfo: audioStreamInfo12000, capturerInfo: audioCapturerInfo12000, } - var resultFlag = await recPromise(audioCapturerOptions12000, dirPath+'/capture_js-12000-1C-24B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-12000-1C-24B.pcm"); + var resultFlag = await recPromise(audioCapturerOptions12000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2370,16 +2366,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo12000 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions12000 = { streamInfo: audioStreamInfo12000, capturerInfo: audioCapturerInfo12000, } - var resultFlag = await recPromise(audioCapturerOptions12000, dirPath+'/capture_js-12000-1C-24B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-12000-1C-24B.pcm"); + var resultFlag = await recPromise(audioCapturerOptions12000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2403,16 +2400,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo16000 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions16000 = { streamInfo: audioStreamInfo16000, capturerInfo: audioCapturerInfo16000, } - var resultFlag = await recPromise(audioCapturerOptions16000, dirPath+'/capture_js-16000-2C-32B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-16000-2C-32B.pcm"); + var resultFlag = await recPromise(audioCapturerOptions16000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2436,16 +2434,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo16000 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions16000 = { streamInfo: audioStreamInfo16000, capturerInfo: audioCapturerInfo16000, } - var resultFlag = await recPromise(audioCapturerOptions16000, dirPath+'/capture_js-16000-2C-32B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-16000-2C-32B.pcm"); + var resultFlag = await recPromise(audioCapturerOptions16000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2469,16 +2468,17 @@ describe('audioCapturer', function () { }; var audioCapturerInfo22050 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions22050 = { streamInfo: audioStreamInfo22050, capturerInfo: audioCapturerInfo22050, } - var resultFlag = await recPromise(audioCapturerOptions22050, dirPath+'/capture_js-22050-1C-8B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-22050-1C-8B.pcm"); + var resultFlag = await recPromise(audioCapturerOptions22050, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2502,16 +2502,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo22050 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions22050 = { streamInfo: audioStreamInfo22050, capturerInfo: audioCapturerInfo22050, } - var resultFlag = await recPromise(audioCapturerOptions22050, dirPath+'/capture_js-22050-1C-8B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-22050-1C-8B.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions22050, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2535,16 +2537,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo24000 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions24000 = { streamInfo: audioStreamInfo24000, capturerInfo: audioCapturerInfo24000, } - var resultFlag = await recPromise(audioCapturerOptions24000, dirPath+'/capture_js-24000-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-24000-2C-16B.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions24000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2568,16 +2572,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo24000 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions24000 = { streamInfo: audioStreamInfo24000, capturerInfo: audioCapturerInfo24000, } - var resultFlag = await recPromise(audioCapturerOptions24000, dirPath+'/capture_js-24000-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-24000-2C-16B.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions24000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2601,16 +2607,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo32000 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions32000 = { streamInfo: audioStreamInfo32000, capturerInfo: audioCapturerInfo32000, } - var resultFlag = await recPromise(audioCapturerOptions32000, dirPath+'/capture_js-32000-1C-24B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-32000-1C-24B.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions32000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2634,16 +2642,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo32000 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions32000 = { streamInfo: audioStreamInfo32000, capturerInfo: audioCapturerInfo32000, } - var resultFlag = await recPromise(audioCapturerOptions32000, dirPath+'/capture_js-32000-1C-24B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-32000-1C-24B.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions32000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2671,16 +2681,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo64000 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions64000 = { streamInfo: audioStreamInfo64000, capturerInfo: audioCapturerInfo64000, } - var resultFlag = await recPromise(audioCapturerOptions64000, dirPath+'/capture_js-64000-2C-32B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-64000-2C-32B.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions64000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2706,16 +2718,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo64000 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions64000 = { streamInfo: audioStreamInfo64000, capturerInfo: audioCapturerInfo64000, } - var resultFlag = await recPromise(audioCapturerOptions64000, dirPath+'/capture_js-64000-2C-32B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getInfo("capture_js-64000-2C-32B.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions64000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2740,16 +2754,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + 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 getInfo("capture_js-44100-1C-16LE.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions44100, dirPath, audio.AudioScene.AUDIO_SCENE_DEFAULT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2774,16 +2790,18 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags : 1, + capturerFlags: 1, } var audioCapturerOptions44100 = { streamInfo: audioStreamInfo44100, capturerInfo: audioCapturerInfo44100, } - var resultFlag = await recPromise(audioCapturerOptions44100, dirPath+'/capture_js-44100-1C-16LE.pcm', 0); + await getInfo("capture_js-44100-1C-16LE.pcm"); + + var resultFlag = await recPromise(audioCapturerOptions44100, dirPath, 0); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); @@ -2800,8 +2818,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_START_055', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -2819,23 +2837,23 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -2844,7 +2862,7 @@ describe('audioCapturer', function () { }); await sleep(1000); await audioCapCallBack.getAudioTime().then(async function (audioTime) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER START : Success' + audioTime ); + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER START : Success' + audioTime); if (audioTime != 0) { stateFlag = true; expect(stateFlag).assertTrue(); @@ -2853,11 +2871,11 @@ describe('audioCapturer', function () { expect(stateFlag).assertTrue(); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); await sleep(1000); await audioCapCallBack.getAudioTime().then(async function (audioTime) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime : Success' + audioTime ); + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime : Success' + audioTime); if (audioTime != 0) { stateFlag = true; expect(stateFlag).assertTrue(); @@ -2866,24 +2884,25 @@ describe('audioCapturer', function () { expect(stateFlag).assertTrue(); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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); @@ -2898,8 +2917,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_056', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -2917,23 +2936,23 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -2942,14 +2961,14 @@ describe('audioCapturer', function () { }); await sleep(1000); await audioCapCallBack.getAudioTime().then(async function (audioTime) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime ); + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime); if (audioTime != 0) { stateFlag = true; } else { stateFlag = false; } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); await sleep(1000); console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); @@ -2960,9 +2979,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -2970,34 +2989,34 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); await audioCapCallBack.getAudioTime().then(async function (audioTime1) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime1 ); + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime1); if (audioTime1 != 0) { stateFlag = true; } else { stateFlag = false; } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -3005,31 +3024,32 @@ describe('audioCapturer', function () { await sleep(3000); await audioCapCallBack.getAudioTime().then(async function (audioTime2) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime2 ); + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime2); if (audioTime2 != 0) { stateFlag = true; } else { stateFlag = false; } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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); @@ -3044,8 +3064,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_057', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -3063,23 +3083,23 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -3088,14 +3108,14 @@ describe('audioCapturer', function () { }); await sleep(1000); await audioCapCallBack.getAudioTime().then(async function (audioTime) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime ); + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime); if (audioTime != 0) { stateFlag = true; } else { stateFlag = false; } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); await sleep(1000); console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); @@ -3106,9 +3126,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -3116,85 +3136,86 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); await audioCapCallBack.getAudioTime().then(async function (audioTime1) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime1 ); + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime1); if (audioTime1 != 0) { stateFlag = true; } else { stateFlag = false; } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; } await sleep(3000); - audioCapCallBack.stop(async(err,value) => { + audioCapCallBack.stop(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 STOP STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - if ((audioCapCallBack.state == 3)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOP STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); - done(); - } + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOP STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 3)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOP STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + done(); + } } }); await sleep(1000); await audioCapCallBack.getAudioTime().then(async function (audioTime2) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime2 ); + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime2); if (audioTime2 != 0) { stateFlag == true; } else { stateFlag == false; } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + 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); + 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); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } else { stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } @@ -3213,8 +3234,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_GET_AUDIO_TIME_058', 0, async function (done) { - var stateFlag ; - var audioCapCallBack ; + var stateFlag; + var audioCapCallBack; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -3232,24 +3253,24 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); await audioCapCallBack.start().then(async function () { console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; }); await sleep(1000); - await audioCapCallBack.getAudioTime(async(err,audioTime) => { - if (err){ + await audioCapCallBack.getAudioTime(async (err, audioTime) => { + if (err) { console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); } else { console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime : Success' + audioTime); @@ -3261,24 +3282,24 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + 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); + 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); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } else { stateFlag = false; - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } @@ -3368,7 +3389,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_PROMISE_RELEASE_BEFORE_START_060', 0, async function (done) { - var stateFlag ; + var stateFlag; var audioCapPromise; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, @@ -3391,18 +3412,18 @@ describe('audioCapturer', function () { audioCapPromise = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO NEW STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); stateFlag = true; }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); await sleep(1000); await audioCapPromise.release().then(async function () { console.info('AudioFrameworkRecLog: Capturer released :SUCCESS '); - stateFlag=true; + stateFlag = true; }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop :ERROR : ' + err.message); + stateFlag = false; expect(stateFlag).assertTrue(); }); await sleep(1000); @@ -3458,13 +3479,13 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); audioCapGetgetStreamInfo = data; } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); done(); }); await sleep(1000); @@ -3475,11 +3496,11 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); setFlag = true; - if (setFlag){ - console.info('AudioFrameworkRecLog: Capturer getStreamInfo: PASS' ); + if (setFlag) { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo: PASS'); } }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); setFlag = false }); await sleep(1000); @@ -3525,7 +3546,7 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var AudioCapturerOptionsInvalid = { streamInfo: audioStreamInfo44100, @@ -3534,13 +3555,13 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); audioCapGetgetStreamInfo = data; } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); done(); }); await sleep(1000); @@ -3550,13 +3571,13 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); - setFlag = true ; - if (setFlag){ - console.info('AudioFrameworkRecLog: Capturer getStreamInfo: PASS' ); + setFlag = true; + if (setFlag) { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo: PASS'); } }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); - setFlag = false ; + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); + setFlag = false; expect(setFlag).assertTrue(); }); await sleep(1000); @@ -3613,21 +3634,21 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); audioCapGetgetStreamInfo = data; } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); done(); }); await sleep(1000); - audioCapGetgetStreamInfo.getStreamInfo(async(err,audioParamsGet) => { + audioCapGetgetStreamInfo.getStreamInfo(async (err, audioParamsGet) => { console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); console.log('AudioFrameworkRecLog: Entered getStreamInfo'); - if (err){ - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); + if (err) { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); setFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); @@ -3683,7 +3704,7 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var AudioCapturerOptionsInvalid = { streamInfo: audioStreamInfo44100, @@ -3692,21 +3713,21 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); audioCapGetgetStreamInfo = data; } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); done(); }); await sleep(1000); - audioCapGetgetStreamInfo.getStreamInfo(async(err,audioParamsGet) => { + audioCapGetgetStreamInfo.getStreamInfo(async (err, audioParamsGet) => { console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); console.log('AudioFrameworkRecLog: Entered getStreamInfo'); - if (err){ - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); + if (err) { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); setFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); @@ -3773,13 +3794,13 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); audioCapGetgetCapturerInfo = data; } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); done(); }); await sleep(1000); @@ -3789,7 +3810,7 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); setFlag = true; }).catch((err) => { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); setFlag = false; }); await sleep(1000); @@ -3836,7 +3857,7 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var AudioCapturerOptionsInvalid = { streamInfo: audioStreamInfo44100, @@ -3845,13 +3866,13 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); audioCapGetgetCapturerInfo = data; } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); done(); }); await sleep(1000); @@ -3862,7 +3883,7 @@ describe('audioCapturer', function () { setFlag = true; }).catch((err) => { setFlag = false; - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); }); await sleep(1000); audioCapGetgetCapturerInfo.release(async (err, value) => { @@ -3918,20 +3939,20 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); audioCapGetgetCapturerInfo = data; } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); done(); }); await sleep(1000); - audioCapGetgetCapturerInfo.getCapturerInfo(async(err,audioParamsGet) => { + audioCapGetgetCapturerInfo.getCapturerInfo(async (err, audioParamsGet) => { console.info('AudioFrameworkRecLog: ---------GET CAPTURER INFO---------'); - if (err){ - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); + if (err) { + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); setFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); @@ -3985,7 +4006,7 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var AudioCapturerOptionsInvalid = { streamInfo: audioStreamInfo44100, @@ -3994,20 +4015,20 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); audioCapGetgetCapturerInfo = data; } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); done(); }); await sleep(1000); - audioCapGetgetCapturerInfo.getCapturerInfo(async(err,audioParamsGet) => { + audioCapGetgetCapturerInfo.getCapturerInfo(async (err, audioParamsGet) => { console.info('AudioFrameworkRecLog: ---------GET CAPTURER INFO---------'); - if (err){ - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); + if (err) { + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); setFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); @@ -4058,7 +4079,7 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: 1, - capturerFlags : 1, + capturerFlags: 1, } var AudioCapturerOptionsInvalid = { streamInfo: audioStreamInfo44100, @@ -4069,13 +4090,13 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data == undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); expect(true).assertTrue(); } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); done(); }) @@ -4098,7 +4119,7 @@ describe('audioCapturer', function () { }; var audioCapturerInfo44100 = { source: 1000, - capturerFlags : 1, + capturerFlags: 1, } var AudioCapturerOptionsInvalid = { streamInfo: audioStreamInfo44100, @@ -4107,14 +4128,14 @@ describe('audioCapturer', function () { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { if (data == undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :'+ data ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); expect(true).assertTrue(); } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:'+ data.state ); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); } }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); }); done(); }) @@ -4128,7 +4149,7 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_ON_ALL_CASES_070', 0, async function (done) { - var stateFlag ; + var stateFlag; var audioCapCallBack; var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, @@ -4144,16 +4165,16 @@ describe('audioCapturer', function () { streamInfo: AudioStreamInfo, capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.on('stateChange',(AudioState) => { + audioCapCallBack.on('stateChange', (AudioState) => { console.info('AudioCapturerLog: Changed State to : ' + AudioState) switch (AudioState) { case audio.AudioState.STATE_NEW: @@ -4183,14 +4204,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); if ((audioCapCallBack.state == 2)) { @@ -4200,33 +4221,33 @@ describe('audioCapturer', function () { }); await sleep(1000); - audioCapCallBack.stop(async(err,value) => { + audioCapCallBack.stop(async (err, value) => { console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); if ((audioCapCallBack.state == audio.AudioState.STATE_STOPPED)) { console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); stateFlag == true; } - console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); } }); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - stateFlag=true; - console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } @@ -4379,14 +4400,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); if ((audioCapCallBack.state == 2)) { @@ -4476,14 +4497,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); await sleep(1000); if ((audioCapCallBack.state == 2)) { @@ -4493,20 +4514,20 @@ describe('audioCapturer', function () { }); await sleep(1000); - audioCapCallBack.stop(async(err,value) => { + audioCapCallBack.stop(async (err, value) => { console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); if ((audioCapCallBack.state == audio.AudioState.STATE_STOPPED)) { console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); stateFlag == true; } - console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); } }); @@ -4537,8 +4558,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_5000_REACH_075', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -4556,12 +4577,12 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); @@ -4577,14 +4598,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -4600,9 +4621,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -4610,25 +4631,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -4636,24 +4657,24 @@ describe('audioCapturer', function () { await sleep(3000); audioCapCallBack.off('markReach'); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + 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); + 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); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } else { stateFlag = false; - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } @@ -4671,8 +4692,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_1000_REACH_076', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -4690,12 +4711,12 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); @@ -4711,14 +4732,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -4734,9 +4755,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -4744,25 +4765,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -4770,36 +4791,37 @@ describe('audioCapturer', function () { await sleep(3000); audioCapCallBack.off('markReach'); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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; - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_10000_REACH_077 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM + 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; + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /* * + * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_10000_REACH_077 + * @tc.name : AudioCapturer-Check-READ_BUFFER + * @tc.desc : AudioCapturer with read buffer + * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_10000_REACH_077', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -4817,12 +4839,12 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); @@ -4838,14 +4860,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -4861,9 +4883,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -4871,25 +4893,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -4897,21 +4919,22 @@ describe('audioCapturer', function () { await sleep(3000); audioCapCallBack.off('markReach'); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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); @@ -4926,8 +4949,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_100_REACH_078', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -4945,12 +4968,12 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); @@ -4966,14 +4989,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -4989,9 +5012,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -4999,25 +5022,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -5025,21 +5048,22 @@ describe('audioCapturer', function () { await sleep(3000); audioCapCallBack.off('markReach'); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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); @@ -5054,8 +5078,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_1_REACH_079', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -5073,12 +5097,12 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); @@ -5094,14 +5118,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -5117,9 +5141,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -5127,25 +5151,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -5153,21 +5177,22 @@ describe('audioCapturer', function () { await sleep(3000); audioCapCallBack.off('markReach'); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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); @@ -5183,8 +5208,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_0_REACH_080', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -5202,12 +5227,12 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); @@ -5223,14 +5248,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -5246,9 +5271,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -5256,25 +5281,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -5282,21 +5307,22 @@ describe('audioCapturer', function () { await sleep(3000); audioCapCallBack.off('markReach'); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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); @@ -5312,8 +5338,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_LARGEVALUE_REACH_081', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -5331,12 +5357,12 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); @@ -5352,14 +5378,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -5375,9 +5401,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -5385,25 +5411,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -5411,21 +5437,22 @@ describe('audioCapturer', function () { await sleep(3000); audioCapCallBack.off('markReach'); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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); @@ -5440,8 +5467,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_NEGATIVEVALUE_REACH_082', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -5459,12 +5486,12 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); @@ -5480,14 +5507,14 @@ describe('audioCapturer', function () { } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -5503,9 +5530,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -5513,25 +5540,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -5539,38 +5566,38 @@ describe('audioCapturer', function () { await sleep(3000); audioCapCallBack.off('markReach'); await sleep(1000); - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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); }) - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_STRINGVALUE_REACH_083 + * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1000_084 * @tc.name : AudioCapturer-Check-READ_BUFFER * @tc.desc : AudioCapturer with read buffer * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0*/ - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_STRINGVALUE_REACH_083', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1000_084', 0, async function (done) { + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -5588,35 +5615,33 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.on('markReach', "HARSHA", (position) => { - if (position == "HARSHA") { + audioCapCallBack.on('periodReach', 1000, (position) => { + if (position == "1000") { console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioRenderLog: mark reached: ' + position); stateFlag = true; } else { stateFlag = false; - expect(stateFlag).assertTrue(); - done(); } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -5632,9 +5657,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -5642,195 +5667,70 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; } await sleep(3000); - audioCapCallBack.off('markReach'); + audioCapCallBack.off('periodReach'); await sleep(1000); - 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---------'); + 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); + 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); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); expect(stateFlag).assertTrue(); done(); } - } - }); - await sleep(1000); - }) - - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1000_084 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1000_084', 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); - audioCapCallBack.on('periodReach',1000, (position) => { - if (position == "1000") { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true ; - } else { - stateFlag = false; - } - }); - await sleep(1000); - audioCapCallBack.start(async (err,value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(fpath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - }else{ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(fpath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag=true; - } - }); - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('periodReach'); - await sleep(1000); - 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) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; expect(stateFlag).assertTrue(); - } 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---------'); - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); - stateFlag=false; - expect(stateFlag).assertTrue(); - done(); - } + } 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---------'); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } } }); await sleep(1000); @@ -5847,8 +5747,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1_085', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -5866,33 +5766,33 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.on('periodReach',1, (position) => { + audioCapCallBack.on('periodReach', 1, (position) => { if (position == "1") { console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true ; + stateFlag = true; } else { stateFlag = false; } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -5908,9 +5808,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -5918,25 +5818,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -5945,41 +5845,43 @@ describe('audioCapturer', function () { audioCapCallBack.off('periodReach'); await sleep(1000); if (stateFlag == true) { - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; expect(stateFlag).assertTrue(); - } 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---------'); - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); - stateFlag=false; - expect(stateFlag).assertTrue(); - done(); - } + } 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---------'); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } } }); await sleep(1000); @@ -5996,8 +5898,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_NEGATIVE_086', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -6015,33 +5917,33 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.on('periodReach',-2, (position) => { + audioCapCallBack.on('periodReach', -2, (position) => { if (position == -2) { console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true ; + stateFlag = true; } else { stateFlag = false; } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -6057,9 +5959,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -6067,25 +5969,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -6094,41 +5996,43 @@ describe('audioCapturer', function () { audioCapCallBack.off('periodReach'); await sleep(1000); if (stateFlag == true) { - audioCapCallBack.release(async(err,value) => { + 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(); - } + 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) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; expect(stateFlag).assertTrue(); - } 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---------'); - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); - stateFlag=false; - expect(stateFlag).assertTrue(); - done(); - } + } 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---------'); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } } }); await sleep(1000); @@ -6146,8 +6050,8 @@ describe('audioCapturer', function () { * @tc.level : Level 0*/ it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_223750_087', 0, async function (done) { - var stateFlag ; - var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; + var stateFlag; + await getAbilityInfo("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, channels: audio.AudioChannel.CHANNEL_2, @@ -6165,33 +6069,33 @@ describe('audioCapturer', function () { capturerInfo: AudioCapturerInfo } - audio.createAudioCapturer(AudioCapturerOptions,async(err,value) => { - if (err){ + 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); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); } }); await sleep(1000); - audioCapCallBack.on('periodReach',223750, (position) => { + audioCapCallBack.on('periodReach', 223750, (position) => { if (position == 223750) { console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioRenderLog: periodReach: ' + position); - stateFlag = true ; + stateFlag = true; } else { stateFlag = false; } }); await sleep(1000); - audioCapCallBack.start(async (err,value) => { + audioCapCallBack.start(async (err, value) => { console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); if ((audioCapCallBack.state == 2)) { stateFlag = true; @@ -6207,9 +6111,9 @@ describe('audioCapturer', function () { var fd = fileio.openSync(fpath, 0o102, 0o777); if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); - }else{ + } else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; + stateFlag = false; } console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); fd = fileio.openSync(fpath, 0o2002, 0o666); @@ -6217,25 +6121,25 @@ describe('audioCapturer', function () { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; + stateFlag = false; } await sleep(1000); var numBuffersToCapture = 45; while (numBuffersToCapture) { console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); await sleep(50); console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); var number = fileio.writeSync(fd, buffer); console.info('BufferRecLog: data written: ' + number); await sleep(100); - stateFlag=true; + stateFlag = true; } }); numBuffersToCapture--; @@ -6244,195 +6148,47 @@ describe('audioCapturer', function () { audioCapCallBack.off('periodReach'); await sleep(1000); if (stateFlag == true) { - audioCapCallBack.release(async(err,value) => { + 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; - expect(stateFlag).assertTrue(); - } 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---------'); - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); - stateFlag=false; - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } - - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_STRING_088 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_STRING_088', 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); - audioCapCallBack.on('periodReach',"Harsha", (position) => { - if (position == "Harsha") { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: periodReach: ' + position); - stateFlag = true ; - } else { - stateFlag = false; - } - }); - await sleep(1000); - audioCapCallBack.start(async (err,value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - stateFlag=false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(fpath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - }else{ - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag=false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(fpath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag=false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - audioCapCallBack.read(bufferSize, true,async(err,buffer) => { if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : '+buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag=true; - } - }); - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('periodReach'); - await sleep(1000); - 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(); - } + 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) => { + audioCapCallBack.release(async (err, value) => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err){ - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); - stateFlag=false; + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; expect(stateFlag).assertTrue(); - } 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---------'); - console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); - stateFlag=false; - expect(stateFlag).assertTrue(); - done(); - } + } 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---------'); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } } }); await sleep(1000); } }) - }) diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturerChangeInfo.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturerChangeInfo.test.js index 337e76eb5cc1e2656087bf8697893bbf8d29bf26..b74b32e89bc7972255cc6624fca7aaad7dafcf1b 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturerChangeInfo.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturerChangeInfo.test.js @@ -18,54 +18,55 @@ import fileio from '@ohos.fileio'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; -describe('audioCapturerChangeInfo', function () { +describe('audioCapturerChange', function () { var audioCapCallBack; var audioStreamManager; var audioStreamManagerCB; var dirPath; var fpath; + var Tag = "AFCapLog : "; const audioManager = audio.getAudioManager(); - console.info('AudioFrameworkRecLog: Create AudioManger Object JS Framework'); + console.info(Tag+'Create AudioManger Object JS Framework'); beforeAll(async function () { - console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); + console.info(Tag+' beforeAll: Prerequisites at the test suite level'); dirPath = '/data/storage/el2/base/haps/entry/cache' - console.info('AudioFrameworkRecLog: Recording files Path: '+dirPath); + console.info(Tag+'Recording files Path: '+dirPath); fpath = dirPath+'/capture_js.pcm'; await sleep(100); await audioManager.getStreamManager().then(async function (data) { audioStreamManager = data; - console.info('AudioFrameworkRendererChangeLog: Get AudioStream Manager : Success '); + console.info(Tag+' Get AudioStream Manager : Success '); }).catch((err) => { - console.info('AudioFrameworkRendererChangeLog: Get AudioStream Manager : ERROR : '+err.message); + console.info(Tag+' Get AudioStream Manager : ERROR : '+err.message); }); audioManager.getStreamManager((err, data) => { if (err) { - console.error('AudioFrameworkChange: Get AudioStream Manager : ERROR : '+err.message); + console.error(Tag+' Get AudioStream Manager : ERROR : '+err.message); } else { audioStreamManagerCB = data; - console.info('AudioFrameworkChange: Get AudioStream Manager : Success '); + console.info(Tag+' Get AudioStream Manager : Success '); } }); await sleep(1000); - console.info('AudioFrameworkTest: beforeAll: END'); + console.info(Tag+' beforeAll: END'); }) beforeEach(async function () { - console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level'); + console.info(Tag+' beforeEach: Prerequisites at the test case level'); await sleep(1000); }) afterEach(function () { - console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions'); + console.info(Tag+' afterEach: Test case-level clearance conditions'); }) afterAll(async function () { await sleep(1000); - console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); + console.info(Tag+' afterAll: Test suite-level cleanup condition'); }) function sleep(ms) { @@ -102,37 +103,48 @@ describe('audioCapturerChangeInfo', function () { var resultFlag = false; audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [CAPTURER-CHANGE-ON-001] ######### CapturerChange Off is called #########'); + console.info(Tag+'[CAPTURER-CHANGE-ON-001] ######### CapturerChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -174,42 +186,55 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); + await sleep(100); + audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManagerCB.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [CAPTURER-CHANGE-ON-002] ######### CapturerChange Off is called #########'); + console.info(Tag+'[CAPTURER-CHANGE-ON-002] ######### CapturerChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -252,52 +277,63 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info(Tag+'Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); + console.info(Tag+'Capturer stop:ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [CAPTURER-CHANGE-ON-003] ######### CapturerChange Off is called #########'); + console.info(Tag+'[CAPTURER-CHANGE-ON-003] ######### CapturerChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -337,50 +373,63 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info(Tag+'Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); await audioCap.stop().then(async function () { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info(Tag+'Capturer stopped : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); + console.info(Tag+'Capturer stop:ERROR : '+err.message); }); + + await sleep (100); audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManagerCB.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [CAPTURER-CHANGE-ON-004] ######### CapturerChange Off is called #########'); + console.info(Tag+'[CAPTURER-CHANGE-ON-004] ######### CapturerChange Off is called #########'); expect(resultFlag).assertTrue(); done(); @@ -417,59 +466,51 @@ describe('audioCapturerChangeInfo', function () { var resultFlag = false; 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); - }); - - await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - }); - - await audioCap.stop().then(async function () { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - }); - + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [CAPTURER-CHANGE-ON-005] ######### CapturerChange Off is called #########'); + console.info(Tag+'[CAPTURER-CHANGE-ON-005] ######### CapturerChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -510,38 +551,49 @@ describe('audioCapturerChangeInfo', function () { audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManagerCB.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [CAPTURER-CHANGE-ON-006] ######### CapturerChange Off is called #########'); + console.info(Tag+'[CAPTURER-CHANGE-ON-006] ######### CapturerChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -579,37 +631,48 @@ describe('audioCapturerChangeInfo', function () { var resultFlag = false; audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [CAPTURER-CHANGE-ON-007] ######### CapturerChange Off is called #########'); + console.info(Tag+'[CAPTURER-CHANGE-ON-007] ######### CapturerChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -647,44 +710,137 @@ describe('audioCapturerChangeInfo', function () { var resultFlag = false; audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [CAPTURER-CHANGE-ON-008] ######### CapturerChange Off is called #########'); + console.info(Tag+'[CAPTURER-CHANGE-ON-008] ######### CapturerChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); done(); }) + /* * + * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_009 + * @tc.name : AudioCapturerChange - DeviceDescriptor + * @tc.desc : AudioCapturerChange - DeviceDescriptor + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0*/ + + it('SUB_AUDIO_ON_CAPTURER_CHANGE_009', 0, async function (done) { + var audioCap ; + 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 + } + + var resultFlag = false; + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i=0;i 0 && dType == 15 && dRole == 1 && sRate!= null && cCount != null && cMask != null) { + resultFlag = true; + } + } + } + }); + await sleep (100); + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); + }); + + await sleep(100); + audioStreamManager.off('audioCapturerChange'); + await sleep(100); + console.info(Tag+'[CAPTURER-CHANGE-ON-009] ######### CapturerChange Off is called #########'); + + await audioCap.release().then(async function () { + console.info(Tag+'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag+'Capturer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + done(); + }) /* * @@ -722,33 +878,43 @@ describe('audioCapturerChangeInfo', function () { audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -790,39 +956,51 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -864,45 +1042,57 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info(Tag+'Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); + console.info(Tag+'Capturer stop:ERROR : '+err.message); }); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -945,45 +1135,144 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info(Tag+'Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); await audioCap.stop().then(async function () { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info(Tag+'Capturer stopped : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); + console.info(Tag+'Capturer stop:ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_OFF_CAPTURER_CHANGE_005 + * @tc.name : AudioCapturerChange - DeviceDescriptor + * @tc.desc : AudioCapturerChange - DeviceDescriptor + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + * */ + + + it('SUB_AUDIO_OFF_CAPTURER_CHANGE_005', 0, async function (done) { + + 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 + } + + var resultFlag = true; + + var audioCap; + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i=0;i 0 && dType == 15 && dRole == 1 && sRate!= null && cCount != null && cMask != null) { + resultFlag = false; + } + } + } + }); + + await sleep (100); + + audioStreamManager.off('audioCapturerChange'); + await sleep(100); + console.info(Tag+'[CAPTURER-CHANGE-OFF-005] ######### CapturerChange Off is called #########'); + console.info(Tag+'[CAPTURER-CHANGE-OFF-005] ResultFlag is: '+ resultFlag); + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); + }); + + await audioCap.release().then(async function () { + console.info(Tag+'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1021,53 +1310,74 @@ describe('audioCapturerChangeInfo', function () { var resultFlag = false; audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { console.info('AFCapturerChangeLog: [GET_CAP_STA_1_PR] **** Get Promise Called ****'); if (AudioCapturerChangeInfoArray!=null) { for (let i=0;i { - console.log('AFCapLog: getCurrentAudioCapturerInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); resultFlag = false; }); audioStreamManagerCB.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [GET_CAPTURER_STATE_1_PR] ## CapCh Off is called ##'); + console.info(Tag+'[GET_CAPTURER_STATE_1_PR] ## CapCh Off is called ##'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1109,61 +1419,82 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info('AFCapLog: [GET_CAPTURER_STATE_2_PROMISE] **** Get Promise Called ****'); + console.info(Tag+'[GET_CAPTURER_STATE_2_PROMISE] **** Get Promise Called ****'); if (AudioCapturerChangeInfoArray!=null) { for (let i=0;i { - console.log('AFCapLog: getCurrentAudioCapturerInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); resultFlag = false; }); audioStreamManager.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [GET_CAPTURER_STATE_2_PROMISE] ######### CapturerChange Off is called #########'); + console.info(Tag+'[GET_CAPTURER_STATE_2_PROMISE] ######### CapturerChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1206,73 +1537,202 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info(Tag+'Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); + console.info(Tag+'Capturer stop:ERROR : '+err.message); }); - await sleep(500); + await sleep(100); await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info('AFCapLog: [GET_CAPTURER_STATE_3_PROMISE] **** Get Promise Called ****'); + console.info(Tag+'[GET_CAPTURER_STATE_3_PROMISE] **** Get Promise Called ****'); if (AudioCapturerChangeInfoArray!=null) { for (let i=0;i { - console.log('AFCapLog: getCurrentAudioCapturerInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); resultFlag = false; }); audioStreamManager.off('audioCapturerChange'); await sleep(100); - console.info('AFCapLog: [GET_CAPTURER_STATE_3_PROMISE] ######### CapturerChange Off is called #########'); + console.info(Tag+'[GET_CAPTURER_STATE_3_PROMISE] ######### CapturerChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info(Tag+'Capturer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); done(); + }) + + /* * + * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_004 + * @tc.name : AudioCapturerChange - DEVICE DESCRIPTOR + * @tc.desc : AudioCapturerChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0*/ + + it('SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_004', 0, async function (done) { + var audioCap ; + 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 + } + + var resultFlag = false; + audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i=0;i { + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); + }); + + await sleep(100); + + await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { + console.info('AFCapturerChangeLog: [GET_CAP_DD_PR] **** Get Promise Called ****'); + if (AudioCapturerChangeInfoArray!=null) { + for (let i=0;i 0 && dType == 15 && dRole == 1 && sRate!= null && cCount != null && cMask != null) { + resultFlag = true; + } + } + } + } + }).catch((err) => { + console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); + resultFlag = false; + }); + + audioStreamManagerCB.off('audioCapturerChange'); + await sleep(100); + console.info(Tag+'[GET_CAPTURER_DD_PR] ## CapCh Off is called ##'); + + await audioCap.release().then(async function () { + console.info(Tag+'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag+'Capturer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + done(); }) /* * @@ -1305,43 +1765,64 @@ describe('audioCapturerChangeInfo', function () { var resultFlag = false; audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { - console.info('AFCapLog: [GET_CAPTURER_STATE_1_CALLBACK] **** Get Callback Called ****'); + console.info(Tag+'[GET_CAPTURER_STATE_1_CALLBACK] **** Get Callback Called ****'); await sleep(100); if (err) { - console.log('AFCapLog: getCurrentAudioCapturerInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); resultFlag = false; } else { if (AudioCapturerChangeInfoArray !=null) { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1399,51 +1880,72 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManagerCB.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { - console.info('AFCapLog: [GET_CAPTURER_STATE_2_CALLBACK] **** Get Callback Called ****'); + console.info(Tag+'[GET_CAPTURER_STATE_2_CALLBACK] **** Get Callback Called ****'); await sleep(100); if (err) { - console.log('AFCapLog: getCurrentAudioCapturerInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); resultFlag = false; } else { if (AudioCapturerChangeInfoArray !=null) { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1502,58 +2004,79 @@ describe('audioCapturerChangeInfo', function () { await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); }); await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info(Tag+'Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); + console.info(Tag+'Capturer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); + console.info(Tag+'Capturer stop:ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { - console.info('AFCapLog: [GET_CAPTURER_STATE_3_CALLBACK] **** Get Callback Called ****'); + console.info(Tag+'[GET_CAPTURER_STATE_3_CALLBACK] **** Get Callback Called ****'); await sleep(100); if (err) { - console.log('AFCapLog: getCurrentAudioCapturerInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); resultFlag = false; } else { if (AudioCapturerChangeInfoArray !=null) { for (let i=0;i { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); + console.info(Tag+'Capturer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); done(); }) + + /* * + * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_004 + * @tc.name : AudioCapturerChange - DEVICE DESCRIPTOR + * @tc.desc : AudioCapturerChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0*/ + + it('SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_004', 0, async function (done) { + var audioCap ; + 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 + } + + var resultFlag = false; + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i=0;i { + console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); + }); + + await sleep(100); + + audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { + console.info(Tag+'[GET_CAPTURER_DD_CALLBACK] **** Get Callback Called ****'); + await sleep(100); + if (err) { + console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); + resultFlag = false; + } + else { + if (AudioCapturerChangeInfoArray !=null) { + for (let i=0;i 0 && dType == 15 && dRole == 1 && sRate!= null && cCount != null && cMask!=null){ + resultFlag = true; + } + } + } + } + } + }); + + await sleep(1000); + + audioStreamManager.off('audioCapturerChange'); + await sleep(100); + console.info(Tag+'[GET_CAPTURER_DD_CALLBACK] ######### CapturerChange Off is called #########'); + + await audioCap.release().then(async function () { + console.info(Tag+'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag+'Capturer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + done(); + }) }) diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js index 05f238633326e98ddf796ac87c7449c65b6602e2..b468fc066f00569dd603dff24aff2702d790b9ed 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js @@ -13,13 +13,12 @@ * limitations under the License. */ - import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; -describe('audioEventManagement', function () { +describe('audioEM', function () { console.info('AudioFrameworkTest: Create AudioManger Object JS Framework'); const audioManager = audio.getAudioManager(); var deviceRoleValue = null; @@ -802,6 +801,33 @@ describe('audioEventManagement', function () { done(); }) + /* * + * @tc.number : SUB_AUDIO_MANAGER_DeviceChangeType_001 + * @tc.name : DeviceChangeType - CONNECT + * @tc.desc : DeviceChangeType - CONNECT + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_DeviceChangeType_001', 0, async function (done) { + expect(audio.DeviceChangeType.CONNECT).assertEqual(0); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_MANAGER_DeviceChangeType_002 + * @tc.name : DeviceChangeType - DISCONNECT + * @tc.desc : DeviceChangeType - DISCONNECT + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_DeviceChangeType_002', 0, async function (done) { + expect(audio.DeviceChangeType.DISCONNECT).assertEqual(1); + await sleep(50); + done(); + }) }) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js index 3fbd234a0f2df175cd5a1c2d8cf5fc555f901d45..1dbf2799c209245b67debab74b443eba32cc1b07 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js @@ -16,13 +16,19 @@ import audio from '@ohos.multimedia.audio'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; -describe('audioFramework', function () { +describe('audioManager', function () { console.info('AudioFrameworkTest: Create AudioManger Object JS Framework'); const audioManager = audio.getAudioManager(); - var deviceRoleValue = null; - var deviceTypeValue = null; + var dRValue = null; + var dTValue = null; + var devId = null; + var devName = null; + var devAddr = null; + var sRate = null; + var cCount = null; + var cMask = null; var volErrorMesg = 'Error, Operation not supported or Failed'; var audioMedia = 3; var audioRingtone = 2; @@ -33,47 +39,58 @@ describe('audioFramework', function () { var outOfRangeVol = 28; var longValue = '28374837458743875804735081439085918459801437584738967509184509813904850914375904790589104801843'; - function sleep (ms) { + function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } function displayDeviceProp(value, index, array) { var devRoleName; var devTypeName; - if (value.deviceRole==1) { + if (value.deviceRole == 1) { devRoleName = 'INPUT_DEVICE'; } - else if (value.deviceRole==2) { + else if (value.deviceRole == 2) { devRoleName = 'OUTPUT_DEVICE '; } else { - devRoleName = 'ERROR : UNKNOWN : '+value.deviceRole; + devRoleName = 'ERROR : UNKNOWN : ' + value.deviceRole; } if (value.deviceType == 1) { devTypeName = 'EARPIECE'; } - else if (value.deviceType == 2){ + else if (value.deviceType == 2) { devTypeName = 'SPEAKER'; } - else if (value.deviceType == 3){ + else if (value.deviceType == 3) { devTypeName = 'WIRED_HEADSET'; } - else if (value.deviceType == 8){ + else if (value.deviceType == 8) { devTypeName = 'BLUETOOTH_A2DP'; } - else if (value.deviceType == 15){ + else if (value.deviceType == 15) { devTypeName = 'MIC'; } else { - devTypeName = 'ERROR : UNKNOWN :'+value.deviceType; + devTypeName = 'ERROR : UNKNOWN :' + value.deviceType; } console.info(`AudioFrameworkTest: device role: ${devRoleName}`); - deviceRoleValue = value.deviceRole; + dRValue = value.deviceRole; console.info(`AudioFrameworkTest: device type: ${devTypeName}`); - deviceTypeValue = value.deviceType; - + dTValue = value.deviceType; + console.info('AudioFrameworkTest: device Id:' + value.id); + devId = value.id; + console.info('AudioFrameworkTest: device Name:' + value.name); + devName = value.name; + console.info('AudioFrameworkTest: device Address:' + value.address); + devAddr = value.address; + console.info('AudioFrameworkTest: device sample Rates:' + value.sampleRates[0]); + sRate = value.sampleRates[0]; + console.info('AudioFrameworkTest: device channel Counts:' + value.channelCounts[0]); + cCount = value.channelCounts[0]; + console.info('AudioFrameworkTest: device channel Masks:' + value.channelMasks); + cMask = value.channelMasks; } beforeAll(function () { @@ -103,11 +120,11 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getAudioManger_001', 0, function (done) { - if(audioManager!=null){ + if (audioManager != null) { console.info('AudioFrameworkTest: getAudioManger : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: getAudioManger : FAIL'); expect(false).assertTrue(); } @@ -133,35 +150,35 @@ describe('audioFramework', function () { const audioManager8 = audio.getAudioManager(); const audioManager9 = audio.getAudioManager(); const audioManager10 = audio.getAudioManager(); - const promise = audioManager.setVolume(audioMedia,lowVol); + const promise = audioManager.setVolume(audioMedia, lowVol); promise.then(function () { console.info('AudioFrameworkTest: Media setVolume promise: successful'); - audioManager1.setVolume(audioMedia,highVol); + audioManager1.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager1 : Media setVolume promise: successful'); - audioManager2.setVolume(audioMedia,highVol); + audioManager2.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager2 : Media setVolume promise: successful'); - audioManager3.setVolume(audioMedia,highVol); + audioManager3.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager3 : Media setVolume promise: successful'); - audioManager4.setVolume(audioMedia,lowVol); + audioManager4.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager4 : Media setVolume promise: successful'); - audioManager5.setVolume(audioMedia,highVol); + audioManager5.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager5 : Media setVolume promise: successful'); - audioManager6.setVolume(audioMedia,lowVol); + audioManager6.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager6 : Media setVolume promise: successful'); - audioManager7.setVolume(audioMedia,highVol); + audioManager7.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager7 : Media setVolume promise: successful'); - audioManager8.setVolume(audioMedia,lowVol); + audioManager8.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager8 : Media setVolume promise: successful'); - audioManager9.setVolume(audioMedia,highVol); + audioManager9.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager9 : Media setVolume promise: successful'); - audioManager10.setVolume(audioMedia,lowVol); + audioManager10.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager10 : Media setVolume promise: successful'); audioManager.getVolume(audioMedia).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -182,15 +199,15 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_001', 0, async function (done) { - const promise = audioManager.setVolume(audioMedia,lowVol); + const promise = audioManager.setVolume(audioMedia, lowVol); promise.then(function () { console.info('AudioFrameworkTest: Media setVolume promise: successful'); audioManager.getVolume(audioMedia).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -209,15 +226,15 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_002', 0, async function (done) { - const promise = audioManager.setVolume(audioMedia,maxVol); + const promise = audioManager.setVolume(audioMedia, maxVol); promise.then(function () { console.info('AudioFrameworkTest: Media setVolume promise: successful'); audioManager.getVolume(audioMedia).then(function (data) { - if(data == maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -236,16 +253,16 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_003', 0, async function (done) { - const promise = audioManager.setVolume(audioMedia,minVol); + const promise = audioManager.setVolume(audioMedia, minVol); promise.then(function () { console.info('AudioFrameworkTest: Media setVolume promise: successful'); audioManager.getVolume(audioMedia).then(function (data) { - if(data == minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -265,7 +282,7 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_SetVolume_004', 0, async function (done) { console.info('AudioFrameworkTest: Media setVolume Promise:Out of range: Setvol 100'); - await audioManager.setVolume(audioMedia,outOfRangeVol).then(() => { + await audioManager.setVolume(audioMedia, outOfRangeVol).then(() => { console.info('AudioFrameworkTest: Media setVolume Promise:Out of range: FAIL'); expect(false).assertTrue(); }).catch((err) => { @@ -284,24 +301,23 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_005', 0, async function (done) { - audioManager.setVolume(audioMedia,highVol, (err) => { + audioManager.setVolume(audioMedia, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else - { + else { console.info(`AudioFrameworkTest: callback : Media setVolume successful `); audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == highVol){ + else if (value == highVol) { console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -321,24 +337,23 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_006', 0, async function (done) { - audioManager.setVolume(audioMedia,maxVol, (err) => { + audioManager.setVolume(audioMedia, maxVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else - { + else { console.info(`AudioFrameworkTest: callback : Media setVolume successful `); audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -358,24 +373,23 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_007', 0, async function (done) { - audioManager.setVolume(audioMedia,minVol, (err) => { + audioManager.setVolume(audioMedia, minVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else - { + else { console.info(`AudioFrameworkTest: callback : Media setVolume successful `); audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -395,12 +409,12 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_008', 0, async function (done) { - audioManager.setVolume(audioMedia,outOfRangeVol, (err) => { + audioManager.setVolume(audioMedia, outOfRangeVol, (err) => { if (err) { console.error(`AudioFrameworkTest: setVolume: Out of range: Callback: PASS: ${err.message}`); expect(volErrorMesg).assertEqual(err.message); } - else{ + else { console.info('AudioFrameworkTest: setVolume: callback : Media Out of range: FAIL'); expect(false).assertTrue(); } @@ -417,15 +431,15 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_009', 0, async function (done) { - const promise = audioManager.setVolume(audioRingtone,lowVol); + const promise = audioManager.setVolume(audioRingtone, lowVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: successful'); audioManager.getVolume(audioRingtone).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -444,15 +458,15 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_010', 0, async function (done) { - const promise = audioManager.setVolume(audioRingtone,maxVol); + const promise = audioManager.setVolume(audioRingtone, maxVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: successful'); audioManager.getVolume(audioRingtone).then(function (data) { - if(data == maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -471,15 +485,15 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_011', 0, async function (done) { - const promise = audioManager.setVolume(audioRingtone,minVol); + const promise = audioManager.setVolume(audioRingtone, minVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: successful'); audioManager.getVolume(audioRingtone).then(function (data) { - if(data == minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -499,7 +513,7 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_SetVolume_012', 0, async function (done) { console.info('AudioFrameworkTest: Ringtone setVolume Promise: Out of range: Setvol 30'); - await audioManager.setVolume(audioRingtone,outOfRangeVol).then(() => { + await audioManager.setVolume(audioRingtone, outOfRangeVol).then(() => { console.info('AudioFrameworkTest: Ringtone setVolume Promise:Out of range: FAIL'); expect(false).assertTrue(); }).catch((err) => { @@ -518,23 +532,23 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_013', 0, async function (done) { - audioManager.setVolume(audioRingtone,highVol, (err) => { + audioManager.setVolume(audioRingtone, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `); audioManager.getVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == highVol){ + else if (value == highVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -554,24 +568,24 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_014', 0, async function (done) { - audioManager.setVolume(audioRingtone,maxVol, (err) => { + audioManager.setVolume(audioRingtone, maxVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `); audioManager.getVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -591,23 +605,23 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_015', 0, async function (done) { - audioManager.setVolume(audioRingtone,minVol, (err) => { + audioManager.setVolume(audioRingtone, minVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `); audioManager.getVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -627,12 +641,12 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_016', 0, async function (done) { - audioManager.setVolume(audioRingtone,outOfRangeVol, (err) => { + audioManager.setVolume(audioRingtone, outOfRangeVol, (err) => { if (err) { console.error(`AudioFrameworkTest: Out of range Volume: Callback: ${err.message}`); expect(volErrorMesg).assertEqual(err.message); } - else{ + else { console.info('AudioFrameworkTest: Out of range Volume: callback : Ringtone set volume: FAIL'); expect(false).assertTrue(); } @@ -650,7 +664,7 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_SetVolume_017', 0, async function (done) { console.info('AudioFrameworkTest: Media setVolume promise: Negative Value -1'); - await audioManager.setVolume(audioMedia,-1).then(() => { + await audioManager.setVolume(audioMedia, -1).then(() => { // Setting negative audio volume for error Scenario console.info('AudioFrameworkTest: Media setVolume Promise:Negative: FAIL'); expect(false).assertTrue(); @@ -670,13 +684,13 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_018', 0, async function (done) { - audioManager.setVolume(audioMedia,-1, (err) => { + audioManager.setVolume(audioMedia, -1, (err) => { // Setting negative audio volume for error Scenario if (err) { console.error(`AudioFrameworkTest: setVolume Callback: Negative: PASS: ${err.message}`); expect(volErrorMesg).assertEqual(err.message); } - else{ + else { console.info('AudioFrameworkTest: setVolume callback : Media Negative: FAIL'); expect(false).assertTrue(); } @@ -694,7 +708,7 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_SetVolume_019', 0, async function (done) { console.info('AudioFrameworkTest: Ringtone setVolume promise: Negative'); - await audioManager.setVolume(audioRingtone,-1).then(() => { + await audioManager.setVolume(audioRingtone, -1).then(() => { // Setting negative audio volume for error Scenario console.info('AudioFrameworkTest: Ringtone setVolume Promise:Negative: FAIL'); expect(false).assertTrue(); @@ -714,13 +728,13 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_020', 0, async function (done) { - audioManager.setVolume(audioRingtone,-1, (err) => { + audioManager.setVolume(audioRingtone, -1, (err) => { // Setting negative audio volume for error Scenario if (err) { console.error(`AudioFrameworkTest:Ringtone setVolume Callback:Negative: PASS : ${err.message}`); expect(volErrorMesg).assertEqual(err.message); } - else{ + else { console.info('AudioFrameworkTest: setVolume: Negative: callback : Ringtone set volume: FAIL'); expect(false).assertTrue(); } @@ -737,14 +751,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_021', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol); + const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); promise.then(function () { audioManager.getVolume(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data); expect(false).assertTrue(); } @@ -763,23 +777,23 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_022', 0, async function (done) { - audioManager.setVolume(audio.AudioVolumeType.MEDIA,highVol, (err) => { + audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME : ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : ENAME : Media setVolume successful `); audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: ENAME : Error ${err.message}`); expect(false).assertTrue(); } - else if(value == highVol){ + else if (value == highVol) { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :' + value); expect(false).assertTrue(); } @@ -799,15 +813,15 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_023', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE,highVol); + const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE, highVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful'); audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == highVol){ + if (data == highVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data); expect(false).assertTrue(); } @@ -826,23 +840,23 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_024', 0, async function (done) { - audioManager.setVolume(audio.AudioVolumeType.RINGTONE,lowVol, (err) => { + audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `); audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == lowVol){ + else if (value == lowVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :' + value); expect(false).assertTrue(); } @@ -862,15 +876,15 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_025', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol); + const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); promise.then(function () { - audioManager.setVolume(audio.AudioVolumeType.RINGTONE,maxVol); + audioManager.setVolume(audio.AudioVolumeType.RINGTONE, maxVol); audioManager.getVolume(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data); expect(false).assertTrue(); } @@ -889,24 +903,24 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_026', 0, async function (done) { - audioManager.setVolume(audio.AudioVolumeType.MEDIA,highVol, (err) => { + audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME : ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : ENAME : Media setVolume successful `); - audioManager.setVolume(audio.AudioVolumeType.RINGTONE,lowVol); + audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol); audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: ENAME : Error: ${err.message}`); expect(false).assertTrue(); } - else if(value == highVol){ + else if (value == highVol) { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :' + value); expect(false).assertTrue(); } @@ -926,16 +940,16 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_027', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE,highVol); + const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE, highVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful'); - audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol); + audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == highVol){ + if (data == highVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data); expect(false).assertTrue(); } @@ -954,24 +968,24 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_028', 0, async function (done) { - audioManager.setVolume(audio.AudioVolumeType.RINGTONE,lowVol, (err) => { + audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `); - audioManager.setVolume(audio.AudioVolumeType.MEDIA,highVol); + audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol); audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == lowVol){ + else if (value == lowVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :' + value); expect(false).assertTrue(); } @@ -993,11 +1007,11 @@ describe('audioFramework', function () { it('SUB_AUDIO_MANAGER_getMaxVolume_001', 0, async function (done) { const promise = audioManager.getMaxVolume(audioMedia); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1020,11 +1034,11 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1043,11 +1057,11 @@ describe('audioFramework', function () { it('SUB_AUDIO_MANAGER_getMaxVolume_003', 0, async function (done) { const promise = audioManager.getMaxVolume(audioRingtone); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1070,11 +1084,11 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1091,14 +1105,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_005', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); const promise = audioManager.getMaxVolume(audioMedia); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1116,14 +1130,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_006', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); const promise = audioManager.getMaxVolume(audioRingtone); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1142,18 +1156,18 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_007', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); audioManager.getMaxVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1170,17 +1184,17 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_008', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); audioManager.getMaxVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1197,14 +1211,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_009', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); const promise = audioManager.getMaxVolume(audioMedia); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1222,14 +1236,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_010', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); const promise = audioManager.getMaxVolume(audioRingtone); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1247,17 +1261,17 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_011', 0, async function (done) { - audioManager.setVolume(audioMedia,highVol); + audioManager.setVolume(audioMedia, highVol); audioManager.getMaxVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1274,17 +1288,17 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_012', 0, async function (done) { - audioManager.setVolume(audioRingtone,highVol); + audioManager.setVolume(audioRingtone, highVol); audioManager.getMaxVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1303,11 +1317,11 @@ describe('audioFramework', function () { it('SUB_AUDIO_MANAGER_getMinVolume_001', 0, async function (done) { const promise = audioManager.getMinVolume(audioMedia); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1330,11 +1344,11 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1353,11 +1367,11 @@ describe('audioFramework', function () { it('SUB_AUDIO_MANAGER_getMinVolume_003', 0, async function (done) { const promise = audioManager.getMinVolume(audioRingtone); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1381,11 +1395,11 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1402,18 +1416,18 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_005', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); const promise = audioManager.getMinVolume(audioMedia); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } - }); + }); await promise; done(); }) @@ -1427,17 +1441,17 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_006', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); audioManager.getMinVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1454,14 +1468,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_007', 0, async function (done) { - audioManager.setVolume(audioMedia,highVol); + audioManager.setVolume(audioMedia, highVol); const promise = audioManager.getMinVolume(audioRingtone); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1479,17 +1493,17 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_008', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); audioManager.getMinVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1506,14 +1520,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_009', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); const promise = audioManager.getMinVolume(audioMedia); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1531,17 +1545,17 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_010', 0, async function (done) { - audioManager.setVolume(audioMedia,highVol); + audioManager.setVolume(audioMedia, highVol); audioManager.getMinVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1558,14 +1572,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_011', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); const promise = audioManager.getMinVolume(audioRingtone) promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1583,17 +1597,17 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_012', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); audioManager.getMinVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1610,18 +1624,24 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_001', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; const promise = audioManager.getDevices(1); // Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG promise.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1639,19 +1659,25 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_002', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; const promise = audioManager.getDevices(2); // Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG promise.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1669,8 +1695,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_003', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; const promise = audioManager.getDevices(3); // Getting all devies connected 3 = ALL_DEVICES_FLAG promise.then(function (value) { @@ -1678,11 +1710,11 @@ describe('audioFramework', function () { console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1699,8 +1731,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_004', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; audioManager.getDevices(1, (err, value) => { // Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); @@ -1713,11 +1751,11 @@ describe('audioFramework', function () { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1735,8 +1773,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_005', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; audioManager.getDevices(2, (err, value) => { // Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG @@ -1746,15 +1790,15 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -1772,8 +1816,14 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_006', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; audioManager.getDevices(3, (err, value) => { // Getting all devies connected 3 = ALL_DEVICES_FLAG @@ -1783,15 +1833,15 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -1809,18 +1859,24 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_007', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; const promise = audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG) promise.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1838,18 +1894,24 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_008', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; const promise = audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG); promise.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1867,18 +1929,24 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_009', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; const promise = audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG); promise.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1896,22 +1964,28 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_010', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); if (err) { console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1929,23 +2003,29 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_011', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG, (err, value) => { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); if (err) { console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -1963,22 +2043,28 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getDevices_012', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; + dRValue = null; + dTValue = null; + devId = null; + devName = null; + devAddr = null; + sRate = null; + cCount = null; + cMask = null; audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG, (err, value) => { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); if (err) { console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -2000,13 +2086,13 @@ describe('audioFramework', function () { // Setting Ringtone Mode to Normal ENUM 2 = RINGER_MODE_NORMAL promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL'); - audioManager.getRingerMode().then(function (value){ - if(value==2){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == 2) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2026,15 +2112,15 @@ describe('audioFramework', function () { it('SUB_AUDIO_MANAGER_setRingerMode_002', 0, async function (done) { const promise = audioManager.setRingerMode(0); // Setting Ringtone Mode to Silent ENUM 0 = RINGER_MODE_SILENT - promise.then(function (){ + promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT'); - audioManager.getRingerMode().then(function (value){ - if(value==0){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == 0) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2054,15 +2140,15 @@ describe('audioFramework', function () { it('SUB_AUDIO_MANAGER_setRingerMode_003', 0, async function (done) { const promise = audioManager.setRingerMode(1); // Setting Ringtone Mode to Vibration ENUM 1 = RINGER_MODE_VIBRATE - promise.then(function (){ + promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE'); - audioManager.getRingerMode().then(function (value){ - if(value==1){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == 1) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2087,18 +2173,18 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); } - else{ + else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); } - else if(value==2){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' +value); + else if (value == 2) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2124,19 +2210,19 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT: Error: ${err.message}`); expect().assertFail(); } - else{ + else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_SILENT: Error: ${err.message}`); expect().assertFail(); } - if(value==0){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' +value); + if (value == 0) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2169,12 +2255,12 @@ describe('audioFramework', function () { expect().assertFail(); } - if(value==1){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value); + if (value == 1) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2196,13 +2282,13 @@ describe('audioFramework', function () { const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL); promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL'); - audioManager.getRingerMode().then(function (value){ - if(value==audio.AudioRingMode.RINGER_MODE_NORMAL){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == audio.AudioRingMode.RINGER_MODE_NORMAL) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2221,15 +2307,15 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_setRingerMode_008', 0, async function (done) { const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_SILENT); - promise.then(function (){ + promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT'); - audioManager.getRingerMode().then(function (value){ - if(value==audio.AudioRingMode.RINGER_MODE_SILENT){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == audio.AudioRingMode.RINGER_MODE_SILENT) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2248,15 +2334,15 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_setRingerMode_009', 0, async function (done) { const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE); - promise.then(function (){ + promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE'); - audioManager.getRingerMode().then(function (value){ - if(value==audio.AudioRingMode.RINGER_MODE_VIBRATE){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == audio.AudioRingMode.RINGER_MODE_VIBRATE) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2286,12 +2372,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); } - else if(value==audio.AudioRingMode.RINGER_MODE_NORMAL){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' +value); + else if (value == audio.AudioRingMode.RINGER_MODE_NORMAL) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2323,12 +2409,12 @@ describe('audioFramework', function () { expect().assertFail(); } - if(value==audio.AudioRingMode.RINGER_MODE_SILENT){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' +value); + if (value == audio.AudioRingMode.RINGER_MODE_SILENT) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2360,12 +2446,12 @@ describe('audioFramework', function () { expect().assertFail(); } - if(value==audio.AudioRingMode.RINGER_MODE_VIBRATE){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value); + if (value == audio.AudioRingMode.RINGER_MODE_VIBRATE) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2384,7 +2470,7 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_006', 0, async function (done) { - audioManager.mute(audioMedia,false, (err) => { + audioManager.mute(audioMedia, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect(false).assertTrue(); @@ -2396,12 +2482,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2420,16 +2506,16 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_005', 0, async function (done) { - await audioManager.mute(audioMedia,false).then(function () { + await audioManager.mute(audioMedia, false).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Media: Promise: FALSE'); audioManager.isMute(audioMedia).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2448,7 +2534,7 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_008', 0, async function (done) { - audioManager.mute(audioRingtone,false, (err) => { + audioManager.mute(audioRingtone, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect(false).assertTrue(); @@ -2460,12 +2546,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : FALSE: Ringtone : failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2484,16 +2570,16 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_007', 0, async function (done) { - await audioManager.mute(audioRingtone,false).then(function () { + await audioManager.mute(audioRingtone, false).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: FALSE'); audioManager.isMute(audioRingtone).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2512,7 +2598,7 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_015', 0, async function (done) { - audioManager.mute(audio.AudioVolumeType.MEDIA,false, (err) => { + audioManager.mute(audio.AudioVolumeType.MEDIA, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect().assertFail(); @@ -2524,12 +2610,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : FALSE: Media : ENAME: failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2548,16 +2634,16 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_011', 0, async function (done) { - await audioManager.mute(audio.AudioVolumeType.MEDIA,false).then(function () { + await audioManager.mute(audio.AudioVolumeType.MEDIA, false).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Media: ENAME: Promise: FALSE'); audioManager.isMute(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2576,7 +2662,7 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_016', 0, async function (done) { - audioManager.mute(audio.AudioVolumeType.RINGTONE,false, (err) => { + audioManager.mute(audio.AudioVolumeType.RINGTONE, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect().assertFail(); @@ -2588,12 +2674,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : FALSE: Ringtone : ENAME: failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2612,16 +2698,16 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_014', 0, async function (done) { - await audioManager.mute(audio.AudioVolumeType.MEDIA,false).then(function () { + await audioManager.mute(audio.AudioVolumeType.MEDIA, false).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Media: ENAME: Promise: FALSE'); audioManager.isMute(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2640,17 +2726,17 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_017', 0, async function (done) { - await audioManager.mute(audioMedia,true).then(function () { + await audioManager.mute(audioMedia, true).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Media: Promise: TRUE'); - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); audioManager.isMute(audioMedia).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2660,7 +2746,7 @@ describe('audioFramework', function () { done(); }) - /* * + /* * * @tc.number : SUB_AUDIO_MANAGER_mute_018 * @tc.name : mute - Media - callback - SetVolume * @tc.desc : mute - Media - callback - Enable mute - SetVolume @@ -2669,27 +2755,27 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_018', 0, async function (done) { - audioManager.mute(audioMedia,true,async (err) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to set Mute Status ${err.message}`); - expect().assertFail(); - } - else{ + audioManager.mute(audioMedia, true, async (err) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to set Mute Status ${err.message}`); + expect().assertFail(); + } + else { console.log('AudioFrameworkTest: Set Stream Mute: Media: Callback : TRUE'); await sleep(100); - await audioManager.setVolume(audioMedia,highVol); + await audioManager.setVolume(audioMedia, highVol); await sleep(100); audioManager.isMute(audioMedia, (err, data) => { if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2699,7 +2785,7 @@ describe('audioFramework', function () { }); }) - /* * + /* * * @tc.number : SUB_AUDIO_MANAGER_mute_019 * @tc.name : mute - Ringtone - Promise - SetVolume * @tc.desc : mute - Ringtone - Promise - Enable mute - SetVolume @@ -2708,19 +2794,19 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_019', 0, async function (done) { - await audioManager.mute(audioRingtone,true).then(async function () { + await audioManager.mute(audioRingtone, true).then(async function () { console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: SetVolume'); - await audioManager.setVolume(audioRingtone,highVol); + await audioManager.setVolume(audioRingtone, highVol); await audioManager.isMute(audioRingtone).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); } - }); + }); }).catch((err) => { console.info('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: ERROR:' + err.message); expect(false).assertTrue(); @@ -2728,7 +2814,7 @@ describe('audioFramework', function () { done(); }) - /* * + /* * * @tc.number : SUB_AUDIO_MANAGER_mute_020 * @tc.name : mute - Ringtone - callback - SetVolume * @tc.desc : mute - Ringtone - callback - Enable mute - SetVolume @@ -2737,25 +2823,25 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_020', 0, async function (done) { - audioManager.mute(audioRingtone,true, (err) => { - if (err) { + audioManager.mute(audioRingtone, true, (err) => { + if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to set Mute Status ${err.message}`); expect().assertFail(); } else { console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Callback : SetVolume'); - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); audioManager.isMute(audioRingtone, (err, data) => { if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2777,12 +2863,12 @@ describe('audioFramework', function () { console.log('AudioFrameworkTest: Promise : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); const promise = audioManager.isActive(audioMedia); promise.then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: PASS:'+data); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: FAIL: ' + data); expect(false).assertTrue(); } }); @@ -2805,12 +2891,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : Media : isActive: failed ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: PASS:'+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2829,12 +2915,12 @@ describe('audioFramework', function () { console.log('AudioFrameworkTest: Promise : isActive Ringtone: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); const promise = audioManager.isActive(audioRingtone); promise.then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: PASS:'+data); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: FAIL: ' + data); expect(false).assertTrue(); } }); @@ -2857,12 +2943,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : Ringtone : isActive: failed ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: PASS:'+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2881,12 +2967,12 @@ describe('audioFramework', function () { console.log('AudioFrameworkTest: Promise : isActive Media: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); const promise = audioManager.isActive(audio.AudioVolumeType.MEDIA); promise.then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: PASS:'+data); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } }); @@ -2909,12 +2995,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : Media : ENAME: isActive: failed ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: PASS:'+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2933,12 +3019,12 @@ describe('audioFramework', function () { console.log('AudioFrameworkTest: Promise : isActive Ringtone: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); const promise = audioManager.isActive(audio.AudioVolumeType.RINGTONE); promise.then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: PASS:'+data); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } }); @@ -2961,12 +3047,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : Ringtone : ENAME: isActive: failed ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: PASS:'+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2985,13 +3071,13 @@ describe('audioFramework', function () { await audioManager.setMicrophoneMute(true).then(function () { console.log('AudioFrameworkTest: setMicrophoneMute: Promise: TRUE'); audioManager.isMicrophoneMute().then(function (data) { - if(data==true){ - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: PASS:'+data); - expect(true).assertTrue(); + if (data == true) { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -3013,13 +3099,13 @@ describe('audioFramework', function () { await audioManager.setMicrophoneMute(false).then(function () { console.log('AudioFrameworkTest: setMicrophoneMute: Promise: FALSE'); audioManager.isMicrophoneMute().then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -3050,12 +3136,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : TRUE: isMicrophoneMute : Error ${err.message}`); expect(false).assertTrue(); } - else if(data==true){ - console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: PASS: '+data); + else if (data == true) { + console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -3086,12 +3172,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : FALSE: isMicrophoneMute : Error ${err.message}`); expect(false).assertTrue(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -3110,22 +3196,22 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_002', 0, async function (done) { - await audioManager.setDeviceActive(2,false).then(function (){ + await audioManager.setDeviceActive(2, false).then(function () { // Setting device active ENUM 2 = SPEAKER - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate'); - audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value){ - if(value==false){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message); - expect(false).assertTrue(); + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate'); + audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) { + if (value == false) { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); + expect(false).assertTrue(); + } + }); + }).catch((err) => { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message); + expect(false).assertTrue(); }); done(); }) @@ -3139,26 +3225,26 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_003', 0, async function (done) { - await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate'); - audioManager.isDeviceActive(2).then(function (value){ - if(value==true){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message); - expect(false).assertTrue(); + await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true).then(function () { + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate'); + audioManager.isDeviceActive(2).then(function (value) { + if (value == true) { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' + value); + expect(false).assertTrue(); + } + }); + }).catch((err) => { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message); + expect(false).assertTrue(); }); done(); }) - + /* * * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_006 * @tc.name : setDeviceActive - SPEAKER - deactivate - Callback @@ -3168,24 +3254,24 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_006', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,false, (err) => { + audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); expect(false).assertTrue(); } else { console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - audioManager.isDeviceActive(2,(err, value) => { + audioManager.isDeviceActive(2, (err, value) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value==false){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' +value); + else if (value == false) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3204,24 +3290,24 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_007', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true, (err) => { + audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true, (err) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active: Error: ${err.message}`); expect(false).assertTrue(); } else { console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - audioManager.isDeviceActive(2,(err, value) => { + audioManager.isDeviceActive(2, (err, value) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value==true){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' +value); + else if (value == true) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3231,7 +3317,7 @@ describe('audioFramework', function () { }); }) - + /* * * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_001 * @tc.name : setAudioParameter - Promise - Character & Number @@ -3244,13 +3330,13 @@ describe('audioFramework', function () { const promise = audioManager.setAudioParameter('PBits per sample', '8 bit'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('PBits per sample').then(function (value){ - if(value=='8 bit'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' +value); + audioManager.getAudioParameter('PBits per sample').then(function (value) { + if (value == '8 bit') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3271,13 +3357,13 @@ describe('audioFramework', function () { const promise = audioManager.setAudioParameter('PNumber', '4800'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('PNumber').then(function (value){ - if(value=='4800'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: PNumber : PASS :' +value); + audioManager.getAudioParameter('PNumber').then(function (value) { + if (value == '4800') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: PNumber : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : PNumber : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : PNumber : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3295,16 +3381,16 @@ describe('audioFramework', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setAudioParameter_003', 0, async function (done) { - const promise = audioManager.setAudioParameter('PLNumber',longValue); + const promise = audioManager.setAudioParameter('PLNumber', longValue); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('PLNumber').then(function (value){ - if(value==longValue){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: PLNumber : PASS :' +value); + audioManager.getAudioParameter('PLNumber').then(function (value) { + if (value == longValue) { + console.info('AudioFrameworkTest: Promise: getAudioParameter: PLNumber : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : PLNumber : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : PLNumber : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3325,13 +3411,13 @@ describe('audioFramework', function () { const promise = audioManager.setAudioParameter('PDecimal', '10.000000234324324324'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('PDecimal').then(function (value){ - if(value=='10.000000234324324324'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: PDecimal : PASS :' +value); + audioManager.getAudioParameter('PDecimal').then(function (value) { + if (value == '10.000000234324324324') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: PDecimal : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : PDecimal : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : PDecimal : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3340,25 +3426,25 @@ describe('audioFramework', function () { done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_005 - * @tc.name : setAudioParameter - Promise - Parameter name Number - * @tc.desc : setAudioParameter - Promise - Parameter name Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_005', 0, async function (done) { + /* * + * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_005 + * @tc.name : setAudioParameter - Promise - Parameter name Number + * @tc.desc : setAudioParameter - Promise - Parameter name Number + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_setAudioParameter_005', 0, async function (done) { const promise = audioManager.setAudioParameter('1212', 'PPNumber'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('1212').then(function (value){ - if(value=='PPNumber'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: 1212 : PASS :' +value); + audioManager.getAudioParameter('1212').then(function (value) { + if (value == 'PPNumber') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: 1212 : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : 1212 : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : 1212 : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3379,13 +3465,13 @@ describe('audioFramework', function () { const promise = audioManager.setAudioParameter('PSpecial', '[]\:";<>?,./~!@#$%^*()_+-={}|'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('PSpecial').then(function (value){ - if(value=='[]\:";<>?,./~!@#$%^*()_+-={}|'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: PSpecial : PASS :' +value); + audioManager.getAudioParameter('PSpecial').then(function (value) { + if (value == '[]\:";<>?,./~!@#$%^*()_+-={}|') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: PSpecial : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : PSpecial : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : PSpecial : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3409,18 +3495,18 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : setAudioParameter: CBSample Rate : Error: ${err.message}`); expect(false).assertTrue(); } - else{ + else { audioManager.getAudioParameter('CBSample Rate', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBSample Rate: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='16 bit'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: PASS :' +value); + else if (value == '16 bit') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3445,18 +3531,18 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : setAudioParameter: Special : Error: ${err.message}`); expect(false).assertTrue(); } - else{ + else { audioManager.getAudioParameter('Special', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParam: Special: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='~!@#$%^*()_+-={}|[]\:";<>?,./'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: PASS :' +value); + else if (value == '~!@#$%^*()_+-={}|[]\:";<>?,./') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3481,18 +3567,18 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : setAudioParameter: CBDecimal : Error: ${err.message}`); expect(false).assertTrue(); } - else{ + else { audioManager.getAudioParameter('CBDecimal', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback :getAudioParm: CBDecimal:Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='10000.21321432432432'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: PASS :' +value); + else if (value == '10000.21321432432432') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3517,18 +3603,18 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : setAudioParameter: CBNumber : Error: ${err.message}`); expect(false).assertTrue(); } - else{ + else { audioManager.getAudioParameter('CBNumber', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParam: CBNumber: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='5454'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: PASS :' +value); + else if (value == '5454') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3558,12 +3644,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBLNumber: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value==longValue){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: PASS :' +value); + else if (value == longValue) { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3592,12 +3678,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: 345667: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='xyza'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: PASS :' +value); + else if (value == 'xyza') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3616,13 +3702,13 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_getAudioParameter_001', 0, async function (done) { const promise = audioManager.getAudioParameter('PBits per sample'); - promise.then(function (value){ - if(value=='8 bit'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' +value); + promise.then(function (value) { + if (value == '8 bit') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3640,13 +3726,13 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_getAudioParameter_002', 0, async function (done) { const promise = audioManager.getAudioParameter('PNumber'); - promise.then(function (value){ - if(value=='4800'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: PNumber : PASS :' +value); + promise.then(function (value) { + if (value == '4800') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: PNumber : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : PNumber : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : PNumber : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3664,13 +3750,13 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_getAudioParameter_003', 0, async function (done) { const promise = audioManager.getAudioParameter('PLNumber'); - promise.then(function (value){ - if(value==longValue){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: PLNumber : PASS :' +value); + promise.then(function (value) { + if (value == longValue) { + console.info('AudioFrameworkTest: Promise: getAudioParameter: PLNumber : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : PLNumber : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : PLNumber : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3688,13 +3774,13 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_getAudioParameter_004', 0, async function (done) { const promise = audioManager.getAudioParameter('PDecimal'); - promise.then(function (value){ - if(value=='10.000000234324324324'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: PDecimal : PASS :' +value); + promise.then(function (value) { + if (value == '10.000000234324324324') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: PDecimal : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : PDecimal : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : PDecimal : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3702,23 +3788,23 @@ describe('audioFramework', function () { done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_005 - * @tc.name : getAudioParameter - Promise - Parameter name Number - * @tc.desc : getAudioParameter - Promise - Parameter name Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_005', 0, async function (done) { + /* * + * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_005 + * @tc.name : getAudioParameter - Promise - Parameter name Number + * @tc.desc : getAudioParameter - Promise - Parameter name Number + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_getAudioParameter_005', 0, async function (done) { const promise = audioManager.getAudioParameter('1212'); - promise.then(function (value){ - if(value=='PPNumber'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: 1212 : PASS :' +value); + promise.then(function (value) { + if (value == 'PPNumber') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: 1212 : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : 1212 : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : 1212 : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3736,13 +3822,13 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_getAudioParameter_006', 0, async function (done) { const promise = audioManager.getAudioParameter('PSpecial'); - promise.then(function (value){ - if(value=='[]\:";<>?,./~!@#$%^*()_+-={}|'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: PSpecial : PASS :' +value); + promise.then(function (value) { + if (value == '[]\:";<>?,./~!@#$%^*()_+-={}|') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: PSpecial : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : PSpecial : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : PSpecial : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3764,12 +3850,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBSample Rate: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='16 bit'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: PASS :' +value); + else if (value == '16 bit') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBSample Rate: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3790,12 +3876,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: Special: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='~!@#$%^*()_+-={}|[]\:";<>?,./'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: PASS :' +value); + else if (value == '~!@#$%^*()_+-={}|[]\:";<>?,./') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: Special: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3816,12 +3902,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBDecimal: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='10000.21321432432432'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: PASS :' +value); + else if (value == '10000.21321432432432') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBDecimal: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3842,12 +3928,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBNumber: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='5454'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: PASS :' +value); + else if (value == '5454') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBNumber: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3868,12 +3954,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: CBLNumber: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value==longValue){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: PASS :' +value); + else if (value == longValue) { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: CBLNumber: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3894,12 +3980,12 @@ describe('audioFramework', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: 345667: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='xyza'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: PASS :' +value); + else if (value == 'xyza') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: 345667: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3916,29 +4002,29 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_onVolumeChange_001', 0, async function (done) { - audioManager.on('volumeChange',(VolumeEvent) => { + audioManager.on('volumeChange', (VolumeEvent) => { console.log('AudioFrameworkTest: Volume Change Event is called'); switch (VolumeEvent.volumeType) { case audio.AudioVolumeType.MEDIA: console.info('AudioFrameworkTest: Audio Volume Type : MEDIA'); - console.info('AudioFrameworkTest: Audio Volume Number : '+VolumeEvent.volume); - console.info('AudioFrameworkTest: Audio Volume Update UI : '+VolumeEvent.updateUi); - if(VolumeEvent.volume == lowVol){ + console.info('AudioFrameworkTest: Audio Volume Number : ' + VolumeEvent.volume); + console.info('AudioFrameworkTest: Audio Volume Update UI : ' + VolumeEvent.updateUi); + if (VolumeEvent.volume == lowVol) { console.info('AudioFrameworkTest: MEDIA CallBack : PASS :' + VolumeEvent.volume); expect(true).assertTrue(); } break; default: - console.info('AudioFrameworkTest: Audio Volume Type : '+VolumeEvent.volumeType); - console.info('AudioFrameworkTest: Audio Volume Number : '+VolumeEvent.volume); - console.info('AudioFrameworkTest: Audio Volume Update UI : '+VolumeEvent.updateUi); + console.info('AudioFrameworkTest: Audio Volume Type : ' + VolumeEvent.volumeType); + console.info('AudioFrameworkTest: Audio Volume Number : ' + VolumeEvent.volume); + console.info('AudioFrameworkTest: Audio Volume Update UI : ' + VolumeEvent.updateUi); expect(false).assertTrue(); break; } }); - await audioManager.setVolume(audioMedia,lowVol); + await audioManager.setVolume(audioMedia, lowVol); done(); }) @@ -3952,29 +4038,29 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_onVolumeChange_002', 0, async function (done) { - audioManager.on('volumeChange',(VolumeEvent) => { + audioManager.on('volumeChange', (VolumeEvent) => { console.log('AudioFrameworkTest: Volume Change Event is called'); switch (VolumeEvent.volumeType) { case audio.AudioVolumeType.RINGTONE: console.info('AudioFrameworkTest: Audio Volume Type : RINGTONE'); - console.info('AudioFrameworkTest: Audio Volume Number : '+VolumeEvent.volume); - console.info('AudioFrameworkTest: Audio Volume Update UI : '+VolumeEvent.updateUi); - if(VolumeEvent.volume == lowVol){ + console.info('AudioFrameworkTest: Audio Volume Number : ' + VolumeEvent.volume); + console.info('AudioFrameworkTest: Audio Volume Update UI : ' + VolumeEvent.updateUi); + if (VolumeEvent.volume == lowVol) { console.info('AudioFrameworkTest: RINGTONE CallBack : PASS :' + VolumeEvent.volume); expect(true).assertTrue(); } break; default: - console.info('AudioFrameworkTest: Audio Volume Type : '+VolumeEvent.volumeType); - console.info('AudioFrameworkTest: Audio Volume Number : '+VolumeEvent.volume); - console.info('AudioFrameworkTest: Audio Volume Update UI : '+VolumeEvent.updateUi); + console.info('AudioFrameworkTest: Audio Volume Type : ' + VolumeEvent.volumeType); + console.info('AudioFrameworkTest: Audio Volume Number : ' + VolumeEvent.volume); + console.info('AudioFrameworkTest: Audio Volume Update UI : ' + VolumeEvent.updateUi); expect(false).assertTrue(); break; } }); - await audioManager.setVolume(audioRingtone,lowVol); + await audioManager.setVolume(audioRingtone, lowVol); done(); }) @@ -3988,29 +4074,29 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_onVolumeChange_003', 0, async function (done) { - audioManager.on('volumeChange',(VolumeEvent) => { + audioManager.on('volumeChange', (VolumeEvent) => { console.log('AudioFrameworkTest: Volume Change Event is called'); switch (VolumeEvent.volumeType) { case audio.AudioVolumeType.VOICE_CALL: console.info('AudioFrameworkTest: Audio Volume Type : VOICE_CALL'); - console.info('AudioFrameworkTest: Audio Volume Number : '+VolumeEvent.volume); - console.info('AudioFrameworkTest: Audio Volume Update UI : '+VolumeEvent.updateUi); - if(VolumeEvent.volume == lowVol){ + console.info('AudioFrameworkTest: Audio Volume Number : ' + VolumeEvent.volume); + console.info('AudioFrameworkTest: Audio Volume Update UI : ' + VolumeEvent.updateUi); + if (VolumeEvent.volume == lowVol) { console.info('AudioFrameworkTest: VOICE_CALL CallBack : PASS :' + VolumeEvent.volume); expect(true).assertTrue(); } break; default: - console.info('AudioFrameworkTest: Audio Volume Type : '+VolumeEvent.volumeType); - console.info('AudioFrameworkTest: Audio Volume Number : '+VolumeEvent.volume); - console.info('AudioFrameworkTest: Audio Volume Update UI : '+VolumeEvent.updateUi); + console.info('AudioFrameworkTest: Audio Volume Type : ' + VolumeEvent.volumeType); + console.info('AudioFrameworkTest: Audio Volume Number : ' + VolumeEvent.volume); + console.info('AudioFrameworkTest: Audio Volume Update UI : ' + VolumeEvent.updateUi); expect(false).assertTrue(); break; } }); - await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL,lowVol); + await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); done(); }) @@ -4024,29 +4110,29 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_onVolumeChange_004', 0, async function (done) { - audioManager.on('volumeChange',(VolumeEvent) => { + audioManager.on('volumeChange', (VolumeEvent) => { console.log('AudioFrameworkTest: Volume Change Event is called'); switch (VolumeEvent.volumeType) { case audio.AudioVolumeType.VOICE_ASSISTANT: console.info('AudioFrameworkTest: Audio Volume Type : VOICE_ASSISTANT'); - console.info('AudioFrameworkTest: Audio Volume Number : '+VolumeEvent.volume); - console.info('AudioFrameworkTest: Audio Volume Update UI : '+VolumeEvent.updateUi); - if(VolumeEvent.volume == lowVol){ + console.info('AudioFrameworkTest: Audio Volume Number : ' + VolumeEvent.volume); + console.info('AudioFrameworkTest: Audio Volume Update UI : ' + VolumeEvent.updateUi); + if (VolumeEvent.volume == lowVol) { console.info('AudioFrameworkTest: VOICE_ASSISTANT CallBack : PASS :' + VolumeEvent.volume); expect(true).assertTrue(); } break; default: - console.info('AudioFrameworkTest: Audio Volume Type : '+VolumeEvent.volumeType); - console.info('AudioFrameworkTest: Audio Volume Number : '+VolumeEvent.volume); - console.info('AudioFrameworkTest: Audio Volume Update UI : '+VolumeEvent.updateUi); + console.info('AudioFrameworkTest: Audio Volume Type : ' + VolumeEvent.volumeType); + console.info('AudioFrameworkTest: Audio Volume Number : ' + VolumeEvent.volume); + console.info('AudioFrameworkTest: Audio Volume Update UI : ' + VolumeEvent.updateUi); expect(false).assertTrue(); break; } }); - await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT,lowVol); + await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); done(); }) @@ -4060,17 +4146,17 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_RingerModeChange_001', 0, async function (done) { - audioManager.on('ringerModeChange',(ringerMode) => { + audioManager.on('ringerModeChange', (ringerMode) => { console.log('AudioFrameworkTest: RingerModeChange is called'); switch (ringerMode) { case audio.AudioRingMode.RINGER_MODE_SILENT: - console.info('AudioFrameworkTest: Ringer Mode Changed to : RINGER_MODE_SILENT : '+ringerMode); + console.info('AudioFrameworkTest: Ringer Mode Changed to : RINGER_MODE_SILENT : ' + ringerMode); expect(true).assertTrue(); break; default: - console.info('AudioFrameworkTest: Ringer Mode Changed : UNKNOWN '+ringerMode); + console.info('AudioFrameworkTest: Ringer Mode Changed : UNKNOWN ' + ringerMode); expect(false).assertTrue(); break; } @@ -4089,17 +4175,17 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_RingerModeChange_002', 0, async function (done) { - audioManager.on('ringerModeChange',(ringerMode) => { + audioManager.on('ringerModeChange', (ringerMode) => { console.log('AudioFrameworkTest: RingerModeChange is called'); switch (ringerMode) { case audio.AudioRingMode.RINGER_MODE_VIBRATE: - console.info('AudioFrameworkTest: Ringer Mode Changed to : RINGER_MODE_VIBRATE : '+ringerMode); + console.info('AudioFrameworkTest: Ringer Mode Changed to : RINGER_MODE_VIBRATE : ' + ringerMode); expect(true).assertTrue(); break; default: - console.info('AudioFrameworkTest: Ringer Mode Changed : UNKNOWN '+ringerMode); + console.info('AudioFrameworkTest: Ringer Mode Changed : UNKNOWN ' + ringerMode); expect(false).assertTrue(); break; } @@ -4118,15 +4204,15 @@ describe('audioFramework', function () { */ it('SUB_AUDIO_MANAGER_RingerModeChange_001', 0, async function (done) { - audioManager.on('ringerModeChange',(ringerMode) => { + audioManager.on('ringerModeChange', (ringerMode) => { console.log('AudioFrameworkTest: RingerModeChange is called'); switch (ringerMode) { case audio.AudioRingMode.RINGER_MODE_NORMAL: - console.info('AudioFrameworkTest: Ringer Mode Changed to : RINGER_MODE_NORMAL : '+ringerMode); + console.info('AudioFrameworkTest: Ringer Mode Changed to : RINGER_MODE_NORMAL : ' + ringerMode); expect(true).assertTrue(); break; default: - console.info('AudioFrameworkTest: Ringer Mode Changed : UNKNOWN '+ringerMode); + console.info('AudioFrameworkTest: Ringer Mode Changed : UNKNOWN ' + ringerMode); expect(false).assertTrue(); break; } @@ -4285,137 +4371,60 @@ describe('audioFramework', function () { done(); }) - /* - * @tc.name:RequestIndependentInterrupt_001 - * @tc.desc: requestIndependentInterrupt callback - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("RequestIndependentInterrupt_001", 0, function (done) { - audioManager.requestIndependentInterrupt(audio.FocusType.FOCUS_TYPE_RECORDING ,(err,data)=>{ - if(err){ - expect(true).assertEqual(false); - return done(); - } - expect(data).assertEqual(true); - done(); - }) - }) - - /* - * @tc.name:RequestIndependentInterrupt_002 - * @tc.desc: requestIndependentInterrupt promise - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("RequestIndependentInterrupt_002", 0, function (done) { - audioManager.requestIndependentInterrupt(audio.FocusType.FOCUS_TYPE_RECORDING).then(data=>{ - expect(data).assertEqual(true); - done(); - }).catch(err=>{ - expect(true).assertEqual(false); - done(); - }) - }) - - /* - * @tc.name:RequestIndependentInterrupt_003 - * @tc.desc: requestIndependentInterrupt ,set param as '0',will catch error with type error - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("RequestIndependentInterrupt_003", 0,async function (done) { - let focusType = '0'; - try{ - await audioManager.requestIndependentInterrupt(focusType) - }catch(err){ - expect('assertion (false) failed: type mismatch').assertEqual(err.message); - } + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_010 + * @tc.name : ActiveDeviceType - BLUETOOTH_SCO + * @tc.desc : ActiveDeviceType - BLUETOOTH_SCO + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_010', 0, async function (done) { + expect(audio.ActiveDeviceType.BLUETOOTH_SCO).assertEqual(7); + await sleep(50); done(); }) - /* - * @tc.name:RequestIndependentInterrupt_004 - * @tc.desc: requestIndependentInterrupt ,set param as 99,will catch error out of border - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("RequestIndependentInterrupt_004", 0, function (done) { - let focusType = 99; - audioManager.requestIndependentInterrupt(focusType).then(data=>{ - expect(data).assertEqual(true); - done(); - }).catch(err=>{ - expect(err).assertEqual(undefined); - done(); - }); + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_011 + * @tc.name : ActiveDeviceType - SPEAKER + * @tc.desc : ActiveDeviceType - SPEAKER + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_011', 0, async function (done) { + expect(audio.ActiveDeviceType.SPEAKER).assertEqual(2); + await sleep(50); + done(); }) - /* - * @tc.name:AbandonIndependentInterrupt_001 - * @tc.desc: abandonIndependentInterrupt callback - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("AbandonIndependentInterrupt_001", 0, function (done) { - audioManager.abandonIndependentInterrupt(audio.FocusType.FOCUS_TYPE_RECORDING,(err,data)=>{ - if(err){ - expect(true).assertEqual(false); - return done(); - } - expect(data).assertEqual(true); - done(); - }) + /* * + * @tc.number : SUB_AUDIO_MANAGER_InterruptActionType_001 + * @tc.name : InterruptActionType - TYPE_ACTIVATED + * @tc.desc : InterruptActionType - TYPE_ACTIVATED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_InterruptActionType_001', 0, async function (done) { + expect(audio.InterruptActionType.TYPE_ACTIVATED).assertEqual(0); + await sleep(50); + done(); }) - /* - * @tc.name:AbandonIndependentInterrupt_002 - * @tc.desc: abandonIndependentInterrupt promise - * @tc.type: FUNC - * @tc.require: Issue Number + /* * + * @tc.number : SUB_AUDIO_MANAGER_InterruptActionType_002 + * @tc.name : InterruptActionType - TYPE_INTERRUPT + * @tc.desc : InterruptActionType - TYPE_INTERRUPT + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 */ - it("AbandonIndependentInterrupt_002", 0, function (done) { - audioManager.abandonIndependentInterrupt(audio.FocusType.FOCUS_TYPE_RECORDING).then(data=>{ - expect(data).assertEqual(true); - done(); - }).catch(err=>{ - expect(true).assertEqual(false); - done(); - }) - }) - - /* - * @tc.name:AbandonIndependentInterrupt_003 - * @tc.desc: abandonIndependentInterrupt ,set param as '0',will catch error with type error - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("AbandonIndependentInterrupt_003", 0, function (done) { - let focusType='0'; - try{ - audioManager.abandonIndependentInterrupt(focusType).then(data=>{ - expect(false).assertTrue(); - }); - }catch(err){ - expect('assertion (false) failed: type mismatch').assertEqual(err.message); - } + it('SUB_AUDIO_MANAGER_InterruptActionType_002', 0, async function (done) { + expect(audio.InterruptActionType.TYPE_INTERRUPT).assertEqual(1); + await sleep(50); done(); }) - /* - * @tc.name:AbandonIndependentInterrupt_004 - * @tc.desc: abandonIndependentInterrupt ,set param as 99,will catch error out of border - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("AbandonIndependentInterrupt_004", 0, function (done) { - let focusType = 99; - audioManager.abandonIndependentInterrupt(focusType).then(data=>{ - expect(data).assertEqual(true); - done(); - }).catch(err=>{ - expect(err).assertEqual(undefined); - 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 7de6bbaf8b320f69eaa87bf1a04b4ebc176fcb32..122b0b912e29facf5ec3918a03e6eccd5a05a114 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 @@ -15,44 +15,24 @@ 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'; +import featureAbility from '@ohos.ability.featureAbility' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; describe('audioRenderer', function () { let fdRead; - let readpath; + 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; - - }*/ + let fdPath; + let filePath; beforeAll(async function () { await applyPermission(); console.info('AudioFrameworkRenderLog: beforeAll: Prerequisites at the test suite level'); - // mediaDir = await getPathName(); }) beforeEach(async function () { @@ -68,22 +48,9 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: afterAll: Test suite-level cleanup condition'); }) - function sleep (ms) { + 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 => { @@ -93,18 +60,30 @@ describe('audioRenderer', function () { }); }); } + 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); - } + let context = await featureAbility.getContext(); + console.info("case0 context is " + context); + await context.getFilesDir().then((data) => { + console.info("case1 getFilesDir is path " + data); + filePath = data + '/' + pathName; + console.info('case4 filePath is ' + filePath); + }) + fdPath = 'fd://'; + await fileio.open(filePath).then((fdNumber) => { + fdPath = fdPath + '' + fdNumber; + fdRead = fdNumber; + console.info('[fileIO]case open fd success,fdPath is ' + fdPath); + console.info('[fileIO]case open fd success,fdRead is ' + fdRead); + + }, (err) => { + console.info('[fileIO]case open fd failed'); + }).catch((err) => { + console.info('[fileIO]case catch open fd failed'); + }); } + async function applyPermission() { let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100); let atManager = abilityAccessCtrl.createAtManager(); @@ -134,22 +113,24 @@ describe('audioRenderer', function () { } } - async function playbackPromise (AudioRendererOptions, pathName, AudioScene) { + 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'); + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state: ' + Object.keys(data)); + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value: ' + JSON.stringify(data)); + }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); return resultFlag; - }); + }); - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+pathName); + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + pathName); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); await audioRen.getStreamInfo().then(async function (audioParamsGet) { console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); @@ -158,11 +139,11 @@ describe('audioRenderer', function () { 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); + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } @@ -172,37 +153,37 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + 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); + 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); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize; await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } @@ -211,65 +192,65 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); - if (rlen > (totalSize/2)){ + if (rlen > (totalSize / 2)) { await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : '+data); + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : ' + data); }).catch((err) => { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: 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 () { 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); + 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); + 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); + resultFlag = true; + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlag); }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } - async function playbackPromise_93 (AudioRendererOptions, pathName, AudioScene) { + async function playbackPromise_93(AudioRendererOptions, pathName, AudioScene) { var resultFlag = true; console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); @@ -278,11 +259,11 @@ describe('audioRenderer', function () { 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: AudioRender Created : ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); await audioRen.getStreamInfo().then(async function (audioParamsGet) { console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); @@ -291,7 +272,7 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); resultFlag = false; }); @@ -301,33 +282,33 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + 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: 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: 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); + // 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: getAudioTime : ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize = await audioRen.getBufferSize(); console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); @@ -337,56 +318,56 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + 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); + if (audioTimeStart != 0) { + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + audioTimeStart); } - else{ - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+audioTimeStart); - resultFlag=false; + 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.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } - async function playbackPromise_94 (AudioRendererOptions, pathName, AudioScene) { + async function playbackPromise_94(AudioRendererOptions, pathName, AudioScene) { var resultFlag = true; console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); @@ -395,11 +376,11 @@ describe('audioRenderer', function () { 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: AudioRender Created : ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); await audioRen.getStreamInfo().then(async function (audioParamsGet) { console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); @@ -408,7 +389,7 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); resultFlag = false; }); @@ -418,23 +399,23 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); - // let audioTime = Date.now(); + // 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); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize = await audioRen.getBufferSize(); console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); @@ -444,22 +425,22 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + 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); + 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: getAudioTime : ERROR : ' + err.message); + resultFlag = false; }); } console.info('AudioFrameworkRenderLog: Renderer after read'); @@ -467,40 +448,40 @@ describe('audioRenderer', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); - if (audioTimeStart != 0){ - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+audioTimeStart); + if (audioTimeStart != 0) { + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + audioTimeStart); } - else{ - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+audioTimeStart); - resultFlag=false; + else { + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + audioTimeStart); + resultFlag = false; } - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } - async function playbackPromise_95 (AudioRendererOptions, pathName, AudioScene) { + async function playbackPromise_95(AudioRendererOptions, pathName, AudioScene) { var resultFlag = true; console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); @@ -509,11 +490,11 @@ describe('audioRenderer', function () { 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: AudioRender Created : ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); await audioRen.getStreamInfo().then(async function (audioParamsGet) { console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); @@ -522,7 +503,7 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); resultFlag = false; }); @@ -532,20 +513,20 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); let audioTimeStart; - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize = await audioRen.getBufferSize(); console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); @@ -555,14 +536,14 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); } @@ -571,79 +552,79 @@ describe('audioRenderer', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); await audioRen.getAudioTime().then(async function (data) { - audioTimeStart = data/1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: '+audioTimeStart); + 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: getAudioTime : ERROR : ' + err.message); + resultFlag = false; }); - if (audioTimeStart !=0){ - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : '+audioTimeStart); + if (audioTimeStart != 0) { + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + audioTimeStart); } - else{ - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+audioTimeStart); - resultFlag=false; + else { + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + audioTimeStart); + resultFlag = false; } - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } - async function playbackPromise_102 (AudioRendererOptions, pathName) { + 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); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); }); - audioRen.on('markReach',55, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : '+position); + audioRen.on('markReach', 55, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : ' + position); resultFlag = true; }) - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize; await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; }); let ss = fileio.fdopenStreamSync(fdRead, 'r'); @@ -653,14 +634,14 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); } @@ -669,65 +650,65 @@ describe('audioRenderer', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); return resultFlag; } - async function playbackPromise_103 (AudioRendererOptions , pathName ) { + 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); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); }); - audioRen.on('markReach',55, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : '+position); + 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); + audioRen.on('markReach', 100, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : ' + position); resultFlag = true; }); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize; await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; }); let ss = fileio.fdopenStreamSync(fdRead, 'r'); @@ -735,14 +716,14 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); } console.info('AudioFrameworkRenderLog: Renderer after read'); @@ -750,65 +731,65 @@ describe('audioRenderer', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); return resultFlag; } - async function playbackPromise_104 ( AudioRendererOptions , pathName ) { + 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); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); }); - audioRen.on('markReach',55, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : '+position); + 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); + audioRen.on('markReach', 73, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : ' + position); resultFlag = false; }); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize; await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; }); let ss = fileio.fdopenStreamSync(fdRead, 'r'); @@ -816,14 +797,14 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); } console.info('AudioFrameworkRenderLog: Renderer after read'); @@ -831,62 +812,62 @@ describe('audioRenderer', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); return resultFlag; } - async function playbackPromise_105 (AudioRendererOptions , pathName) { + 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); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); }); - audioRen.on('periodReach',55, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : '+position); + 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); + 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize; await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; }); let ss = fileio.fdopenStreamSync(fdRead, 'r'); @@ -894,14 +875,14 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); } @@ -910,67 +891,67 @@ describe('audioRenderer', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); return resultFlag; } - async function playbackPromise_106 (AudioRendererOptions , pathName) { + 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); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); }); - audioRen.on('periodReach',55, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : '+position); + 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); + 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); + 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize; await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; }); let ss = fileio.fdopenStreamSync(fdRead, 'r'); @@ -978,14 +959,14 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); } console.info('AudioFrameworkRenderLog: Renderer after read'); @@ -993,65 +974,65 @@ describe('audioRenderer', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); return resultFlag; } - async function playbackPromise_107 (AudioRendererOptions, pathName) { + 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); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); }); - audioRen.on('periodReach',55, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : '+position); + 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); + audioRen.on('periodReach', 73, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : ' + position); resultFlag = false; }); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize; await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; }); let ss = fileio.fdopenStreamSync(fdRead, 'r'); @@ -1059,14 +1040,14 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); } console.info('AudioFrameworkRenderLog: Renderer after read'); @@ -1074,26 +1055,26 @@ describe('audioRenderer', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); return resultFlag; } @@ -1106,11 +1087,11 @@ describe('audioRenderer', function () { 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: AudioRender Created : ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); await audioRen.getStreamInfo().then(async function (audioParamsGet) { console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); @@ -1119,7 +1100,7 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); resultFlag = false; }); @@ -1129,19 +1110,19 @@ describe('audioRenderer', function () { console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize = await audioRen.getBufferSize(); console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); @@ -1151,29 +1132,29 @@ describe('audioRenderer', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); - if (rlen > (totalSize/8)){ + if (rlen > (totalSize / 8)) { await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data); + console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; }); } - if (rlen > (totalSize/8)){ + 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; + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); + resultFlag = false; } else { console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); @@ -1185,272 +1166,272 @@ describe('audioRenderer', function () { audioRen.getRenderRate((err, data) => { if (err) { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message); - resultFlag=false; + 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 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; + 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.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer stop:ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + 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(100); - 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; + 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(100); + 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; } @@ -1464,32 +1445,32 @@ describe('audioRenderer', function () { */ 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 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 AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + 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(); + readPath = 'StarWars10s-1C-44100-2SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); }) /* * @@ -1500,7 +1481,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_093', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_093', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, @@ -1520,13 +1501,13 @@ describe('audioRenderer', function () { 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); + readPath = 'StarWars10s-2C-24000-3SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_93(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -1539,7 +1520,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_094', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_094', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, @@ -1559,13 +1540,13 @@ describe('audioRenderer', function () { 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); + readPath = 'StarWars10s-2C-24000-3SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_94(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -1577,7 +1558,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_095', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_095', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, @@ -1597,13 +1578,13 @@ describe('audioRenderer', function () { 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); + readPath = 'StarWars10s-2C-24000-3SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_95(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -1615,7 +1596,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_102', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_102', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -1635,13 +1616,13 @@ describe('audioRenderer', function () { } //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); + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_102(AudioRendererOptions, filePath); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -1654,7 +1635,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_103', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_103', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -1673,13 +1654,13 @@ describe('audioRenderer', function () { 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); + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_103(AudioRendererOptions, filePath); await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -1692,7 +1673,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_104', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_104', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -1712,13 +1693,13 @@ describe('audioRenderer', function () { } //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); + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_104(AudioRendererOptions, filePath); await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -1731,7 +1712,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_105', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_105', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -1749,13 +1730,13 @@ describe('audioRenderer', function () { streamInfo: AudioStreamInfo, rendererInfo: AudioRendererInfo } - readpath ='StarWars10s-2C-48000-4SW.wav'; - await getFdRead(readpath,done); - var resultFlag = await playbackPromise_105(AudioRendererOptions, readpath); + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_105(AudioRendererOptions, filePath); await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -1768,7 +1749,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_106', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_106', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -1787,13 +1768,13 @@ describe('audioRenderer', function () { 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); + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_106(AudioRendererOptions, filePath); await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -1806,7 +1787,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_107', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_107', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -1826,13 +1807,13 @@ describe('audioRenderer', function () { } //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); + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_107(AudioRendererOptions, filePath); await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -1844,34 +1825,34 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + 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); + readPath = 'StarWars10s-1C-8000-2SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); }) /* * @@ -1882,34 +1863,34 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + 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); + readPath = 'StarWars10s-1C-32000-1SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); }) /* * @@ -1920,33 +1901,33 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + 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(); + readPath = 'StarWars10s-1C-64000-3SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); }) /* * @@ -1957,33 +1938,33 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + 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(); + readPath = 'StarWars10s-1C-96000-4SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); }) /* * @@ -1994,33 +1975,33 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + 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(); + readPath = 'StarWars10s-2C-11025-1SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); }) /* * @@ -2031,33 +2012,33 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + 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(); + readPath = 'StarWars10s-2C-12000-2SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); }) /* * @@ -2068,33 +2049,33 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + 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(); + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); }) /* * @@ -2105,43 +2086,43 @@ describe('audioRenderer', function () { * @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 - } + 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 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); + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) @@ -2153,43 +2134,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2200,43 +2181,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2247,43 +2228,43 @@ describe('audioRenderer', function () { * @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 - } + 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 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); + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) @@ -2295,43 +2276,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2342,43 +2323,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2389,43 +2370,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2436,43 +2417,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - 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(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2483,43 +2464,43 @@ describe('audioRenderer', function () { * @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 - } + 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 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); + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) @@ -2531,43 +2512,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2578,43 +2559,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2625,43 +2606,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2672,43 +2653,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2719,43 +2700,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - 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(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2766,43 +2747,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2813,43 +2794,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2860,90 +2841,90 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - 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 + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -2954,43 +2935,43 @@ describe('audioRenderer', function () { * @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 - } + 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 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); + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) @@ -3002,43 +2983,43 @@ describe('audioRenderer', function () { * @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 - } + 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 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); + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) @@ -3050,43 +3031,43 @@ describe('audioRenderer', function () { * @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 - } + 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 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); + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) @@ -3098,43 +3079,43 @@ describe('audioRenderer', function () { * @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 - } + 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 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); + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) @@ -3146,43 +3127,43 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } - 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); + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :'+data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); + + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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(); }) /* * @@ -3193,357 +3174,45 @@ describe('audioRenderer', function () { * @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 - } + 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 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); + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :'+data); + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); - }) + var resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, 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 @@ -3553,68 +3222,68 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - done(); + done(); }) @@ -3626,70 +3295,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -3701,70 +3370,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -3776,70 +3445,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -3851,70 +3520,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -3926,70 +3595,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4001,70 +3670,70 @@ describe('audioRenderer', function () { * @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); + 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 } - else{ - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; + + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 } - if (audioParamsGet.usage == AudioRendererInfo.usage){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4076,70 +3745,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4151,70 +3820,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4226,70 +3895,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4301,70 +3970,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4376,70 +4045,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4451,70 +4120,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4526,70 +4195,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4601,70 +4270,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4676,70 +4345,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4751,70 +4420,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4826,70 +4495,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4901,70 +4570,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -4976,70 +4645,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -5051,70 +4720,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -5126,70 +4795,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -5201,70 +4870,70 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + done(); }) @@ -5276,576 +4945,73 @@ describe('audioRenderer', function () { * @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 - } + 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 AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } + var AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } - var resultFlag=true; + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } - 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; - }); + var resultFlag = true; - 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); + 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 (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags){ - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else{ - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + }); + + 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; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); - resultFlag = false; - }); + }); - expect(resultFlag).assertTrue(); + expect(resultFlag).assertTrue(); - done(); + 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 @@ -5854,52 +5020,52 @@ describe('audioRenderer', function () { * @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(); + 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(); }) @@ -5911,67 +5077,67 @@ describe('audioRenderer', function () { * @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(); + 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(); }) @@ -5983,69 +5149,69 @@ describe('audioRenderer', function () { * @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(); + 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(); }) @@ -6057,70 +5223,70 @@ describe('audioRenderer', function () { * @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(); + 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(); }) @@ -6132,561 +5298,561 @@ describe('audioRenderer', function () { * @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(); + 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; + }); - /* * - * @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(); + 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); - /* * - * @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) { + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); - 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 - } + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - 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(); + 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); - /* * - * @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) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - 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 - } + await sleep(500) - 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(); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); }) @@ -6698,7 +5864,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_081', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_081', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, @@ -6707,142 +5873,142 @@ describe('audioRenderer', function () { 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(); + 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(); }) @@ -6854,7 +6020,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_113', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_113', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, @@ -6875,13 +6041,13 @@ describe('audioRenderer', function () { } //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 ); + readPath = 'StarWars10s-1C-32000-1SW.wav' + await getFdRead(readPath, done); + var resultFlag = await playbackPromise_113(AudioRendererOptions, filePath); await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -6893,7 +6059,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_096', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_096', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, @@ -6915,10 +6081,10 @@ describe('audioRenderer', function () { //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readpath = 'StarWars10s-2C-48000-4SW.wav'; - await getFdRead(readpath,done); + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); var resultFlag = true; - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+readpath); + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); @@ -6927,37 +6093,37 @@ describe('audioRenderer', function () { 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: 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); + console.info('AudioFrameworkRenderLog: getAudioTime : Value : ' + data); + resultFlag = true; + if (data > 0) { + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + data); } - else{ - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : '+data); + else { + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + data); } }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : '+err.message); + 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: Renderer release :ERROR : ' + err.message); }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); await sleep(500); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(readPath); done(); }) @@ -6971,7 +6137,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_097', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_097', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -6996,11 +6162,11 @@ describe('audioRenderer', function () { audioRen = data; console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); resultFlag = false; }); - audioRen.on('stateChange',(AudioState) => { + audioRen.on('stateChange', (AudioState) => { console.log('AudioFrameworkTest: Volume Change Event is called'); @@ -7010,7 +6176,7 @@ describe('audioRenderer', function () { resultFlag = true; break; default: - console.info('AudioFrameworkTest: state : '+AudioState); + console.info('AudioFrameworkTest: state : ' + AudioState); break; } }); @@ -7018,7 +6184,7 @@ describe('audioRenderer', function () { 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: Renderer release :ERROR : ' + err.message); }); await sleep(1000); expect(resultFlag).assertTrue(); @@ -7035,7 +6201,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_098', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_098', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -7060,11 +6226,11 @@ describe('audioRenderer', function () { audioRen = data; console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); resultFlag = false; }); - audioRen.on('stateChange',(AudioState) => { + audioRen.on('stateChange', (AudioState) => { console.log('AudioFrameworkTest: Volume Change Event is called'); @@ -7074,7 +6240,7 @@ describe('audioRenderer', function () { resultFlag = true; break; default: - console.info('AudioFrameworkTest: state : '+AudioState); + console.info('AudioFrameworkTest: state : ' + AudioState); break; } }); @@ -7082,8 +6248,8 @@ describe('audioRenderer', function () { 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); await sleep(500); @@ -7091,13 +6257,13 @@ describe('audioRenderer', function () { 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: 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); + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); }); await sleep(1000); @@ -7115,7 +6281,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_099', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_099', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -7140,11 +6306,11 @@ describe('audioRenderer', function () { audioRen = data; console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); resultFlag = false; }); - audioRen.on('stateChange',(AudioState) => { + audioRen.on('stateChange', (AudioState) => { console.log('AudioFrameworkTest: Volume Change Event is called'); @@ -7154,7 +6320,7 @@ describe('audioRenderer', function () { resultFlag = true; break; default: - console.info('AudioFrameworkTest: state : '+AudioState); + console.info('AudioFrameworkTest: state : ' + AudioState); break; } }); @@ -7162,8 +6328,8 @@ describe('audioRenderer', function () { 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); await sleep(500); @@ -7171,15 +6337,15 @@ describe('audioRenderer', function () { await audioRen.stop().then(async function () { console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlag=false; + 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); + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); }); await sleep(500); @@ -7197,7 +6363,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_100', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_100', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -7222,11 +6388,11 @@ describe('audioRenderer', function () { audioRen = data; console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); resultFlag = false; }); - audioRen.on('stateChange',(AudioState) => { + audioRen.on('stateChange', (AudioState) => { console.log('AudioFrameworkTest: Volume Change Event is called'); @@ -7236,7 +6402,7 @@ describe('audioRenderer', function () { resultFlag = true; break; default: - console.info('AudioFrameworkTest: state : '+AudioState); + console.info('AudioFrameworkTest: state : ' + AudioState); break; } }); @@ -7244,8 +6410,8 @@ describe('audioRenderer', function () { 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: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); await sleep(500); @@ -7253,15 +6419,15 @@ describe('audioRenderer', function () { await audioRen.stop().then(async function () { console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlag=false; + 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); + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); }); await sleep(500); @@ -7279,7 +6445,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_101', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_101', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -7304,10 +6470,10 @@ describe('audioRenderer', function () { audioRen = data; console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); resultFlag = false; }); - audioRen.on('stateChange',(AudioState) => { + audioRen.on('stateChange', (AudioState) => { console.log('AudioFrameworkTest: Volume Change Event is called'); @@ -7317,15 +6483,15 @@ describe('audioRenderer', function () { resultFlag = true; break; default: - console.info('AudioFrameworkTest: state : '+AudioState); + 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; + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); await sleep(500); @@ -7333,22 +6499,22 @@ describe('audioRenderer', function () { await audioRen.pause().then(async function () { console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : '+err.message); - resultFlag=false; + 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); + 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); + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); }); await sleep(500) @@ -7426,7 +6592,7 @@ describe('audioRenderer', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_AUDIO_RENDERER_Play_audio_112', 0,async function (done) { + it('SUB_AUDIO_RENDERER_Play_audio_112', 0, async function (done) { var AudioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, channels: audio.AudioChannel.CHANNEL_2, @@ -7451,10 +6617,10 @@ describe('audioRenderer', function () { audioRen = data; console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); resultFlag = false; }); - audioRen.on('stateChange',(AudioState) => { + audioRen.on('stateChange', (AudioState) => { console.log('AudioFrameworkTest: Volume Change Event is called'); @@ -7464,25 +6630,25 @@ describe('audioRenderer', function () { resultFlag = true; break; default: - console.info('AudioFrameworkTest: state : '+AudioState); + 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; + 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; + console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : ' + err.message); + resultFlag = false; } - else{ + else { console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); } }); @@ -7491,14 +6657,14 @@ describe('audioRenderer', function () { 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: 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); + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); }); await sleep(500) @@ -7522,206 +6688,4 @@ describe('audioRenderer', function () { await sleep(50); done(); }) - - /* - * @tc.name:SetInterruptMode_001 - * @tc.desc:SetInterruptMode mode 0 callback,is public share mode - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_001", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 0; - audioRenderer.setInterruptMode(mode,(err,data)=>{ - if(err){ - expect(true).assertEqual(false); - return done(); - } - expect(true).assertEqual(true); - done(); - }) - }) - - /* - * @tc.name:SetInterruptMode_002 - * @tc.desc:SetInterruptMode mode 1 callback,is independent mode - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_002", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 1; - audioRenderer.setInterruptMode(mode,(err,data)=>{ - if(err){ - expect(true).assertEqual(false); - return done(); - } - expect(true).assertEqual(true); - done(); - }) - }) - - /* - * @tc.name:SetInterruptMode_003 - * @tc.desc:SetInterruptMode mode 0 promise,is public share mode - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_003", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 0; - audioRenderer.setInterruptMode(mode).then(data=>{ - expect(true).assertEqual(true); - done(); - }).catch(err=>{ - expect(true).assertEqual(false); - done(); - }) - }) - - /* - * @tc.name:SetInterruptMode_004 - * @tc.desc:SetInterruptMode mode 1 promise,is independent mode - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_004", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 1; - audioRenderer.setInterruptMode(mode).then(data=>{ - expect(true).assertEqual(true); - done(); - }).catch(err=>{ - expect(true).assertEqual(false); - done(); - }) - }) - - /* - * @tc.name:SetInterruptMode_005 - * @tc.desc:SetInterruptMode mode '1',will catch error with type error - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_005", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = '1'; - try{ - let data = await audioRenderer.setInterruptMode(mode); - expect(false).assertEqual(false); - done(); - }catch(err){ - expect('assertion (false) failed: type mismatch').assertEqual(err.message); - done(); - } - }) - - /* - * @tc.name:SetInterruptMode_006 - * @tc.desc:SetInterruptMode mode 2,will catch error with out of border - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_006", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 2; - try{ - let data = await audioRenderer.setInterruptMode(mode) - expect(true).assertEqual(true); - done(); - }catch(err){ - expect(err).assertEqual(undefined); - done(); - } - }) }) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRendererChangeInfo.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRendererChangeInfo.test.js index 7e3eb73f2c6c8a89d466114383757463bbe0302b..ad1c96f22055b06c6760925c96f75e4a073ff2ef 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRendererChangeInfo.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRendererChangeInfo.test.js @@ -23,49 +23,50 @@ import ability_featureAbility from '@ohos.ability.featureAbility'; import resourceManager from '@ohos.resourceManager'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; -describe('audioRendererChangeInfo', function () { +describe('audioRendererChange', function () { var audioStreamManager; var audioStreamManagerCB; let fdRead; let readpath; + var Tag = "AFRenLog : "; const audioManager = audio.getAudioManager(); - console.info('AFRenLog: Create AudioManger Object JS Framework'); + console.info(Tag+'Create AudioManger Object JS Framework'); beforeAll(async function () { await applyPermission(); await audioManager.getStreamManager().then(async function (data) { audioStreamManager = data; - console.info('AFRenLog: Get AudioStream Manager : Success '); + console.info(Tag+'Get AudioStream Manager : Success '); }).catch((err) => { - console.info('AFRenLog: Get AudioStream Manager : ERROR : '+err.message); + console.info(Tag+'Get AudioStream Manager : ERROR : '+err.message); }); audioManager.getStreamManager((err, data) => { if (err) { - console.error('AudioFrameworkChange: Get AudioStream Manager : ERROR : '+err.message); + console.error(Tag+'Get AudioStream Manager : ERROR : '+err.message); } else { audioStreamManagerCB = data; - console.info('AudioFrameworkChange: Get AudioStream Manager : Success '); + console.info(Tag+'Get AudioStream Manager : Success '); } }); await sleep(1000); - console.info('AFRenLog: beforeAll: Prerequisites at the test suite level'); + console.info(Tag+'beforeAll: Prerequisites at the test suite level'); }) beforeEach(async function () { - console.info('AFRenLog: beforeEach: Prerequisites at the test case level'); + console.info(Tag+'beforeEach: Prerequisites at the test case level'); await sleep(1000); }) afterEach(function () { - console.info('AFRenLog: afterEach: Test case-level clearance conditions'); + console.info(Tag+'afterEach: Test case-level clearance conditions'); }) afterAll(async function () { - console.info('AFRenLog: afterAll: Test suite-level cleanup condition'); + console.info(Tag+'afterAll: Test suite-level cleanup condition'); }) function sleep (ms) { @@ -78,7 +79,7 @@ describe('audioRendererChangeInfo', function () { await mgr.getRawFileDescriptor(fileName).then(value => { fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length }; }).catch(error => { - console.log('AFRenLog:case getRawFileDescriptor err: '+error); + console.log(Tag+'case getRawFileDescriptor err: '+error); }); }); return fileDescriptor; @@ -87,9 +88,9 @@ describe('audioRendererChangeInfo', function () { async function closeFileDescriptor(fileName) { await resourceManager.getResourceManager().then(async (mgr) => { await mgr.closeRawFileDescriptor(fileName).then(value => { - console.log('AFRenLog:case closeRawFileDescriptor success for file:'+fileName); + console.log(Tag+'case closeRawFileDescriptor success for file:'+fileName); }).catch(error => { - console.log('AFRenLog:case closeRawFileDescriptor err: '+error); + console.log(Tag+'case closeRawFileDescriptor err: '+error); }); }); } @@ -97,7 +98,7 @@ describe('audioRendererChangeInfo', function () { await getFileDescriptor(pathName).then((res) => { if (res == undefined) { expect().assertFail(); - console.info('AFRenLog:case error fileDescriptor undefined, open file fail'); + console.info(Tag+'case error fileDescriptor undefined, open file fail'); done(); } else { fdRead = res.fd; @@ -110,27 +111,27 @@ describe('audioRendererChangeInfo', function () { let atManager = abilityAccessCtrl.createAtManager(); if (atManager != null) { let tokenID = appInfo.accessTokenId; - console.info('AFRenLog:[permission] case accessTokenID is '+tokenID); + console.info(Tag+'[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('AFRenLog:[permission] case grantUserGrantedPermission success :'+result); + console.info(Tag+'[permission] case grantUserGrantedPermission success :'+result); }).catch((err) => { - console.info('AFRenLog:[permission] case grantUserGrantedPermission failed :'+err); + console.info(Tag+'[permission] case grantUserGrantedPermission failed :'+err); }); await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('AFRenLog:[permission] case grantUserGrantedPermission success :'+result); + console.info(Tag+'[permission] case grantUserGrantedPermission success :'+result); }).catch((err) => { - console.info('AFRenLog:[permission] case grantUserGrantedPermission failed :'+err); + console.info(Tag+'[permission] case grantUserGrantedPermission failed :'+err); }); await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('AFRenLog:[permission] case grantUserGrantedPermission success :'+result); + console.info(Tag+'[permission] case grantUserGrantedPermission success :'+result); }).catch((err) => { - console.info('AFRenLog:[permission] case grantUserGrantedPermission failed :'+err); + console.info(Tag+'[permission] case grantUserGrantedPermission failed :'+err); }); } else { - console.info('AFRenLog:[permission] case apply permission failed, createAtManager failed'); + console.info(Tag+'[permission] case apply permission failed, createAtManager failed'); } } @@ -166,38 +167,49 @@ describe('audioRendererChangeInfo', function () { audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManagerCB.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-001] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-001] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -239,52 +251,65 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-002] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-002] ######### RendererChange Off is called #########'); await audioRen.stop().then(async function () { - console.info('AFRenLog: Renderer stopped : SUCCESS'); + console.info(Tag+'Renderer stopped : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); done(); @@ -324,51 +349,64 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); await audioRen.start().then(async function () { - console.info('AFRenLog: renderInstant started :SUCCESS '); + console.info(Tag+'renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-003] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-003] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -409,52 +447,65 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); await audioRen.start().then(async function () { - console.info('AFRenLog: renderInstant started :SUCCESS '); + console.info(Tag+'renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); await audioRen.stop().then(async function () { - console.info('AFRenLog: Renderer stopped : SUCCESS'); + console.info(Tag+'Renderer stopped : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-004] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-004] ######### RendererChange Off is called #########'); expect(resultFlag).assertTrue(); done(); @@ -494,57 +545,70 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); await audioRen.start().then(async function () { - console.info('AFRenLog: renderInstant started :SUCCESS '); + console.info(Tag+'renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: renderInstant Pause :ERROR : '+err.message); + console.info(Tag+'renderInstant Pause :ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-005] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-005] ######### RendererChange Off is called #########'); await audioRen.stop().then(async function () { - console.info('AFRenLog: Renderer stopped : SUCCESS'); + console.info(Tag+'Renderer stopped : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -583,37 +647,48 @@ describe('audioRendererChangeInfo', function () { audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManagerCB.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-006] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-006] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -653,37 +728,48 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-007] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-007] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -727,37 +813,48 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-008] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-008] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -799,37 +896,48 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-009] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-009] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -870,38 +978,49 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-010] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-010] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -943,38 +1062,49 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-011] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-011] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1014,38 +1144,49 @@ describe('audioRendererChangeInfo', function () { audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManagerCB.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-012] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-012] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1086,38 +1227,49 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-013] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-013] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1159,38 +1311,49 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-014] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-014] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1230,37 +1393,48 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1300,37 +1474,48 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1371,44 +1556,144 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########'); + + await audioRen.release().then(async function () { + console.info(Tag+'Renderer release : SUCCESS'); + }).catch((err) => { + console.info(Tag+'Renderer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /* * + * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_018 + * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_ON_RENDERER_CHANGE_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_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 1 + } + + var AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + var resultFlag = false; + + var audioRen; + + audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i=0;i 0 && dType == 2 && dRole == 2 && sRate!= null && cCount != null && cMask != null) { + resultFlag = true; + } + } + } + }); + await sleep (100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag+'AudioRender Created : ERROR : '+err.message); + }); + + await sleep (100); + + audioStreamManagerCB.off('audioRendererChange'); + await sleep(100); + console.info(Tag+'[RENDERER-CHANGE-ON-018] ######### RendererChange Off is called #########'); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); done(); }) + /* * * @tc.number : SUB_AUDIO_OFF_RENDERER_CHANGE_001 * @tc.name : AudioRendererChange - OFF_STATE_PREPARED @@ -1442,34 +1727,44 @@ describe('audioRendererChangeInfo', function () { audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1508,40 +1803,52 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1579,46 +1886,58 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); await audioRen.start().then(async function () { - console.info('AFRenLog: renderInstant started :SUCCESS '); + console.info(Tag+'renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1658,46 +1977,58 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); await audioRen.start().then(async function () { - console.info('AFRenLog: renderInstant started :SUCCESS '); + console.info(Tag+'renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); await audioRen.stop().then(async function () { - console.info('AFRenLog: Renderer stopped : SUCCESS'); + console.info(Tag+'Renderer stopped : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1737,52 +2068,64 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); await audioRen.start().then(async function () { - console.info('AFRenLog: renderInstant started :SUCCESS '); + console.info(Tag+'renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); + await sleep (100); + audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: renderInstant Pause :ERROR : '+err.message); + console.info(Tag+'renderInstant Pause :ERROR : '+err.message); }); await audioRen.stop().then(async function () { - console.info('AFRenLog: Renderer stopped : SUCCESS'); + console.info(Tag+'Renderer stopped : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1790,6 +2133,91 @@ describe('audioRendererChangeInfo', function () { }) + /* * + * @tc.number : SUB_AUDIO_OFF_RENDERER_CHANGE_006 + * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_OFF_RENDERER_CHANGE_006', 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 resultFlag = true; + var audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i=0;i 0 && dType == 2 && dRole == 2 && sRate!= null && cCount != null && cMask != null) { + resultFlag = false; + } + } + } + }); + await sleep (100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(Tag+'[RENDERER-CHANGE-OFF-006] ######### RendererChange Off is called #########'); + console.info(Tag+'[RENDERER-CHANGE-OFF-006] ResultFlag is:'+resultFlag); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag+'AudioRender Created : ERROR : '+err.message); + }); + + await audioRen.release().then(async function () { + console.info(Tag+'Renderer release : SUCCESS'); + }).catch((err) => { + console.info(Tag+'Renderer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + /* * * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_001 * @tc.name : AudioRendererChange - GET_STATE_PREPARED @@ -1821,55 +2249,76 @@ describe('audioRendererChangeInfo', function () { var resultFlag = false; audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioRenderer Created : ERROR : '+err.message); + console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info('AFRenLog: [GET_RENDERER_STATE_1_PROMISE] ######### Get Promise is called ##########'); + console.info(Tag+'[GET_RENDERER_STATE_1_PROMISE] ######### Get Promise is called ##########'); if (AudioRendererChangeInfoArray!=null) { for (let i=0;i { - console.log('AFRenLog: getCurrentAudioRendererInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); resultFlag = false; }); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [GET_RENDERER_STATE_1_PROMISE] ######### RendererChange Off is called #########'); + console.info(Tag+'[GET_RENDERER_STATE_1_PROMISE] ######### RendererChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -1912,63 +2361,84 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioRenderer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRenderer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioRenderer Created : ERROR : '+err.message); + console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Renderer start :ERROR : '+err.message); + console.info(Tag+'Renderer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); await audioStreamManagerCB.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info('AFRenLog: [GET_RENDERER_STATE_2_PROMISE] ######### Get Promise is called ##########'); + console.info(Tag+'[GET_RENDERER_STATE_2_PROMISE] ######### Get Promise is called ##########'); if (AudioRendererChangeInfoArray!=null) { for (let i=0;i { - console.log('AFRenLog: getCurrentAudioRendererInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); resultFlag = false; }); audioStreamManagerCB.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [GET_RENDERER_STATE_2_PROMISE] ######### RendererChange Off is called #########'); + console.info(Tag+'[GET_RENDERER_STATE_2_PROMISE] ######### RendererChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -2012,70 +2482,91 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioRenderer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRenderer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioRenderer Created : ERROR : '+err.message); + console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); }); await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Renderer started :SUCCESS '); + console.info(Tag+'Renderer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Renderer start :ERROR : '+err.message); + console.info(Tag+'Renderer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); - await sleep(500); + await sleep(100); await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info('AFRenLog: [GET_RENDERER_STATE_3_PROMISE] ######### Get Promise is called ##########'); + console.info(Tag+'[GET_RENDERER_STATE_3_PROMISE] ######### Get Promise is called ##########'); if (AudioRendererChangeInfoArray!=null) { for (let i=0;i { - console.log('AFRenLog: getCurrentAudioRendererInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); resultFlag = false; }); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [GET_RENDERER_STATE_3_PROMISE] ######### RendererChange Off is called #########'); + console.info(Tag+'[GET_RENDERER_STATE_3_PROMISE] ######### RendererChange Off is called #########'); await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -2117,80 +2608,213 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); await audioRen.start().then(async function () { - console.info('AFRenLog: renderInstant started :SUCCESS '); + console.info(Tag+'renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: renderInstant Pause :ERROR : '+err.message); + console.info(Tag+'renderInstant Pause :ERROR : '+err.message); }); - await sleep (500); + await sleep (100); await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info('AFRenLog: [GET_RENDERER_STATE_5_PROMISE] ######### Get Promise is called ##########'); + console.info(Tag+'[GET_RENDERER_STATE_5_PROMISE] ######### Get Promise is called ##########'); if (AudioRendererChangeInfoArray!=null) { for (let i=0;i { - console.log('AFRenLog: getCurrentAudioRendererInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); resultFlag = false; }); audioStreamManager.off('audioRendererChange'); await sleep(100); - console.info('AFRenLog: [GET_RENDERER_STATE_5_PROMISE] ######### RendererChange Off is called #########'); + console.info(Tag+'[GET_RENDERER_STATE_5_PROMISE] ######### RendererChange Off is called #########'); await audioRen.stop().then(async function () { - console.info('AFRenLog: Renderer stopped : SUCCESS'); + console.info(Tag+'Renderer stopped : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); done(); }) +/* * + * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_005 + * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0*/ + + it('SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_005', 0, async function (done) { + var audioCap ; + 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 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; + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i=0;i { + console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); + }); + + await sleep(100); + + await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { + console.info(Tag+'[GET_RENDERER_DD_PROMISE] ######### Get Promise is called ##########'); + if (AudioRendererChangeInfoArray!=null) { + for (let i=0;i 0 && dType == 2 && dRole == 2 && sRate!= null && cCount != null && cMask != null) { + resultFlag = true; + } + } + } + } + }).catch((err) => { + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); + resultFlag = false; + }); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(Tag+'[GET_RENDERER_DD_PROMISE] ######### RendererChange Off is called #########'); + + await audioCap.release().then(async function () { + console.info(Tag+'Renderer release : SUCCESS'); + }).catch((err) => { + console.info(Tag+'Renderer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + done(); + }) /* * * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_001 @@ -2223,45 +2847,66 @@ describe('audioRendererChangeInfo', function () { var resultFlag = false; audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: AudioRenderer Created : ERROR : '+err.message); + console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info('AFRenLog: [GET_RENDERER_STATE_1_CALLBACK] **** Get Callback Called ****'); + console.info(Tag+'[GET_RENDERER_STATE_1_CALLBACK] **** Get Callback Called ****'); await sleep(100); if (err) { - console.log('AFRenLog: getCurrentAudioRendererInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); resultFlag = false; } else { if (AudioRendererChangeInfoArray !=null) { for (let i=0;i { - console.info('AudioFrameworkRecLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -2320,53 +2965,74 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioRenderer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRenderer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioRenderer Created : ERROR : '+err.message); + console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Renderer start :ERROR : '+err.message); + console.info(Tag+'Renderer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManagerCB.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info('AFRenLog: [GET_RENDERER_STATE_2_CALLBACK] **** Get Callback Called ****'); + console.info(Tag+'[GET_RENDERER_STATE_2_CALLBACK] **** Get Callback Called ****'); await sleep(100); if (err) { - console.log('AFRenLog: getCurrentAudioRendererInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); resultFlag = false; } else { if (AudioRendererChangeInfoArray !=null) { for (let i=0;i { - console.info('AudioFrameworkRecLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -2426,60 +3092,81 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioCap = data; - console.info('AudioFrameworkRecLog: AudioRenderer Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRenderer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioRenderer Created : ERROR : '+err.message); + console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); }); await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Renderer started :SUCCESS '); + console.info(Tag+'Renderer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Renderer start :ERROR : '+err.message); + console.info(Tag+'Renderer start :ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AudioFrameworkRecLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); - await sleep(500); + await sleep(100); audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info('AFRenLog: [GET_RENDERER_STATE_3_CALLBACK] **** Get Callback Called ****'); + console.info(Tag+'[GET_RENDERER_STATE_3_CALLBACK] **** Get Callback Called ****'); await sleep(100); if (err) { - console.log('AFRenLog: getCurrentAudioRendererInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); resultFlag = false; } else { if (AudioRendererChangeInfoArray !=null) { for (let i=0;i { - console.info('AudioFrameworkRecLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); @@ -2537,58 +3224,81 @@ describe('audioRendererChangeInfo', function () { await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { audioRen = data; - console.info('AFRenLog: AudioRender Created : Success : Stream Type: SUCCESS'); + console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AFRenLog: AudioRender Created : ERROR : '+err.message); + console.info(Tag+'AudioRender Created : ERROR : '+err.message); }); await audioRen.start().then(async function () { - console.info('AFRenLog: renderInstant started :SUCCESS '); + console.info(Tag+'renderInstant started :SUCCESS '); }).catch((err) => { - console.info('AFRenLog: renderInstant start :ERROR : '+err.message); + console.info(Tag+'renderInstant start :ERROR : '+err.message); }); + await sleep (100); + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i=0;i { - console.info('AFRenLog: renderInstant Pause :ERROR : '+err.message); + console.info(Tag+'renderInstant Pause :ERROR : '+err.message); }); - await sleep (500); + await sleep (100); audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info('AFRenLog: [GET_RENDERER_STATE_5_CALLBACK] **** Get Callback Called ****'); + console.info(Tag+'[GET_RENDERER_STATE_5_CALLBACK] **** Get Callback Called ****'); await sleep(100); if (err) { - console.log('AFRenLog: getCurrentAudioRendererInfoArray :ERROR: '+err.message); + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); resultFlag = false; } else { if (AudioRendererChangeInfoArray !=null) { for (let i=0;i { - console.info('AFRenLog: Renderer stop:ERROR : '+err.message); + console.info(Tag+'Renderer stop:ERROR : '+err.message); }); await audioRen.release().then(async function () { - console.info('AFRenLog: Renderer release : SUCCESS'); + console.info(Tag+'Renderer release : SUCCESS'); }).catch((err) => { - console.info('AFRenLog: Renderer release :ERROR : '+err.message); + console.info(Tag+'Renderer release :ERROR : '+err.message); }); expect(resultFlag).assertTrue(); done(); }) + + /* * + * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_005 + * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0*/ + + it('SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_005', 0, async function (done) { + var audioCap ; + 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 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; + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i=0;i { + console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); + }); + + await sleep(100); + + audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { + console.info(Tag+'[GET_RENDERER_DD_CALLBACK] **** Get Callback Called ****'); + await sleep(100); + if (err) { + console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); + resultFlag = false; + } + else { + if (AudioRendererChangeInfoArray !=null) { + for (let i=0;i 0 && dType == 2 && dRole == 2 && sRate!= null && cCount != null && cMask!=null){ + resultFlag = true; + } + } + } + } + } + }); + + await sleep(1000); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(Tag+'[GET_RENDERER_DD_CALLBACK] ######### RendererChange Off is called #########'); + + await audioCap.release().then(async function () { + console.info(Tag+'Renderer release : SUCCESS'); + }).catch((err) => { + console.info(Tag+'Renderer release :ERROR : '+err.message); + }); + + expect(resultFlag).assertTrue(); + 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 94ccbf7977f28358ffada055d673a3baa9e856c7..24af831bc6718cb6f1fb2a94a741674f977b7b49 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 @@ -22,30 +22,14 @@ 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'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; -describe('audioVOIP', function () { +describe('audioVoip', function () { 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; - }*/ - + let fdPath; + let filePath; const audioManager = audio.getAudioManager(); console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); @@ -55,7 +39,7 @@ describe('audioVOIP', function () { beforeAll(async function () { await applyPermission(); console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - mediaDir = '/data/storage/el2/base/haps/entry/cache'; + //mediaDir = '/data/storage/el2/base/haps/entry/cache'; }) beforeEach(async function () { @@ -71,22 +55,19 @@ describe('audioVOIP', function () { console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); }) - function sleep (ms) { + 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 getAbilityInfo(fileName) { + let context = await featureAbility.getContext(); + console.info("case0 context is " + context); + await context.getFilesDir().then((data) => { + console.info("case1 getFilesDir is path " + data); + mediaDir = data + '/' + fileName; + console.info('case2 mediaDir is ' + mediaDir); + }) } - async function closeFileDescriptor(fileName) { await resourceManager.getResourceManager().then(async (mgr) => { await mgr.closeRawFileDescriptor(fileName).then(value => { @@ -96,17 +77,27 @@ describe('audioVOIP', function () { }); }); } - 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 getFdRead(pathName) { + let context = await featureAbility.getContext(); + console.info("case0 context is " + context); + await context.getFilesDir().then((data) => { + console.info("case1 getFilesDir is path " + data); + filePath = data + '/' + pathName; + console.info('case4 filePath is ' + filePath); + }) + fdPath = 'fd://'; + await fileio.open(filePath).then((fdNumber) => { + fdPath = fdPath + '' + fdNumber; + fdRead = fdNumber; + console.info('[fileIO]case open fd success,fdPath is ' + fdPath); + console.info('[fileIO]case open fd success,fdRead is ' + fdRead); + + }, (err) => { + console.info('[fileIO]case open fd failed'); + }).catch((err) => { + console.info('[fileIO]case catch open fd failed'); + }); } async function applyPermission() { @@ -138,7 +129,7 @@ describe('audioVOIP', function () { } } - async function playbackPromise (AudioRendererOptions, pathName, AudioScene) { + async function playbackPromise(AudioRendererOptions, pathName, AudioScene) { var resultFlag = 'new'; console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); @@ -147,13 +138,13 @@ describe('audioVOIP', function () { audioRen = data; console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); return resultFlag; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+pathName); + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + pathName); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); await audioRen.getStreamInfo().then(async function (audioParamsGet) { console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); @@ -162,11 +153,11 @@ describe('audioVOIP', function () { console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } @@ -176,37 +167,37 @@ describe('audioVOIP', function () { console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + 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; + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); var bufferSize; await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); - bufferSize=data; + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } @@ -215,21 +206,21 @@ describe('audioVOIP', function () { 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); + 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) { + while (rlen < totalSize / 4) { let buf = new ArrayBuffer(bufferSize); rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); await audioRen.write(buf); - if (rlen > (totalSize/2)){ + if (rlen > (totalSize / 2)) { await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : '+data); + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : ' + data); }).catch((err) => { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; }); } } @@ -238,42 +229,42 @@ describe('audioVOIP', function () { await audioRen.drain().then(async function () { console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); - resultFlag=false; + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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); + resultFlag = true; + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlag); }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + 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: Renderer release :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); return resultFlag; } - async function recPromise (AudioCapturerOptions, fpath, AudioScene) { + async function recPromise(AudioCapturerOptions, fpath, AudioScene) { var resultFlag = 'new'; console.info('AudioFrameworkRecLog: Promise : Audio Recording Function'); @@ -284,13 +275,13 @@ describe('audioVOIP', function () { audioCap = data; console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); return resultFlag; }); - console.info('AudioFrameworkRecLog: AudioCapturer : Path : '+fpath); + console.info('AudioFrameworkRecLog: AudioCapturer : Path : ' + fpath); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); await audioCap.getStreamInfo().then(async function (audioParamsGet) { if (audioParamsGet != undefined) { @@ -300,16 +291,16 @@ describe('audioVOIP', function () { console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); } else { - console.info('AudioFrameworkRecLog: audioParamsGet is : '+audioParamsGet); + console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); console.info('AudioFrameworkRecLog: audioParams getStreamInfo are incorrect: '); resultFlag = false; } }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); return resultFlag; } @@ -318,32 +309,32 @@ describe('audioVOIP', function () { 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); + } else { + console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); console.info('AudioFrameworkRecLog: audioParams getCapturerInfo are incorrect: '); resultFlag = false; } }).catch((err) => { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); return resultFlag; } await audioCap.start().then(async function () { console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + resultFlag = false; }); - if (resultFlag == false){ - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + if (resultFlag == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); return resultFlag; } - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); var bufferSize = await audioCap.getBufferSize(); console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); @@ -352,9 +343,9 @@ describe('audioVOIP', function () { if (fd !== null) { console.info('AudioFrameworkRecLog: file fd created'); } - else{ + else { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - resultFlag=false; + resultFlag = false; return resultFlag; } @@ -362,9 +353,9 @@ describe('audioVOIP', function () { if (fd !== null) { console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); } - else{ + else { console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - resultFlag=false; + resultFlag = false; return resultFlag; } await sleep(100); @@ -380,27 +371,27 @@ describe('audioVOIP', function () { numBuffersToCapture--; } await sleep(1000); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); await audioCap.stop().then(async function () { console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - resultFlag=true; - console.info('AudioFrameworkRecLog: resultFlag : '+resultFlag); + resultFlag = true; + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - resultFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + 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: Capturer release :ERROR : ' + err.message); + resultFlag = false; }); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); return resultFlag; @@ -434,13 +425,12 @@ describe('audioVOIP', function () { 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 getFdRead("StarWars10s-1C-44100-2SW.wav"); + var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); + await closeFileDescriptor(filePath); done(); }) @@ -462,7 +452,7 @@ describe('audioVOIP', function () { } var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, + source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, capturerFlags: 1 } @@ -471,9 +461,10 @@ describe('audioVOIP', function () { capturerInfo: AudioCapturerInfo } - var resultFlag = await recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await getAbilityInfo("capture_js-44100-2C-16B.pcm"); + var resultFlag = await recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); done(); }) @@ -496,7 +487,7 @@ describe('audioVOIP', function () { } var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, + source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, capturerFlags: 1 } @@ -523,16 +514,17 @@ describe('audioVOIP', function () { rendererInfo: AudioRendererInfo } - recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B-2.pcm', audio.AudioScene.AUDIO_SCENE_PHONE_CHAT); + await getAbilityInfo("capture_js-44100-2C-16B-2.pcm"); + recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_PHONE_CHAT); await sleep(500); readpath = 'StarWars10s-1C-44100-2SW.wav'; - await getFdRead(readpath,done); + await getFdRead(readpath); var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath,done); + await closeFileDescriptor(readpath); done(); }) 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 04b31245292a849c0f670cf8f4c03a22db9ae808..309d6321d95292f62b04e75c1630afeedfffecfc 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 @@ -14,12 +14,12 @@ */ require('./getPermission.test.js') +require('./AudioRendererChangeInfo.test.js') +require('./AudioCapturerChangeInfo.test.js') require('./AudioFramework.test.js') require('./AudioVOIP.test.js') require('./AudioCall.test.js') require('./AudioCapturer.test.js') require('./AudioEventManagement.test.js') require('./AudioRenderer.test.js') -require('./AudioRendererChangeInfo.test.js') -require('./AudioCapturerChangeInfo.test.js')