未验证 提交 35d22c84 编写于 作者: O openharmony_ci 提交者: Gitee

!2291 Updating Audio Standard JS Test scripts - Issue fix

Merge pull request !2291 from GaganP/audioframework_Master_09Mar2022
...@@ -7855,4 +7855,350 @@ describe('audioRenderer', function () { ...@@ -7855,4 +7855,350 @@ describe('audioRenderer', function () {
}) })
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_108
* @tc.name : AudioState - STATE_INVALID
* @tc.desc : AudioState - STATE_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_108', 0, async function (done) {
expect(audio.AudioState.STATE_INVALID).assertEqual(-1);
await sleep(50);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_109
* @tc.name : AudioState - STATE_NEW
* @tc.desc : AudioState - STATE_NEW
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_109', 0, async function (done) {
expect(audio.AudioState.STATE_NEW).assertEqual(0);
await sleep(50);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_110
* @tc.name : AudioSampleFormat - STATE_FORMAT_INVALID
* @tc.desc : AudioSampleFormat - STATE_FORMAT_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_110', 0, async function (done) {
expect(audio.AudioSampleFormat.SAMPLE_FORMAT_INVALID).assertEqual(-1);
await sleep(50);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_111
* @tc.name : SourceType - SOURCE_TYPE_INVALID
* @tc.desc : SourceType - SOURCE_TYPE_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_111', 0, async function (done) {
expect(audio.SourceType.SOURCE_TYPE_INVALID).assertEqual(-1);
await sleep(50);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_112
* @tc.name : AudioRenderer - Pause - Callback
* @tc.desc : AudioRenderer - Pause - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_112', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_RINGTONE,
usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
var resultFlag = false;
var audioRen;
await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) {
audioRen = data;
console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message);
resultFlag = false;
});
audioRen.on('stateChange',(AudioState) => {
console.log('AudioFrameworkTest: Volume Change Event is called');
switch (AudioState) {
case audio.AudioState.STATE_PAUSED:
console.info('AudioFrameworkTest: state : STATE_PAUSED');
resultFlag = true;
break;
default:
console.info('AudioFrameworkTest: state : '+AudioState);
break;
}
});
await audioRen.start().then(async function () {
console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS ');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message);
resultFlag=false;
});
await sleep(2000);
audioRen.pause((err) => {
if (err) {
console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : '+err.message);
resultFlag=false;
}
else{
console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS ');
}
});
await sleep(500);
await audioRen.stop().then(async function () {
console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message);
});
await sleep(500);
await audioRen.release().then(async function () {
console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message);
});
await sleep(500)
expect(resultFlag).assertTrue();
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_113
* @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback
* @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_113', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_RINGTONE,
usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav';
var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT;
var resultFlag = true;
console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function');
var audioRen;
await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) {
audioRen = data;
console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message);
resultFlag=false;
});
console.info('AudioFrameworkRenderLog: AudioRenderer : Path : '+fpath);
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state);
await audioManager.setAudioScene(AudioScene).then(async function () {
console.info('AudioFrameworkRenderLog: setAudioScene : SUCCESS ');
await audioManager.getAudioScene().then(async function (data) {
console.info('AudioFrameworkRenderLog: getAudioScene : Value : '+data);
}).catch((err) => {
console.info('AudioFrameworkRenderLog: getAudioScene : ERROR : '+err.message);
resultFlag=false;
});
}).catch((err) => {
console.info('AudioFrameworkRenderLog: setAudioScene : ERROR : '+err.message);
resultFlag=false;
});
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state);
await audioRen.getStreamInfo().then(async function (audioParamsGet) {
console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:');
console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat);
console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate);
console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels);
console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType);
}).catch((err) => {
console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message);
resultFlag = false;
});
await audioRen.getRendererInfo().then(async function (audioParamsGet) {
console.info('AudioFrameworkRenderLog: Renderer RendererInfo:');
console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content);
console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage);
console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags);
}).catch((err) => {
console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message);
resultFlag = false;
});
await audioRen.start().then(async function () {
console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS ');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message);
resultFlag=false;
});
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state);
var bufferSize = await audioRen.getBufferSize();
console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize);
let ss = fileio.createStreamSync(fpath, 'r');
console.info('AudioFrameworkRenderLog: File Path: ' + fpath);
let discardHeader = new ArrayBuffer(44);
ss.readSync(discardHeader);
let totalSize = fileio.statSync(fpath).size;
console.info('AudioFrameworkRenderLog: File totalSize size: ' +totalSize);
totalSize = totalSize-44;
console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize);
let rlen = 0;
while (rlen < totalSize) {
let buf = new ArrayBuffer(bufferSize);
rlen += ss.readSync(buf);
console.info('BufferAudioFramework: bytes read from file: ' +rlen);
await audioRen.write(buf);
if (rlen > (totalSize/2)){
await audioManager.getAudioScene().then(async function (data) {
console.info('AudioFrameworkAudioScene: getAudioScene : Value : '+data);
}).catch((err) => {
console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message);
resultFlag=false;
});
}
if (rlen > (totalSize/2)){
audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE, (err) => {
if (err) {
console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message);
resultFlag=false;
}
else {
console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS');
}
});
}
}
console.info('AudioFrameworkRenderLog: Renderer after read');
audioRen.getRenderRate((err, data) => {
if (err) {
console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : '+err.message);
resultFlag=false;
}
else if (data == audio.AudioRendererRate.RENDER_RATE_DOUBLE){
console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS : '+data);
}
else{
console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL : '+data);
resultFlag=false;
}
});
await audioRen.drain().then(async function () {
console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS');
}).catch((err) => {
console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message);
});
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state);
await audioRen.stop().then(async function () {
console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message);
});
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state);
await audioRen.release().then(async function () {
console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS');
}).catch((err) => {
console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message);
});
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
await sleep(500)
expect(resultFlag).assertTrue();
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_114
* @tc.name : AudioEncodingType - ENCODING_TYPE_INVALID
* @tc.desc : AudioEncodingType - ENCODING_TYPE_INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_114', 0, async function (done) {
expect(audio.AudioEncodingType.ENCODING_TYPE_INVALID).assertEqual(-1);
await sleep(50);
done();
})
}) })
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
require('./AudioFramework.test.js') require('./AudioFramework.test.js')
require('./AudioPerf.test.js') //require('./AudioPerf.test.js')
require('./AudioRenderer.test.js') require('./AudioRenderer.test.js')
require('./SR000GHLLV.test.js') require('./SR000GHLLV.test.js')
require('./AudioCall.test.js') require('./AudioCall.test.js')
......
...@@ -39,7 +39,7 @@ describe('audioManager',async function () { ...@@ -39,7 +39,7 @@ describe('audioManager',async function () {
console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level');
console.info('AudioFrameworkTest: before get scanner instance'); console.info('AudioFrameworkTest: before get scanner instance');
let scannerObj = mediaLibrary.getScannerInstance(); let scannerObj = mediaLibrary.getScannerInstance();
let path = "/data/media"; let path = "/storage/media/100/local/files/media";
console.info('AudioFrameworkTest: before scan file'); console.info('AudioFrameworkTest: before scan file');
const scanPromise = await scannerObj.scanDir(path); const scanPromise = await scannerObj.scanDir(path);
console.info('AudioFrameworkTest: before scan file'); console.info('AudioFrameworkTest: before scan file');
...@@ -97,7 +97,7 @@ describe('audioManager',async function () { ...@@ -97,7 +97,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager002', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager002', 0,async function(done){
console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',0).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0).then(function(){
console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: ');
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -144,7 +144,7 @@ describe('audioManager',async function () { ...@@ -144,7 +144,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_004', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_004', 0,async function(done){
console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',multiSIM).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',multiSIM).then(function(){
console.info('AudioFrameworkTestSSM: enum: Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM: enum: Set Ringtone Uri : SUCCESS: ');
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -191,7 +191,7 @@ describe('audioManager',async function () { ...@@ -191,7 +191,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_006', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_006', 0,async function(done){
console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){
console.info('AudioFrameworkTestSSM:ENAME: Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:ENAME: Set Ringtone Uri : SUCCESS: ');
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -266,7 +266,7 @@ describe('audioManager',async function () { ...@@ -266,7 +266,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_009', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_009', 0,async function(done){
console.log('AudioFrameworkTestSSM: Set System Ringtone Uri'); console.log('AudioFrameworkTestSSM: Set System Ringtone Uri');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then( function() { await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then( function() {
console.info('AudioFrameworkTestSSM:Callback : ENAME: Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:Callback : ENAME: Set Ringtone Uri : SUCCESS: ');
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -355,7 +355,7 @@ describe('audioManager',async function () { ...@@ -355,7 +355,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_013', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_013', 0,async function(done){
console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); console.log('AudioFrameworkTestRM: Set System Ringtone Uri');
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',1,async(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',1,async(err) => {
if(err) { if(err) {
console.error('AudioFrameworkTestSSM :enum: Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM :enum: Set System Ringtone Uri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -379,7 +379,7 @@ describe('audioManager',async function () { ...@@ -379,7 +379,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_014', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_014', 0,async function(done){
console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); console.log('AudioFrameworkTestRM: Set System Ringtone Uri');
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',0,async(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0,async(err) => {
if(err) { if(err) {
console.error('AudioFrameworkTestSSM: Callback :enum: Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM: Callback :enum: Set System Ringtone Uri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -514,7 +514,7 @@ describe('audioManager',async function () { ...@@ -514,7 +514,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_019', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_019', 0,async function(done){
console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); console.log('AudioFrameworkTestRM: Set System Ringtone Uri');
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async(err) => {
if(err) { if(err) {
console.error('AudioFrameworkTestSSM: Callback :ENAME: Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM: Callback :ENAME: Set System Ringtone Uri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -625,7 +625,7 @@ describe('audioManager',async function () { ...@@ -625,7 +625,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_023', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_023', 0,async function(done){
console.log('AudioFrameworkTestSSM: setSystemNotificationUri'); console.log('AudioFrameworkTestSSM: setSystemNotificationUri');
await systemSoundManager.setSystemNotificationUri(null,'/data/media/test.mp3').then( function() { await systemSoundManager.setSystemNotificationUri(null,'/storage/media/100/local/files/media/test.mp3').then( function() {
console.info('AudioFrameworkTestSSM:Callback : setSystemNotificationUri : SUCCESS'); console.info('AudioFrameworkTestSSM:Callback : setSystemNotificationUri : SUCCESS');
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -646,7 +646,7 @@ describe('audioManager',async function () { ...@@ -646,7 +646,7 @@ describe('audioManager',async function () {
it('SUB_AUDIO_MANAGER_SystemSoundManager_024', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_024', 0,async function(done){
console.log('AudioFrameworkTestRM: getSystemNotificationUri'); console.log('AudioFrameworkTestRM: getSystemNotificationUri');
await systemSoundManager.getSystemNotificationUri(null).then(async function(data) { await systemSoundManager.getSystemNotificationUri(null).then(async function(data) {
if (data == '/data/media/test.mp3') { if (data == '/storage/media/100/local/files/media/test.mp3') {
console.info('AudioFrameworkTestSSM:enum: getSystemNotificationUri : SUCCESS : '+data); console.info('AudioFrameworkTestSSM:enum: getSystemNotificationUri : SUCCESS : '+data);
expect(true).assertTrue(); expect(true).assertTrue();
} }
...@@ -687,7 +687,7 @@ describe('audioManager',async function () { ...@@ -687,7 +687,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_026', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_026', 0,async function(done){
console.log('AudioFrameworkTestRM: setSystemNotificationUri'); console.log('AudioFrameworkTestRM: setSystemNotificationUri');
systemSoundManager.setSystemNotificationUri(null,'/data/media/test.mp4',async(err) => { systemSoundManager.setSystemNotificationUri(null,'/storage/media/100/local/files/media/test.mp4',async(err) => {
if(err) { if(err) {
console.error('AudioFrameworkTestSSM : setSystemNotificationUri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM : setSystemNotificationUri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -716,7 +716,7 @@ describe('audioManager',async function () { ...@@ -716,7 +716,7 @@ describe('audioManager',async function () {
console.error('AudioFrameworkTestSSM: Callback : getSystemNotificationUri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM: Callback : getSystemNotificationUri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
} }
else if(data == '/data/media/test.mp4'){ else if(data == '/storage/media/100/local/files/media/test.mp4'){
console.info('AudioFrameworkTestSSM:Callback : getSystemNotificationUri : SUCCESS: '+data); console.info('AudioFrameworkTestSSM:Callback : getSystemNotificationUri : SUCCESS: '+data);
expect(true).assertTrue(); expect(true).assertTrue();
} }
...@@ -763,7 +763,7 @@ describe('audioManager',async function () { ...@@ -763,7 +763,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_029', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_029', 0,async function(done){
console.log('AudioFrameworkTestSSM: setSystemAlarmUri'); console.log('AudioFrameworkTestSSM: setSystemAlarmUri');
await systemSoundManager.setSystemAlarmUri(null,'/data/media/test.mp3').then( function() { await systemSoundManager.setSystemAlarmUri(null,'/storage/media/100/local/files/media/test.mp3').then( function() {
console.info('AudioFrameworkTestSSM:Callback : setSystemAlarmUri : SUCCESS'); console.info('AudioFrameworkTestSSM:Callback : setSystemAlarmUri : SUCCESS');
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -784,7 +784,7 @@ describe('audioManager',async function () { ...@@ -784,7 +784,7 @@ describe('audioManager',async function () {
it('SUB_AUDIO_MANAGER_SystemSoundManager_030', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_030', 0,async function(done){
console.log('AudioFrameworkTestRM: getSystemAlarmUri'); console.log('AudioFrameworkTestRM: getSystemAlarmUri');
await systemSoundManager.getSystemAlarmUri(null).then(async function(data) { await systemSoundManager.getSystemAlarmUri(null).then(async function(data) {
if (data == '/data/media/test.mp3') { if (data == '/storage/media/100/local/files/media/test.mp3') {
console.info('AudioFrameworkTestSSM:enum: getSystemAlarmUri : SUCCESS :'+data); console.info('AudioFrameworkTestSSM:enum: getSystemAlarmUri : SUCCESS :'+data);
expect(true).assertTrue(); expect(true).assertTrue();
} }
...@@ -825,7 +825,7 @@ describe('audioManager',async function () { ...@@ -825,7 +825,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_SystemSoundManager_032', 0,async function(done){ it('SUB_AUDIO_MANAGER_SystemSoundManager_032', 0,async function(done){
console.log('AudioFrameworkTestRM: setSystemAlarmUri'); console.log('AudioFrameworkTestRM: setSystemAlarmUri');
systemSoundManager.setSystemAlarmUri(null,'/data/media/test.mp4',async(err) => { systemSoundManager.setSystemAlarmUri(null,'/storage/media/100/local/files/media/test.mp4',async(err) => {
if(err) { if(err) {
console.error('AudioFrameworkTestSSM : setSystemAlarmUri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM : setSystemAlarmUri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -854,7 +854,7 @@ describe('audioManager',async function () { ...@@ -854,7 +854,7 @@ describe('audioManager',async function () {
console.error('AudioFrameworkTestSSM: Callback : getSystemAlarmUri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM: Callback : getSystemAlarmUri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
} }
else if(data == '/data/media/test.mp4'){ else if(data == '/storage/media/100/local/files/media/test.mp4'){
console.info('AudioFrameworkTestSSM:Callback : getSystemAlarmUri : SUCCESS: '+data); console.info('AudioFrameworkTestSSM:Callback : getSystemAlarmUri : SUCCESS: '+data);
expect(true).assertTrue(); expect(true).assertTrue();
} }
...@@ -891,6 +891,46 @@ describe('audioManager',async function () { ...@@ -891,6 +891,46 @@ describe('audioManager',async function () {
done(); done();
}) })
/* *
* @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_035
* @tc.name : getSystemRingtonePlayer - ERROR - Negative
* @tc.desc : getSystemRingtonePlayer - ERROR - Negative
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SystemSoundManager_035', 0,async function(done){
console.log('AudioFrameworkTestRM: Get System Ringtone Player');
await systemSoundManager.getSystemRingtonePlayer(null,-1).then(async function(data) {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data);
expect(false).assertTrue();
}).catch((err) => {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message));
expect(true).assertTrue();
});
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_SystemSoundManager_036
* @tc.name : getSystemRingtonePlayer - ERROR - OutOfRange
* @tc.desc : getSystemRingtonePlayer - ERROR - OutOfRange
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SystemSoundManager_036', 0,async function(done){
console.log('AudioFrameworkTestRM: Get System Ringtone Player');
await systemSoundManager.getSystemRingtonePlayer(null,2).then(async function(data) {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data);
expect(false).assertTrue();
}).catch((err) => {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message));
expect(true).assertTrue();
});
done();
})
/* * /* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_001 * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_001
* @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_DEFAULT ENAME * @tc.name : setSystemRingtoneUri - promise RINGTONE_TYPE_DEFAULT ENAME
...@@ -901,10 +941,10 @@ describe('audioManager',async function () { ...@@ -901,10 +941,10 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_001', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_001', 0,async function(done){
console.info('AudioFrameworkTestSSM: Starting Set RM path'); console.info('AudioFrameworkTestSSM: Starting Set RM path');
const promise = systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT); const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT);
promise.then(function () { promise.then(function () {
systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) {
if(data == '/data/StarWars10s-1C-44100-2SW.wav') if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav')
{ {
console.info('AudioFrameworkTestSSM: Ringtone SRC Path set SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: Ringtone SRC Path set SUCCESS: ' + data);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -958,10 +998,10 @@ describe('audioManager',async function () { ...@@ -958,10 +998,10 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_003', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_003', 0,async function(done){
console.info('AudioFrameworkTestSSM: Starting Set RM path'); console.info('AudioFrameworkTestSSM: Starting Set RM path');
const promise = systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT); const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT);
promise.then(function () { promise.then(function () {
systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then(function (data) { systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then(function (data) {
if(data == '/data/StarWars10s-1C-44100-2SW.wav') if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav')
{ {
console.info('AudioFrameworkTestSSM: Ringtone SRC Path set SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: Ringtone SRC Path set SUCCESS: ' + data);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1118,10 +1158,10 @@ describe('audioManager',async function () { ...@@ -1118,10 +1158,10 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_009', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_009', 0,async function(done){
console.info('AudioFrameworkTestSSM: Starting Set RM path'); console.info('AudioFrameworkTestSSM: Starting Set RM path');
const promise = systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',0); const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0);
promise.then(function () { promise.then(function () {
systemSoundManager.getSystemRingtoneUri(null,0).then(function (data) { systemSoundManager.getSystemRingtoneUri(null,0).then(function (data) {
if(data == '/data/StarWars10s-1C-44100-2SW.wav') if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav')
{ {
console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1190,7 +1230,7 @@ describe('audioManager',async function () { ...@@ -1190,7 +1230,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_011',0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_011',0,async function(done){
console.info('AudioFrameworkTestSSM: Starting Set RM path'); console.info('AudioFrameworkTestSSM: Starting Set RM path');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',-1).then(function () { await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1).then(function () {
console.info('AudioFrameworkTestSSM: Ringtone SRC Path set : enum : SUCCESS: '); console.info('AudioFrameworkTestSSM: Ringtone SRC Path set : enum : SUCCESS: ');
expect(false).assertTrue(); expect(false).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -1235,7 +1275,7 @@ describe('audioManager',async function () { ...@@ -1235,7 +1275,7 @@ describe('audioManager',async function () {
const promise = systemSoundManager.setSystemRingtoneUri(null,'xyz@123',0); const promise = systemSoundManager.setSystemRingtoneUri(null,'xyz@123',0);
promise.then(function () { promise.then(function () {
systemSoundManager.getSystemRingtoneUri(null,0).then(function (data) { systemSoundManager.getSystemRingtoneUri(null,0).then(function (data) {
if(data == '/data/StarWars10s-1C-44100-2SW.wav') if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav')
{ {
console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -1266,10 +1306,10 @@ describe('audioManager',async function () { ...@@ -1266,10 +1306,10 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_014', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_014', 0,async function(done){
console.info('AudioFrameworkTestSSM: Starting Set RM path'); console.info('AudioFrameworkTestSSM: Starting Set RM path');
const promise = systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT); const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT);
promise.then(function () { promise.then(function () {
systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) {
if(data == '/data/StarWars10s-1C-44100-2SW.wav') if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav')
{ {
console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME SUCCESS: ' + data);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1352,10 +1392,10 @@ describe('audioManager',async function () { ...@@ -1352,10 +1392,10 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_017', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_017', 0,async function(done){
console.info('AudioFrameworkTestSSM: Starting Set RM path'); console.info('AudioFrameworkTestSSM: Starting Set RM path');
const promise = systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM); const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM);
promise.then(function () { promise.then(function () {
systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then(function (data) { systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_MULTISIM).then(function (data) {
if(data == '/data/StarWars10s-1C-44100-2SW.wav') if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav')
{ {
console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :ENAME SUCCESS: ' + data);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1435,7 +1475,7 @@ describe('audioManager',async function () { ...@@ -1435,7 +1475,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_020', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_020', 0,async function(done){
console.info('AudioFrameworkTestSSM: Starting Set RM path'); console.info('AudioFrameworkTestSSM: Starting Set RM path');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',2).then(function (){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',2).then(function (){
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkTestSSM: Ringtone set SRC Path set: enum ERROR: ' + err.message); console.info('AudioFrameworkTestSSM: Ringtone set SRC Path set: enum ERROR: ' + err.message);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1475,10 +1515,10 @@ describe('audioManager',async function () { ...@@ -1475,10 +1515,10 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_022', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_022', 0,async function(done){
console.info('AudioFrameworkTestSSM: Starting Set RM path'); console.info('AudioFrameworkTestSSM: Starting Set RM path');
const promise = systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',1); const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',1);
promise.then(function () { promise.then(function () {
systemSoundManager.getSystemRingtoneUri(null,1).then(function (data) { systemSoundManager.getSystemRingtoneUri(null,1).then(function (data) {
if(data == '/data/StarWars10s-1C-44100-2SW.wav') if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav')
{ {
console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1542,10 +1582,10 @@ describe('audioManager',async function () { ...@@ -1542,10 +1582,10 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_024', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_024', 0,async function(done){
console.info('AudioFrameworkTestSSM: Starting Set RM path'); console.info('AudioFrameworkTestSSM: Starting Set RM path');
const promise = systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',multiSIM); const promise = systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',multiSIM);
promise.then(function () { promise.then(function () {
systemSoundManager.getSystemRingtoneUri(null,multiSIM).then(function (data) { systemSoundManager.getSystemRingtoneUri(null,multiSIM).then(function (data) {
if(data == '/data/StarWars10s-1C-44100-2SW.wav') if(data == '/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav')
{ {
console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: Ringtone SRC Path set :enum SUCCESS: ' + data);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -1715,7 +1755,7 @@ describe('audioManager',async function () { ...@@ -1715,7 +1755,7 @@ describe('audioManager',async function () {
}; };
console.log('AudioFrameworkTestRM: Configure RingtonePlayer : lowVol: Loop False'); console.log('AudioFrameworkTestRM: Configure RingtonePlayer : lowVol: Loop False');
await ringtonePlayer.configure(ringtoneOptions).then (function() { await ringtonePlayer.configure(ringtoneOptions).then(function() {
console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : '+ringtonePlayer.state); console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : '+ringtonePlayer.state);
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -1741,7 +1781,7 @@ describe('audioManager',async function () { ...@@ -1741,7 +1781,7 @@ describe('audioManager',async function () {
}; };
console.log('AudioFrameworkTestRM: Configure RingtonePlayer : Vol outOfRangeVol : Loop False'); console.log('AudioFrameworkTestRM: Configure RingtonePlayer : Vol outOfRangeVol : Loop False');
await ringtonePlayer.configure(ringtoneOptions).then (function() { await ringtonePlayer.configure(ringtoneOptions).then(function() {
console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS :FAIL '+ringtonePlayer.state); console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS :FAIL '+ringtonePlayer.state);
expect(false).assertTrue(); expect(false).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -1767,7 +1807,7 @@ describe('audioManager',async function () { ...@@ -1767,7 +1807,7 @@ describe('audioManager',async function () {
}; };
console.log('AudioFrameworkTestRM: Configure RingtonePlayer : Vol outOfRangeVol : Loop True'); console.log('AudioFrameworkTestRM: Configure RingtonePlayer : Vol outOfRangeVol : Loop True');
await ringtonePlayer.configure(ringtoneOptions).then (function() { await ringtonePlayer.configure(ringtoneOptions).then(function() {
console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : '+ringtonePlayer.state); console.log('AudioFrameworkTestRM: Configure RingtonePlayer : SUCCESS : '+ringtonePlayer.state);
expect(false).assertTrue(); expect(false).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -1898,7 +1938,7 @@ describe('audioManager',async function () { ...@@ -1898,7 +1938,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_036', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_036', 0,async function(done){
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT,(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_DEFAULT,(err) => {
if (err){ if (err){
console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message);
} }
...@@ -1909,7 +1949,7 @@ describe('audioManager',async function () { ...@@ -1909,7 +1949,7 @@ describe('audioManager',async function () {
console.error('AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR '+err.message); console.error('AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
} }
else if(data=='/data/StarWars10s-1C-44100-2SW.wav') { else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') {
console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : SUCCESS'); console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : SUCCESS');
expect(true).assertTrue(); expect(true).assertTrue();
} }
...@@ -2139,7 +2179,7 @@ describe('audioManager',async function () { ...@@ -2139,7 +2179,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_043', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_043', 0,async function(done){
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',0,(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0,(err) => {
if (err){ if (err){
console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -2151,7 +2191,7 @@ describe('audioManager',async function () { ...@@ -2151,7 +2191,7 @@ describe('audioManager',async function () {
console.error('AudioFrameworkTestRM :Callback: enum: Get system Ringtone Uri: ERROR '+err.message); console.error('AudioFrameworkTestRM :Callback: enum: Get system Ringtone Uri: ERROR '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
} }
else if(data=='/data/StarWars10s-1C-44100-2SW.wav') { else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') {
console.info('AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS'); console.info('AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS');
expect(true).assertTrue(); expect(true).assertTrue();
} }
...@@ -2222,7 +2262,7 @@ describe('audioManager',async function () { ...@@ -2222,7 +2262,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_045', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_045', 0,async function(done){
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',-1,async(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1,async(err) => {
if (err){ if (err){
console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -2259,44 +2299,6 @@ describe('audioManager',async function () { ...@@ -2259,44 +2299,6 @@ describe('audioManager',async function () {
}); });
}) })
// /* *
// * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_049
// * @tc.name : setSystemRingtoneUri - Callback Invalid - RINGTONE_TYPE_DEFAULT
// * @tc.desc : setSystemRingtoneUri - Callback Invalid uri
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_AUDIO_MANAGER_RingtoneManager_049', 0,async function(done){
// systemSoundManager.setSystemRingtoneUri(null,'xyz123',audio.RingtoneType.RINGTONE_TYPE_DEFAULT,async(err) => {
// if (err){
// console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message);
// }
// else{
// console.info('AudioFrameworkTestRM :Callback: Set system Ringtone SUCCESS');
// systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT, async(err,data) => {
// if (err){
// console.error('AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR '+err.message);
// expect(true).assertTrue();
// }
// else if(data=='/data/StarWars10s-1C-44100-2SW.wav') {
// console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : PASS');
// expect(false).assertTrue();
// }
// else{
// console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : FAIL');
// expect(false).assertTrue();
// }
// done();
// await sleep(1000);
// });
// }
// done();
// });
// })
/* * /* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_047 * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_047
* @tc.name : getSystemRingtonePlayer -Callback Get State RINGTONE_TYPE_MULTISIM * @tc.name : getSystemRingtonePlayer -Callback Get State RINGTONE_TYPE_MULTISIM
...@@ -2459,7 +2461,7 @@ describe('audioManager',async function () { ...@@ -2459,7 +2461,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_052', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_052', 0,async function(done){
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',2,async(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',2,async(err) => {
if (err){ if (err){
console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -2517,7 +2519,7 @@ describe('audioManager',async function () { ...@@ -2517,7 +2519,7 @@ describe('audioManager',async function () {
console.error('AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR '+err.message); console.error('AudioFrameworkTestRM :Callback: Failed to get system Ringtone Uri: ERROR '+err.message);
expect(true).assertTrue(); expect(true).assertTrue();
} }
else if(data=='/data/StarWars10s-1C-44100-2SW.wav') { else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') {
console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : PASS'); console.info('AudioFrameworkTestRM :Callback: Get system Ringtone Uri : PASS');
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -2542,7 +2544,7 @@ describe('audioManager',async function () { ...@@ -2542,7 +2544,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_055', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_055', 0,async function(done){
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',1,(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',1,(err) => {
if (err){ if (err){
console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message);
} }
...@@ -2553,7 +2555,7 @@ describe('audioManager',async function () { ...@@ -2553,7 +2555,7 @@ describe('audioManager',async function () {
console.error('AudioFrameworkTestRM :Callback: enum: Failed to get system Ringtone Uri: ERROR '+err.message); console.error('AudioFrameworkTestRM :Callback: enum: Failed to get system Ringtone Uri: ERROR '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
} }
else if(data=='/data/StarWars10s-1C-44100-2SW.wav'){ else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav'){
console.info('AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS'); console.info('AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS');
expect(true).assertTrue(); expect(true).assertTrue();
} }
...@@ -2812,7 +2814,7 @@ describe('audioManager',async function () { ...@@ -2812,7 +2814,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_063', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_063', 0,async function(done){
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async (err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,async (err) => {
if (err){ if (err){
console.error('AudioFrameworkTestRM :Callback :ENAME: Failed to set system ringtone '+err.message); console.error('AudioFrameworkTestRM :Callback :ENAME: Failed to set system ringtone '+err.message);
} }
...@@ -2823,7 +2825,7 @@ describe('audioManager',async function () { ...@@ -2823,7 +2825,7 @@ describe('audioManager',async function () {
console.error('AudioFrameworkTestRM :Callback: ENAME: Failed to get system Ringtone Uri: ERROR '+err.message); console.error('AudioFrameworkTestRM :Callback: ENAME: Failed to get system Ringtone Uri: ERROR '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
} }
else if(data=='/data/StarWars10s-1C-44100-2SW.wav') { else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') {
console.info('AudioFrameworkTestRM :Callback: ENAME: Get system Ringtone Uri : PASS'); console.info('AudioFrameworkTestRM :Callback: ENAME: Get system Ringtone Uri : PASS');
expect(true).assertTrue(); expect(true).assertTrue();
} }
...@@ -2881,7 +2883,6 @@ describe('audioManager',async function () { ...@@ -2881,7 +2883,6 @@ describe('audioManager',async function () {
expect(true).assertTrue(); expect(true).assertTrue();
} }
await sleep(1000); await sleep(1000);
// done();
}); });
}); });
}); });
...@@ -2995,7 +2996,7 @@ describe('audioManager',async function () { ...@@ -2995,7 +2996,7 @@ describe('audioManager',async function () {
ringtonePlayer.start().then(async function () { ringtonePlayer.start().then(async function () {
console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state); console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state);
await sleep(1000); await sleep(1000);
ringtonePlayer.stop().then (function () { ringtonePlayer.stop().then(function () {
console.log('AudioFrameworkTestRM : Stop RingtonePlayer : SUCCESS :'+ringtonePlayer.state); console.log('AudioFrameworkTestRM : Stop RingtonePlayer : SUCCESS :'+ringtonePlayer.state);
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -3114,7 +3115,7 @@ describe('audioManager',async function () { ...@@ -3114,7 +3115,7 @@ describe('audioManager',async function () {
await ringtonePlayer.release().then(async function () { await ringtonePlayer.release().then(async function () {
console.log('AudioFrameworkTestRM: Release RingtonePlayer : SUCCESS : '+ringtonePlayer.state); console.log('AudioFrameworkTestRM: Release RingtonePlayer : SUCCESS : '+ringtonePlayer.state);
await sleep(2000); await sleep(2000);
await ringtonePlayer.start().then (function () { await ringtonePlayer.start().then(function () {
console.log('AudioFrameworkTestRM : Start RingtonePlayer : SUCCESS :'+ringtonePlayer.state); console.log('AudioFrameworkTestRM : Start RingtonePlayer : SUCCESS :'+ringtonePlayer.state);
expect(false).assertTrue(); expect(false).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -3184,7 +3185,7 @@ describe('audioManager',async function () { ...@@ -3184,7 +3185,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_074', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_074', 0,async function(done){
console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',1).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',1).then(function(){
console.info('AudioFrameworkTestSSM:enum:1:Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:enum:1:Set Ringtone Uri : SUCCESS: ');
}).catch((err) => { }).catch((err) => {
console.error('AudioFrameworkTestSSM:enum:1:Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM:enum:1:Set System Ringtone Uri :ERROR: '+err.message);
...@@ -3227,13 +3228,12 @@ describe('audioManager',async function () { ...@@ -3227,13 +3228,12 @@ describe('audioManager',async function () {
expect(false).assertTrue(); expect(false).assertTrue();
} }
else if (data!==null){ else if (data!==null){
console.log('AudioFrameworkTestRM : Ringtone info content: Pass :'+data.content); console.log('AudioFrameworkTestRM : Ringtone info content: Pass :'+data.content);
expect(true).assertTrue(); expect(true).assertTrue();
} }
else{ else{
console.log('AudioFrameworkTestRM : Ringtone info content: Fail :'+data.content); expect(false).assertTrue();
expect(false).assertTrue(); await sleep(100);
await sleep(100);
} }
}) })
done(); done();
...@@ -3273,13 +3273,12 @@ describe('audioManager',async function () { ...@@ -3273,13 +3273,12 @@ describe('audioManager',async function () {
expect(false).assertTrue(); expect(false).assertTrue();
} }
else if (data!==null){ else if (data!==null){
console.log('AudioFrameworkTestRM : Ringtone info usage: Pass :'+data.content); console.log('AudioFrameworkTestRM : Ringtone info usage: Pass :'+data.content);
expect(true).assertTrue(); expect(true).assertTrue();
} }
else{ else{
console.log('AudioFrameworkTestRM :Ringtone info usage: Fail :'+data.content); expect(false).assertTrue();
expect(false).assertTrue(); await sleep(100);
await sleep(100);
} }
}) })
done(); done();
...@@ -3295,8 +3294,8 @@ describe('audioManager',async function () { ...@@ -3295,8 +3294,8 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_079', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_079', 0,async function(done){
await ringtonePlayer.getAudioRendererInfo().then(function(data){ await ringtonePlayer.getAudioRendererInfo().then(function(data){
console.info('AudioFrameworkTestRM : Ringtone info rendererFlags : '+data.rendererFlags); console.info('AudioFrameworkTestRM : Ringtone info rendererFlags : '+data.rendererFlags);
expect(true).assertTrue(); expect(true).assertTrue();
}).catch((err) => { }).catch((err) => {
console.log('AudioFrameworkTestRM : Ringtone info rendererFlags : '+err.message); console.log('AudioFrameworkTestRM : Ringtone info rendererFlags : '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -3319,78 +3318,17 @@ describe('audioManager',async function () { ...@@ -3319,78 +3318,17 @@ describe('audioManager',async function () {
expect(false).assertTrue(); expect(false).assertTrue();
} }
else if (data!==null){ else if (data!==null){
console.log('AudioFrameworkTestRM : Ringtone info rendererFlags: Pass :'+data.rendererFlags); console.log('AudioFrameworkTestRM : Ringtone info rendererFlags: Pass :'+data.rendererFlags);
expect(true).assertTrue(); expect(true).assertTrue();
} }
else{ else{
console.log('AudioFrameworkTestRM :Ringtone info rendererFlags: Fail :'+data.rendererFlags); expect(false).assertTrue();
expect(false).assertTrue(); await sleep(100);
await sleep(100);
} }
}); });
done(); done();
}) })
// /* *
// * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_081
// * @tc.name : setSystemRingtoneUri - Promise- Null uri -Start
// * @tc.desc : setSystemRingtoneUri - Promise
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_AUDIO_MANAGER_RingtoneManager_081', 0,async function(done){
// console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri');
// await systemSoundManager.setSystemRingtoneUri(null,null,defaultRingtoneType).then(function(){
// console.info('AudioFrameworkTestSSM: enum: Set Ringtone Uri : SUCCESS: ');
// ringtonePlayer.start().then(async function () {
// console.log('AudioFrameworkTestRM: Start RingtonePlayer : SUCCESS : '+ringtonePlayer.state);
// expect(false).assertTrue();
// }).catch((err) => {
// console.log('AudioFrameworkTestRM: Start RingtonePlayer :ERROR: '+err.message);
// expect(true).assertTrue();
// });
// }).catch((err) => {
// console.error('AudioFrameworkTestSSM: enum: Set System Ringtone Uri :ERROR: '+err.message);
// expect(true).assertTrue();
// });
// done();
// })
//
// /* *
// * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_082
// * @tc.name : setSystemRingtoneUri - Callback null uri Start
// * @tc.desc : setSystemRingtoneUri - Callback
// * @tc.size : MEDIUM
// * @tc.type : Function
// * @tc.level : Level 0
// */
// it('SUB_AUDIO_MANAGER_RingtoneManager_082', 0,async function(done){
// console.log('AudioFrameworkTestRM: Set System Ringtone Uri');
// systemSoundManager.setSystemRingtoneUri(null,null,0,async(err) => {
// if(err){
// console.error('AudioFrameworkTestSSM: enum: Set System Ringtone Uri :ERROR: '+err.message);
// expect(true).assertTrue();
// }
// else{
// console.info('AudioFrameworkTestSSM: enum: Set Ringtone Uri : SUCCESS: ');
// console.log('AudioFrameworkTestRM: Start RingtonePlayer');
// ringtonePlayer.start(async(err) => {
// if (err){
// console.error('AudioFrameworkTestRM: Callback : Start RingtonePlayer :ERROR: '+err.message);
// expect(false).assertTrue();
// }
// else{
// console.log('AudioFrameworkTestRM: Callback : Start RingtonePlayer :SUCCESS : '+ringtonePlayer.state);
// expect(false).assertTrue();
// }
// await sleep(1000);
// });
// }
// });
// done();
// })
/* * /* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_083 * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_083
* @tc.name : setSystemRingtoneUri - Promise invalid uri RINGTONE_TYPE_DEFAULT enum 0 * @tc.name : setSystemRingtoneUri - Promise invalid uri RINGTONE_TYPE_DEFAULT enum 0
...@@ -3429,7 +3367,7 @@ describe('audioManager',async function () { ...@@ -3429,7 +3367,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_084', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_084', 0,async function(done){
console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',-1).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1).then(function(){
console.info('AudioFrameworkTestSSM:enum: Negative Value :Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:enum: Negative Value :Set Ringtone Uri : SUCCESS: ');
ringtonePlayer.start().then(async function () { ringtonePlayer.start().then(async function () {
...@@ -3456,7 +3394,7 @@ describe('audioManager',async function () { ...@@ -3456,7 +3394,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_085', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_085', 0,async function(done){
console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); console.log('AudioFrameworkTestRM: Set System Ringtone Uri');
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',-1,(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1,(err) => {
if(err) { if(err) {
console.error('AudioFrameworkTestRM: Callback :enum: Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestRM: Callback :enum: Set System Ringtone Uri :ERROR: '+err.message);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -3489,7 +3427,7 @@ describe('audioManager',async function () { ...@@ -3489,7 +3427,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_085', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_085', 0,async function(done){
console.log('AudioFrameworkTestRM: Set System Ringtone Uri'); console.log('AudioFrameworkTestRM: Set System Ringtone Uri');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',-1).then(function () { await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',-1).then(function () {
console.log('AudioFrameworkTestRM: Set System Ringtone Uri : SUCCESS'); console.log('AudioFrameworkTestRM: Set System Ringtone Uri : SUCCESS');
expect(false).assertTrue(); expect(false).assertTrue();
}).catch((err) => { }).catch((err) => {
...@@ -3542,7 +3480,7 @@ describe('audioManager',async function () { ...@@ -3542,7 +3480,7 @@ describe('audioManager',async function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_087', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_087', 0,async function(done){
systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,(err) => { systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',audio.RingtoneType.RINGTONE_TYPE_MULTISIM,(err) => {
if (err){ if (err){
console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message); console.error('AudioFrameworkTestRM :Callback : Failed to set system ringtone '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -3555,7 +3493,7 @@ describe('audioManager',async function () { ...@@ -3555,7 +3493,7 @@ describe('audioManager',async function () {
console.error('AudioFrameworkTestRM :Callback: enum: Failed to get system Ringtone Uri: ERROR '+err.message); console.error('AudioFrameworkTestRM :Callback: enum: Failed to get system Ringtone Uri: ERROR '+err.message);
expect(true).assertTrue(); expect(true).assertTrue();
} }
else if(data=='/data/StarWars10s-1C-44100-2SW.wav') { else if(data=='/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav') {
console.info('AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS'); console.info('AudioFrameworkTestRM :Callback:enum: Get system Ringtone Uri : SUCCESS');
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -3581,7 +3519,7 @@ describe('audioManager',async function () { ...@@ -3581,7 +3519,7 @@ describe('audioManager',async function () {
*/ */
it('SUB_AUDIO_MANAGER_RingtoneManager_088', 0,async function(done){ it('SUB_AUDIO_MANAGER_RingtoneManager_088', 0,async function(done){
console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri'); console.log('AudioFrameworkTestSSMM: Set System Ringtone Uri');
await systemSoundManager.setSystemRingtoneUri(null,'/data/StarWars10s-1C-44100-2SW.wav',0).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/StarWars10s-1C-44100-2SW.wav',0).then(function(){
console.info('AudioFrameworkTestSSM:enum:0:Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:enum:0:Set Ringtone Uri : SUCCESS: ');
}).catch((err) => { }).catch((err) => {
console.error('AudioFrameworkTestSSM:enum:0:Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM:enum:0:Set System Ringtone Uri :ERROR: '+err.message);
...@@ -3659,14 +3597,14 @@ describe('audioManager',async function () { ...@@ -3659,14 +3597,14 @@ describe('audioManager',async function () {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' +err.message); console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' +err.message);
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.setSystemRingtoneUri(null,'/data/media/test.mp3',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp3',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){
console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: ');
}).catch((err) => { }).catch((err) => {
console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) {
if (data == '/data/media/test.mp3') { if (data == '/storage/media/100/local/files/media/test.mp3') {
console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data);
} }
else { else {
...@@ -3739,14 +3677,14 @@ describe('audioManager',async function () { ...@@ -3739,14 +3677,14 @@ describe('audioManager',async function () {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' +err.message); console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' +err.message);
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.setSystemRingtoneUri(null,'/data/media/test.mp4',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp4',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){
console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: ');
}).catch((err) => { }).catch((err) => {
console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) {
if (data == '/data/media/test.mp4') { if (data == '/storage/media/100/local/files/media/test.mp4') {
console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data);
} }
else { else {
...@@ -3819,14 +3757,14 @@ describe('audioManager',async function () { ...@@ -3819,14 +3757,14 @@ describe('audioManager',async function () {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message));
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.setSystemRingtoneUri(null,'/data/media/test.mp3',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp3',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){
console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: ');
}).catch((err) => { }).catch((err) => {
console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) {
if (data == '/data/media/test.mp3') { if (data == '/storage/media/100/local/files/media/test.mp3') {
console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data);
} }
else { else {
...@@ -3903,14 +3841,14 @@ describe('audioManager',async function () { ...@@ -3903,14 +3841,14 @@ describe('audioManager',async function () {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message));
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.setSystemRingtoneUri(null,'/data/media/test.mp3',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp3',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){
console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: ');
}).catch((err) => { }).catch((err) => {
console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) {
if (data == '/data/media/test.mp3') { if (data == '/storage/media/100/local/files/media/test.mp3') {
console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data);
} }
else { else {
...@@ -3946,8 +3884,8 @@ describe('audioManager',async function () { ...@@ -3946,8 +3884,8 @@ describe('audioManager',async function () {
/* * /* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_094 * @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_094
* @tc.name : Ringtone-Player - wav -Get Title * @tc.name : Ringtone-Player - mp4 -Get Title
* @tc.desc : Configure & get title - Callback * @tc.desc : Configure & get title
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
...@@ -3966,14 +3904,14 @@ describe('audioManager',async function () { ...@@ -3966,14 +3904,14 @@ describe('audioManager',async function () {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message)); console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message));
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.setSystemRingtoneUri(null,'/data/media/test.mp4',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){ await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp4',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){
console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: '); console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: ');
}).catch((err) => { }).catch((err) => {
console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message); console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message);
expect(false).assertTrue(); expect(false).assertTrue();
}); });
await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) { await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) {
if (data == '/data/media/test.mp4') { if (data == '/storage/media/100/local/files/media/test.mp4') {
console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data); console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data);
} }
else { else {
...@@ -4006,6 +3944,70 @@ describe('audioManager',async function () { ...@@ -4006,6 +3944,70 @@ describe('audioManager',async function () {
done(); done();
}); });
/* *
* @tc.number : SUB_AUDIO_MANAGER_RingtoneManager_095
* @tc.name : Ringtone-Player - mp4 -Get Title - Callback
* @tc.desc : Configure & get title
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_RingtoneManager_095', 0,async function(done){
var ringtonePlayerTemp;
var resultFlag;
console.log('AudioFrameworkTestRM: Get System Ringtone Player');
await systemSoundManager.getSystemRingtonePlayer(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(async function(data) {
ringtonePlayerTemp = data;
if (ringtonePlayerTemp !=null) {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : SUCCESS: ' + data);
}
}).catch((err) => {
console.info('AudioFrameworkTestSSM:ENAME: get Ringtone Player : ERROR :' + (err.message));
expect(false).assertTrue();
});
await systemSoundManager.setSystemRingtoneUri(null,'/storage/media/100/local/files/media/test.mp4',audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function(){
console.info('AudioFrameworkTestSSM:enum: Set Ringtone Uri : SUCCESS: ');
}).catch((err) => {
console.error('AudioFrameworkTestSSM:enum: Set System Ringtone Uri :ERROR: '+err.message);
expect(false).assertTrue();
});
await systemSoundManager.getSystemRingtoneUri(null,audio.RingtoneType.RINGTONE_TYPE_DEFAULT).then(function (data) {
if (data == '/storage/media/100/local/files/media/test.mp4') {
console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri : DEFAULT : SUCCESS: ' + data);
}
else {
console.info('AudioFrameworkTestSSM: enum Get Ringtone Uri :DEFAULT : FAIL: ' + data);
}
}).catch((err) => {
console.info('AudioFrameworkTestSSM: enum Ringtone Get Ringtone ERROR: ' + err.message);
expect(false).assertTrue();
});
ringtonePlayerTemp.getTitle((err, data) => {
if (err) {
console.error(`AudioFrameworkTestRM: getTitle : ERROR : ${err.message}`);
expect(false).assertTrue();
}
else {
if (data == 'Galway') {
console.log('AudioFrameworkTestRM: TITLE : PASS : ' + data);
resultFlag = true;
}
else {
console.log('AudioFrameworkTestRM: TITLE : FAIL : ' + data);
resultFlag = false;
}
}
});
await sleep(100);
expect(resultFlag).assertTrue();
console.log('AudioFrameworkTestRM: Release RingtonePlayer');
await ringtonePlayerTemp.release();
done();
});
}); });
......
...@@ -57,7 +57,7 @@ describe('audioCapturer', function () { ...@@ -57,7 +57,7 @@ describe('audioCapturer', function () {
console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition');
}) })
function sleep (ms) { function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
...@@ -1483,7 +1483,7 @@ describe('audioCapturer', function () { ...@@ -1483,7 +1483,7 @@ describe('audioCapturer', function () {
expect(stateFlag).assertTrue(); expect(stateFlag).assertTrue();
done(); done();
//return resultFlag; //return resultFlag;
}).catch ((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message);
stateFlag=false; stateFlag=false;
}); });
...@@ -1652,7 +1652,7 @@ describe('audioCapturer', function () { ...@@ -1652,7 +1652,7 @@ describe('audioCapturer', function () {
console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag); console.info('AudioFrameworkRenderLog: stateFlag : '+stateFlag);
expect(stateFlag).assertTrue(); expect(stateFlag).assertTrue();
done(); done();
}).catch ((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message);
stateFlag=false stateFlag=false
}); });
...@@ -3800,7 +3800,7 @@ describe('audioCapturer', function () { ...@@ -3800,7 +3800,7 @@ describe('audioCapturer', function () {
} }
} }
}); });
await sleep (1000); await sleep(1000);
}) })
...@@ -4237,7 +4237,7 @@ describe('audioCapturer', function () { ...@@ -4237,7 +4237,7 @@ describe('audioCapturer', function () {
console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType);
setFlag = true; setFlag = true;
} }
await sleep (100); await sleep(100);
done(); done();
}); });
...@@ -4462,7 +4462,7 @@ describe('audioCapturer', function () { ...@@ -4462,7 +4462,7 @@ describe('audioCapturer', function () {
setFlag = true; setFlag = true;
}).catch((err) => { }).catch((err) => {
setFlag = false; setFlag = false;
console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message);; console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message);
}); });
await sleep(1000); await sleep(1000);
audioCapGetgetCapturerInfo.release(async (err, value) => { audioCapGetgetCapturerInfo.release(async (err, value) => {
...@@ -4538,7 +4538,7 @@ describe('audioCapturer', function () { ...@@ -4538,7 +4538,7 @@ describe('audioCapturer', function () {
console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source);
console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags);
setFlag = true; setFlag = true;
await sleep (100); await sleep(100);
done(); done();
} }
}); });
...@@ -5232,7 +5232,7 @@ describe('audioCapturer', function () { ...@@ -5232,7 +5232,7 @@ describe('audioCapturer', function () {
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 sleep(1000);
audioCapCallBack.on('markReach', 5000, (position) => { audioCapCallBack.on('markReach', 5000, (position) => {
if (position == 5000) { if (position == 5000) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
...@@ -5244,7 +5244,7 @@ describe('audioCapturer', function () { ...@@ -5244,7 +5244,7 @@ describe('audioCapturer', function () {
done(); done();
} }
}); });
await sleep (1000); await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){ if (err){
...@@ -5320,6 +5320,8 @@ describe('audioCapturer', function () { ...@@ -5320,6 +5320,8 @@ describe('audioCapturer', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
await sleep(3000); await sleep(3000);
audioCapCallBack.off('markReach');
await sleep(1000);
audioCapCallBack.release(async(err,value) => { audioCapCallBack.release(async(err,value) => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
if (err){ if (err){
...@@ -5382,7 +5384,7 @@ describe('audioCapturer', function () { ...@@ -5382,7 +5384,7 @@ describe('audioCapturer', function () {
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 sleep(1000);
audioCapCallBack.on('markReach', 1000, (position) => { audioCapCallBack.on('markReach', 1000, (position) => {
if (position == 1000) { if (position == 1000) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
...@@ -5394,7 +5396,7 @@ describe('audioCapturer', function () { ...@@ -5394,7 +5396,7 @@ describe('audioCapturer', function () {
done(); done();
} }
}); });
await sleep (1000); await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){ if (err){
...@@ -5470,6 +5472,8 @@ describe('audioCapturer', function () { ...@@ -5470,6 +5472,8 @@ describe('audioCapturer', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
await sleep(3000); await sleep(3000);
audioCapCallBack.off('markReach');
await sleep(1000);
audioCapCallBack.release(async(err,value) => { audioCapCallBack.release(async(err,value) => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
if (err){ if (err){
...@@ -5525,7 +5529,7 @@ describe('audioCapturer', function () { ...@@ -5525,7 +5529,7 @@ describe('audioCapturer', function () {
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 sleep(1000);
audioCapCallBack.on('markReach', 10000, (position) => { audioCapCallBack.on('markReach', 10000, (position) => {
if (position == 10000) { if (position == 10000) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
...@@ -5537,7 +5541,7 @@ describe('audioCapturer', function () { ...@@ -5537,7 +5541,7 @@ describe('audioCapturer', function () {
done(); done();
} }
}); });
await sleep (1000); await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){ if (err){
...@@ -5613,6 +5617,8 @@ describe('audioCapturer', function () { ...@@ -5613,6 +5617,8 @@ describe('audioCapturer', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
await sleep(3000); await sleep(3000);
audioCapCallBack.off('markReach');
await sleep(1000);
audioCapCallBack.release(async(err,value) => { audioCapCallBack.release(async(err,value) => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
if (err){ if (err){
...@@ -5669,7 +5675,7 @@ describe('audioCapturer', function () { ...@@ -5669,7 +5675,7 @@ describe('audioCapturer', function () {
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 sleep(1000);
audioCapCallBack.on('markReach', 100, (position) => { audioCapCallBack.on('markReach', 100, (position) => {
if (position == 100) { if (position == 100) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
...@@ -5681,7 +5687,7 @@ describe('audioCapturer', function () { ...@@ -5681,7 +5687,7 @@ describe('audioCapturer', function () {
done(); done();
} }
}); });
await sleep (1000); await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){ if (err){
...@@ -5757,6 +5763,8 @@ describe('audioCapturer', function () { ...@@ -5757,6 +5763,8 @@ describe('audioCapturer', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
await sleep(3000); await sleep(3000);
audioCapCallBack.off('markReach');
await sleep(1000);
audioCapCallBack.release(async(err,value) => { audioCapCallBack.release(async(err,value) => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
if (err){ if (err){
...@@ -5813,7 +5821,7 @@ describe('audioCapturer', function () { ...@@ -5813,7 +5821,7 @@ describe('audioCapturer', function () {
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 sleep(1000);
audioCapCallBack.on('markReach', 1, (position) => { audioCapCallBack.on('markReach', 1, (position) => {
if (position == 1) { if (position == 1) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
...@@ -5825,7 +5833,7 @@ describe('audioCapturer', function () { ...@@ -5825,7 +5833,7 @@ describe('audioCapturer', function () {
done(); done();
} }
}); });
await sleep (1000); await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){ if (err){
...@@ -5901,6 +5909,8 @@ describe('audioCapturer', function () { ...@@ -5901,6 +5909,8 @@ describe('audioCapturer', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
await sleep(3000); await sleep(3000);
audioCapCallBack.off('markReach');
await sleep(1000);
audioCapCallBack.release(async(err,value) => { audioCapCallBack.release(async(err,value) => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
if (err){ if (err){
...@@ -5923,14 +5933,14 @@ describe('audioCapturer', function () { ...@@ -5923,14 +5933,14 @@ describe('audioCapturer', function () {
/* * /* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_LARGEVALUE_REACH_081 * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_0_REACH_080
* @tc.name : AudioCapturer-Check-READ_BUFFER * @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer * @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0*/ * @tc.level : Level 0*/
it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_LARGEVALUE_REACH_081', 0, async function (done) { it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_0_REACH_080', 0, async function (done) {
var stateFlag ; var stateFlag ;
var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm';
var AudioStreamInfo = { var AudioStreamInfo = {
...@@ -5958,9 +5968,9 @@ describe('audioCapturer', function () { ...@@ -5958,9 +5968,9 @@ describe('audioCapturer', function () {
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 sleep(1000);
audioCapCallBack.on('markReach', 1234567890, (position) => { audioCapCallBack.on('markReach', 0, (position) => {
if (position == 1234567890) { if (position == 0) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
console.info('AudioRenderLog: mark reached: ' + position); console.info('AudioRenderLog: mark reached: ' + position);
stateFlag = true; stateFlag = true;
...@@ -5970,7 +5980,7 @@ describe('audioCapturer', function () { ...@@ -5970,7 +5980,7 @@ describe('audioCapturer', function () {
done(); done();
} }
}); });
await sleep (1000); await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){ if (err){
...@@ -6046,6 +6056,8 @@ describe('audioCapturer', function () { ...@@ -6046,6 +6056,8 @@ describe('audioCapturer', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
await sleep(3000); await sleep(3000);
audioCapCallBack.off('markReach');
await sleep(1000);
audioCapCallBack.release(async(err,value) => { audioCapCallBack.release(async(err,value) => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
if (err){ if (err){
...@@ -6067,16 +6079,15 @@ describe('audioCapturer', function () { ...@@ -6067,16 +6079,15 @@ describe('audioCapturer', function () {
}) })
/* * /* *
* @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1000_084 * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_LARGEVALUE_REACH_081
* @tc.name : AudioCapturer-Check-READ_BUFFER * @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer * @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0*/ * @tc.level : Level 0*/
it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1000_084', 0, async function (done) { it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_LARGEVALUE_REACH_081', 0, async function (done) {
var stateFlag ; var stateFlag ;
var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm';
var AudioStreamInfo = { var AudioStreamInfo = {
...@@ -6104,17 +6115,19 @@ describe('audioCapturer', function () { ...@@ -6104,17 +6115,19 @@ describe('audioCapturer', function () {
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 sleep(1000);
audioCapCallBack.on('periodReach',1000, (position) => { audioCapCallBack.on('markReach', 1234567890, (position) => {
if (position == "1000") { if (position == 1234567890) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
console.info('AudioRenderLog: mark reached: ' + position); console.info('AudioRenderLog: mark reached: ' + position);
stateFlag = true ; stateFlag = true;
} else { } else {
stateFlag = false; stateFlag = false;
expect(stateFlag).assertTrue();
done();
} }
}); });
await sleep (1000); await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){ if (err){
...@@ -6190,58 +6203,37 @@ describe('audioCapturer', function () { ...@@ -6190,58 +6203,37 @@ describe('audioCapturer', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
await sleep(3000); await sleep(3000);
if (stateFlag == true) { audioCapCallBack.off('markReach');
audioCapCallBack.release(async(err,value) => { await sleep(1000);
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); audioCapCallBack.release(async(err,value) => {
if (err){ console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); if (err){
stateFlag=false; console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message);
} else {console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); stateFlag=false;
console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); } else {console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS');
if ((audioCapCallBack.state == 4)) { console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state);
console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); if ((audioCapCallBack.state == 4)) {
stateFlag = true; console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------');
console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); stateFlag = true;
expect(stateFlag).assertTrue(); console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag);
done(); expect(stateFlag).assertTrue();
} done();
} }
}); }
await sleep(1000); });
} else { 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;
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_1_085 * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_NEGATIVEVALUE_REACH_082
* @tc.name : AudioCapturer-Check-READ_BUFFER * @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer * @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0*/ * @tc.level : Level 0*/
it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1_085', 0, async function (done) { it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_NEGATIVEVALUE_REACH_082', 0, async function (done) {
var stateFlag ; var stateFlag ;
var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm';
var AudioStreamInfo = { var AudioStreamInfo = {
...@@ -6269,17 +6261,19 @@ describe('audioCapturer', function () { ...@@ -6269,17 +6261,19 @@ describe('audioCapturer', function () {
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 sleep(1000);
audioCapCallBack.on('periodReach',1, (position) => { audioCapCallBack.on('markReach', -2, (position) => {
if (position == "1") { if (position == -2) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
console.info('AudioRenderLog: mark reached: ' + position); console.info('AudioRenderLog: mark reached: ' + position);
stateFlag = true ; stateFlag = true;
} else { } else {
stateFlag = false; stateFlag = false;
expect(stateFlag).assertTrue();
done();
} }
}); });
await sleep (1000); await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){ if (err){
...@@ -6355,58 +6349,38 @@ describe('audioCapturer', function () { ...@@ -6355,58 +6349,38 @@ describe('audioCapturer', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
await sleep(3000); await sleep(3000);
if (stateFlag == true) { audioCapCallBack.off('markReach');
audioCapCallBack.release(async(err,value) => { await sleep(1000);
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); audioCapCallBack.release(async(err,value) => {
if (err){ console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); if (err){
stateFlag=false; console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message);
} else {console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); stateFlag=false;
console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); } else {console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS');
if ((audioCapCallBack.state == 4)) { console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state);
console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); if ((audioCapCallBack.state == 4)) {
stateFlag = true; console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------');
console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag); stateFlag = true;
expect(stateFlag).assertTrue(); console.info('AudioFrameworkRenderLog: resultFlag : '+stateFlag);
done(); expect(stateFlag).assertTrue();
} done();
} }
}); }
await sleep(1000); });
} else { 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;
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_223750_086 * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_STRINGVALUE_REACH_083
* @tc.name : AudioCapturer-Check-READ_BUFFER * @tc.name : AudioCapturer-Check-READ_BUFFER
* @tc.desc : AudioCapturer with read buffer * @tc.desc : AudioCapturer with read buffer
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0*/ * @tc.level : Level 0*/
it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_223750_086', 0, async function (done) { it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_STRINGVALUE_REACH_083', 0, async function (done) {
var stateFlag ; var stateFlag ;
var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm'; var fpath = dirPath+'/capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm';
var AudioStreamInfo = { var AudioStreamInfo = {
...@@ -6434,17 +6408,19 @@ describe('audioCapturer', function () { ...@@ -6434,17 +6408,19 @@ describe('audioCapturer', function () {
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 sleep(1000);
audioCapCallBack.on('periodReach',223750, (position) => { audioCapCallBack.on('markReach', "HARSHA", (position) => {
if (position == 223750) { if (position == "HARSHA") {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
console.info('AudioRenderLog: periodReach: ' + position); console.info('AudioRenderLog: mark reached: ' + position);
stateFlag = true ; stateFlag = true;
} else { } else {
stateFlag = false; stateFlag = false;
expect(stateFlag).assertTrue();
done();
} }
}); });
await sleep (1000); await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => { audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------'); console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){ if (err){
...@@ -6520,6 +6496,822 @@ describe('audioCapturer', function () { ...@@ -6520,6 +6496,822 @@ describe('audioCapturer', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
await sleep(3000); await sleep(3000);
audioCapCallBack.off('markReach');
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---------');
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_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);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){
console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message);
stateFlag=false;
} else {
console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS ');
console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue);
console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait');
console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state);
console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state);
if ((audioCapCallBack.state == 1)) {
stateFlag = true;
}
}
});
await sleep(1000);
audioCapCallBack.start(async (err,value) => {
console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS');
console.info('AudioFrameworkRecLog: ---------START---------');
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 = 250;
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) => {
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_1_085
* @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_1_085', 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',1, (position) => {
if (position == "1") {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
console.info('AudioRenderLog: mark reached: ' + position);
stateFlag = true ;
} else {
stateFlag = false;
}
});
await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){
console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message);
stateFlag=false;
} else {
console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS ');
console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue);
console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait');
console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state);
console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state);
if ((audioCapCallBack.state == 1)) {
stateFlag = true;
}
}
});
await sleep(1000);
audioCapCallBack.start(async (err,value) => {
console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS');
console.info('AudioFrameworkRecLog: ---------START---------');
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 = 250;
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) => {
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_NEGATIVE_086
* @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_NEGATIVE_086', 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',-2, (position) => {
if (position == -2) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
console.info('AudioRenderLog: mark reached: ' + position);
stateFlag = true ;
} else {
stateFlag = false;
}
});
await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){
console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message);
stateFlag=false;
} else {
console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS ');
console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue);
console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait');
console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state);
console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state);
if ((audioCapCallBack.state == 1)) {
stateFlag = true;
}
}
});
await sleep(1000);
audioCapCallBack.start(async (err,value) => {
console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS');
console.info('AudioFrameworkRecLog: ---------START---------');
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 = 250;
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) => {
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_223750_087
* @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_223750_087', 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',223750, (position) => {
if (position == 223750) {
console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------');
console.info('AudioRenderLog: periodReach: ' + position);
stateFlag = true ;
} else {
stateFlag = false;
}
});
await sleep(1000);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){
console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message);
stateFlag=false;
} else {
console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS ');
console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue);
console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait');
console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state);
console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state);
if ((audioCapCallBack.state == 1)) {
stateFlag = true;
}
}
});
await sleep(1000);
audioCapCallBack.start(async (err,value) => {
console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS');
console.info('AudioFrameworkRecLog: ---------START---------');
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 = 250;
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) => {
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);
audioManagerRec.setAudioScene(audio.AudioScene.AUDIO_SCENE_VOICE_CHAT,async(err,setValue) => {
console.info('AudioFrameworkRecLog: ---------SET AUDIO SCENE---------');
if (err){
console.info('AudioFrameworkRecLog: setAudioScene : ERROR : '+err.message);
stateFlag=false;
} else {
console.info('AudioFrameworkRecLog: setAudioScene : SUCCESS ');
console.info('AudioFrameworkRecLog: setAudioScene : Value : '+setValue);
console.info('AudioFrameworkRecLog: getAudioScene : Value : startawait');
console.info('AudioFrameworkRecLog: getAudioScene : Value : initaitestart');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapCallBack.state);
console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'+audioCapCallBack.state);
if ((audioCapCallBack.state == 1)) {
stateFlag = true;
}
}
});
await sleep(1000);
audioCapCallBack.start(async (err,value) => {
console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS');
console.info('AudioFrameworkRecLog: ---------START---------');
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 = 250;
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) { if (stateFlag == true) {
audioCapCallBack.release(async(err,value) => { audioCapCallBack.release(async(err,value) => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
......
...@@ -1303,7 +1303,7 @@ describe('audioManger', function () { ...@@ -1303,7 +1303,7 @@ describe('audioManger', function () {
it('SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_037', 0, async function (done) { it('SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_037', 0, async function (done) {
await audioManager.setDeviceActive(audio.DeviceType.SPEAKER,false).then(function (){ await audioManager.setDeviceActive(audio.DeviceType.SPEAKER,false).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`);
}); });
var setflag ; var setflag ;
...@@ -1330,7 +1330,7 @@ describe('audioManger', function () { ...@@ -1330,7 +1330,7 @@ describe('audioManger', function () {
}); });
await audioManager.setDeviceActive(audio.DeviceType.SPEAKER,true).then(function (){ await audioManager.setDeviceActive(audio.DeviceType.SPEAKER,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`);
}); });
done(); done();
...@@ -1367,7 +1367,7 @@ describe('audioManger', function () { ...@@ -1367,7 +1367,7 @@ describe('audioManger', function () {
}); });
await audioManager.setDeviceActive(2,true).then(function (){ await audioManager.setDeviceActive(2,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`);
}); });
}) })
...@@ -1400,7 +1400,7 @@ describe('audioManger', function () { ...@@ -1400,7 +1400,7 @@ describe('audioManger', function () {
}); });
await audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true).then(function (){ await audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error: ${err.message}`);
}); });
done(); done();
...@@ -1437,7 +1437,7 @@ describe('audioManger', function () { ...@@ -1437,7 +1437,7 @@ describe('audioManger', function () {
}); });
await audioManager.setDeviceActive(7,true).then(function (){ await audioManager.setDeviceActive(7,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error: ${err.message}`);
}); });
done(); done();
...@@ -1472,7 +1472,7 @@ describe('audioManger', function () { ...@@ -1472,7 +1472,7 @@ describe('audioManger', function () {
}); });
await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){ await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error: ${err.message}`);
}); });
done(); done();
...@@ -1515,7 +1515,7 @@ describe('audioManger', function () { ...@@ -1515,7 +1515,7 @@ describe('audioManger', function () {
}); });
await audioManager.setDeviceActive(3,true).then(function (){ await audioManager.setDeviceActive(3,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error: ${err.message}`);
}); });
done(); done();
...@@ -1543,19 +1543,19 @@ describe('audioManger', function () { ...@@ -1543,19 +1543,19 @@ describe('audioManger', function () {
await sleep(1000); await sleep(1000);
await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){ await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error: ${err.message}`);
}); });
await sleep(5000); await sleep(5000);
await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true).then(function (){ await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`);
}); });
await sleep(5000); await sleep(5000);
await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){ await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active Again'); console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active Again');
}).catch ((err) => { }).catch((err) => {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate Again: Error: ${err.message}`); console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate Again: Error: ${err.message}`);
}); });
await sleep(5000); await sleep(5000);
...@@ -1577,4 +1577,36 @@ describe('audioManger', function () { ...@@ -1577,4 +1577,36 @@ describe('audioManger', function () {
done(); done();
}) })
/* *
* @tc.number : SUB_AUDIO_MANAGER_DeviceType_001
* @tc.name : DeviceType - INVALID
* @tc.desc : DeviceType - INVALID
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_DeviceType_001', 0, async function (done) {
expect(audio.DeviceType.INVALID).assertEqual(0);
await sleep(50);
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_DeviceType_002
* @tc.name : DeviceType - WIRED_HEADSET
* @tc.desc : DeviceType - WIRED_HEADSET
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_DeviceType_001', 0, async function (done) {
expect(audio.DeviceType.WIRED_HEADSET).assertEqual(3);
await sleep(50);
done();
})
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册