未验证 提交 336f2bc7 编写于 作者: O openharmony_ci 提交者: Gitee

!3536 【location-biuetooth】新增location用例+Bluetooth用例

Merge pull request !3536 from 权力/myfeature
......@@ -298,6 +298,30 @@ describe('bluetoothhostTest', function() {
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GET_DEVICE_NAME_CALLBACK_0001
* @tc.name testGetDeviceName
* @tc.desc Test GetDeviceName api by callback.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNACATION_bluetooth_GET_DEVICE_NAME_CALLBACK_0001', 0, async function (done) {
console.info('[bluetooth_js] BLE get device name callback start');
await tryToEnableBt();
let promise = new Promise((resolve) => {
let gattClient = bluetooth.BLE.createGattClientDevice("00:00:00:00:00:00");
gattClient.getDeviceName((err, data)=> {
console.info('[bluetooth_js] device name' + JSON.stringify(data))
expect(data).assertNull();
done();
})
resolve()
})
await promise.then(done)
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_GETSERVICES_CALLBACK_0001
* @tc.name testGetServices
......@@ -363,7 +387,7 @@ describe('bluetoothhostTest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNACATION_bluetooth_GATT_READ_CHARA_VALUE_0001', 0, async function (done) {
console.info('[bluetooth_js] readCharacteristicValue start');
console.info('[bluetooth_js] readCharacteristicValue promise start');
await tryToEnableBt();
let promise = new Promise((resolve) => {
let descriptors = [];
......@@ -384,12 +408,12 @@ describe('bluetoothhostTest', function() {
if (object != null) {
expect(true).assertEqual(true);
} else {
console.info('[bluetooth_js] readCharacValue data:' + JSON.stringify(data));
console.info('[bluetooth_js] readCharacValue promise data:' + JSON.stringify(data));
expect(null).assertFail();
}
done();
}).catch(err => {
console.error(`bluetooth readCharacteristicValue has error: ${err}`);
console.error(`bluetooth readCharacteristicValue promise has error: ${err}`);
expect(true).assertEqual(true);
done();
});
......@@ -399,6 +423,53 @@ describe('bluetoothhostTest', function() {
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_READ_CHARA_VALUE_0002
* @tc.name testReadCharacteristicValue
* @tc.desc Test ReadCharacteristicValue api by callback.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNACATION_bluetooth_GATT_READ_CHARA_VALUE_0002', 0, async function (done) {
console.info('[bluetooth_js] readCharacteristicValue callback start');
await tryToEnableBt();
let promise = new Promise((resolve) => {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let desValue = new Uint8Array(arrayBuffer);
desValue[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
descriptors[0] = descriptor;
let arrayBufferCCC = new ArrayBuffer(8);
let cccValue = new Uint8Array(arrayBufferCCC);
cccValue[0] = 32;
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,(err, data)=> {
if (err) {
console.error(`bluetooth readCharacteristicValue callback has error: ${err}`);
expect(true).assertEqual(true);
done();
return;
}
if (object != null) {
expect(true).assertEqual(true);
} else {
console.info('[bluetooth_js] readCharacValue callback data:' + JSON.stringify(data));
expect(null).assertFail();
}
done();
})
resolve()
})
await promise.then(done)
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_READ_DESCRI_VALUE_0001
* @tc.name testReadDescriptorValue
......@@ -408,7 +479,7 @@ describe('bluetoothhostTest', function() {
* @tc.level Level 2
*/
it('SUB_COMMUNACATION_bluetooth_GATT_READ_DESCRI_VALUE_0001', 0, async function (done) {
console.info('[bluetooth_js] readDescriptorValue start');
console.info('[bluetooth_js] readDescriptorValue promise start');
await tryToEnableBt();
let promise = new Promise((resolve) => {
let arrayBuffer = new ArrayBuffer(8);
......@@ -421,12 +492,12 @@ describe('bluetoothhostTest', function() {
if (object != null) {
expect(true).assertEqual(true);
} else {
console.info('[bluetooth_js] BLEDescriptor data:' + JSON.stringify(object));
console.info('[bluetooth_js] BLEDescriptor promise data:' + JSON.stringify(object));
expect(null).assertFail();
}
done();
}).catch(err => {
console.error(`bluetooth readDescriptorValue has error: ${err}`);
console.error(`bluetooth readDescriptorValue promise has error: ${err}`);
expect(true).assertEqual(true);
done();
});
......@@ -436,6 +507,44 @@ describe('bluetoothhostTest', function() {
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_READ_DESCRI_VALUE_0002
* @tc.name testReadDescriptorValue
* @tc.desc Test ReadDescriptorValue api by callback.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNACATION_bluetooth_GATT_READ_DESCRI_VALUE_0002', 0, async function (done) {
console.info('[bluetooth_js] readDescriptorValue callback start');
await tryToEnableBt();
let promise = new Promise((resolve) => {
let arrayBuffer = new ArrayBuffer(8);
let desValue = new Uint8Array(arrayBuffer);
desValue[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
let gattClient = bluetooth.BLE.createGattClientDevice("00:00:00:00:00:00");
gattClient.readDescriptorValue(descriptor,(err, data)=> {
if (err) {
console.error(`bluetooth readDescriptorValue callback has error: ${err}`);
expect(true).assertEqual(true);
done();
return;
}
if (object != null) {
expect(true).assertEqual(true);
} else {
console.info('[bluetooth_js] BLEDescriptor callback data:' + JSON.stringify(object));
expect(null).assertFail();
}
done();
})
resolve()
})
await promise.then(done)
done();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_WRITE_CHARACT_VALUE_0001
......@@ -743,3 +852,4 @@ describe('bluetoothhostTest', function() {
})
})
......@@ -17,8 +17,6 @@ import geolocation from '@ohos.geolocation';
import { LocationEventListener } from '@ohos.geolocation';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import osaccount from '@ohos.account.osAccount'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
let LocationRequestScenario = {UNSET : 0x300 ,NAVIGATION : 0x301 ,
TRAJECTORY_TRACKING : 0x302 ,CAR_HAILING : 0x303,
......@@ -53,11 +51,7 @@ async function changedLocationMode(){
}
async function applyPermission() {
let osAccountManager = osaccount.getAccountManager();
console.info('[permission] getAccountManager call end');
let localId = await osAccountManager.getOsAccountLocalIdFromProcess();
console.info('[permission] getOsAccountLocalIdFromProcess localId' + localId);
let appInfo = await bundle.getApplicationInfo('ohos.acts.location.geolocation.function', 0, localId);
let appInfo = await bundle.getApplicationInfo('ohos.acts.location.geolocation.function', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
......@@ -1014,6 +1008,595 @@ describe('geolocationTest', function () {
done()
})
/**
* @tc.number SingleLoc_0010
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0010
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0010', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0200, "scenario": 0x0300, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0011
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0011
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0011', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0300, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0012
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0012
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0012', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0301, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0013
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0013
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0013', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0302, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0014
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0014
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0014', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0303, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0015
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0015
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0015', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0304, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0016
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0016
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0016', 0, async function(done) {
let currentLocationRequest1 = { "priority": 0x201, "scenario": 0x305, "timeoutMs": 10, "maxAccuracy": 0 };
let currentLocationRequest2= { "priority": 0x201, "scenario": 0x301, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest1,
async(err, result) => {
if (err){
console.info("getCurrentLocation callback1 err: " + err)
geolocation.getCurrentLocation(currentLocationRequest2,
async(err, result) => {
if (err){
return console.info("getCurrentLocation callback2 err: " + err)
}else{
console.info("getCurrentLocation callback, result2: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
done()
}
});
}
console.info("getCurrentLocation callback, result1: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength == 0);
});
done()
})
/**
* @tc.number SingleLoc_0017
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0017
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0017', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0202, "scenario": 0x0300, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0018
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0018
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0018', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0202, "scenario": 0x0301, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0019
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0019
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0019', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0202, "scenario": 0x0302, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0020
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0020
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0020', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0202, "scenario": 0x0303, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0021
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0021
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0021', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0202, "scenario": 0x0304, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0022
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0022
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0022', 0, async function(done) {
let currentLocationRequest1 = { "priority": 0x202, "scenario": 0x305, "timeoutMs": 10, "maxAccuracy": 0 };
let currentLocationRequest2= { "priority": 0x202, "scenario": 0x301, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest1,
async(err, result) => {
if (err){
console.info("getCurrentLocation callback1 err: " + err)
geolocation.getCurrentLocation(currentLocationRequest2,
async(err, result) => {
if (err){
return console.info("getCurrentLocation callback2 err: " + err)
}else{
console.info("getCurrentLocation callback, result2: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
done()
}
});
}
console.info("getCurrentLocation callback, result1: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength == 0);
});
done()
})
/**
* @tc.number SingleLoc_0023
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0023
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0023', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0203, "scenario": 0x0300, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0024
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0024
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0024', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0203, "scenario": 0x0302, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0025
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0025
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0025', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0203, "scenario": 0x0303, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0026
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0026
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0026', 0, async function(done) {
let currentLocationRequest = { "priority": 0x0203, "scenario": 0x0304, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest,
(err, result) => {
if (err){
return console.info("getCurrentLocation callback err: " + err)
}else{
console.info("getCurrentLocation callback, result: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
}
});
done()
})
/**
* @tc.number SingleLoc_0027
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0027
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0027', 0, async function(done) {
let currentLocationRequest1 = { "priority": 0x203, "scenario": 0x305, "timeoutMs": 10, "maxAccuracy": 0 };
let currentLocationRequest2= { "priority": 0x203, "scenario": 0x301, "timeoutMs": 10, "maxAccuracy": 0 };
geolocation.getCurrentLocation(currentLocationRequest1,
async(err, result) => {
if (err){
console.info("getCurrentLocation callback1 err: " + err)
geolocation.getCurrentLocation(currentLocationRequest2,
async(err, result) => {
if (err){
return console.info("getCurrentLocation callback2 err: " + err)
}else{
console.info("getCurrentLocation callback, result2: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength >= 0);
done()
}
});
}
console.info("getCurrentLocation callback, result1: " + JSON.stringify(result));
let resultLength = Object.keys(result).length;
expect(true).assertEqual(resultLength == 0);
});
done()
})
/**
* @tc.number LastLocation_0001
* @tc.name SUB_HSS_LocationSystem_LastLocation_0001
* @tc.desc Test getLastLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_LastLocation_0001', 0, async function (done) {
geolocation.getLastLocation(async(err, data) => {
if (err) {
console.info('[lbs_js] getLastLocation callback err is : ' + err );
}else {
console.info('[lbs_js] getLastLocation callback result: ' + data);
expect(data).assertTrue();
}
done()
})
});
/**
* @tc.number LastLocation_0002
* @tc.name SUB_HSS_LocationSystem_LastLocation_0002
* @tc.desc Test getLastLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_LastLocation_0002', 0, async function (done) {
await geolocation.getLastLocation().then((result) => {
console.info('[lbs_js] getLastLocation promise result: ' + result);
expect(result).assertTrue();
}).catch((error) => {
console.info('[lbs_js] getLastLocation promise then err: ' + result);
expect().assertFail();
});
done();
})
/**
* @tc.number SingleLoc_0028
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0028
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0028', 0, async function (done) {
let currentLocationRequest = { "priority": 0x0200, "scenario": 0x0300, "timeoutMs": 10, "maxAccuracy": 0 };
await geolocation.getCurrentLocation(currentLocationRequest).then((result) => {
console.info("[lbs_js] getCurrentLocation promise data is: " + JSON.stringify(result));
expect(true).assertEqual((JSON.stringify(result)) !=null);
}).catch((error) => {
console.info("[lbs_js] getCurrentLocation promise then error." + error);
expect().assertFail();
});
done();
})
/**
* @tc.number SingleLoc_0029
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0029
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0029', 0, async function (done) {
let currentLocationRequest = { "priority": 0x0200, "scenario": 0x0301, "timeoutMs": 10, "maxAccuracy": 0 };
await geolocation.getCurrentLocation(currentLocationRequest).then((result) => {
console.info("[lbs_js] getCurrentLocation promise result is: " + JSON.stringify(result));
expect(true).assertEqual((JSON.stringify(result)) !=null);
}).catch((error) => {
console.info("[lbs_js] getCurrentLocation promise then error." + error);
expect().assertFail();
});
done();
})
/**
* @tc.number SingleLoc_0030
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0030
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0030', 0, async function (done) {
let currentLocationRequest = { "priority": 0x0200, "scenario": 0x0302, "timeoutMs": 10, "maxAccuracy": 0 };
await geolocation.getCurrentLocation(currentLocationRequest).then((result) => {
console.info("[lbs_js] getCurrentLocation promise result is: " + JSON.stringify(result));
expect(true).assertEqual((JSON.stringify(result)) !=null);
}).catch((error) => {
console.info("[lbs_js] getCurrentLocation promise then error." + error);
expect().assertFail();
});
done();
})
/**
* @tc.number SingleLoc_0031
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0031
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0031', 0, async function (done) {
let currentLocationRequest = { "priority": 0x0200, "scenario": 0x0303, "timeoutMs": 10, "maxAccuracy": 0 };
await geolocation.getCurrentLocation(currentLocationRequest).then((result) => {
console.info("[lbs_js] getCurrentLocation promise result is: " + JSON.stringify(result));
expect(true).assertEqual((JSON.stringify(result)) !=null);
}).catch((error) => {
console.info("[lbs_js] getCurrentLocation promise then error." + error);
expect().assertFail();
});
done();
})
/**
* @tc.number SingleLoc_0032
* @tc.name SUB_HSS_LocationSystem_SingleLoc_0032
* @tc.desc Test getCurrentLocation api .
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_HSS_LocationSystem_SingleLoc_0032', 0, async function (done) {
let currentLocationRequest = { "priority": 0x0200, "scenario": 0x0304, "timeoutMs": 10, "maxAccuracy": 0 };
await geolocation.getCurrentLocation(currentLocationRequest).then((result) => {
console.info("[lbs_js] getCurrentLocation promise result is: " + JSON.stringify(result));
expect(true).assertEqual((JSON.stringify(result)) !=null);
}).catch((error) => {
console.info("[lbs_js] getCurrentLocation promise then error." + error);
expect().assertFail();
});
done();
})
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册