提交 c116858b 编写于 作者: Q q00313334

quanli1@huawei.com

Signed-off-by: Nq00313334 <quanli1@huawei.com>
上级 b4b78da5
...@@ -41,7 +41,7 @@ let MajorClass = { ...@@ -41,7 +41,7 @@ let MajorClass = {
} }
describe('bluetoothhostTest_ble1', function() { describe('bluetoothhostTest', function() {
let gattServer = null; let gattServer = null;
let gattClient = null; let gattClient = null;
...@@ -685,7 +685,7 @@ describe('bluetoothhostTest_ble1', function() { ...@@ -685,7 +685,7 @@ describe('bluetoothhostTest_ble1', function() {
desValue[0] = 11; desValue[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB',
descriptorValue: arrayBuffer}; descriptorValue: arrayBuffer};
descriptors[0] = descriptor; descriptors[0] = descriptor;
let characteristics = []; let characteristics = [];
...@@ -700,27 +700,15 @@ describe('bluetoothhostTest_ble1', function() { ...@@ -700,27 +700,15 @@ describe('bluetoothhostTest_ble1', function() {
isPrimary: true, characteristics: characteristics, includeServices: []}; isPrimary: true, characteristics: characteristics, includeServices: []};
let ret = gattServer.addService(service); let ret = gattServer.addService(service);
console.info('[bluetooth_js] bluetooth addService ret : ' + ret); 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(); 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 * @tc.number SUB_COMMUNACATION_bluetooth_GATT_NOTIFY_CHARA_CHANGED_0001
...@@ -853,3 +841,4 @@ describe('bluetoothhostTest_ble1', function() { ...@@ -853,3 +841,4 @@ describe('bluetoothhostTest_ble1', function() {
}) })
...@@ -162,6 +162,25 @@ describe('bluetoothhostTest_host1', function () { ...@@ -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.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_SOURCCE_PROFILE_ON_0001
* @tc.name testa2dpSourceProfileon * @tc.name testa2dpSourceProfileon
......
...@@ -333,12 +333,13 @@ describe('bluetoothhostTest_standard1', function() { ...@@ -333,12 +333,13 @@ describe('bluetoothhostTest_standard1', function() {
it('SUB_COMMUNACATION_bluetooth_SPP_CLOSE_SERVER_SOCKET_0001', 0, async function (done) { it('SUB_COMMUNACATION_bluetooth_SPP_CLOSE_SERVER_SOCKET_0001', 0, async function (done) {
console.log("[bluetooth_js] spp closeServerSocket start"); console.log("[bluetooth_js] spp closeServerSocket start");
await tryToEnableBt(); await tryToEnableBt();
let ret = bluetooth.sppCloseServerSocket(-1); setTimeout(async ()=>{
console.info('[bluetooth_js] bluetooth sppCloseServerSocket ret : ' + ret); bluetooth.sppCloseServerSocket(-1);
expect(ret).assertEqual(false); },3000);
done(); done();
}) })
/** /**
* @tc.number SUB_COMMUNACATION_bluetooth_SPP_CONNECT_0001 * @tc.number SUB_COMMUNACATION_bluetooth_SPP_CONNECT_0001
* @tc.name testSppConnect * @tc.name testSppConnect
...@@ -383,6 +384,25 @@ describe('bluetoothhostTest_standard1', function() { ...@@ -383,6 +384,25 @@ describe('bluetoothhostTest_standard1', function() {
done(); 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.number SUB_COMMUNACATION_bluetooth_GET_REMO_DEV_NAME_0001
* @tc.name testGetRemoteDeviceName * @tc.name testGetRemoteDeviceName
......
...@@ -44,7 +44,10 @@ async function changedLocationMode(){ ...@@ -44,7 +44,10 @@ async function changedLocationMode(){
expect().assertFail(); expect().assertFail();
}); });
} }
}) });
await geolocation.isLocationEnabled().then(async(result) => {
console.info('[lbs_js] check LocationSwitchStatu result: ' + result);
});
} }
async function applyPermission() { async function applyPermission() {
...@@ -1607,8 +1610,49 @@ describe('geolocationTest_geo1', function () { ...@@ -1607,8 +1610,49 @@ describe('geolocationTest_geo1', function () {
done(); 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();
})
})
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册