From c116858bc6f888e6449cce69f796915a8aa09a53 Mon Sep 17 00:00:00 2001 From: q00313334 Date: Tue, 21 Jun 2022 16:12:12 +0800 Subject: [PATCH] quanli1@huawei.com Signed-off-by: q00313334 --- .../main/js/default/test/BluetoothBle.test.js | 29 ++++-------- .../js/default/test/BluetoothA2dp.test.js | 19 ++++++++ .../main/js/default/test/Bluetooth.test.js | 26 +++++++++-- .../main/js/default/test/GeocoderTest.test.js | 46 ++++++++++++++++++- 4 files changed, 96 insertions(+), 24 deletions(-) diff --git a/communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js b/communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js index 394dc448c..e75641be0 100644 --- a/communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js +++ b/communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js @@ -41,7 +41,7 @@ let MajorClass = { } -describe('bluetoothhostTest_ble1', function() { +describe('bluetoothhostTest', function() { let gattServer = null; let gattClient = null; @@ -685,7 +685,7 @@ describe('bluetoothhostTest_ble1', function() { desValue[0] = 11; let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; descriptors[0] = descriptor; let characteristics = []; @@ -700,27 +700,15 @@ describe('bluetoothhostTest_ble1', function() { isPrimary: true, characteristics: characteristics, includeServices: []}; let ret = gattServer.addService(service); console.info('[bluetooth_js] bluetooth addService ret : ' + ret); - expect(ret).assertEqual(false); + expect(ret).assertTrue(); + await sleep(3500); + let ret1=gattServer.removeService('00001810-0000-1000-8000-00805F9B34FB'); + console.info('[bluetooth_js]removeService ret:'+ret1); + expect(ret1).assertTrue(); done(); }) - /** - * @tc.number SUB_COMMUNACATION_bluetooth_GATT_REMOVE_SERVICE_0001 - * @tc.name testRemoveService - * @tc.desc Test RemoveService api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetooth_GATT_REMOVE_SERVICE_0001', 0, async function (done) { - console.info('[bluetooth_js] removeService start'); - await tryToEnableBt(); - let gattServer = bluetooth.BLE.createGattServer(); - let ret = gattServer.removeService('00001810-0000-1000-8000-008000000000'); - console.info('[bluetooth_js] removeService ret : ' + ret); - expect(ret).assertEqual(false); - done(); - }) + /** * @tc.number SUB_COMMUNACATION_bluetooth_GATT_NOTIFY_CHARA_CHANGED_0001 @@ -853,3 +841,4 @@ describe('bluetoothhostTest_ble1', function() { }) + diff --git a/communication/bluetooth_profile/src/main/js/default/test/BluetoothA2dp.test.js b/communication/bluetooth_profile/src/main/js/default/test/BluetoothA2dp.test.js index e3c4715b0..43e27dd6f 100644 --- a/communication/bluetooth_profile/src/main/js/default/test/BluetoothA2dp.test.js +++ b/communication/bluetooth_profile/src/main/js/default/test/BluetoothA2dp.test.js @@ -162,6 +162,25 @@ describe('bluetoothhostTest_host1', function () { }) + /** + * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_GET_PROFILE_STATE_0001 + * @tc.name testgetProfileState + * @tc.desc Test getProfileState api. + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_GET_PROFILE_STATE_0001', 0, async function (done) { + console.info('[bluetooth_js] a2dpSourceProfile getProfileState start'); + await tryToEnableBt(); + let state = bluetooth.getProfileConnState(bluetooth.ProfileId.PROFILE_A2DP_SOURCE); + console.info('[bluetooth_js] a2dpSourceProfile state is:' + state); + expect(state).assertEqual(0); + await sleep(1000); + done(); + }) + + + /** * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_SOURCCE_PROFILE_ON_0001 * @tc.name testa2dpSourceProfileon diff --git a/communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js b/communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js index 349f6a239..86b560023 100644 --- a/communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js +++ b/communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js @@ -333,12 +333,13 @@ describe('bluetoothhostTest_standard1', function() { it('SUB_COMMUNACATION_bluetooth_SPP_CLOSE_SERVER_SOCKET_0001', 0, async function (done) { console.log("[bluetooth_js] spp closeServerSocket start"); await tryToEnableBt(); - let ret = bluetooth.sppCloseServerSocket(-1); - console.info('[bluetooth_js] bluetooth sppCloseServerSocket ret : ' + ret); - expect(ret).assertEqual(false); + setTimeout(async ()=>{ + bluetooth.sppCloseServerSocket(-1); + },3000); done(); }) + /** * @tc.number SUB_COMMUNACATION_bluetooth_SPP_CONNECT_0001 * @tc.name testSppConnect @@ -383,6 +384,25 @@ describe('bluetoothhostTest_standard1', function() { done(); }) + + /** + * @tc.number SUB_COMMUNACATION_bluetooth_SPP_CLOSE_CLIENT_SOCKET_0001 + * @tc.name testSppCloseClientSocket + * @tc.desc Test SppCloseClientSocket api. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNACATION_bluetooth_SPP_CLOSE_CLIENT_SOCKET_0001', 0, async function (done) { + console.log("[bluetooth_js] spp closeClientSocket start"); + await tryToEnableBt(); + setTimeout(async ()=>{ + bluetooth.sppCloseClientSocket(-1); + },3000); + done(); + }) + + /** * @tc.number SUB_COMMUNACATION_bluetooth_GET_REMO_DEV_NAME_0001 * @tc.name testGetRemoteDeviceName diff --git a/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js b/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js index fea6e4ae4..d9ab27916 100644 --- a/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js +++ b/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js @@ -44,7 +44,10 @@ async function changedLocationMode(){ expect().assertFail(); }); } - }) + }); + await geolocation.isLocationEnabled().then(async(result) => { + console.info('[lbs_js] check LocationSwitchStatu result: ' + result); + }); } async function applyPermission() { @@ -1607,8 +1610,49 @@ describe('geolocationTest_geo1', function () { done(); }) + /** + * @tc.number SendCommand + * @tc.name SUB_HSS_Location_SendCommand_callback + * @tc.desc Test sendCommand api . + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_HSS_Location_SendCommand_callback', 0, async function (done) { + let requestInfo = {"scenario":0x301,"command":"command_1"}; + geolocation.sendCommand(requestInfo,(err,result) =>{ + if(err){ + return console.info("[lbs_js] sendCommand callback err" + err); + } + console.info('[LBS_js] sendCommand callback result:' + result) + }) + done(); + }) + + /** + * @tc.number SendCommand + * @tc.name SUB_HSS_Location_SendCommand_promise + * @tc.desc Test sendCommand api . + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_HSS_Location_SendCommand_promise', 0, async function (done) { + let requestInfo = {"scenario":0x301,"command":"command_1"}; + geolocation.sendCommand(requestInfo).then((result) =>{ + console.info('[LBS_js] sendCommand promise result:' + result); + done(); + }).catch(error =>{ + console.info("[lbs_js] sendCommand promise err:" + err); + expect.assertFail(); + done(); + }) + }) + + }) + -- GitLab