diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js index f7c8a0fb69c72fd1b14ebd8e235088bd3f281ad4..4502a2a7aa9ff20a7244a09a024b533d603fa0aa 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js @@ -45,8 +45,7 @@ describe('audioCall', function () { console.error('AudioFrameworkRenderLog: Failed to obtain the cache directory. Cause:' + error.message); }); await sleep(200); - var mediaDirTemp = path1 + packageName + '/' + packageName + '/assets/entry/resources/rawfile'; - + var mediaDirTemp = '/data' console.info('AudioFrameworkRenderLog: Resource DIR Path : '+mediaDirTemp); return mediaDirTemp; diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js index bd8f457db1f222908b3e3f64d38b9b3af2f323c1..f8fb94c420e13b3dd5c49d61e5586c0dc567b7e9 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js @@ -14,7 +14,6 @@ */ require('./AudioFramework.test.js') -//require('./AudioPerf.test.js') require('./AudioRenderer.test.js') require('./SR000GHLLV.test.js') require('./AudioCall.test.js') diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js index 684036431b4359644043ee3825366feb725f6dbb..6ead3b1ff292dbc64d4d65963e8f2bb0e21f7fcf 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/SR000GHQBN.test.js @@ -1023,560 +1023,6 @@ describe('audioManger', function () { await sleep(1000); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_029 - * @tc.name : setDeviceActive - WIRED_HEADSET - Activate - Promise - * @tc.desc : Activate HEADSET - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_029', 0, async function (done) { - await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Activate'); - audioManager.isDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET).then(function (value){ - if(value==true){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL : Error :' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_ENUM_030 - * @tc.name : setDeviceActive - WIRED_HEADSET - Activate - Promise - * @tc.desc : Activate WIRED_HEADSET - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_ENUM_030', 0, async function (done) { - await audioManager.setDeviceActive(3,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Activate'); - audioManager.isDeviceActive(3).then(function (value){ - if(value==true){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL : Error :' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_031 - * @tc.name : setDeviceActive - WIRED_HEADSET - Deactivate - Promise - * @tc.desc : Activate HEADSET - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_031', 0, async function (done) { - await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,false).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Deactivate'); - audioManager.isDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET).then(function (value){ - if(value==false){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : FAIL : Error :' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_ENUM_032 - * @tc.name : setDeviceActive - WIRED_HEADSET - Deactivate - Promise - * @tc.desc : Activate WIRED_HEADSET - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_ENUM_032', 0, async function (done) { - await audioManager.setDeviceActive(3,false).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Deactivate'); - audioManager.isDeviceActive(3).then(function (value){ - if(value==false){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Deactivate : FAIL : Error :' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_033 - * @tc.name : setDeviceActive - WIRED_HEADSET - activate - Callback - * @tc.desc : Activate WIRED_HEADSET - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_033', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET ,true, (err) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET : Active: Error: ${err.message}`); - expect(false).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET : Active'); - audioManager.isDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET ,(err, value) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Active: Error: ${err.message}`); - expect(false).assertTrue(); - } - else if(value==true){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Active : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Active : FAIL :' +value); - expect(false).assertTrue(); - } - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_ENUM_034 - * @tc.name : setDeviceActive - WIRED_HEADSET - activate - Callback - * @tc.desc : Activate WIRED_HEADSET - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_ENUM_034 ', 0, async function (done) { - audioManager.setDeviceActive(3,true, (err) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active: Error: ${err.message}`); - expect(false).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active'); - audioManager.isDeviceActive(3,(err, value) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Active: Error: ${err.message}`); - expect(false).assertTrue(); - } - else if(value==true){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Active : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Active : FAIL :' +value); - expect(false).assertTrue(); - } - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_035 - * @tc.name : setDeviceActive - WIRED_HEADSET - Deactivate - Callback - * @tc.desc : Activate WIRED_HEADSET - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_035', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET ,false, (err) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET : Deactive: Error: ${err.message}`); - expect(false).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET : Deactive'); - audioManager.isDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET ,(err, value) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Deactive: Error: ${err.message}`); - expect(false).assertTrue(); - } - else if(value==true){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Deactive : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET : Deactive : FAIL :' +value); - expect(false).assertTrue(); - } - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_ENUM_036 - * @tc.name : setDeviceActive - WIRED_HEADSET - Deactivate - Callback - * @tc.desc : Deactivate WIRED_HEADSET - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_ENUM_036 ', 0, async function (done) { - var setflag; - audioManager.setDeviceActive(3, true,async (err) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active: Error: ${err.message}`); - expect(false).assertTrue(); - } - else { - audioManager.setDeviceActive(3, false, async (err) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Deactive: Error: ${err.message}`); - expect(false).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Deactive'); - audioManager.isDeviceActive(3, async (err, value) => { - if (!value) { - expect(true).assertTrue(); - //console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Deactive : PASS :' + value); - //setflag = true ; - //console.info('AudioFrameworkTest: Device Test: setFlag' + setflag); - } - else { - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : WIRED_HEADSET: Deactive : FAIL :' + value); - setflag = false ; - console.info('AudioFrameworkTest: Device Test: setFlag' + setflag); - expect(false).assertTrue(); - } - done(); - }); - await sleep(100); - } - done(); - }); - await sleep(1000); - } - }); - done(); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_037 - * @tc.name : setDeviceActive - SPEAKER - * @tc.desc : Listner on speaker active - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_037', 0, async function (done) { - await audioManager.setDeviceActive(audio.DeviceType.SPEAKER,false).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`); - }); - var setflag ; - audioManager.on('deviceChange', (deviceChangeAction) => { - console.info('AudioManagerLog: device connected: ' + deviceChangeAction.type); - let deviceList = deviceChangeAction.deviceDescriptors; - for (let i = 0; i < deviceList.length; i++) { - console.info('AudioManagerLog: device role: ' + deviceList[i].deviceRole); - console.info('AudioManagerLog: device type: ' + deviceList[i].deviceType); - } - if (deviceList[0].deviceType == 2) { - console.info('AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : PASS :' +deviceList[0].deviceType); - setflag = true; - console.info('AudioManagerLog: setFlag is : ' + setflag); - expect(setflag).assertTrue(); - done(); - } else { - console.info('AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : FAIL :' +deviceList[0].deviceType); - setflag = false; - console.info('AudioManagerLog: setFlag is : ' + setflag); - expect(setflag).assertTrue(); - done(); - } - }); - await audioManager.setDeviceActive(audio.DeviceType.SPEAKER,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_ENUM_038 - * @tc.name : setDeviceActive - SPEAKER - * @tc.desc : Listner on speaker active - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_ON_setDeviceActive_SPEAKER_ENUM_038', 0, async function (done) { - audioManager.setDeviceActive(2,false).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactive'); - }); - audioManager.on('deviceChange', (deviceChangeAction) => { - console.info('AudioManagerLog: device connected: ' + deviceChangeAction.type); - let deviceList = deviceChangeAction.deviceDescriptors; - for (let i = 0; i < deviceList.length; i++) { - console.info('AudioManagerLog: device role: ' + deviceList[i].deviceRole); - console.info('AudioManagerLog: device type: ' + deviceList[i].deviceType); - } - if (deviceList[0].deviceType == 2) { - console.info('AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : PASS :' +deviceList[0].deviceType); - expect(true).assertTrue(); - done(); - } else { - console.info('AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : FAIL :' +deviceList[0].deviceType); - expect(false).assertTrue(); - done(); - } - }); - await audioManager.setDeviceActive(2,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_BLUETOOTH_SCO_039 - * @tc.name : setDeviceActive - BLUETOOTH_SCO - * @tc.desc : Listner on speaker active - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_ON_setDeviceActive_BLUETOOTH_SCO_039', 0, async function (done) { - audioManager.on('deviceChange', (deviceChangeAction) => { - console.info('AudioManagerLog: device connected: ' + deviceChangeAction.type); - let deviceList = deviceChangeAction.deviceDescriptors; - for (let i = 0; i < deviceList.length; i++) { - console.info('AudioManagerLog: device role: ' + deviceList[i].deviceRole); - console.info('AudioManagerLog: device type: ' + deviceList[i].deviceType); - } - if (deviceList[0].deviceType == 7) { - console.info('AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : PASS :' +deviceList[0].deviceType); - expect(true).assertTrue(); - done(); - } else { - console.info('AudioFrameworkTest: Device Test: ON : SPEAKER ACTIVE : FAIL :' +deviceList[0].deviceType); - expect(false).assertTrue(); - done(); - } - }); - await audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error: ${err.message}`); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_BLUETOOTH_SCO_ENUM_040 - * @tc.name : setDeviceActive - BLUETOOTH_SCO - * @tc.desc : Listner on speaker active - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_ON_setDeviceActive_BLUETOOTH_SCO_ENUM_040', 0, async function (done) { - audioManager.setDeviceActive(7,false).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Deactive'); - }); - audioManager.on('deviceChange', (deviceChangeAction) => { - console.info('AudioManagerLog: device connected: ' + deviceChangeAction.type); - let deviceList = deviceChangeAction.deviceDescriptors; - for (let i = 0; i < deviceList.length; i++) { - console.info('AudioManagerLog: device role: ' + deviceList[i].deviceRole); - console.info('AudioManagerLog: device type: ' + deviceList[i].deviceType); - } - if (deviceList[0].deviceType == 7) { - console.info('AudioFrameworkTest: Device Test: ON : BLUETOOTH_SCO ACTIVE : PASS :' +deviceList[0].deviceType); - expect(true).assertTrue(); - done(); - } else { - console.info('AudioFrameworkTest: Device Test: ON : BLUETOOTH_SCO ACTIVE : FAIL :' +deviceList[0].deviceType); - expect(false).assertTrue(); - done(); - } - }); - await audioManager.setDeviceActive(7,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Activate: Error: ${err.message}`); - }); - done(); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_WIRED_HEADSET_041 - * @tc.name : setDeviceActive - WIRED_HEADSET - * @tc.desc : Listner on WIRED_HEADSET active - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_ON_setDeviceActive_WIRED_HEADSET_ENUM_041', 0, async function (done) { - audioManager.on('deviceChange', (deviceChangeAction) => { - console.info('AudioManagerLog: device connected: ' + deviceChangeAction.type); - let deviceList = deviceChangeAction.deviceDescriptors; - for (let i = 0; i < deviceList.length; i++) { - console.info('AudioManagerLog: device role: ' + deviceList[i].deviceRole); - console.info('AudioManagerLog: device type: ' + deviceList[i].deviceType); - } - if (deviceList[0].deviceType == 3) { - console.info('AudioFrameworkTest: Device Test: ON : WIRED_HEADSET ACTIVE : PASS :' +deviceList[0].deviceType); - expect(true).assertTrue(); - done(); - } else { - console.info('AudioFrameworkTest: Device Test: ON : WIRED_HEADSET ACTIVE : FAIL :' +deviceList[0].deviceType); - expect(false).assertTrue(); - done(); - } - }); - await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error: ${err.message}`); - }); - done(); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_WIRED_HEADSET_ENUM_042 - * @tc.name : setDeviceActive - WIRED_HEADSET - * @tc.desc : Listner on WIRED_HEADSET active - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_ON_setDeviceActive_WIRED_HEADSET_ENUM_042', 0, async function (done) { - let setflag; - audioManager.setDeviceActive(3,false).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : WIRED_HEADSET: Deactive'); - }); - audioManager.on('deviceChange', (deviceChangeAction) => { - console.info('AudioManagerLog: device connected: ' + deviceChangeAction.type); - let deviceList = deviceChangeAction.deviceDescriptors; - for (let i = 0; i < deviceList.length; i++) { - console.info('AudioManagerLog: device role: ' + deviceList[i].deviceRole); - console.info('AudioManagerLog: device type: ' + deviceList[i].deviceType); - } - if (deviceList[0].deviceType == 3) { - console.info('AudioFrameworkTest: Device Test: ON : WIRED_HEADSET ACTIVE : PASS :' +deviceList[0].deviceType); - setflag = true; - console.info('AudioManagerLog: device type: setFlag is ' + setflag); - expect(setflag).assertTrue(); - done(); - } else { - console.info('AudioFrameworkTest: Device Test: ON : WIRED_HEADSET ACTIVE : FAIL :' +deviceList[0].deviceType); - setflag = false; - console.info('AudioManagerLog: device type: setFlag is ' + setflag); - expect(false).assertTrue(); - done(); - } - }); - await audioManager.setDeviceActive(3,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error: ${err.message}`); - }); - done(); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_ON_setDeviceActive_Combination1_043 - * @tc.name : setDeviceActive - WIRED_HEADSET - * @tc.desc : Listner on WIRED_HEADSET active - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_ON_setDeviceActive_Combination1_043', 0, async function (done) { - var setFalg ; - await audioManager.on('deviceChange', (deviceChangeAction) => { - console.info('AudioManagerLog: ON device connected: ' + deviceChangeAction.type); - let deviceList = deviceChangeAction.deviceDescriptors; - for (let i = 0; i < deviceList.length; i++) { - console.info('AudioManagerLog: device role: ' + deviceList[i].deviceRole); - console.info('AudioManagerLog: device type: ' + deviceList[i].deviceType); - } - }); - await sleep(1000); - await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate: Error: ${err.message}`); - }); - await sleep(5000); - await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Activate: Error: ${err.message}`); - }); - await sleep(5000); - await audioManager.setDeviceActive(audio.ActiveDeviceType.WIRED_HEADSET,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Active Again'); - }).catch((err) => { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : WIRED_HEADSET: Activate Again: Error: ${err.message}`); - }); - await sleep(5000); - await audioManager.isDeviceActive(3).then(function (value){ - setFalg = value; - if(value == true){ - if (setFalg == true){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : PASS :' +value); - console.info('AudioFrameworkTest: Device Test: after asseert'); - } - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : WIRED_HEADSET: Activate : FAIL :' +value); - } - }); - console.info('AudioFrameworkTest: Device Test: after COMPLETE'); - await sleep(1000); - expect(setFalg).assertTrue(); - done(); - }) - /* * * @tc.number : SUB_AUDIO_MANAGER_DeviceType_001 * @tc.name : DeviceType - INVALID