提交 10312669 编写于 作者: Q quanli

quanli1@huawei.com

Signed-off-by: Nquanli <quanli1@huawei.com>
上级 f75c4e8d
......@@ -52,7 +52,7 @@ describe('bluetoothBLETest', function() {
beforeAll(function () {
console.info('beforeAll called')
gattServer = bluetooth.BLE.createGattServer();
gattClient = bluetooth.BLE.createGattClientDevice("00:00:00:00:00:00");
gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
})
beforeEach(async function(done) {
console.info('beforeEach called')
......@@ -77,7 +77,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattConnect_0100', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.connect();
await sleep(2000);
console.info('[bluetooth_js] gattClient connect' + ret)
......@@ -120,7 +119,6 @@ describe('bluetoothBLETest', function() {
console.info('[bluetooth_js] state changed' + connectState)
expect(true).assertEqual(connectState!=null);
}
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
await gattClient.on('BLEConnectionStateChange', ConnectStateChanged);
let ret = gattClient.connect();
console.info('[bluetooth_js] gattClient connect' + ret)
......@@ -140,7 +138,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.connect();
console.info('[bluetooth_js] gattClient getrssi2 connect' + JSON.stringify(ret))
expect(ret).assertTrue();
......@@ -170,7 +167,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.connect();
console.info('[bluetooth_js] gattClient getRssi connect' + JSON.stringify(ret))
expect(ret).assertTrue();
......@@ -197,7 +193,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0100', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.connect();
console.info('[bluetooth_js] gattClient getname2 connect' + JSON.stringify(ret))
expect(ret).assertTrue();
......@@ -227,7 +222,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0200', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.connect();
console.info('[bluetooth_js] gattClient getname1 connect' + JSON.stringify(ret))
expect(ret).assertTrue();
......@@ -252,7 +246,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0100', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.connect();
console.info('[bluetooth_js]gattClient getservices1 connect' + JSON.stringify(ret))
expect(ret).assertTrue();
......@@ -280,7 +273,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0200', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.connect();
console.info('[bluetooth_js]gattClient getservices2 connect' + JSON.stringify(ret))
gattClient.getServices((code, data)=> {
......@@ -308,7 +300,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0100', 0, function () {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.setBLEMtuSize(100);
console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret);
expect(ret).assertEqual(false);
......@@ -324,7 +315,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0200', 0, function () {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.setBLEMtuSize(22);
console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret);
expect(ret).assertEqual(false);
......@@ -340,7 +330,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0300', 0, function () {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.setBLEMtuSize(21);
console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret);
expect(ret).assertEqual(false);
......@@ -356,7 +345,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0400', 0, function () {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.setBLEMtuSize(512);
console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret);
expect(ret).assertEqual(false);
......@@ -372,7 +360,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0500', 0, function () {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.setBLEMtuSize(513);
console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret);
expect(ret).assertEqual(false);
......@@ -401,7 +388,6 @@ describe('bluetoothBLETest', function() {
let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
characteristicValue: arrayBufferCCC, descriptors:descriptors};
let gattClient = bluetooth.BLE.createGattClientDevice("00:00:00:00:00:00");
gattClient.readCharacteristicValue(characteristic).then((object) => {
if (object != null) {
expect(true).assertEqual(true);
......@@ -449,7 +435,6 @@ describe('bluetoothBLETest', function() {
let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
characteristicValue: arrayBufferCCC, descriptors:descriptor};
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
await gattClient.readCharacteristicValue(characteristic,readCcc);
done()
})
......@@ -482,6 +467,7 @@ describe('bluetoothBLETest', function() {
let gattServer = bluetooth.BLE.createGattServer();
await gattServer.on("characteristicRead", ReadCharacteristicReq);
await gattServer.off("characteristicRead");
gattServer.close();
done()
})
......@@ -500,7 +486,6 @@ describe('bluetoothBLETest', function() {
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB',
descriptorValue: arrayBuffer};
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
await gattClient.readDescriptorValue(descriptor).then((object) => {
if (object != null) {
console.error('readDescriptorValue promise object:'+JSON.stringify(object));
......@@ -542,7 +527,6 @@ describe('bluetoothBLETest', function() {
desValue[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
gattClient.readDescriptorValue(descriptor,readDesc);
done()
})
......@@ -580,6 +564,7 @@ describe('bluetoothBLETest', function() {
let gattServer = bluetooth.BLE.createGattServer();
await gattServer.on("descriptorRead", ReadDescriptorReq);
await gattServer.off("descriptorRead");
gattServer.close();
done()
})
......@@ -605,7 +590,6 @@ describe('bluetoothBLETest', function() {
let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
characteristicValue: arrayBufferCCC, descriptors:descriptors};
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.writeCharacteristicValue(characteristic);
console.info('[bluetooth_js] writeCharacteristicValue ret : ' + ret);
expect(ret).assertEqual(false);
......@@ -620,7 +604,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0200', 0, function () {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.writeCharacteristicValue("123");
console.info('[bluetooth_js] invaild writeCharacteristicValue ret : ' + ret);
expect(ret).assertEqual(false);
......@@ -657,6 +640,7 @@ describe('bluetoothBLETest', function() {
let gattServer = bluetooth.BLE.createGattServer();
gattServer.on("characteristicWrite", WriteCharacteristicReq);
gattServer.off("characteristicWrite");
gattServer.close();
done()
})
......@@ -674,7 +658,6 @@ describe('bluetoothBLETest', function() {
desValue[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.writeDescriptorValue(descriptor);
console.info('[bluetooth_js] bluetooth writeDescriptorValue ret : ' + ret);
expect(ret).assertEqual(false);
......@@ -689,7 +672,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0200', 0, function () {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.writeDescriptorValue("");
console.info('[bluetooth_js] bluetooth writeDescriptorValue ret : ' + ret);
expect(ret).assertEqual(false);
......@@ -733,6 +715,7 @@ describe('bluetoothBLETest', function() {
let gattServer = bluetooth.BLE.createGattServer();
gattServer.on("descriptorWrite", WriteDescriptorReq);
gattServer.off("descriptorWrite");
gattServer.close();
done()
})
......@@ -745,7 +728,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0100', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let desValue = new Uint8Array(arrayBuffer);
......@@ -782,7 +764,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0200', 0, async function(done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let desValue = new Uint8Array(arrayBuffer);
......@@ -819,7 +800,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0300', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.setNotifyCharacteristicChanged(null, false);
console.info('[bluetooth_js] setNotifyCharacteristicChanged is null ret:' + ret);
expect(ret).assertEqual(false);
......@@ -835,7 +815,6 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0400', 0, async function (done) {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
function CharacteristicChange(CharacteristicChangeReq) {
let serviceUuid = CharacteristicChangeReq.serviceUuid;
let characteristicUuid = CharacteristicChangeReq.characteristicUuid;
......
......@@ -52,7 +52,7 @@ describe('bluetoothBLETest1', function() {
beforeAll(function () {
console.info('beforeAll called')
gattServer = bluetooth.BLE.createGattServer();
gattClient = bluetooth.BLE.createGattClientDevice("00:00:00:00:00:00");
gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
})
beforeEach(async function(done) {
console.info('beforeEach called')
......@@ -85,10 +85,7 @@ describe('bluetoothBLETest1', function() {
+'deviceId:' + deviceId + 'status:' + status);
expect(true).assertEqual(BLEConnectChangedState !=null);
}
let gattServer = bluetooth.BLE.createGattServer();
await gattServer.on("connectStateChange", Connected);
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
let ret = gattClient.connect();
await sleep(2000);
console.info('[bluetooth_js] gattClient connect' + ret)
......@@ -106,7 +103,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0100', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let service = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
isPrimary: true, includeServices: []};
let ret = gattServer.addService(service);
......@@ -129,7 +125,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0200', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -168,7 +163,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0300', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -211,7 +205,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0400', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let characteristics = [];
let arrayBufferC = new ArrayBuffer(8);
let cccV = new Uint8Array(arrayBufferC);
......@@ -242,7 +235,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0500', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -281,7 +273,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0600', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -326,7 +317,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0700', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -365,7 +355,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0800', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -404,7 +393,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0900', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -443,7 +431,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_1000', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -482,7 +469,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_1100', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -519,7 +505,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_1200', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -557,7 +542,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_RemoveService_0100', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let gattService = {serviceUuid:'00001810-0000-1000-8000-00805F9B34FB',
isPrimary: true,includeServices:[]};
let gattService1 = {serviceUuid:'00001888-0000-1000-8000-00805f9b34fb',
......@@ -569,7 +553,7 @@ describe('bluetoothBLETest1', function() {
console.info('[bluetooth_js] bluetooth addService2 result : ' + retN);
expect(retN).assertTrue();
await sleep(1000);
let ret1=gattServer.removeService('00001888-0000-1000-8000-00805f9b34fb');
let ret1=gattServer.removeService('00001810-0000-1000-8000-00805F9B34FB');
console.info('[bluetooth_js]removeService ret:'+ret1);
expect(ret1).assertTrue();
done();
......@@ -584,7 +568,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_RemoveService_0200', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let ret1=gattServer.removeService('00001800-0000-1000-8000-00805f9b3442');
console.info('[bluetooth_js]removeService ret:'+ret1);
expect(ret1).assertFalse();
......@@ -600,7 +583,6 @@ describe('bluetoothBLETest1', function() {
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_RemoveService_0300', 0, async function (done) {
let gattServer = bluetooth.BLE.createGattServer();
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -629,7 +611,7 @@ describe('bluetoothBLETest1', function() {
expect(ret1).assertTrue();
let ret2=gattServer.removeService('00001810-0000-1000-8000-00805F9B34FB');
await sleep(1000);
console.info('[bluetooth_js]removeService ret:'+ret2);
console.info('[bluetooth_js]removeService1 ret:'+ret2);
expect(ret2).assertFalse();
done();
})
......@@ -753,3 +735,4 @@ describe('bluetoothBLETest1', function() {
})
}
......@@ -75,8 +75,9 @@ describe('bluetoothhostTest2', function() {
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0100', 0, async function (done) {
let result = bluetooth.pairDevice("11:22:55:66:33:44");
await sleep(12000);
console.info("[bluetooth_js] onStartpair001 -> " + JSON.stringify(result));
expect(result).assertFalse();
expect(result).assertTrue();
done()
})
......@@ -190,7 +191,7 @@ describe('bluetoothhostTest2', function() {
console.info('[bluetooth_js] getRemoteDeviceClass ret2 :' + JSON.stringify(DeviceClass)
+ 'majorClass:' +DeviceClass.majorClass + 'majorMinorClass:'+ DeviceClass.majorMinorClass
+ 'classOfDevice:' + DeviceClass.classOfDevice);
expect(DeviceClass.majorClass).assertEqual(0);
expect(DeviceClass.majorClass).assertEqual(7936);
done();
})
......@@ -242,8 +243,9 @@ describe('bluetoothhostTest2', function() {
}
bluetooth.BLE.on('pinRequired', PinRequiredParam);
let result = bluetooth.pairDevice("11:22:55:66:33:44");
await sleep(12000);
console.info("[bluetooth_js] onStartpair007 -> " + JSON.stringify(result));
expect(result).assertFalse();
expect(result).assertTrue();
bluetooth.BLE.off('pinRequired', PinRequiredParam);
done()
})
......@@ -264,8 +266,9 @@ describe('bluetoothhostTest2', function() {
}
bluetooth.BLE.on('pinRequired', PinRequiredParam);
let result = bluetooth.pairDevice("11:22:55:66:33:44");
await sleep(12000);
console.info("[bluetooth_js] onStartpair008 -> " + JSON.stringify(result));
expect(result).assertFalse();
expect(result).assertTrue();
bluetooth.BLE.off('pinRequired', PinRequiredParam);
done()
})
......@@ -304,3 +307,4 @@ describe('bluetoothhostTest2', function() {
......@@ -96,6 +96,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0100', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.LETTERS_TEST);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_0100 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.LETTERS_TEST == getNewName);
......@@ -114,6 +115,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0200', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.CHINESES_TEST);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_0200 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.CHINESES_TEST == getNewName);
......@@ -132,6 +134,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0300', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.NUM_TEST);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_0300 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.NUM_TEST == getNewName);
......@@ -150,6 +153,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0400', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.SYMBOL_TEST);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_0400 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.SYMBOL_TEST == getNewName);
......@@ -169,6 +173,7 @@ describe('bluetoothhostTest1', function() {
let newName = 'my bluetooth';
let result = bluetooth.setLocalName(newName);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_0500 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(newName == getNewName);
......@@ -188,6 +193,7 @@ describe('bluetoothhostTest1', function() {
let newName = 'bluetooth1234ABCDEFGH';
let result = bluetooth.setLocalName(newName);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_0600 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(newName == getNewName);
......@@ -207,6 +213,7 @@ describe('bluetoothhostTest1', function() {
let newName = '蓝牙设备bluetooth';
let result = bluetooth.setLocalName(newName);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_0700 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(newName == getNewName);
......@@ -225,6 +232,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0800', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.MIXES4);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_0800 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.MIXES4 == getNewName);
......@@ -243,6 +251,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0900', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.MIXES2);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_0900 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.MIXES2 == getNewName);
......@@ -261,6 +270,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1000', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.MIXES3);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_1000 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.MIXES3 == getNewName);
......@@ -280,6 +290,7 @@ describe('bluetoothhostTest1', function() {
let newName = '蓝牙设备123';
let result = bluetooth.setLocalName(newName);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_1100 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(newName == getNewName);
......@@ -299,6 +310,7 @@ describe('bluetoothhostTest1', function() {
let newName = '蓝牙设备bluetooth12';
let result = bluetooth.setLocalName(newName);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName1200 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(newName == getNewName);
......@@ -317,6 +329,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1300', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.MIXES6);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_1300 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.MIXES6 == getNewName);
......@@ -335,6 +348,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1400', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.MIXES);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_1400 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.MIXES == getNewName);
......@@ -354,6 +368,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1500', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.MIXES5);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_1500 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.MIXES5 == getNewName);
......@@ -372,6 +387,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1600', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.NUM_TEST1);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_1600 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(Btname.NUM_TEST1 == getNewName);
......@@ -390,6 +406,7 @@ describe('bluetoothhostTest1', function() {
it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1700', 0, async function (done) {
let result = bluetooth.setLocalName(Btname.MIXES7);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_1700 NewName = '+ JSON.stringify(getNewName));
expect(false).assertEqual(Btname.MIXES7 == getNewName);
......@@ -409,6 +426,7 @@ describe('bluetoothhostTest1', function() {
let name = bluetooth.getLocalName();
let set = bluetooth.setLocalName('');
expect(set).assertFalse();
await sleep(1000);
let localName = bluetooth.getLocalName();
expect(true).assertTrue(localName==name);
console.info('[bluetooth_js] getLocalName1800=' + JSON.stringify(localName));
......@@ -431,11 +449,13 @@ describe('bluetoothhostTest1', function() {
let newName = 'bluetoothtest';
let result = bluetooth.setLocalName(newName);
expect(result).assertTrue();
await sleep(1000);
let getNewName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalName_1900 NewName = '+ JSON.stringify(getNewName));
expect(true).assertEqual(newName == getNewName);
let result1=bluetooth.setLocalName(localName);
expect(result1).assertTrue();
await sleep(1000);
let getLocalName = bluetooth.getLocalName();
console.info('[bluetooth_js] LocalNam1900 localName ='+ JSON.stringify(getLocalName));
expect(true).assertEqual(localName == getLocalName);
......@@ -446,3 +466,4 @@ describe('bluetoothhostTest1', function() {
}
......@@ -13,6 +13,7 @@
* limitations under the License.
*/
import geolocation from '@ohos.geolocation';
import geolocationm from '@ohos.geoLocationManager';
import geolocations from '@system.geolocation';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
......@@ -97,7 +98,7 @@ describe('geolocationTest_4', function () {
* @tc.level since 9
*/
it('SUB_HSS_LocationSystem_CountryCode_0100', 0, async function (done) {
await geolocation.getCountryCode().then((result) => {
await geolocationm.getCountryCode().then((result) => {
console.info("[lbs_js] getCountryCode promise result: " + JSON.stringify(result));
console.info("[lbs_js] country :" + result.country);
console.info("[lbs_js] type: " + result.type);
......@@ -122,7 +123,7 @@ describe('geolocationTest_4', function () {
it('SUB_HSS_LocationSystem_CountryCode_0200', 0, async function (done) {
function getCountryCodeCallback() {
return new Promise((resolve, reject) => {
geolocation.getCountryCode((err,data) => {
geolocationm.getCountryCode((err,data) => {
if (err) {
return console.info("getCountryCode callback err: " + JSON.stringify(err));
} else {
......@@ -146,17 +147,17 @@ describe('geolocationTest_4', function () {
*/
it('SUB_HSS_LocationSystem_CountryCode_0300', 0, async function (done) {
console.info("[lbs_js]countryCodeChange");
geolocation.on('countryCodeChange', function (data) {
geolocationm.on('countryCodeChange', function (data) {
console.info('[lbs_js] countryCodeChange' +JSON.stringify(data) );
});
await geolocation.getCountryCode().then((result) => {
await geolocationm.getCountryCode().then((result) => {
console.info("[lbs_js] getCountryCode promise result: " + JSON.stringify(result));
expect(true).assertTrue(JSON.stringify(result)!=null);
}).catch((error) => {
console.info("[lbs_js] getCountryCode promise then error." + JSON.stringify(error));
expect().assertFail();
});
geolocation.off('countryCodeChange', function (data) {
geolocationm.off('countryCodeChange', function (data) {
console.info('[lbs_js] countryCodeChange' + JSON.stringify(data));
done();
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册