提交 2bf10229 编写于 作者: Q quanli

quanli1@huawei.com

Signed-off-by: Nquanli <quanli1@huawei.com>
上级 5b633153
......@@ -16,12 +16,13 @@ group("communication") {
testonly = true
if (is_standard_system) {
deps = [
"bluetooth_ble:ActsBluetoothBleJsTest",
"bluetooth_manager:ActsBluetoothBleJs1Test",
"bluetooth_on:ActsBluetoothOnJsTest",
"bluetooth_gatt:ActsBluetoothGattJsTest",
"bluetooth_profile:ActsBluetoothProFileJsTest",
"bluetooth_scanpairing:ActsBluetoothScanPairingJsTest",
"bluetooth_standard:ActsBluetoothJsTest",
"bluetooth_switchoff:ActsBluetoothSwitchTest",
"btmanager_errorcode202:ActsBtManagerErrorCode202JsTest",
"btmanager_errorcode401:ActsBtManagerErrorCode401JsTest",
"btmanager_switchoff:ActsBtManagerSwitchOff003JsTest",
"dsoftbus/rpc:ActsRpcJsTest",
"dsoftbus/rpc_request:ActsRpcRequestJsTest",
"nfc_Controller:ActsNFCJSTest",
......
......@@ -12,7 +12,7 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBluetoothBleJsTest") {
ohos_js_hap_suite("ActsBluetoothGattJsTest") {
hap_profile = "./src/main/config.json"
deps = [
":bluetooth_js_assets",
......@@ -20,7 +20,7 @@ ohos_js_hap_suite("ActsBluetoothBleJsTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBluetoothBleHapTest"
hap_name = "ActsBluetoothGattHapTest"
part_name = "bluetooth"
subsystem_name = "communication"
}
......
......@@ -11,7 +11,7 @@
"kits": [
{
"test-file-name": [
"ActsBluetoothOnHapTest.hap"
"ActsBluetoothGattHapTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......@@ -23,4 +23,4 @@
]
}
]
}
}
\ No newline at end of file
......@@ -129,6 +129,10 @@
],
"when": "inuse"
}
},
{
"name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason": ""
}
],
"testRunner": {
......
......@@ -18,8 +18,8 @@ import bluetooth from '@ohos.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothBLETest2() {
describe('bluetoothBLETest2', function() {
export default function btGattAdvertTest() {
describe('btGattAdvertTest', function() {
let gattServer = null;
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
......@@ -68,15 +68,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0100
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0100', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -124,15 +122,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0200
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0200', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -180,15 +176,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0300
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0300', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -236,15 +230,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0400
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0400
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0400', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0400', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -292,15 +284,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0500
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0500
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0500', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0500', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -348,15 +338,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0800
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0800
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0800', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0800', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -404,15 +392,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0900
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0900
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0900', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_0900', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -460,15 +446,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1000
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1000
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1000', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1000', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -516,15 +500,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1100
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1100', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -572,15 +554,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1200
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1200', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -628,15 +608,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1400
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1400
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1400', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1400', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -657,7 +635,7 @@ describe('bluetoothBLETest2', function() {
manufactureData:[{
manufactureId:4567,
manufactureValue:manufactureValueBuffer.buffer
}],
}],
serviceData:[{
serviceUuid:"00001888-0000-1000-8000-00805f9b34fb",
serviceValue:serviceValueBuffer.buffer
......@@ -684,15 +662,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1500
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1500
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1500', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1500', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -740,15 +716,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1600
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1600
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1600', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1600', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -796,15 +770,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1800
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1800
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1800', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1800', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -852,15 +824,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1900
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1900
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1900', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_1900', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -903,15 +873,13 @@ describe('bluetoothBLETest2', function() {
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_2100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_2100
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_2100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_2100', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -953,15 +921,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_StartAdvertise_0400
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_2200
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_StartAdvertise_0400', 0, function () {
it('SUB_COMMUNICATION_BLUETOOTH_GATTADVERT_2200', 0, function () {
let isRet = true;
try{
gattServer.stopAdvertising();
......@@ -975,5 +941,4 @@ describe('bluetoothBLETest2', function() {
})
}
}
\ No newline at end of file
......@@ -16,8 +16,8 @@
import bluetooth from '@ohos.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothBLETest1() {
describe('bluetoothBLETest1', function() {
export default function btGattServiceTest() {
describe('btGattServiceTest', function() {
let gattServer = null;
let gattClient = null;
......@@ -69,15 +69,13 @@ describe('bluetoothBLETest1', function() {
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTSERCONNECT_0100
* @tc.name test Server connectStateChange
* @tc.desc Test on and off api .
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_GATTSERCONNECT_0100', 0, async function (done) {
function Connected(BLEConnectChangedState) {
let deviceId = BLEConnectChangedState.deviceId;
let status = BLEConnectChangedState.state;
......@@ -95,14 +93,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0100
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0100', 0, async function (done) {
let service = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
isPrimary: true, includeServices: []};
let ret = gattServer.addService(service);
......@@ -117,14 +114,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0200
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0200', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -155,14 +151,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0300
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0300', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -197,14 +192,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0400
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0400
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0400', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0400', 0, async function (done) {
let characteristics = [];
let arrayBufferC = new ArrayBuffer(8);
let cccV = new Uint8Array(arrayBufferC);
......@@ -227,14 +221,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0500
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0500
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0500', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0500', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -265,14 +258,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0600
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0600
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0600', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0600', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -309,14 +301,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0700
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0700
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0700', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0700', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -347,14 +338,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0800
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0800
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0800', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0800', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -385,14 +375,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0900
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0900
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0900', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_0900', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -423,14 +412,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_1000
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_1000
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_1000', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_1000', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -461,14 +449,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_1100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_1100
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_1100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_1100', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -497,14 +484,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_1200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_1200
* @tc.name testAddService
* @tc.desc Test AddService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_1200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ADDSERVICE_1200', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -534,14 +520,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_RemoveService_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_REMOVESERVICE_0100
* @tc.name testRemoveService
* @tc.desc Test RemoveService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_RemoveService_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_REMOVESERVICE_0100', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -576,14 +561,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_RemoveService_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_REMOVESERVICE_0200
* @tc.name testRemoveService
* @tc.desc Test RemoveService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_RemoveService_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_REMOVESERVICE_0200', 0, async function (done) {
let ret1=gattServer.removeService('00001800-0000-1000-8000-00805f9b3442');
console.info('[bluetooth_js]removeService ret:'+ret1);
expect(ret1).assertFalse();
......@@ -591,14 +575,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_RemoveService_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_REMOVESERVICE_0300
* @tc.name testRemoveService
* @tc.desc Test RemoveService api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_RemoveService_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_REMOVESERVICE_0300', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -633,14 +616,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_NOTIFYCHARACTERISTIC_0100
* @tc.name testNotifyCharacteristicChanged
* @tc.desc Test NotifyCharacteristicChanged api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_NOTIFYCHARACTERISTIC_0100', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -663,14 +645,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_NOTIFYCHARACTERISTIC_0200
* @tc.name testNotifyCharacteristicChanged
* @tc.desc Test NotifyCharacteristicChanged api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_NOTIFYCHARACTERISTIC_0200', 0, async function (done) {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
let descV = new Uint8Array(arrayBuffer);
......@@ -693,14 +674,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_NOTIFYCHARACTERISTIC_0300
* @tc.name testNotifyCharacteristicChanged
* @tc.desc Test NotifyCharacteristicChanged api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_NOTIFYCHARACTERISTIC_0300', 0, async function (done) {
console.info('[bluetooth_js] SUB_COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0200');
let ret = gattServer.notifyCharacteristicChanged('00:11:22:33:44:55', null);
console.info('[bluetooth_js] notifyCharacteristicChanged ret : ' + ret);
......@@ -709,14 +689,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SENDRESPONSE_0100
* @tc.name testSendResponse success
* @tc.desc Test SendResponse api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SENDRESPONSE_0100', 0, async function (done) {
let arrayBuffer = new ArrayBuffer(8);
let value = new Uint8Array(arrayBuffer);
value[0] = 1;
......@@ -729,14 +708,13 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SENDRESPONSE_0200
* @tc.name testSendResponse success
* @tc.desc Test SendResponse api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SENDRESPONSE_0200', 0, async function (done) {
let arrayBuffer = new ArrayBuffer(8);
let value = new Uint8Array(arrayBuffer);
value[0] = 1;
......@@ -749,6 +727,4 @@ describe('bluetoothBLETest1', function() {
})
})
}
}
\ No newline at end of file
......@@ -18,8 +18,8 @@ import bluetooth from '@ohos.bluetoothManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothBLETest2() {
describe('bluetoothBLETest2', function() {
export default function btManagerGattAdvertTest() {
describe('btManagerGattAdvertTest', function() {
let gattServer = null;
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
......@@ -70,15 +70,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0100
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0100
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 0
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0100', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -128,15 +126,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0200
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0200
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0200', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -186,15 +182,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0300
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0300
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0300', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -244,15 +238,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0400
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0400
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0400', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0400', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -302,15 +294,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0500
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0500
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0500', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0500', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -360,15 +350,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0800
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0800
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0800', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0800', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -416,15 +404,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0900
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0900
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0900', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_0900', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -474,15 +460,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1000
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1000
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1000', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1000', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -530,15 +514,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1100
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1100
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1100', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -588,15 +570,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1200
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1200
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1200', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1200', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -646,15 +626,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1400
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1400
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1400', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1400', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -702,15 +680,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1500
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1500
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1500', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1500', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -760,15 +736,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1800
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1800
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1800', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1800', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -818,15 +792,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1900
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1900
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1900', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_1900', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -871,15 +843,13 @@ describe('bluetoothBLETest2', function() {
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_2100
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_2100
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_2100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_2100', 0, async function (done) {
let manufactureValueBuffer = new Uint8Array(4);
manufactureValueBuffer[0] = 1;
manufactureValueBuffer[1] = 2;
......@@ -923,15 +893,13 @@ describe('bluetoothBLETest2', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_StartAdvertise_0400
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_2200
* @tc.name testStartAdvertising
* @tc.desc Test StartAdvertising api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_StartAdvertise_0400', 0, function () {
it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_2200', 0, function () {
let isRet = true;
try{
gattServer.stopAdvertising();
......
......@@ -16,8 +16,8 @@
import bluetooth from '@ohos.bluetoothManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothBLETest() {
describe('bluetoothBLETest', function() {
export default function btManagerGattManagerTest() {
describe('btManagerGattManagerTest', function() {
let gattServer = null;
let gattClient = null;
function sleep(delay) {
......@@ -69,15 +69,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_GattConnect_0100
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTCONNECT_0100
* @tc.name test gatt connect and disconnect
* @tc.desc Test api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_GattConnect_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTCONNECT_0100', 0, async function (done) {
try {
gattClient.connect();
await sleep(2000);
......@@ -92,15 +90,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Connect_0200
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTCONNECT_0200
* @tc.name testGetConnectedBLEDevices
* @tc.desc Test api 201 - Permission denied.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_GattConnect_0200', 0, function () {
it('SUB_COMMUNICATION_BTMANAGER_GATTCONNECT_0200', 0, function () {
try {
let result = bluetooth.BLE.getConnectedBLEDevices();
console.info("[bluetooth_js] getConnDev:" + JSON.stringify(result)
......@@ -114,15 +110,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Connect_0300
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTCONNECT_0300
* test Client BLEconnectStateChange
* @tc.desc Test on and off api
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_GattConnect_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTCONNECT_0300', 0, async function (done) {
try {
function ConnectStateChanged(state) {
console.log('bluetooth connect state changed');
......@@ -145,15 +139,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100
* @tc.number SUB_COMMUNICATION_BTMANAGER_GETRSSIVALUE_0100
* @tc.name testgetRssiValue
* @tc.desc Test getRssiValue api by promise.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GETRSSIVALUE_0100', 0, async function (done) {
try {
await gattClient.getRssiValue().then((data) => {
console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data));
......@@ -180,15 +172,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200
* @tc.number SUB_COMMUNICATION_BTMANAGER_GETRSSIVALUE_0200
* @tc.name testgetRssiValue
* @tc.desc Test testGetDeviceName api by callback.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GETRSSIVALUE_0200', 0, async function (done) {
try {
function getRssi() {
return new Promise((resolve,reject) => {
......@@ -222,15 +212,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0100
* @tc.number SUB_COMMUNICATION_BTMANAGER_GETDEVICENAME_0100
* @tc.name testGetDeviceName
* @tc.desc Test GetDeviceName api by promise.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GETDEVICENAME_0100', 0, async function (done) {
await sleep(5000)
try {
await gattClient.getDeviceName().then((data) => {
......@@ -251,15 +239,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_getDeviceName_0200
* @tc.number SUB_COMMUNICATION_BTMANAGER_GETDEVICENAME_0200
* @tc.name testGetDeviceName
* @tc.desc Test testGetDeviceName api by callback.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GETDEVICENAME_0200', 0, async function (done) {
try {
gattClient.getDeviceName((err, data)=> {
if (err) {
......@@ -279,15 +265,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_GetService_0100
* @tc.number SUB_COMMUNICATION_BTMANAGER_GETSERVICE_0100
* @tc.name testGetServices
* @tc.desc Test GetServices api by promise.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_GetService_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GETSERVICE_0100', 0, async function (done) {
try {
await gattClient.getServices().then((GattService) => {
console.info('[bluetooth_js] getServices successfully:'+JSON.stringify(GattService));
......@@ -307,15 +291,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_GetService_0200
* @tc.number SUB_COMMUNICATION_BTMANAGER_GETSERVICE_0200
* @tc.name testGetServices
* @tc.desc Test GetServices api by callback.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_GetService_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GETSERVICE_0200', 0, async function (done) {
try {
gattClient.getServices((code, data)=> {
if(code.code==0){
......@@ -337,15 +319,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_MtuSize_0100
* @tc.number SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0100
* @tc.name testSetBLEMtuSize
* @tc.desc Test SetBLEMtuSize api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 1
*/
it('COMMUNICATION_BLUETOOTH_BLE_MtuSize_0100', 0, function () {
it('SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0100', 0, function () {
try {
gattClient.setBLEMtuSize(100);
console.info("[bluetooth_js]setBLEMtuSize success")
......@@ -358,15 +338,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_MtuSize_0200
* @tc.number SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0200
* @tc.name testSetBLEMtuSize
* @tc.desc Test SetBLEMtuSize api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_MtuSize_0200', 0, function () {
it('SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0200', 0, function () {
try {
gattClient.setBLEMtuSize(22);
console.info("[bluetooth_js]setBLEMtuSize success")
......@@ -379,15 +357,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_MtuSize_0300
* @tc.number SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0300
* @tc.name testSetBLEMtuSize
* @tc.desc Test SetBLEMtuSize api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_MtuSize_0300', 0, function () {
it('SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0300', 0, function () {
try {
gattClient.setBLEMtuSize(21);
console.info("[bluetooth_js]setBLEMtuSize success")
......@@ -400,15 +376,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_MtuSize_0400
* @tc.number SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0400
* @tc.name testSetBLEMtuSize
* @tc.desc Test SetBLEMtuSize api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_MtuSize_0400', 0, function () {
it('SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0400', 0, function () {
try {
gattClient.setBLEMtuSize(512);
console.info("[bluetooth_js]setBLEMtuSize success")
......@@ -421,15 +395,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_MtuSize_0500
* @tc.number SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0500
* @tc.name testSetBLEMtuSize
* @tc.desc Test SetBLEMtuSize api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_MtuSize_0500', 0, function () {
it('SUB_COMMUNICATION_BTMANAGER_MTUSIZE_0500', 0, function () {
try {
gattClient.setBLEMtuSize(513);
console.info("[bluetooth_js]setBLEMtuSize success")
......@@ -442,14 +414,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1900
* @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_1900
* @tc.name testReadDescriptorValue
* @tc.desc Test ReadDescriptorValue api by promise.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1900', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_1900', 0, async function (done) {
try {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
......@@ -487,14 +458,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_2000
* @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_2000
* @tc.name testReadDescriptorValue
* @tc.desc Test ReadDescriptorValue api by callback.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_2000', 0, async function(done) {
it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_2000', 0, async function(done) {
try {
function readCcc(code, BLECharacteristic) {
if (code.code != 0) {
......@@ -534,14 +504,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_2100
* @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_2100
* @tc.name test characteristicReadOn
* @tc.desc Test On and off api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_2100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_2100', 0, async function (done) {
try {
let arrayBufferCCC = new ArrayBuffer(8);
let cccValue = new Uint8Array(arrayBufferCCC);
......@@ -571,14 +540,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1300
* @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_1300
* @tc.name testReadDescriptorValue
* @tc.desc Test ReadDescriptorValue api by promise.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1300', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_1300', 0, async function (done) {
try {
let arrayBuffer = new ArrayBuffer(8);
let desValue = new Uint8Array(arrayBuffer);
......@@ -605,14 +573,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1400
* @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_1400
* @tc.name testReadDescriptorValue
* @tc.desc Test ReadDescriptorValue api by callback.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1400', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_1400', 0, async function (done) {
try {
function readDesc(code, BLEDescriptor) {
if (code.code != 0) {
......@@ -641,14 +608,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1500
* @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_1500
* @tc.name test ReadDescriptorOn
* @tc.desc Test On and Off api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1500', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_1500', 0, async function (done) {
try {
let arrayBufferCCC = new ArrayBuffer(8);
let cccValue = new Uint8Array(arrayBufferCCC);
......@@ -684,14 +650,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1900
* @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_1900
* @tc.name testWriteCharacteristicValue
* @tc.desc Test Client WriteCharacteristicValue api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1900', 0, function () {
it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_1900', 0, function () {
try {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
......@@ -719,14 +684,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_2000
* @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_2000
* @tc.name test characteristicWriteOn
* @tc.desc Test on and off api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_2000', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_2000', 0, async function (done) {
try {
let arrayBufferCCC = new ArrayBuffer(8);
let cccValue = new Uint8Array(arrayBufferCCC);
......@@ -758,14 +722,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_1100
* @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_1100
* @tc.name testWriteDescriptorValue
* @tc.desc Test Client WriteDescriptorValue api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_1100', 0, function () {
it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_1100', 0, function () {
try {
let arrayBuffer = new ArrayBuffer(8);
let desValue = new Uint8Array(arrayBuffer);
......@@ -785,14 +748,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_1200
* @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_1200
* @tc.name test WriteDescriptorOn
* @tc.desc Test on and off api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_1200', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_1200', 0, async function (done) {
try {
let arrayBufferDesc = new ArrayBuffer(8);
let descValue = new Uint8Array(arrayBufferDesc);
......@@ -830,14 +792,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1200
* @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_1200
* @tc.name testSetNotifyCharacteristicChanged
* @tc.desc Test SetNotifyCharacteristicChanged api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1200', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_1200', 0, async function (done) {
try {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
......@@ -874,14 +835,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1300
* @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_1300
* @tc.name testSetNotifyCharacteristicChanged
* @tc.desc Test SetNotifyCharacteristicChanged api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1300', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_1300', 0, async function (done) {
try {
let descriptors = [];
let arrayBuffer = new ArrayBuffer(8);
......@@ -918,14 +878,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1400
* @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_1400
* @tc.name test BLECharacteristicChangeON
* @tc.desc Test On and off api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1400', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_1400', 0, async function (done) {
try {
function CharacteristicChange(CharacteristicChangeReq) {
let serviceUuid = CharacteristicChangeReq.serviceUuid;
......@@ -962,14 +921,13 @@ describe('bluetoothBLETest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_GattClose_0100
* @tc.number SUB_COMMUNICATION_BTMANAGER_GATTCLOSE_0100
* @tc.name test gattClient close
* @tc.desc Test close api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_GattClose_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_GATTCLOSE_0100', 0, async function (done) {
try {
let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66");
gattClient.close();
......
......@@ -13,13 +13,18 @@
* limitations under the License.
*/
import bluetoothhostTest2 from './BluetoothPair.test.js'
import bluetoothhostTest4 from './bluetoothSys.test.js'
import bluetoothhostTest from './BleScanResult.test.js'
import btGattAdvertTest from './BtGattAdvertiser.test.js'
import btGattManagerTest from './BtGattManager.test.js'
import btGattServiceTest from './BtGattService.test.js'
import btManagerGattAdvertTest from './BtManagerGattAdvertiser.test.js'
import btManagerGattManagerTest from './BtManagerGattManager.test.js'
import btManagerGattServiceTest from './BtManagerGattService.test.js'
export default function testsuite() {
btGattAdvertTest()
btManagerGattServiceTest()
btGattServiceTest()
btManagerGattAdvertTest()
btManagerGattManagerTest()
btGattManagerTest()
bluetoothhostTest2()
bluetoothhostTest4()
bluetoothhostTest()
}
......@@ -20,7 +20,7 @@ ohos_js_hap_suite("ActsBluetoothProFileJsTest") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBluetoothProFileJsTest"
hap_name = "ActsBluetoothProFileHapTest"
part_name = "bluetooth"
subsystem_name = "communication"
}
......
......@@ -11,7 +11,7 @@
"kits": [
{
"test-file-name": [
"ActsBluetoothProFileJsTest.hap"
"ActsBluetoothProFileHapTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -17,8 +17,8 @@ import bluetooth from '@ohos.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothhostTest_host_1() {
describe('bluetoothhostTest_host_1', function () {
export default function btA2dpConnTest() {
describe('btA2dpConnTest', function () {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
......@@ -65,15 +65,13 @@ describe('bluetoothhostTest_host_1', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0100
* @tc.name test bluetooth Profile ConnectionState
* @tc.desc Test getBtConnectionState api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0100', 0, async function (done) {
let connState = bluetooth.getBtConnectionState();
console.info('[bluetooth_js] get bt connection state result' + JSON.stringify(connState));
expect(connState).assertEqual(bluetooth.ProfileConnectionState.STATE_DISCONNECTED);
......@@ -84,15 +82,13 @@ describe('bluetoothhostTest_host_1', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0200
* @tc.name test A2DP Connect
* @tc.desc Test connect api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0200', 0, async function (done) {
function StateChangeParam(data) {
console.info("[bluetooth_js] a2dp state " + JSON.stringify(data) +
'deviceId: ' + data.deviceId + 'state:'+ data.state);
......@@ -110,15 +106,13 @@ describe('bluetoothhostTest_host_1', function () {
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0300
* @tc.name test A2DP disconnect
* @tc.desc Test disconnect api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0300', 0, async function (done) {
function StateChangeParam(data) {
console.info("[bluetooth_js] a2dp state " + JSON.stringify(data) +
'deviceId: ' + data.deviceId + 'state:'+ data.state);
......@@ -136,15 +130,13 @@ describe('bluetoothhostTest_host_1', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0400
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0400
* @tc.name test a invaild A2DP disconnect
* @tc.desc Test disconnect api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0400', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0400', 0, async function (done) {
let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc));
let conn = a2dpSrc.disconnect('test');
......@@ -154,15 +146,13 @@ describe('bluetoothhostTest_host_1', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0500
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0500
* @tc.name test Get A2DP ConnectionState
* @tc.desc Test getProfileConnState api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0500', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0500', 0, async function (done) {
let a2dpSrcConn = bluetooth.getProfileConnState(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
console.info('[bluetooth_js]get a2dp result:' + JSON.stringify(a2dpSrcConn));
expect(a2dpSrcConn).assertEqual(bluetooth.ProfileConnectionState.STATE_DISCONNECTED);
......@@ -170,15 +160,13 @@ describe('bluetoothhostTest_host_1', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0600
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0600
* @tc.name test a invaild A2DP Connect
* @tc.desc Test connect api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0600', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0600', 0, async function (done) {
let a2dpSrc = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
let conn = a2dpSrc.connect('test');
console.info('[bluetooth_js]a2dp invaild connect:' + JSON.stringify(conn));
......@@ -187,15 +175,13 @@ describe('bluetoothhostTest_host_1', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0700
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0700
* @tc.name test getDevice A2DP State.
* @tc.desc Test getDeviceState api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0700', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0700', 0, async function (done) {
let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc));
let ret = a2dpSrc.getDeviceState('11:22:33:44:55:66');
......@@ -204,15 +190,13 @@ describe('bluetoothhostTest_host_1', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0800
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0800
* @tc.name test getDevice A2DP State.
* @tc.desc Test getDeviceState api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0800', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0800', 0, async function (done) {
let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc));
let ret = a2dpSrc.getDeviceState('test');
......@@ -221,15 +205,13 @@ describe('bluetoothhostTest_host_1', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0900
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0900
* @tc.name test get A2DP Playing State
* @tc.desc Test getPlayingState api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0900', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_0900', 0, async function (done) {
let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc));
let state = a2dpSrc.getPlayingState('11:22:33:44:55:66');
......@@ -240,15 +222,13 @@ describe('bluetoothhostTest_host_1', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_1000
* @tc.number SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_1000
* @tc.name test getDevice A2DP State.
* @tc.desc Test getDeviceState api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_1000', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_A2DPCONN_1000', 0, async function (done) {
let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc));
let retArray = a2dpSrc.getConnectionDevices();
......@@ -259,6 +239,4 @@ describe('bluetoothhostTest_host_1', function () {
})
}
}
\ No newline at end of file
......@@ -17,8 +17,8 @@ import bluetooth from '@ohos.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothhostTest_host_3() {
describe('bluetoothhostTest_host_3', function () {
export default function btHfpConnTest() {
describe('btHfpConnTest', function () {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
......@@ -65,15 +65,13 @@ describe('bluetoothhostTest_host_3', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1100
* @tc.name test Get HFP ConnectionState
* @tc.desc Test getProfileConnState api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1100', 0, async function (done) {
let hfpSrcConn =
bluetooth.getProfileConnState(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
console.info('[bluetooth_js]get hfp result:' + JSON.stringify(hfpSrcConn));
......@@ -82,15 +80,13 @@ describe('bluetoothhostTest_host_3', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1200
* @tc.name test getDevice HFP State.
* @tc.desc Test getDeviceState api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1200', 0, async function (done) {
let hfpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
let ret = hfpSrc.getDeviceState('11:22:33:44:55:66');
console.info('[bluetooth_js]hfp getDeviceState:' + JSON.stringify(ret));
......@@ -99,15 +95,13 @@ describe('bluetoothhostTest_host_3', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1300
* @tc.name test getDevice HFP State.
* @tc.desc Test getDeviceState api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1300', 0, async function (done) {
let hfpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
let ret = hfpSrc.getDeviceState('bluetooth1');
console.info('[bluetooth_js]hfp get valid mac DeviceState:' + JSON.stringify(ret));
......@@ -116,15 +110,13 @@ describe('bluetoothhostTest_host_3', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1400
* @tc.number SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1400
* @tc.name test HFP Connect
* @tc.desc Test connect api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1400', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1400', 0, async function (done) {
function StateChangeParam(data) {
console.info("[bluetooth_js] hfp state " + JSON.stringify(data) +
'deviceId: ' + data.deviceId + 'state:'+ data.state);
......@@ -141,15 +133,13 @@ describe('bluetoothhostTest_host_3', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1500
* @tc.number SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1500
* @tc.name test HFP disconnect
* @tc.desc Test disconnect api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1500', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1500', 0, async function (done) {
function StateChangeParam(data) {
console.info("[bluetooth_js] hfp state " + JSON.stringify(data) +
'deviceId: ' + data.deviceId + 'state:'+ data.state);
......@@ -166,15 +156,13 @@ describe('bluetoothhostTest_host_3', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1600
* @tc.number SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1600
* @tc.name test a invaild HFP Connect
* @tc.desc Test connect api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1600', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1600', 0, async function (done) {
let hfpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
let conn1 = hfpSrc.connect('test');
console.info('[bluetooth_js]hfp vaild MAC disconnect :' + JSON.stringify(conn1));
......@@ -183,15 +171,13 @@ describe('bluetoothhostTest_host_3', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1700
* @tc.number SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1700
* @tc.name test a invaild HFP disconnect
* @tc.desc Test disconnect api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1700', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1700', 0, async function (done) {
let hfpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
console.info('[bluetooth_js]hfp get profile result:' + JSON.stringify(hfpSrc));
let conn = hfpSrc.disconnect('test');
......@@ -201,15 +187,13 @@ describe('bluetoothhostTest_host_3', function () {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1800
* @tc.number SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1800
* @tc.name test getDevice HFP State.
* @tc.desc Test getDeviceState api.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1800', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_HFPCONN_1800', 0, async function (done) {
let hfpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
let retArray = hfpSrc.getConnectionDevices();
console.info('[bluetooth_js]hfp getConnectionDevices:' + JSON.stringify(retArray));
......@@ -220,5 +204,4 @@ describe('bluetoothhostTest_host_3', function () {
})
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bluetoothManager from '@ohos.bluetoothManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function btManagerA2dpConnTest() {
describe('btManagerA2dpConnTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
async function tryToEnableBt() {
let sta = bluetoothManager.getState();
switch (sta) {
case 0:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta1 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turn off:' + JSON.stringify(sta1));
break;
case 1:
console.info('[bluetooth_js] bt turning on:' + JSON.stringify(sta));
await sleep(3000);
break;
case 2:
console.info('[bluetooth_js] bt turn on:' + JSON.stringify(sta));
break;
case 3:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta2 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turning off:' + JSON.stringify(sta2));
break;
default:
console.info('[bluetooth_js] enable success');
}
}
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(async function (done) {
console.info('beforeEach called')
await tryToEnableBt()
done()
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_A2DPCONN_0100
* @tc.name test A2DP Connect
* @tc.desc Test connect api.
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BTMANAGER_A2DPCONN_0100', 0, async function (done) {
function onReceiveEvent(data) {
console.info('a2dp state = '+ JSON.stringify(data));
expect(true).assertEqual(data != null);
}
let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE);
a2dpSrc.on('connectionStateChange', onReceiveEvent);
a2dpSrc.off('connectionStateChange', onReceiveEvent);
done();
})
})
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bluetoothManager from '@ohos.bluetoothManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function btManagerHfpConnTest() {
describe('btManagerHfpConnTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
async function tryToEnableBt() {
let sta = bluetoothManager.getState();
switch (sta) {
case 0:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta1 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turn off:' + JSON.stringify(sta1));
break;
case 1:
console.info('[bluetooth_js] bt turning on:' + JSON.stringify(sta));
await sleep(3000);
break;
case 2:
console.info('[bluetooth_js] bt turn on:' + JSON.stringify(sta));
break;
case 3:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta2 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turning off:' + JSON.stringify(sta2));
break;
default:
console.info('[bluetooth_js] enable success');
}
}
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(async function (done) {
console.info('beforeEach called')
await tryToEnableBt()
done()
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_HFPCONN_0100
* @tc.name test HFP Connect
* @tc.desc Test connect api.
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BTMANAGER_HFPCONN_0100', 0, async function (done) {
function onReceiveEvent(data) {
console.info('hfp state = '+ JSON.stringify(data));
expect(true).assertEqual(data != null);
}
let hfpAg = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
hfpAg.on('connectionStateChange', onReceiveEvent);
hfpAg.off('connectionStateChange', onReceiveEvent);
done();
})
})
}
\ No newline at end of file
......@@ -13,9 +13,13 @@
* limitations under the License.
*/
import bluetoothhostTest_host_1 from './BluetoothHfp.test.js'
import bluetoothhostTest_host_3 from './BluetoothA2dp.test.js'
import btHfpConnTest from './BluetoothHfp.test.js'
import btA2dpConnTest from './BluetoothA2dp.test.js'
import btManagerHfpConnTest from './BtManagerHfp.test.js'
import btManagerA2dpConnTest from './BtManagerA2dp.test.js'
export default function testsuite() {
bluetoothhostTest_host_1()
bluetoothhostTest_host_3()
btHfpConnTest()
btA2dpConnTest()
btManagerHfpConnTest()
btManagerA2dpConnTest()
}
......@@ -12,7 +12,7 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBluetoothBleJs1Test") {
ohos_js_hap_suite("ActsBluetoothScanPairingJsTest") {
hap_profile = "./src/main/config.json"
deps = [
":bluetooth_js_assets",
......@@ -20,7 +20,7 @@ ohos_js_hap_suite("ActsBluetoothBleJs1Test") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBluetoothBleManagerHapTest"
hap_name = "ActsBluetoothScanPairingHapTest"
part_name = "bluetooth"
subsystem_name = "communication"
}
......
{
"description": "Configuration for bluetooth js api Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"shell-timeout": "600000",
"bundle-name": "ohos.acts.communication.bluetooth.bluetoothhost",
"package-name": "ohos.acts.communication.bluetooth.bluetoothhost",
"testcase-timeout": 70000
},
"kits": [
{
"test-file-name": [
"ActsBluetoothScanPairingHapTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"svc bluetooth enable"
]
}
]
}
......@@ -16,8 +16,8 @@
import bluetooth from '@ohos.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothhostTest() {
describe('bluetoothhostTest', function() {
export default function btBleScanTest() {
describe('btBleScanTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
......@@ -64,15 +64,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0100
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0100', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result1 '+JSON.stringify(data));
......@@ -87,15 +85,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0200
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0200', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result2'+JSON.stringify(data));
......@@ -111,15 +107,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0300
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0300', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result3'+JSON.stringify(data));
......@@ -135,15 +129,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0400
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0400
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0400', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0400', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result4'+JSON.stringify(data));
......@@ -159,15 +151,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0500
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0500
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0500', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0500', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result5'+JSON.stringify(data));
......@@ -190,15 +180,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0600
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0600
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0600', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0600', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result6'+JSON.stringify(data));
......@@ -219,15 +207,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0700
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0700
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0700', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0700', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result7'+JSON.stringify(data));
......@@ -249,15 +235,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0700
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0900
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_0900', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_0900', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result9'+JSON.stringify(data));
......@@ -280,15 +264,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1000
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1000
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1000', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1000', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result10'+JSON.stringify(data));
......@@ -311,15 +293,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1100
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1100', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result11'+JSON.stringify(data));
......@@ -342,15 +322,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1200
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1200', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result12'+JSON.stringify(data));
......@@ -373,15 +351,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1300
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1300', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLEscan device result13'+JSON.stringify(data));
......@@ -407,15 +383,13 @@ describe('bluetoothhostTest', function() {
done();
})
/* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1400
/* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1400
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1400', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1400', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLE scan device find result14'+ JSON.stringify(data));
......@@ -435,15 +409,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1500
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1500
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1500', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1500', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLE scan device find result15'+ JSON.stringify(data));
......@@ -463,15 +435,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1600
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1600
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1600', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1600', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLE scan device find result16'+ JSON.stringify(data));
......@@ -499,15 +469,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1700
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1700
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1700', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1700', 0, async function (done) {
function onReceiveEvent(data)
{
console.info('[bluetooth_js] BLE scan device find result17'+ JSON.stringify(data));
......@@ -537,15 +505,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1800
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1800
* @tc.name test gatt connect and disconnect
* @tc.desc Test connect and disconnect api .
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BLE_Scan_1800', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_BLESCAN_1800', 0, async function (done) {
async function onReceiveEvent(ScanResult)
{
console.info('[bluetooth_js] BLEscan device result12'+JSON.stringify(ScanResult)
......@@ -576,6 +542,4 @@ describe('bluetoothhostTest', function() {
done()
})
})
}
}
\ No newline at end of file
......@@ -34,8 +34,8 @@ async function grantPerm() {
console.info("tokenId" + tokenID + " result1:" + result1);
console.info("====grant Permission end====");
}
export default function bluetoothhostTest3() {
describe('bluetoothhostTest3', function() {
export default function btDiscoveryTest() {
describe('btDiscoveryTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
......@@ -85,15 +85,13 @@ describe('bluetoothhostTest3', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Discovery_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_DISCOVERY_0100
* @tc.name TEST DISCOVERY
* @tc.desc TEST DISCOVERY
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Discovery_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_DISCOVERY_0100', 0, async function (done) {
function onReceiveEvent(data){
console.info('[bluetooth_js] Device' + JSON.stringify(data)+
'length' + data.length);
......@@ -112,15 +110,13 @@ describe('bluetoothhostTest3', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Discovery_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_DISCOVERY_0300
* @tc.name TEST DISCOVERY
* @tc.desc TEST DISCOVERY api 8.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Discovery_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_DISCOVERY_0300', 0, async function (done) {
let result1 = bluetooth.setBluetoothScanMode(bluetooth.ScanMode.SCAN_MODE_CONNECTABLE,10);
expect(result1).assertTrue();
let getScanMode = bluetooth.getBluetoothScanMode();
......
......@@ -16,8 +16,8 @@
import bluetooth from '@ohos.bluetoothManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothBLETest6() {
describe('bluetoothBLETest6', function() {
export default function btManagerBleScanTest() {
describe('btManagerBleScanTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
......@@ -64,15 +64,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_0100
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_0100
* @tc.name testClassicStartBLEScan
* @tc.desc Test startBLEScan 401 - Invalid parameter.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 0
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_0100', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -94,15 +92,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_0200
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_0200
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_0200', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -124,15 +120,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_0300
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_0300
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_0300', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -154,15 +148,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_0400
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_0400
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_0400', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_0400', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -184,15 +176,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_0500
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_0500
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_0500', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_0500', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -222,15 +212,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_0600
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_0600
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_0600', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_0600', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -258,15 +246,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_0700
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_0700
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_0700', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_0700', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -296,15 +282,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_0700
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_0900
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_0900', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_0900', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -335,15 +319,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1000
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1000
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1000', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1000', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -373,15 +355,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1100
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1100
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1100', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1100', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -412,15 +392,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1200
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1200
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1200', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1200', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -450,15 +428,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1300
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1300
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1300', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1300', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -492,15 +468,13 @@ describe('bluetoothBLETest6', function() {
})
/* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1400
/* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1400
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 3
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1400', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1400', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -526,15 +500,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1500
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1500
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1500', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1500', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -562,15 +534,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1600
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1600
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1600', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1600', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -606,15 +576,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1700
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1700
* @tc.name testClassicStartBLEScan
* @tc.desc Test ClassicStartBLEScan api.
* @tc.size MEDIUM
* @ since 9
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1700', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1700', 0, async function (done) {
try {
function onReceiveEvent(data)
{
......@@ -652,15 +620,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1800
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1800
* @tc.name test gatt connect and disconnect
* @tc.desc Test connect and disconnect api .
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 2
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1800', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1800', 0, async function (done) {
try {
async function onReceiveEvent(ScanResult)
{
......@@ -700,15 +666,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_1900
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_1900
* @tc.name testClassicStartBLEScan
* @tc.desc Test startBLEScan 401 - Invalid parameter.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 0
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_1900', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_1900', 0, async function (done) {
try {
bluetooth.BLE.startBLEScan(123);
expect(true).assertFalse();
......@@ -723,15 +687,13 @@ describe('bluetoothBLETest6', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_BLE_Scan_2000
* @tc.number SUB_COMMUNICATION_BTMANAGER_BLESCAN_2000
* @tc.name testClassicStartBLEScan
* @tc.desc Test startBLEScan 401 - Invalid parameter.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 0
*/
it('COMMUNICATION_BLUETOOTH_BLE_Scan_2000', 0, async function (done) {
it('SUB_COMMUNICATION_BTMANAGER_BLESCAN_2000', 0, async function (done) {
try {
bluetooth.BLE.startBLEScan([{
serviceSolicitationUuid:"00000101-0000-1000-8000-00805F9B34FB",
......
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bluetoothManager from '@ohos.bluetoothManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function btManagerDiscoveryTest() {
describe('btManagerDiscoveryTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
async function tryToEnableBt() {
let sta = bluetoothManager.getState();
switch (sta) {
case 0:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta1 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turn off:' + JSON.stringify(sta1));
break;
case 1:
console.info('[bluetooth_js] bt turning on:' + JSON.stringify(sta));
await sleep(3000);
break;
case 2:
console.info('[bluetooth_js] bt turn on:' + JSON.stringify(sta));
break;
case 3:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta2 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turning off:' + JSON.stringify(sta2));
break;
default:
console.info('[bluetooth_js] enable success');
}
}
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(async function (done) {
console.info('beforeEach called')
await tryToEnableBt()
done()
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_DISCOVERY_0100
* @tc.name TEST bluetoothDeviceFind on&off
* @tc.desc TEST bluetoothDeviceFind
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNICATION_BTMANAGER_DISCOVERY_0100', 0, async function (done) {
function onReceiveEvent(data) {
console.info('[bluetooth_js] Device' + JSON.stringify(data) +
'length' + data.length);
expect(true).assertTrue(data.length > 0);
}
try {
bluetoothManager.on("bluetoothDeviceFind", onReceiveEvent);
let result = bluetoothManager.startBluetoothDiscovery();
await sleep(3000);
console.info('[bluetooth_js] startDiscovery' + result);
expect(result).assertTrue();
bluetoothManager.off('bluetoothDeviceFind', onReceiveEvent);
result = bluetoothManager.stopBluetoothDiscovery();
console.info('[bluetooth_js] stopDiscovery' + result);
expect(true).assertTrue();
} catch (error) {
console.error(`[bluetooth_js]bluetoothDeviceFin error, code is ${error.code},
message is ${error.message}`);
}
done();
})
})
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bluetoothManager from '@ohos.bluetoothManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function btManagerPairTest() {
describe('btManagerPairTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
async function tryToEnableBt() {
let sta = bluetoothManager.getState();
switch (sta) {
case 0:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta1 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turn off:' + JSON.stringify(sta1));
break;
case 1:
console.info('[bluetooth_js] bt turning on:' + JSON.stringify(sta));
await sleep(3000);
break;
case 2:
console.info('[bluetooth_js] bt turn on:' + JSON.stringify(sta));
break;
case 3:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta2 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turning off:' + JSON.stringify(sta2));
break;
default:
console.info('[bluetooth_js] enable success');
}
}
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(async function (done) {
console.info('beforeEach called')
await tryToEnableBt()
done()
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_PAIR_0100
* @tc.name Test pinRequired and setDevicePairing true
* @tc.desc Test pinRequired off api
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BTMANAGER_PAIR_0100', 0, async function (done) {
function onReceiveEvent(data) {
console.info('pin required = '+ JSON.stringify(data));
}
try {
bluetoothManager.on('pinRequired', onReceiveEvent);
bluetoothManager.off('pinRequired', onReceiveEvent);
} catch (error) {
console.error(`[bluetooth_js]PairDevice error, code is ${error.code},
message is ${error.message}`);
}
done();
})
})
}
\ No newline at end of file
......@@ -17,8 +17,8 @@ import bluetooth from '@ohos.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothhostTest2() {
describe('bluetoothhostTest2', function() {
export default function btPairTest() {
describe('btPairTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
......@@ -65,15 +65,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_PAIR_0100
* @tc.name Test pairDevice of use invailded address
* @tc.desc Test pairDevice api
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_PAIR_0100', 0, async function (done) {
let result = bluetooth.pairDevice("11:22:55:66:33:44");
await sleep(32000);
console.info("[bluetooth_js] onStartpair001 -> " + JSON.stringify(result));
......@@ -82,15 +80,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_PAIR_0200
* @tc.name testStartpair
* @tc.desc Test pairDevice of use vailded address.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_PAIR_0200', 0, async function (done) {
function PinRequiredParam(data) {
console.info("[bluetooth_js] pinRequired on:" +
JSON.stringify(data.deviceId)+JSON.stringify(data.pinCode));
......@@ -105,15 +101,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_PAIR_0300
* @tc.name test getRemoteDeviceName
* @tc.desc Test get RemoteDeviceName
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_PAIR_0300', 0, async function (done) {
let ret = bluetooth.getRemoteDeviceName("00:00:00:00:00:00");
console.info('[bluetooth_js] getRemoteDeviceName ret2:' + JSON.stringify(ret));
expect(ret.length).assertEqual(0);
......@@ -121,15 +115,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0400
* @tc.number SUB_COMMUNICATION_BLUETOOTH_PAIR_0400
* @tc.name test getRemoteDeviceClass
* @tc.desc Test get RemoteDeviceClass
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0400', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_PAIR_0400', 0, async function (done) {
let MajorMinorClass = {
COMPUTER_UNCATEGORIZED : 0x0100,COMPUTER_DESKTOP : 0x0104,
COMPUTER_SERVER : 0x0108,COMPUTER_LAPTOP : 0x010C,
......@@ -196,15 +188,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0500
* @tc.number SUB_COMMUNICATION_BLUETOOTH_PAIR_0500
* @tc.name test get RemoteDeviceName
* @tc.desc Test getRemoteDeviceName api
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0500', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_PAIR_0500', 0, async function (done) {
let ret = bluetooth.getRemoteDeviceName("1125445");
console.info('[bluetooth_js] getRemoteDeviceName ret2:' + JSON.stringify(ret));
expect(ret.length).assertEqual(0);
......@@ -212,15 +202,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0600
* @tc.number SUB_COMMUNICATION_BLUETOOTH_PAIR_0600
* @tc.name test get PairedDevices
* @tc.desc Test getPairedDevices api
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0600', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_PAIR_0600', 0, async function (done) {
let ret = bluetooth.getPairedDevices();
console.info('[bluetooth_js] getPairedDevices ret2:' + JSON.stringify(ret));
expect(true).assertEqual(ret.length>=0);
......@@ -228,15 +216,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0700
* @tc.number SUB_COMMUNICATION_BLUETOOTH_PAIR_0700
* @tc.name Test pinRequired and setDevicePairing false
* @tc.desc Test pinRequired ON api
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0700', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_PAIR_0700', 0, async function (done) {
function PinRequiredParam(data) {
console.info("[bluetooth_js] pinRequired on:" + JSON.stringify(data));
bluetooth.setDevicePairingConfirmation(data.deviceId,false);
......@@ -251,15 +237,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0800
* @tc.number SUB_COMMUNICATION_BLUETOOTH_PAIR_0800
* @tc.name Test pinRequired and setDevicePairing true
* @tc.desc Test pinRequired off api
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0800', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_PAIR_0800', 0, async function (done) {
function PinRequiredParam(data) {
console.info("[bluetooth_js] pinRequired on:" + JSON.stringify(data));
bluetooth.setDevicePairingConfirmation(data.deviceId,true);
......@@ -274,15 +258,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0900
* @tc.number SUB_COMMUNICATION_BLUETOOTH_PAIR_0900
* @tc.name Test On pair StateChange
* @tc.desc Test bondStateChange ON api
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0900', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_PAIR_0900', 0, async function (done) {
function BondStateParam(data) {
console.info("[bluetooth_js] bondStateChange on:" + JSON.stringify(data)
+'bondStateChange deviceId:' + data.deviceId + 'bondStateChange state:' + data.state);
......@@ -297,9 +279,4 @@ describe('bluetoothhostTest2', function() {
})
})
}
}
\ No newline at end of file
......@@ -16,8 +16,8 @@
import bluetooth from '@ohos.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothhostTest2() {
describe('bluetoothhostTest2', function() {
export default function btScanModeTest() {
describe('btScanModeTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
......@@ -63,15 +63,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0100
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0100', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
if(state==bluetooth.BluetoothState.STATE_ON)
......@@ -100,15 +98,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0200
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0200
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0200', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0200', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
......@@ -137,15 +133,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0300
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0300', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
if(state==bluetooth.BluetoothState.STATE_ON)
......@@ -173,15 +167,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0400
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0400
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0400', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0400', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
if(state==bluetooth.BluetoothState.STATE_ON)
......@@ -209,14 +201,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0500
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0500
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0500', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0500', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
if(state==bluetooth.BluetoothState.STATE_ON)
......@@ -244,15 +235,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0600
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0600
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0600', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ScanMode_0600', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
if(state==bluetooth.BluetoothState.STATE_ON)
......@@ -280,15 +269,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0700
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0700
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0700', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0700', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
if(state==bluetooth.BluetoothState.STATE_ON)
......@@ -316,15 +303,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0800
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0800
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0800', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ScanMode_0800', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
if(state==bluetooth.BluetoothState.STATE_ON)
......@@ -352,15 +337,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0900
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_0900
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_0900', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_ScanMode_0900', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
if(state==bluetooth.BluetoothState.STATE_ON)
......@@ -388,15 +371,13 @@ describe('bluetoothhostTest2', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_1000
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SCANMODE_1000
* @tc.name TEST scanmode
* @tc.desc TEST scanmode api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level 4
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_ScanMode_1000', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SCANMODE_1000', 0, async function (done) {
let state = bluetooth.getState();
console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state));
if(state==bluetooth.BluetoothState.STATE_ON)
......@@ -419,6 +400,4 @@ describe('bluetoothhostTest2', function() {
})
})
}
}
\ No newline at end of file
......@@ -13,17 +13,20 @@
* limitations under the License.
*/
import bluetoothBLETest from './BleGattManager.test.js'
import bluetoothBLETest4 from './BleGattManager401.test.js'
import bluetoothBLETest1 from './BleService.test.js'
import bluetoothBLETest2 from './BleAdvertiser.test.js'
import bluetoothBLETest5 from './BleAdvertiser401.test.js'
import bluetoothBLETest6 from './BleScanResult.test.js'
import btBleScanTest from './BtBleScanResult.test.js'
import btDiscoveryTest from './BtDiscovery.test.js'
import btManagerBleScanTest from './BtManagerBleScanResult.test.js'
import btPairTest from './BtPair.test.js'
import btScanModeTest from './BtScanMode.test.js'
import btManagerDiscoveryTest from './BtManagerDiscovery.test.js'
import btManagerPairTest from './BtManagerPair.test.js'
export default function testsuite() {
bluetoothBLETest()
bluetoothBLETest1()
bluetoothBLETest2()
bluetoothBLETest4()
bluetoothBLETest5()
bluetoothBLETest6()
btBleScanTest()
btDiscoveryTest()
btManagerBleScanTest()
btPairTest()
btScanModeTest()
btManagerDiscoveryTest()
btManagerPairTest()
}
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bluetoothManager from '@ohos.bluetoothManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function btManagerSwitchTest() {
describe('btManagerSwitchTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
async function tryToEnableBt() {
let sta = bluetoothManager.getState();
switch (sta) {
case 0:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta1 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turn off:' + JSON.stringify(sta1));
break;
case 1:
console.info('[bluetooth_js] bt turning on:' + JSON.stringify(sta));
await sleep(3000);
break;
case 2:
console.info('[bluetooth_js] bt turn on:' + JSON.stringify(sta));
break;
case 3:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta2 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turning off:' + JSON.stringify(sta2));
break;
default:
console.info('[bluetooth_js] enable success');
}
}
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(async function (done) {
console.info('beforeEach called')
await tryToEnableBt()
done()
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_STATECHANGE_0100
* @tc.name Test On pair StateChange
* @tc.desc Test bondStateChange ON api
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BTMANAGER_STATECHANGE_0100', 0, async function (done) {
function BondStateParam(data) {
console.info("[bluetooth_js] bondStateChange on:" + JSON.stringify(data)
+ 'bondStateChange deviceId:' + data.deviceId + 'bondStateChange state:' + data.state);
}
try {
bluetoothManager.on('bondStateChange', BondStateParam);
let result = bluetoothManager.pairDevice("11:22:55:66:33:44");
expect(bluetoothManager.BondState.BOND_STATE_INVALID == 0).assertTrue();
expect(bluetoothManager.BondState.BOND_STATE_BONDING == 1).assertTrue();
expect(bluetoothManager.BondState.BOND_STATE_BONDED == 2).assertTrue();
bluetoothManager.off('bondStateChange', BondStateParam);
} catch (error) {
console.error(`[bluetooth_js]bondStateChange error, code is ${error.code},
message is ${error.message}`);
}
done();
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_STATECHANGE_0200
* @tc.name test EnableBluetooth and getState
* @tc.desc Test EnableBluetooth
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNICATION_BTMANAGER_STATECHANGE_0200', 0, async function (done) {
function onReceiveEvent(data) {
console.info('bluetoothManager state001 =' + JSON.stringify(data));
}
try {
await bluetoothManager.on('stateChange', onReceiveEvent);
let state = bluetoothManager.getState();
console.info('[bluetooth_js] get bluetooth state001' + JSON.stringify(state));
if (state != bluetoothManager.BluetoothState.STATE_ON) {
let enable = bluetoothManager.enableBluetooth();
await sleep(10000);
console.info('[bluetooth_js] bluetoothManager enable001' + JSON.stringify(enable));
expect(enable).assertTrue();
let state1 = bluetoothManager.getState();
console.info('[bluetooth_js] enable state001 ' + JSON.stringify(state1));
expect(state1).assertEqual(bluetoothManager.BluetoothState.STATE_ON);
}
} catch (error) {
console.error(`[bluetooth_js]enable StateChange error, code is ${error.code},
message is ${error.message}`);
}
done();
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_STATECHANGE_0300
* @tc.name test disableBluetooth and getState
* @tc.desc Test disableBluetooth api
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNICATION_BTMANAGER_STATECHANGE_0300', 0, async function (done) {
function onReceiveEvent(data) {
console.info('bluetoothManager state001 =' + JSON.stringify(data));
}
try {
await bluetoothManager.on('stateChange', onReceiveEvent);
await sleep(3000);
await bluetoothManager.off('stateChange', onReceiveEvent);
let state = bluetoothManager.getState();
console.info('[bluetooth_js] get bluetooth state001' + JSON.stringify(state));
if (state != bluetoothManager.BluetoothState.STATE_OFF) {
let disable = bluetoothManager.disableBluetooth();
await sleep(10000);
console.info('[bluetooth_js] bluetoothManager disable001' + JSON.stringify(disable));
expect(disable).assertTrue();
let state1 = bluetoothManager.getState();
console.info('[bluetooth_js] disable state001 ' + JSON.stringify(state1));
expect(state1).assertEqual(bluetoothManager.BluetoothState.STATE_OFF);
}
} catch (error) {
console.error(`[bluetooth_js]disable StateChange error, code is ${error.code},
message is ${error.message}`);
}
done();
})
})
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import bluetoothManager from '@ohos.bluetoothManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function btManagerSppTest() {
describe('btManagerSppTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
async function tryToEnableBt() {
let sta = bluetoothManager.getState();
switch (sta) {
case 0:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta1 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turn off:' + JSON.stringify(sta1));
break;
case 1:
console.info('[bluetooth_js] bt turning on:' + JSON.stringify(sta));
await sleep(3000);
break;
case 2:
console.info('[bluetooth_js] bt turn on:' + JSON.stringify(sta));
break;
case 3:
bluetoothManager.enableBluetooth();
await sleep(10000);
let sta2 = bluetoothManager.getState();
console.info('[bluetooth_js] bt turning off:' + JSON.stringify(sta2));
break;
default:
console.info('[bluetooth_js] enable success');
}
}
beforeAll(function () {
console.info('beforeAll called')
})
beforeEach(async function (done) {
console.info('beforeEach called')
await tryToEnableBt()
done()
})
afterEach(function () {
console.info('afterEach called')
})
afterAll(function () {
console.info('afterAll called')
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_SPP_0100
* @tc.name test SppListen
* @tc.desc Test SppListen
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BTMANAGER_SPP_0100', 0, async function (done) {
let SppOption = {
uuid: '00001810-0000-1000-8000-00805F9B34FB',
secure: false, type: bluetoothManager.SppType.SPP_RFCOMM
};
let serverNumber = -1;
function serverSocket(code, number) {
if (code) {
console.log('bluetooth error code01: ' + code);
} else {
console.log('bluetooth serverSocket Number:' + JSON.stringify(number));
serverNumber = number;
expect(true).assertEqual(number != null);
}
}
try {
await bluetoothManager.sppListen('server1', SppOption, serverSocket);
} catch (error) {
console.error(`[bluetooth_js]SPPListen error, code is ${error.code},
message is ${error.message}`);
}
done();
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_SPP_0200
* @tc.name testSppAccept
* @tc.desc Test SppAccept api
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BTMANAGER_SPP_0200', 0, async function (done) {
let serverNumber = -1;
function serverSocket(code, number) {
console.log('bluetooth error code: ' + code.code);
if (code.code == 0) {
console.log('bluetooth serverSocket Number: ' + number);
serverNumber = number;
}
}
let clientNumber = -1;
function acceptClientSocket(code, number) {
console.log('bluetooth error code: ' + code.code);
if (code.code == 0) {
console.log('bluetooth clientSocket Number: ' + number);
clientNumber = number;
}
}
try {
bluetoothManager.sppAccept(serverNumber, acceptClientSocket);
} catch (error) {
console.error(`[bluetooth_js]SPPAccept error, code is ${error.code},
message is ${error.message}`);
}
done();
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_SPP_0300
* @tc.name test SppConnect
* @tc.desc Test SppConnect api 8
* @tc.type Function
* @tc.level Level 1
*/
it('SUB_COMMUNICATION_BTMANAGER_SPP_0300', 0, async function (done) {
let sppOption = {
uuid: '00001810-0000-1000-8000-00805F9B34FB',
secure: true, type: 0
};
try {
await bluetoothManager.sppConnect('00:11:22:33:44:55', sppOption, function (code, number) {
if (code) {
console.info('[bluetooth_js] code is: ' + JSON.stringify(code));
} else {
console.log('[bluetooth_js]sppConnect Number:'
+ JSON.stringify(number));
expect(true).assertEqual(number != null);
}
});
} catch (error) {
console.error(`[bluetooth_js]SPPConnect error, code is ${error.code},
message is ${error.message}`);
}
done();
})
/**
* @tc.number SUB_COMMUNICATION_BTMANAGER_SPP_0400
* @tc.name test sppReadOn
* @tc.desc Test On and Off Api
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNICATION_BTMANAGER_SPP_0400', 0, async function (done) {
let clientNumber = -1;
function clientSocket(code, number) {
if (code.code != 0) {
return;
}
console.log('bluetooth serverSocket Number: ' + number);
clientNumber = number;
}
function dataRead(dataBuffer) {
let data = new Uint8Array(dataBuffer);
console.log('bluetooth data is: ' + data[0]);
}
try {
bluetoothManager.on('sppRead', clientNumber, dataRead);
bluetoothManager.off('sppRead', clientNumber);
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
done();
})
})
}
\ No newline at end of file
......@@ -16,8 +16,8 @@
import bluetooth from '@ohos.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothhostTest() {
describe('bluetoothhostTest', function() {
export default function btSwitchTest() {
describe('btSwitchTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
}
......@@ -64,15 +64,13 @@ describe('bluetoothhostTest', function() {
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Switch_0300
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SWITCH_0300
* @tc.name testEnableBluetooth
* @tc.desc Test EnableBluetooth api by promise.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 3
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Switch_0300', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SWITCH_0300', 0, async function (done) {
let enable = bluetooth.enableBluetooth();
let state = bluetooth.getState();
console.info('[bluetooth_js] bt open state1 = '+ JSON.stringify(state));
......@@ -92,15 +90,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Switch_0100
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SWITCH_0100
* @tc.name testEnableBluetooth and getState
* @tc.desc Test EnableBluetooth api by promise.
* @tc.size MEDIUM
* @ since 7
* @tc.type Function
* @tc.level Level 0
*/
it('SUB_COMMUNICATION_BLUETOOTH_BR_Switch_0100', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SWITCH_0100', 0, async function (done) {
function onReceiveEvent(data) {
console.info('bluetooth state001 ='+ JSON.stringify(data));
}
......@@ -121,14 +117,13 @@ describe('bluetoothhostTest', function() {
})
/**
* @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0444
* @tc.number SUB_COMMUNICATION_BLUETOOTH_SwitchOff_0444
* @tc.name testEnableBluetooth and getState
* @tc.desc Test EnableBluetooth api by promise.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
*/
it('COMMUNICATION_BLUETOOTH_SwitchOff_0444', 0, async function (done) {
it('SUB_COMMUNICATION_BLUETOOTH_SwitchOff_0444', 0, async function (done) {
let STATE_ON = bluetooth.BluetoothState.STATE_ON;
console.info("[bluetooth_js]STATE_ON : " + JSON.stringify(STATE_ON));
expect(true).assertTrue(STATE_ON == 2);
......@@ -153,6 +148,4 @@ describe('bluetoothhostTest', function() {
done()
})
})
}
}
\ No newline at end of file
......@@ -17,8 +17,8 @@ import bluetooth from '@ohos.bluetooth';
import bluetoothsys from '@system.bluetooth';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function bluetoothhostTest4() {
describe('bluetoothhostTest4', function() {
export default function btSubscBleTest() {
describe('btSubscBleTest', function() {
function sleep(delay) {
return new Promise(resovle => setTimeout(resovle, delay))
......@@ -65,14 +65,13 @@ describe('bluetoothhostTest4', function() {
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_SUBSCRIBE_BLEFound_0001
* @tc.number SUB_COMMUNACATION_BLUETOOTH_BLESUBSFOUND_0100
* @tc.name testsubscribeBLEFound
* @tc.desc Test subscribeBLEFound api.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_COMMUNACATION_bluetooth_SUBSCRIBE_BLEFound_0001', 0, async function (done) {
it('SUB_COMMUNACATION_BLUETOOTH_BLESUBSFOUND_0100', 0, async function (done) {
bluetoothsys.startBLEScan({
interval:0,
success() {
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册