diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js index 8cde62dfcfb63dbce17a2cdd2209c70737744b5a..3467d0c50c5c909e5a95053c97ce6a69e3e48e29 100644 --- a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js +++ b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js @@ -45,6 +45,8 @@ describe('audioCapturer', function () { const GET_STREAMINFO_EVENT = 'getStreamInfo'; const GET_AUDIOSCENE_EVENT = 'getAudioScene'; const ERROR_EVENT = 'error'; + let stringParameter = "invalid_parameter"; + let numberParameter = 999999; let eventEmitter = new events.EventEmitter(); function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); @@ -1940,6 +1942,68 @@ describe('audioCapturer', function () { done(); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_0200 + *@tc.name : AudioCapturer-GET_AUDIO_TIME + *@tc.desc : AudioCapturer GET_AUDIO_TIME + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_0200', 2, async function (done) { + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let audioCapPromise; + try { + audioCapPromise = await audio.createAudioCapturer(AudioCapturerOptions); + console.log(`${Tag} createAudioCapturer ok`); + } catch (err) { + console.log(`${Tag} createAudioCapturer err: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + return done(); + } + + try { + await audioCapPromise.start(); + console.log(`${Tag} start ok`); + let audioTime = await audioCapPromise.getAudioTime(); + console.log(`${Tag} audioTime: ${JSON.stringify(audioTime)}`); + expect(audioTime).assertLarger(0); + + await audioCapPromise.read(stringParameter, true); + } catch (err) { + if (err.code == 6800101) { + console.log(`audioVolumeManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`audioVolumeManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + + try { + await audioCapPromise.release(); + } catch (err) { + console.log(`${Tag} err: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + done(); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100 *@tc.name : AudioCapturer-GET_AUDIO_TIME @@ -2040,6 +2104,62 @@ describe('audioCapturer', function () { done(); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100 + *@tc.name : AudioCapturer-GET_AUDIO_TIME + *@tc.desc : AudioCapturer GET_AUDIO_TIME + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100', 2, async function (done) { + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let audioCapPromise; + try { + audioCapPromise = await audio.createAudioCapturer(AudioCapturerOptions); + console.log(`${Tag} createAudioCapturer ok`); + } catch (err) { + console.log(`${Tag} createAudioCapturer err: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + return done(); + } + + try { + await audioCapPromise.stop(); + } catch (err) { + if (err.code == 6800301) { + console.log(`${Tag} stop error code : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${Tag} stop error code : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + + try { + await audioCapPromise.release(); + } catch (err) { + console.log(`${Tag} err: ${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + done(); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_GET_AUDIO_TIME_0100 *@tc.name : AudioCapturer-GET_AUDIO_TIME diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js index 20d42d14f222c1e34895f96f530f16ac914bb034..39cd5975d44cd74b6152a3d20d0890a8d542fbc2 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js @@ -37,6 +37,8 @@ describe('audioFramework', function () { let highVol = 14; let outOfRangeVol = 28; let longValue = '28374837458743875804735081439085918459801437584738967509184509813904850914375904790589104801843'; + let stringParameter = "invalid_parameter"; + let numberParameter = 999999; function getAudioManager() { audioManager = audio.getAudioManager(); if (audioManager != null) { @@ -958,6 +960,154 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2900 + *@tc.name : setVolume Callback + *@tc.desc : Setvolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2900', 2, function (done) { + audioManager.setVolume(stringParameter, lowVol, (err) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.info('${TagFrmwk}: Callback: setVolume : FAIL'); + expect(false).assertTrue(); + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_3000 + *@tc.name : setVolume Promise + *@tc.desc : Setvolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_3000', 2, async function (done) { + try { + await audioManager.setVolume(numberParameter, highVol); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: setVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_3100 + *@tc.name : setVolume Promise + *@tc.desc : Setvolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_3100', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.MEDIA, stringParameter); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_3200 + *@tc.name : setVolume Promise + *@tc.desc : Setvolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_3200', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.MEDIA, numberParameter); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: setVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETVOLUME_0100 + *@tc.name : getVolume Promise + *@tc.desc : getVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETVOLUME_0100', 2, async function (done) { + try { + await audioManager.getVolume(audio.AudioVolumeType.MEDIA, numberParameter); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: getVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETVOLUME_0200 + *@tc.name : getVolume Promise + *@tc.desc : getVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETVOLUME_0200', 2, async function (done) { + try { + await audioManager.getVolume(audio.AudioVolumeType.MEDIA, numberParameter); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: getVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0100 *@tc.name : getMaxVolume - Media - Promise @@ -1260,6 +1410,59 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1300 + *@tc.name : getMaxVolume - Callback + *@tc.desc : getMaxVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1300', 2, async function (done) { + audioManager.getMaxVolume(numberParameter, (err, value) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: getMaxVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMaxVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.info(`${TagFrmwk}: Callback: setVolume : FAIL`); + expect(false).assertTrue(); + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1400 + *@tc.name : getMaxVolume Promise + *@tc.desc : getMaxVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1400', 2, async function (done) { + try { + await audioManager.getMaxVolume(stringParameter); + expect(false).assertTrue(); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getMaxVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMaxVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0100 *@tc.name : getMinVolume - Media - Promise @@ -1618,6 +1821,60 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1300 + *@tc.name : getMinVolume - Callback + *@tc.desc : getMinVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1300', 2, async function (done) { + await audioManager.setVolume(audioRingtone, highVol); + audioManager.getMinVolume(numberParameter, (err, value) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: setVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.info(`${TagFrmwk}: Callback: setVolume : FAIL`); + expect(false).assertTrue(); + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1400 + *@tc.name : getMinVolume Promise + *@tc.desc : getMinVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1400', 2, async function (done) { + try { + await audioManager.getMinVolume(stringParameter); + expect(false).assertTrue(); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getMinVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMinVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0100 *@tc.name : getDevices - Output device - Promise @@ -1949,7 +2206,7 @@ describe('audioFramework', function () { *@tc.type : Function *@tc.level : Level 2 */ - it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1200', 2, function (done) { + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1200', 2, function (done) { audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG, (err, value) => { console.info(`${TagFrmwk}: Callback: getDevices ALL_DEVICES_FLAG`); if (err) { @@ -1970,6 +2227,58 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1300 + *@tc.name : getDevices - ALL device - Callback - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1300', 2, function (done) { + audioManager.getDevices(numberParameter, (err, value) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: getDevices : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getDevices : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.info(`${TagFrmwk}: Callback: getDevices : FAIL`); + expect(false).assertTrue(); + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1400 + *@tc.name : getDevices - ALL device - Callback - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1400', 2, async function (done) { + try { + await audioManager.getDevices(stringParameter); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getDevices : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getDevices : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0100 *@tc.name : setRingerMode - Normal Mode - Promise @@ -2331,6 +2640,59 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1300 + *@tc.name : setRingerMode - Vibration Mode - Callback + *@tc.desc : setRingerMode - Set Ring more to Vibration Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1300', 2, function (done) { + audioManager.setRingerMode(stringParameter, (err, value) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setRingerMode : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setRingerMode : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.info(`${TagFrmwk}: Callback: setRingerMode : FAIL`); + expect(false).assertTrue(); + } + done(); + }); + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1400 + *@tc.name : setRingerMode - Vibration Mode - Callback + *@tc.desc : setRingerMode - Set Ring more to Vibration Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1400', 2, async function (done) { + try { + await audioManager.setRingerMode(stringParameter); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setRingerMode : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setRingerMode : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0100 *@tc.name : mute - Media - callback @@ -3218,6 +3580,84 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_2100 + *@tc.name : mute - callback + *@tc.desc : mute - callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_2100', 3, async function (done) { + audioManager.mute(stringParameter, false, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getMinVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMinVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`${TagFrmwk}: failed to getMinVolume: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_2200 + *@tc.name : mute - callback + *@tc.desc : mute - callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_2200', 3, async function (done) { + await audioManager.mute(numberParameter, false).then(async function () { + console.log(`${TagFrmwk}: Set Stream GroupManager Mute: RINGTONE: Promise: FALSE`); + expect(false).assertTrue(); + }).catch((err) => { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: getMinVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMinVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + }); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_2300 + *@tc.name : mute - callback + *@tc.desc : mute - callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_2300', 3, async function (done) { + await audioManager.mute(stringParameter, false).then((resolve)=> { + console.log(`${TagFrmwk}: Set Stream GroupManager Mute: RINGTONE: Promise: FALSE`); + expect(false).assertTrue(); + }, (err) => { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setRingerMode : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setRingerMode : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + }) + done(); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0100 *@tc.name : isActive - Media - Promise @@ -3425,6 +3865,61 @@ describe('audioFramework', function () { }); }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0900 + *@tc.name : isActive - Promise + *@tc.desc : isActive - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0900', 2, async function (done) { + await audioManager.isActive(stringParameter, false).then((resolve)=> { + console.log(`${TagFrmwk}: Set Stream GroupManager Mute: RINGTONE: Promise: FALSE`); + expect(false).assertTrue(); + }, (err) => { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: isActive : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: isActive : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + }) + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_1000 + *@tc.name : isActive - Callback + *@tc.desc : isActive - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_1000', 2, function (done) { + console.log(`${TagFrmwk}: Callback : isActive Ringtone: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS`); + audioManager.isActive(numberParameter, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: isActive : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: isActive : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`${TagFrmwk}: failed to isActive: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0100 *@tc.name : setMicrophoneMute - true - Promise @@ -3545,6 +4040,59 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0500 + *@tc.name : setMicrophoneMute - Promise + *@tc.desc : Disable mic mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0500', 1, async function (done) { + await audioManager.setMicrophoneMute(stringParameter).then(()=>{ + console.log(`${TagFrmwk}: setMicrophoneMute : ERROR : message:${err.message}`); + expect(false).assertTrue(); + }).catch (err =>{ + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setMicrophoneMute : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setMicrophoneMute : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + }) + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0600 + *@tc.name : setMicrophoneMute - false - Callback + *@tc.desc : Disable mic mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0600', 1, function (done) { + audioManager.setMicrophoneMute(numberParameter, (err) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getMinVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMinVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`${TagFrmwk}: failed to getMinVolume: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 *@tc.name : setDeviceActive - SPEAKER - deactivate - Promise @@ -3692,6 +4240,58 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0500 + *@tc.name : setDeviceActive - Callback + *@tc.desc : Activate - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0500', 1, async function (done) { + await audioManager.setDeviceActive(stringParameter, true).then(()=>{ + console.log(`${TagFrmwk}: setDeviceActive : ERROR : message:${err.message}`); + expect(false).assertTrue(); + }).catch (err =>{ + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setDeviceActive : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setDeviceActive : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + }) + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0600 + *@tc.name : setDeviceActive - Callback + *@tc.desc : Activate - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0600', 1, function (done) { + audioManager.setDeviceActive(numberParameter, true, (err) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: setDeviceActive : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setDeviceActive : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`${TagFrmwk}: failed to setDeviceActive: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); + }) /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0100 @@ -4051,6 +4651,59 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1300 + *@tc.name : setAudioParameter - Promise + *@tc.desc : setAudioParameter - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1300', 2, async function (done) { + try { + await audioManager.setAudioParameter(numberParameter, numberParameter); + expect(false).assertTrue(); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setAudioParameter : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setAudioParameter : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1400 + *@tc.name : setAudioParameter - Callback + *@tc.desc : setAudioParameter - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1400', 2, function (done) { + audioManager.setAudioParameter(numberParameter, '16 bit', (err) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setAudioParameter : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setAudioParameter : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`${TagFrmwk}: failed to setAudioParameter: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0100 *@tc.name : getAudioParameter - Promise - Character & Number @@ -4409,6 +5062,59 @@ describe('audioFramework', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1300 + *@tc.name : getAudioParameter - Promise + *@tc.desc : getAudioParameter - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1300', 2, async function (done) { + try { + await audioManager.getAudioParameter(numberParameter); + expect(false).assertTrue(); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getAudioParameter : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getAudioParameter : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1400 + *@tc.name : getAudioParameter - Callback + *@tc.desc : getAudioParameter - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1400', 2, function (done) { + audioManager.getAudioParameter(numberParameter, (err) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getAudioParameter : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getAudioParameter : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`${TagFrmwk}: failed to getAudioParameter: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0100 *@tc.name : OnVolumeChange - setVolume - MEDIA diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioManagerApi9.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioManagerApi9.test.js index d8c309de6143b2f7c8b39187e7dd0fff1c58a158..40efc41ad3fabc1a965690141b04b8e3880da175 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioManagerApi9.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioManagerApi9.test.js @@ -35,6 +35,8 @@ describe('audioManagerApi9', function () { let volMappingId = null; let volGroupName = null; let volConnectType = null; + let stringParameter = "invalid_parameter"; + let numberParameter = 999999; function displayVolumeGroupProp(value, index, array) { console.info('audioManagerApi9Test: volume group networkId:' + value.networkId); volNetworkId = value.networkId; @@ -251,6 +253,36 @@ describe('audioManagerApi9', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_MANAGER_GETVOLUMEGROUPSINFOS_0300 + *@tc.name : getVolumeGroupInfos - LOCAL_NETWORK_ID - Callback + *@tc.desc : getVolumeGroupInfos - LOCAL_NETWORK_ID + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_MANAGER_GETVOLUMEGROUPSINFOS_0300', 2,async function (done) { + let audioVolumeManager = audioManager.getVolumeManager(); + audioVolumeManager.getVolumeGroupInfos(numberParameter, (err, value) => { + // Getting Local VolumeGroupInfos + console.info(`${TagFrmwk}: Callback: getVolumeGroupInfos LOCAL_NETWORK_ID`); + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getVolumeGroupInfos on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getVolumeGroupInfos on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.info('audioManagerErrorCodeTest: Callback: getVolumeGroups : FAIL'); + expect(false).assertTrue(); + } + done(); + }); + }) /** * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_0100 * @tc.name : getVolumeGroupManager - callback @@ -320,6 +352,60 @@ describe('audioManagerApi9', function () { done(); }) + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_0300 + * @tc.name : getVolumeGroupManager - callback + * @tc.desc : getVolumeGroupManager + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_0300', 3, async function (done) { + let audioVolumeManager = audioManager.getVolumeManager(); + audioVolumeManager.getVolumeGroupManager(stringParameter, (err,groupManager)=>{ + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getVolumeGroupManager : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getVolumeGroupManager : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } else { + console.info('audioManagerErrorCodeTest: Promise: getGroupManager : FAIL'); + expect(false).assertTrue(); + } + done(); + }) + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_0400 + * @tc.name : getVolumeGroupManager - prmiose + * @tc.desc : getVolumeGroupManager + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_0400', 3, async function (done) { + try{ + let audioVolumeManager = audioManager.getVolumeManager(); + let groupManager = await audioVolumeManager.getVolumeGroupManager(numberParameter); + expect(false).assertTrue(); + }catch(err){ + console.log('err :' + err.code) + if (err.code == 6800301) { + console.log(`${TagFrmwk}: getVolumeGroupManager : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getVolumeGroupManager : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + /** * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETVOLUME_0100 * @tc.name : group manager setVolume - MEDIA - Callback @@ -336,7 +422,7 @@ describe('audioManagerApi9', function () { let groupId_ = volumeGroupInfos[0].groupId groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); } catch (err) { - console.info('audioManagerApi9Test: getVolumeGroupManager : err:' + err.message); + console.info('audioManagerApi9Test: setVolume : err:' + err.message); expect(false).assertTrue(); done(); } @@ -392,10 +478,167 @@ describe('audioManagerApi9', function () { } done(); } catch (err) { - console.info('audioManagerApi9Test: getVolumeGroupManager : err:' + err.message); + console.info('audioManagerApi9Test: setVolume : err:' + err.message); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_ERRORCODE_VOLUME_GROUP_MANAGER_SETVOLUME_0300 + * @tc.name : group manager setVolume - MEDIA - Callback + * @tc.desc : group manager Setvolo to 14 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_ERRORCODE_VOLUME_GROUP_MANAGER_SETVOLUME_0300', 3, async function (done) { + let groupManager; + try{ + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId + groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + }catch(err){ + console.info('audioManagerErrorCodeTest: setVolume : err:'+ err.message); + expect(false).assertTrue(); + done(); + } + groupManager.setVolume(stringParameter, highVol, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to set volume: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_ERRORCODE_VOLUME_GROUP_MANAGER_SETVOLUME_0400 + * @tc.name : group manager setVolume - MEDIA - Callback + * @tc.desc : group manager Setvolo to 14 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_ERRORCODE_VOLUME_GROUP_MANAGER_SETVOLUME_0400', 3, async function (done) { + let groupManager; + try{ + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId + groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + }catch(err){ + console.info('audioManagerErrorCodeTest: getVolumeGroupManager : err:'+ err.message); + expect(false).assertTrue(); + done(); + } + groupManager.setVolume(numberParameter, highVol, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: setVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to set volume: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_ERRORCODE_VOLUME_GROUP_MANAGER_GETVOLUME_0100 + * @tc.name : group manager getVolume - MEDIA - Callback + * @tc.desc : group manager Setvoloe + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_ERRORCODE_VOLUME_GROUP_MANAGER_GETVOLUME_0100', 3, async function (done) { + let groupManager; + try{ + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId + groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + }catch(err){ + console.info('audioManagerErrorCodeTest: getVolumeGroupManager : err:'+ err.message); + expect(false).assertTrue(); + done(); + } + groupManager.getVolume(stringParameter, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + else { + console.error(`audioManagerErrorCodeTest: failed to get volume: Callback: ${err.message}`); + expect(false).assertTrue(); + done(); + } + }); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_ERRORCODE_VOLUME_GROUP_MANAGER_GETVOLUME_0200 + * @tc.name : group manager getVolume - MEDIA - Callback + * @tc.desc : group manager getVolume + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_ERRORCODE_VOLUME_GROUP_MANAGER_GETVOLUME_0200', 3, async function (done) { + let groupManager; + try{ + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId + groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + }catch(err){ + console.info('audioManagerErrorCodeTest: getVolumeGroupManager : err:'+ err.message); expect(false).assertTrue(); done(); } + groupManager.getVolume(numberParameter, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: getVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to getVolume: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); }) /** @@ -466,6 +709,81 @@ describe('audioManagerApi9', function () { done(); }) + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMAXVOLUME_0300 + * @tc.name : getMaxVolume - Callback + * @tc.desc : getMaxVolume + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMAXVOLUME_0300', 3, async function (done) { + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + let groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + groupManager.getMaxVolume(stringParameter, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getMaxVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMaxVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to getMaxVolume: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); + } catch (err) { + console.info('audioManagerApi9Test: getMaxVolume : err:' + err.message); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMAXVOLUME_0400 + * @tc.name : getMaxVolume - RINGTONE - Promise + * @tc.desc : getMaxVolume + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMAXVOLUME_0400', 3, async function (done) { + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + let groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + let maxVolume = await groupManager.getMaxVolume(numberParameter); + console.info('audioManagerApi9Test: promise : Ringtone getMaxVolume: FAIL :' + maxVolume); + expect(false).assertTrue(); + } catch (err) { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: getMaxVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMaxVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to getMaxVolume: Callback: ${err.message}`); + expect(false).assertTrue(); + done(); + } + } + done(); + }) + /** * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMINVOLUME_0100 * @tc.name : getMinVolume - RINGTONE - Callback @@ -535,29 +853,104 @@ describe('audioManagerApi9', function () { }) /** - * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_MUTE_0100 - * @tc.name : group manager mute - RINGTONE - Callback - * @tc.desc : mute - RINGTONE - Callback + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMINVOLUME_0300 + * @tc.name : getMinVolume - Callback + * @tc.desc : getMinVolume * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 3 */ - it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_MUTE_0100', 3, async function (done) { - let groupManager; + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMINVOLUME_0300', 3, async function (done) { try { let audioVolumeManager = audioManager.getVolumeManager(); let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); let groupId_ = volumeGroupInfos[0].groupId; - groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + let groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + groupManager.getMinVolume(stringParameter, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getMinVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMinVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to getMinVolume: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }); } catch (err) { - console.info('audioManagerApi9Test: getGroupManager mute : parameter err:' + err.message); + console.info('audioManagerApi9Test: getMinVolume : err:' + err.message); expect(false).assertTrue(); done(); } - groupManager.mute(audio.AudioVolumeType.RINGTONE, false, (err, data) => { + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMINVOLUME_0400 + * @tc.name : getMinVolume - RINGTONE - Promise + * @tc.desc : getMinVolume + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMINVOLUME_0400', 3, async function (done) { + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + let groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + let maxVolume = await groupManager.getMinVolume(numberParameter); + console.info('audioManagerApi9Test: promise : Ringtone getMinVolume: FAIL :' + maxVolume); + expect(false).assertTrue(); + } catch (err) { if (err) { - console.error(`audioManagerApi9Test: failed to mute : Callback: ${err.message}`); - expect(false).assertTrue(); + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: getMinVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMinVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to getMinVolume: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + } + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_MUTE_0100 + * @tc.name : group manager mute - RINGTONE - Callback + * @tc.desc : mute - RINGTONE - Callback + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_MUTE_0100', 3, async function (done) { + let groupManager; + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + } catch (err) { + console.info('audioManagerApi9Test: getGroupManager mute : parameter err:' + err.message); + expect(false).assertTrue(); + done(); + } + groupManager.mute(audio.AudioVolumeType.RINGTONE, false, (err, data) => { + if (err) { + console.error(`audioManagerApi9Test: failed to mute : Callback: ${err.message}`); + expect(false).assertTrue(); } else { groupManager.isMute(audio.AudioVolumeType.RINGTONE, (err, data) => { @@ -625,6 +1018,89 @@ describe('audioManagerApi9', function () { } }) + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_MUTE_0300 + * @tc.name : group manager mute - RINGTONE - Callback + * @tc.desc : mute - RINGTONE - Callback + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_MUTE_0300', 3, async function (done) { + let groupManager; + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + } catch (err) { + console.info('audioManagerApi9Test: getGroupManager mute : parameter err:' + err.message); + expect(false).assertTrue(); + done(); + } + groupManager.mute(streamManager, false, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: getMinVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMinVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to getMinVolume: Callback: ${err.message}`); + expect(false).assertTrue(); + } + done(); + }) + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_MUTE_0400 + * @tc.name : group manager mute - RINGTONE - Promise + * @tc.desc : mute - RINGTONE - Promise + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_MUTE_0400', 3, async function (done) { + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + let groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + await groupManager.mute(audio.AudioVolumeType.RINGTONE, false).then(async function () { + console.log('audioManagerApi9Test: Set Stream GroupManager Mute: RINGTONE: Promise: FALSE'); + await groupManager.isMute(numberParameter).then(function (data) { + expect(false).assertTrue(); + }); + }).catch((err) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: getMinVolume : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: getMinVolume : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to getMinVolume: Callback: ${err.message}`); + expect(false).assertTrue(); + + }; + done(); + }); + } catch (err) { + console.info('audioManagerApi9Test: getGroupManager mute : parameter err:' + err.message); + expect(false).assertTrue(); + done(); + } + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_VOLUMECHANGE_0100 *@tc.name : OnVolumeChange - setVolume - MEDIA @@ -744,6 +1220,79 @@ describe('audioManagerApi9', function () { done(); }) + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETRINGERMODE_0300 + * @tc.name : group manager mute - RINGTONE - Callback + * @tc.desc : mute - RINGTONE - Callback + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETRINGERMODE_0300', 3, async function (done) { + let groupManager; + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + } catch (err) { + console.info('audioManagerApi9Test: getGroupManager mute : parameter err:' + err.message); + expect(false).assertTrue(); + done(); + } + groupManager.setRingerMode(stringParameter, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setRingerMode : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setRingerMode : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to setRingerMode: Callback: ${err.message}`); + expect(false).assertTrue(); + }; + done(); + }) + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETRINGERMODE_0400 + *@tc.name : setRingerMode - Normal Mode - Promise - ENAME + *@tc.desc : setRingerMode - Set Ring more to Normal Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETRINGERMODE_0400', 3, async function (done) { + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + let groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + await groupManager.setRingerMode(numberParameter); + expect(false).assertTrue(); + } catch (err) { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: setRingerMode : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setRingerMode : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to setRingerMode: Callback: ${err.message}`); + expect(false).assertTrue(); + }; + } + done(); + }) /** *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ONRINGMODECHANGE_0100 *@tc.name : OnRingMode - RINGER_MODE_NORMAL @@ -828,13 +1377,13 @@ describe('audioManagerApi9', function () { }) /** - *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETMICROPHONEMUTE_0200 - *@tc.name : setMicrophoneMute - true - Promise - *@tc.desc : Enable mic mute - *@tc.size : MEDIUM - *@tc.type : Function - *@tc.level : Level 3 - */ + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETMICROPHONEMUTE_0200 + *@tc.name : setMicrophoneMute - true - Promise + *@tc.desc : Enable mic mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 3 + */ it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETMICROPHONEMUTE_0200', 3, async function (done) { try { let audioVolumeManager = audioManager.getVolumeManager(); @@ -857,6 +1406,74 @@ describe('audioManagerApi9', function () { done(); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GSETMICROPHONEMUTE_0300 + *@tc.name : setMicrophoneMute - true - Callback + *@tc.desc : Enable mic mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETMICROPHONEMUTE_0300', 3, async function (done) { + let groupManager; + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + } catch (err) { + console.log('err :' + err.message); + expect(false).assertTrue(); + done(); + } + groupManager.setMicrophoneMute(numberParameter, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setMicrophoneMute : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setMicrophoneMute : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to setMicrophoneMute: Callback: ${err.message}`); + expect(false).assertTrue(); + }; + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GSETMICROPHONEMUTE_0400 + *@tc.name : setMicrophoneMute - true - Promise + *@tc.desc : Enable mic mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 3 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETMICROPHONEMUTE_0400', 3, async function (done) { + try { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + let groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + await groupManager.setMicrophoneMute(stringParameter); + expect(false).assertTrue(); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setMicrophoneMute : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setMicrophoneMute : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ONMICSTATECHANGE_0100 *@tc.name : OnMicStateChange @@ -953,62 +1570,172 @@ describe('audioManagerApi9', function () { }) /** - *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 - *@tc.name : setCommunicationDevice - SPEAKER - deactivate - Promise - *@tc.desc : setCommunicationDevice speaker - Promise + *@tc.number : SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ISACTIVE_0300 + *@tc.name : isActive - Media - Promise + *@tc.desc : isActive - Media - Promise - When stream is NOT playing *@tc.size : MEDIUM *@tc.type : Function *@tc.level : Level 1 */ - it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100', 1, async function (done) { - try { - let flag = true; - let AudioRoutingManager = audioManager.getRoutingManager(); - let outputDeviceDescription = await AudioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG); - console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 - outputDeviceDescription is ${JSON.stringify(outputDeviceDescription)}`); - if (outputDeviceDescription.length == 1 && - outputDeviceDescription[0].deviceType == audio.DeviceType.SPEAKER) { - flag = false; - } - await AudioRoutingManager.setCommunicationDevice(2, false).then(() => { - console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 - Promise returned to indicate that the device is set to the active status.`); - }); - await AudioRoutingManager.isCommunicationDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) { - if (flag == true && value == false) { - console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 - isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value} flag is ${flag}`); - expect(true).assertTrue(); - } - else if (flag == false && value == true) { - console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 - isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value} flag is ${flag}`); - expect(true).assertTrue(); - } - else { - console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 - isCommunicationDeviceActive : SPEAKER: Deactivate : fail :${value} flag is ${flag}`); - expect(false).assertTrue(); - } - }).catch((err) => { - console.log('err :' + JSON.stringify(err)); - expect(false).assertTrue(); - }); - } catch (err) { - console.log('err :' + JSON.stringify(err)); + it('SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ISACTIVE_0300', 1, async function (done) { + try{ + const PROMISE = await streamManager.isActive(stringParameter); + console.log(`${TagFrmwk}: setMicrophoneMute : FAIL : message:${err.message}`); expect(false).assertTrue(); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setMicrophoneMute : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setMicrophoneMute : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } } done(); }) /** - *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0200 - *@tc.name : setCommunicationDevice - SPEAKER - deactivate - Callback - *@tc.desc : setCommunicationDevice speaker - Callback + *@tc.number : SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ISACTIVE_0400 + *@tc.name : isActive - Media - Callback + *@tc.desc : isActive - Media - Callback - When stream is NOT playing *@tc.size : MEDIUM *@tc.type : Function - *@tc.level : Level 2 + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ISACTIVE_0400', 1, function (done) { + console.log(`${TagFrmwk}: Callback : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS`); + streamManager.isActive(numberParameter, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: setMicrophoneMute : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setMicrophoneMute : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to setMicrophoneMute: Callback: ${err.message}`); + expect(false).assertTrue(); + }; + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ISACTIVE_0300 + *@tc.name : isActive - Media - Promise + *@tc.desc : isActive - Media - Promise - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ISACTIVE_0300', 1, async function (done) { + try{ + const PROMISE = await streamManager.isActive(stringParameter); + console.log(`${TagFrmwk}: setMicrophoneMute : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setMicrophoneMute : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setMicrophoneMute : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ISACTIVE_0400 + *@tc.name : isActive - Media - Callback + *@tc.desc : isActive - Media - Callback - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ISACTIVE_0400', 1, function (done) { + console.log(`${TagFrmwk}: Callback : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS`); + streamManager.isActive(numberParameter, (err, data) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: setMicrophoneMute : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setMicrophoneMute : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`audioManagerErrorCodeTest: failed to setMicrophoneMute: Callback: ${err.message}`); + expect(false).assertTrue(); + }; + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETCOMMUNICATIONDEVICE_0100 + *@tc.name : setCommunicationDevice - SPEAKER - deactivate - Promise + *@tc.desc : setCommunicationDevice speaker - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100', 1, async function (done) { + try { + let flag = true; + let AudioRoutingManager = audioManager.getRoutingManager(); + let outputDeviceDescription = await AudioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG); + console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 + outputDeviceDescription is ${JSON.stringify(outputDeviceDescription)}`); + if (outputDeviceDescription.length == 1 && + outputDeviceDescription[0].deviceType == audio.DeviceType.SPEAKER) { + flag = false; + } + await AudioRoutingManager.setCommunicationDevice(2, false).then(() => { + console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 + Promise returned to indicate that the device is set to the active status.`); + }); + await AudioRoutingManager.isCommunicationDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) { + if (flag == true && value == false) { + console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 + isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value} flag is ${flag}`); + expect(true).assertTrue(); + } + else if (flag == false && value == true) { + console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 + isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value} flag is ${flag}`); + expect(true).assertTrue(); + } + else { + console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 + isCommunicationDeviceActive : SPEAKER: Deactivate : fail :${value} flag is ${flag}`); + expect(false).assertTrue(); + } + }).catch((err) => { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + }); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0200 + *@tc.name : setCommunicationDevice - SPEAKER - deactivate - Callback + *@tc.desc : setCommunicationDevice speaker - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 */ it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0200', 2, async function (done) { let flag = true @@ -1047,6 +1774,128 @@ describe('audioManagerApi9', function () { }); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETCOMMUNICATIONDEVICE_0300 + *@tc.name : setCommunicationDevice - SPEAKER - deactivate - Promise + *@tc.desc : setCommunicationDevice speaker - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0300', 1, async function (done) { + try { + let flag = true; + let AudioRoutingManager = audioManager.getRoutingManager(); + + await AudioRoutingManager.setCommunicationDevice(stringParameter, false).then(() => { + console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 + Promise returned to indicate that the device is set to the active status.`); + }).catch((err) => { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: setCommunicationDevice : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setCommunicationDevice : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + }); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0400 + *@tc.name : setCommunicationDevice - SPEAKER - deactivate - Callback + *@tc.desc : setCommunicationDevice speaker - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0400', 2, async function (done) { + let flag = true + let AudioRoutingManager = audioManager.getRoutingManager(); + AudioRoutingManager.setCommunicationDevice(numberParameter, false, (err) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: setCommunicationDevice : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: setCommunicationDevice : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`${TagFrmwk}: failed to setCommunicationDevice: Callback: ${err.message}`); + expect(false).assertTrue(); + }; + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISCOMMUNICATIONDEVICE_0100 + *@tc.name : isCommunicationDeviceActive - Promise + *@tc.desc : isCommunicationDeviceActive + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_ISCOMMUNICATIONDEVICE_0100', 1, async function (done) { + try { + let AudioRoutingManager = audioManager.getRoutingManager(); + await AudioRoutingManager.isCommunicationDeviceActive(stringParameter).then(() => { + expect(false).assertTrue(); + }).catch((err) => { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`${TagFrmwk}: isCommunicationDeviceActive : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: isCommunicationDeviceActive : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + }); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_ISCOMMUNICATIONDEVICE_0200 + *@tc.name : isCommunicationDeviceActive Callback + *@tc.desc : isCommunicationDeviceActive + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_ISCOMMUNICATIONDEVICE_0200', 2, async function (done) { + let AudioRoutingManager = audioManager.getRoutingManager(); + AudioRoutingManager.isCommunicationDeviceActive(numberParameter, (err) => { + if (err) { + console.log('err :' + err.code) + if (err.code == 6800104) { + console.log(`${TagFrmwk}: isCommunicationDeviceActive : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`${TagFrmwk}: isCommunicationDeviceActive : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + } + else { + console.error(`${TagFrmwk}: failed to isCommunicationDeviceActive: Callback: ${err.message}`); + expect(false).assertTrue(); + }; + done(); + }); + }) + /** *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_MICSTATECHANGE_0100 *@tc.name : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_MICSTATECHANGE_0100 @@ -1197,4 +2046,373 @@ describe('audioManagerApi9', function () { done(); }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_MANAGER_ON_0100 + *@tc.name : audioVolumeManager on + *@tc.desc : audioVolumeManager on + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_MANAGER_ON_0100', 2, async function (done) { + let audioVolumeManager = audioManager.getVolumeManager(); + let stringParameter = "invalid_parameter"; + try { + audioVolumeManager.on(stringParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + if (err.code == 6800101) { + console.log(`audioVolumeManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`audioVolumeManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_MANAGER_ON_0200 + *@tc.name : audioVolumeManager on + *@tc.desc : audioVolumeManager on + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_MANAGER_ON_0200', 2, async function (done) { + let audioVolumeManager = audioManager.getVolumeManager(); + let numberParameter = 1; + try { + audioVolumeManager.on(numberParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + if (err.code == 401) { + console.log(`audioVolumeManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`audioVolumeManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_0100 + *@tc.name : volumeGroupManager on + *@tc.desc : volumeGroupManager on + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_0100', 2, async function (done) { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + let groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + let stringParameter = "invalid_parameter"; + + try { + groupManager.on(stringParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`groupManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`groupManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_0200 + *@tc.name : volumeGroupManager on + *@tc.desc : volumeGroupManager on + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_0200', 2, async function (done) { + let audioVolumeManager = audioManager.getVolumeManager(); + let volumeGroupInfos = await audioVolumeManager.getVolumeGroupInfos(audio.LOCAL_NETWORK_ID); + let groupId_ = volumeGroupInfos[0].groupId; + let groupManager = await audioVolumeManager.getVolumeGroupManager(groupId_); + let numberParameter = 1; + try { + groupManager.on(numberParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 401) { + console.log(`groupManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`groupManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_ON_0100 + *@tc.name : routingManager on + *@tc.desc : routingManager on + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_ON_0100', 2, async function (done) { + let AudioRoutingManager = audioManager.getRoutingManager(); + let stringParameter = "invalid_parameter"; + + try { + AudioRoutingManager.on(stringParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`AudioRoutingManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`AudioRoutingManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_ON_0200 + *@tc.name : routingManager on + *@tc.desc : routingManager on + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_ON_0200', 2, async function (done) { + let AudioRoutingManager = audioManager.getRoutingManager(); + let numberParameter = 1; + try { + AudioRoutingManager.on(numberParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 401) { + console.log(`AudioRoutingManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`AudioRoutingManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_OFF_0100 + *@tc.name : routingManager off + *@tc.desc : routingManager off + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_OFF_0100', 2, async function (done) { + let AudioRoutingManager = audioManager.getRoutingManager(); + let stringParameter = "invalid_parameter"; + + try { + AudioRoutingManager.off(stringParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`AudioRoutingManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`AudioRoutingManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_OFF_0200 + *@tc.name : routingManager off + *@tc.desc : routingManager off + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_OFF_0200', 2, async function (done) { + let AudioRoutingManager = audioManager.getRoutingManager(); + let numberParameter = 1; + try { + AudioRoutingManager.off(numberParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 401) { + console.log(`AudioRoutingManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`AudioRoutingManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ON_0100 + *@tc.name : audioStreamManager on + *@tc.desc : audioStreamManager on + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ON_0100', 2, async function (done) { + let audioStreamManager = audioManager.getStreamManager(); + let stringParameter = "invalid_parameter"; + + try { + audioStreamManager.on(stringParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`audioStreamManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`audioStreamManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ON_0200 + *@tc.name : audioStreamManager on + *@tc.desc : audioStreamManager on + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_ON_0200', 2, async function (done) { + let audioStreamManager = audioManager.getStreamManager(); + let numberParameter = 1; + try { + audioStreamManager.on(numberParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 401) { + console.log(`audioStreamManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`audioStreamManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_OFF_0100 + *@tc.name : audioStreamManager off + *@tc.desc : audioStreamManager off + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_OFF_0100', 2, async function (done) { + let audioStreamManager = audioManager.getStreamManager(); + let stringParameter = "invalid_parameter"; + + try { + audioStreamManager.off(stringParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 6800101) { + console.log(`audioStreamManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`audioStreamManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_OFF_0200 + *@tc.name : audioStreamManager off + *@tc.desc : audioStreamManager off + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_STREAM_MANAGER_OFF_0200', 2, async function (done) { + let audioStreamManager = audioManager.getStreamManager(); + let numberParameter = 1; + try { + audioStreamManager.off(numberParameter, (ChangeEvent) => { + console.log(`${TagFrmwk}: Change Event is called : Error`); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.log('err :' + err.code) + if (err.code == 401) { + console.log(`audioStreamManager on : PASS : message:${err.message}`); + expect(true).assertTrue(); + }else { + console.log(`audioStreamManager on : FAIL : message:${err.message}`); + expect(false).assertTrue(); + } + done(); + } + }) + }) \ No newline at end of file