diff --git a/communication/BUILD.gn b/communication/BUILD.gn index 70cfc42ce40c446153cb916b267f363a0dc8c1d8..a732eb404bf19af3338b4c9936a57ee98b2c1bcd 100644 --- a/communication/BUILD.gn +++ b/communication/BUILD.gn @@ -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", diff --git a/communication/bluetooth_ble/BUILD.gn b/communication/bluetooth_gatt/BUILD.gn similarity index 92% rename from communication/bluetooth_ble/BUILD.gn rename to communication/bluetooth_gatt/BUILD.gn index deeda2f5e900a773d08bb70e9b4ccbcb1370fdae..31c2f50714c64e23253670983cb8cecf63ce5561 100644 --- a/communication/bluetooth_ble/BUILD.gn +++ b/communication/bluetooth_gatt/BUILD.gn @@ -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" } diff --git a/communication/bluetooth_ble/Test.json b/communication/bluetooth_gatt/Test.json similarity index 90% rename from communication/bluetooth_ble/Test.json rename to communication/bluetooth_gatt/Test.json index 69aefab584d7fbac10219fc4b5d7120e2761ace7..8fbfbb34e9aad16ca1423838bd033884c25e087a 100644 --- a/communication/bluetooth_ble/Test.json +++ b/communication/bluetooth_gatt/Test.json @@ -11,7 +11,7 @@ "kits": [ { "test-file-name": [ - "ActsBluetoothBleHapTest.hap" + "ActsBluetoothGattHapTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/communication/bluetooth_ble/signature/openharmony_sx.p7b b/communication/bluetooth_gatt/signature/openharmony_sx.p7b similarity index 100% rename from communication/bluetooth_ble/signature/openharmony_sx.p7b rename to communication/bluetooth_gatt/signature/openharmony_sx.p7b diff --git a/communication/bluetooth_ble/src/main/config.json b/communication/bluetooth_gatt/src/main/config.json similarity index 94% rename from communication/bluetooth_ble/src/main/config.json rename to communication/bluetooth_gatt/src/main/config.json index ee6ee3d48f37f356aaf4977ec4df4aa0137c9e2f..2309c75120be51feb4782be9abd0577afc97c151 100644 --- a/communication/bluetooth_ble/src/main/config.json +++ b/communication/bluetooth_gatt/src/main/config.json @@ -129,6 +129,10 @@ ], "when": "inuse" } + }, + { + "name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", + "reason": "" } ], "testRunner": { diff --git a/communication/bluetooth_ble/src/main/js/MainAbility/app.js b/communication/bluetooth_gatt/src/main/js/MainAbility/app.js similarity index 100% rename from communication/bluetooth_ble/src/main/js/MainAbility/app.js rename to communication/bluetooth_gatt/src/main/js/MainAbility/app.js diff --git a/communication/bluetooth_ble/src/main/js/MainAbility/i18n/en-US.json b/communication/bluetooth_gatt/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from communication/bluetooth_ble/src/main/js/MainAbility/i18n/en-US.json rename to communication/bluetooth_gatt/src/main/js/MainAbility/i18n/en-US.json diff --git a/communication/bluetooth_ble/src/main/js/MainAbility/i18n/zh-CN.json b/communication/bluetooth_gatt/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from communication/bluetooth_ble/src/main/js/MainAbility/i18n/zh-CN.json rename to communication/bluetooth_gatt/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/communication/bluetooth_ble/src/main/js/MainAbility/pages/index/index.css b/communication/bluetooth_gatt/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from communication/bluetooth_ble/src/main/js/MainAbility/pages/index/index.css rename to communication/bluetooth_gatt/src/main/js/MainAbility/pages/index/index.css diff --git a/communication/bluetooth_ble/src/main/js/MainAbility/pages/index/index.hml b/communication/bluetooth_gatt/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from communication/bluetooth_ble/src/main/js/MainAbility/pages/index/index.hml rename to communication/bluetooth_gatt/src/main/js/MainAbility/pages/index/index.hml diff --git a/communication/bluetooth_ble/src/main/js/MainAbility/pages/index/index.js b/communication/bluetooth_gatt/src/main/js/MainAbility/pages/index/index.js similarity index 100% rename from communication/bluetooth_ble/src/main/js/MainAbility/pages/index/index.js rename to communication/bluetooth_gatt/src/main/js/MainAbility/pages/index/index.js diff --git a/communication/bluetooth_ble/src/main/js/TestAbility/app.js b/communication/bluetooth_gatt/src/main/js/TestAbility/app.js similarity index 100% rename from communication/bluetooth_ble/src/main/js/TestAbility/app.js rename to communication/bluetooth_gatt/src/main/js/TestAbility/app.js diff --git a/communication/bluetooth_ble/src/main/js/TestAbility/i18n/en-US.json b/communication/bluetooth_gatt/src/main/js/TestAbility/i18n/en-US.json similarity index 100% rename from communication/bluetooth_ble/src/main/js/TestAbility/i18n/en-US.json rename to communication/bluetooth_gatt/src/main/js/TestAbility/i18n/en-US.json diff --git a/communication/bluetooth_ble/src/main/js/TestAbility/i18n/zh-CN.json b/communication/bluetooth_gatt/src/main/js/TestAbility/i18n/zh-CN.json similarity index 100% rename from communication/bluetooth_ble/src/main/js/TestAbility/i18n/zh-CN.json rename to communication/bluetooth_gatt/src/main/js/TestAbility/i18n/zh-CN.json diff --git a/communication/bluetooth_ble/src/main/js/TestAbility/pages/index/index.css b/communication/bluetooth_gatt/src/main/js/TestAbility/pages/index/index.css similarity index 100% rename from communication/bluetooth_ble/src/main/js/TestAbility/pages/index/index.css rename to communication/bluetooth_gatt/src/main/js/TestAbility/pages/index/index.css diff --git a/communication/bluetooth_ble/src/main/js/TestAbility/pages/index/index.hml b/communication/bluetooth_gatt/src/main/js/TestAbility/pages/index/index.hml similarity index 100% rename from communication/bluetooth_ble/src/main/js/TestAbility/pages/index/index.hml rename to communication/bluetooth_gatt/src/main/js/TestAbility/pages/index/index.hml diff --git a/communication/bluetooth_ble/src/main/js/TestAbility/pages/index/index.js b/communication/bluetooth_gatt/src/main/js/TestAbility/pages/index/index.js similarity index 100% rename from communication/bluetooth_ble/src/main/js/TestAbility/pages/index/index.js rename to communication/bluetooth_gatt/src/main/js/TestAbility/pages/index/index.js diff --git a/communication/bluetooth_ble/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/communication/bluetooth_gatt/src/main/js/TestRunner/OpenHarmonyTestRunner.js similarity index 100% rename from communication/bluetooth_ble/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename to communication/bluetooth_gatt/src/main/js/TestRunner/OpenHarmonyTestRunner.js diff --git a/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js b/communication/bluetooth_gatt/src/main/js/test/BtGattAdvertiser.test.js similarity index 90% rename from communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js rename to communication/bluetooth_gatt/src/main/js/test/BtGattAdvertiser.test.js index b524894531b5b34a400f8ebbc5072fba059793e3..29ff2ac694d817b846def1fd0ff64e6c465ef803 100644 --- a/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/BtGattAdvertiser.test.js @@ -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 diff --git a/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js b/communication/bluetooth_gatt/src/main/js/test/BtGattManager.test.js similarity index 84% rename from communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js rename to communication/bluetooth_gatt/src/main/js/test/BtGattManager.test.js index 0e8cc094ef22cd9914f4e7453e42b3a219a9bb9f..73467d8fb489a1b27cc9b641f8262858d9bd9e94 100644 --- a/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/BtGattManager.test.js @@ -16,8 +16,8 @@ import bluetooth from '@ohos.bluetooth'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -export default function bluetoothBLETest() { -describe('bluetoothBLETest', function() { +export default function btGattManagerTest() { +describe('btGattManagerTest', function() { let gattServer = null; let gattClient = null; function sleep(delay) { @@ -42,7 +42,7 @@ describe('bluetoothBLETest', function() { case 3: console.info('[bluetooth_js] bt turning off:'+ JSON.stringify(sta)); bluetooth.enableBluetooth(); - await sleep(1000); + await sleep(10000); break; default: console.info('[bluetooth_js] enable success'); @@ -63,21 +63,18 @@ describe('bluetoothBLETest', function() { }) afterAll(async function (done) { console.info('afterAll called') - await sleep(6000); gattClient.close(); done() }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GattConnect_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTCLICONNECT_0100 * @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_GattConnect_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_GATTCLICONNECT_0100', 0, async function (done) { let ret = gattClient.connect(); await sleep(2000); console.info('[bluetooth_js] gattClient connect' + ret) @@ -89,15 +86,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTCLICONNECT_0200 * @tc.name testGetConnectedBLEDevices * @tc.desc Test getConnectedBLEDevices api . - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattConnect_0200', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_GATTCLICONNECT_0200', 0, function () { let result = bluetooth.BLE.getConnectedBLEDevices(); console.info("[bluetooth_js] getConnDev:" + JSON.stringify(result) + "length:" +result.length); @@ -105,15 +100,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTCLICONNECT_0300 * test Client BLEconnectStateChange * @tc.desc Test on and off api - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattConnect_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_GATTCLICONNECT_0300', 0, async function (done) { function ConnectStateChanged(state) { console.log('bluetooth connect state changed'); let connectState = state.state; @@ -131,15 +124,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_GETRSSIVALUE_0100 * @tc.name testgetRssiValue - * @tc.desc Test getRssiValue api by promise. - * @tc.size MEDIUM - * @ since 7 + * @tc.desc Test getRssiValue api by promise * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_GETRSSIVALUE_0100', 0, async function (done) { let ret = gattClient.connect(); console.info('[bluetooth_js] gattClient getrssi connect:' + JSON.stringify(ret)) expect(ret).assertTrue(); @@ -152,7 +143,7 @@ describe('bluetoothBLETest', function() { }).catch(error => { console.info('bluetooth getRssiValue has error: '+ JSON.stringify(error)); let b=false; - if(err.code==2900099||err.code==-1) + if(error.code==2900099||error.code==-1) { b=true } @@ -171,15 +162,13 @@ describe('bluetoothBLETest', function() { /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_GETRSSIVALUE_0200 * @tc.name testgetRssiValue - * @tc.desc Test testGetDeviceName api by callback. - * @tc.size MEDIUM - * @ since 7 + * @tc.desc Test testGetDeviceName api by callback * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_GETRSSIVALUE_0200', 0, async function (done) { let ret = gattClient.connect(); console.info('[bluetooth_js] gattClient getRssi connect' + JSON.stringify(ret)) expect(ret).assertTrue(); @@ -208,15 +197,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_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('SUB_COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_GETDEVICENAME_0100', 0, async function (done) { let ret = gattClient.connect(); console.info('[bluetooth_js] gattClient getname2 connect' + JSON.stringify(ret)) expect(ret).assertTrue(); @@ -237,15 +224,13 @@ describe('bluetoothBLETest', function() { /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_getDeviceName_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_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('SUB_COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_GETDEVICENAME_0200', 0, async function (done) { let ret = gattClient.connect(); console.info('[bluetooth_js] gattClient getname1 connect' + JSON.stringify(ret)) expect(ret).assertTrue(); @@ -261,15 +246,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_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('SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_GETSERVICE_0100', 0, async function (done) { let ret = gattClient.connect(); console.info('[bluetooth_js]gattClient getservices1 connect' + JSON.stringify(ret)) expect(ret).assertTrue(); @@ -288,15 +271,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_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('SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_GETSERVICE_0200', 0, async function (done) { let ret = gattClient.connect(); console.info('[bluetooth_js]gattClient getservices2 connect' + JSON.stringify(ret)) gattClient.getServices((code, data)=> { @@ -315,89 +296,78 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0100 * @tc.name testSetBLEMtuSize * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 1 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0100', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0100', 0, function () { let ret = gattClient.setBLEMtuSize(100); console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); expect(ret).assertEqual(false); }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0200 * @tc.name testSetBLEMtuSize * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0200', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0200', 0, function () { let ret = gattClient.setBLEMtuSize(22); console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); expect(ret).assertEqual(false); }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0300 * @tc.name testSetBLEMtuSize * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0300', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0300', 0, function () { let ret = gattClient.setBLEMtuSize(21); console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); expect(ret).assertEqual(false); }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0400 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0400 * @tc.name testSetBLEMtuSize * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 1 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0400', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0400', 0, function () { let ret = gattClient.setBLEMtuSize(512); console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); expect(ret).assertEqual(false); }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0500 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0500 * @tc.name testSetBLEMtuSize * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0500', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_MTUSIZE_0500', 0, function () { let ret = gattClient.setBLEMtuSize(513); console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); expect(ret).assertEqual(false); }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_READCHARACTERISTIC_0100 * @tc.name testReadDescriptorValue * @tc.desc Test ReadDescriptorValue api by promise. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_READCHARACTERISTIC_0100', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -434,14 +404,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_READCHARACTERISTIC_0200 * @tc.name testReadDescriptorValue * @tc.desc Test ReadDescriptorValue api by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0200', 0, async function(done) { + it('SUB_COMMUNICATION_BLUETOOTH_READCHARACTERISTIC_0200', 0, async function(done) { function readCcc(code, BLECharacteristic) { if (code.code != 0) { return; @@ -470,14 +439,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_READCHARACTERISTIC_0300 * @tc.name test characteristicReadOn * @tc.desc Test On and off api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_READCHARACTERISTIC_0300', 0, async function (done) { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); cccValue[0] = 1123; @@ -501,14 +469,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_READDESCRIPTOR_0100 * @tc.name testReadDescriptorValue * @tc.desc Test ReadDescriptorValue api by promise. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_READDESCRIPTOR_0100', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -534,14 +501,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_READDESCRIPTOR_0200 * @tc.name testReadDescriptorValue * @tc.desc Test ReadDescriptorValue api by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_READDESCRIPTOR_0200', 0, async function (done) { function readDesc(code, BLEDescriptor) { if (code.code != 0) { console.info('[bluetooth_js] descriptor code: ' + BLEDescriptor.descriptorUuid); @@ -563,14 +529,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_READDESCRIPTOR_0300 * @tc.name test ReadDescriptorOn * @tc.desc Test On and Off api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_READDESCRIPTOR_0300', 0, async function (done) { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); cccValue[0] = 1011; @@ -600,14 +565,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_WRITECHARACTERISTIC_0100 * @tc.name testWriteCharacteristicValue * @tc.desc Test Client WriteCharacteristicValue api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0100', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_WRITECHARACTERISTIC_0100', 0, function () { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -628,28 +592,26 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_WRITECHARACTERISTIC_0200 * @tc.name testWriteCharacteristicValue * @tc.desc Test Client WriteCharacteristicValue api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0200', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_WRITECHARACTERISTIC_0200', 0, function () { let ret = gattClient.writeCharacteristicValue("123"); console.info('[bluetooth_js] invaild writeCharacteristicValue ret : ' + ret); expect(ret).assertEqual(false); }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_WRITECHARACTERISTIC_0300 * @tc.name test characteristicWriteOn * @tc.desc Test on and off api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_WRITECHARACTERISTIC_0300', 0, async function (done) { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); function WriteCharacteristicReq(CharacteristicWriteReq) { @@ -677,14 +639,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_WRITEDESCRIPTOR_0100 * @tc.name testWriteDescriptorValue * @tc.desc Test Client WriteDescriptorValue api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0100', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_WRITEDESCRIPTOR_0100', 0, function () { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); desValue[0] = 11; @@ -697,28 +658,26 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_WRITEDESCRIPTOR_0200 * @tc.name testWriteDescriptorValue * @tc.desc Test WriteDescriptorValue api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0200', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_WRITEDESCRIPTOR_0200', 0, function () { let ret = gattClient.writeDescriptorValue(""); console.info('[bluetooth_js] bluetooth writeDescriptorValue ret : ' + ret); expect(ret).assertEqual(false); }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_WRITEDESCRIPTOR_0300 * @tc.name test WriteDescriptorOn * @tc.desc Test on and off api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_WRITEDESCRIPTOR_0300', 0, async function (done) { let arrayBufferDesc = new ArrayBuffer(8); let descValue = new Uint8Array(arrayBufferDesc); function WriteDescriptorReq(DescriptorWriteReq) { @@ -752,14 +711,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SETNOTIFYCHARACTERISTIC_0100 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test SetNotifyCharacteristicChanged api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SETNOTIFYCHARACTERISTIC_0100', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -790,14 +748,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SETNOTIFYCHARACTERISTIC_0200 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test SetNotifyCharacteristicChanged api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0200', 0, async function(done) { + it('SUB_COMMUNICATION_BLUETOOTH_SETNOTIFYCHARACTERISTIC_0200', 0, async function(done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -828,14 +785,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SETNOTIFYCHARACTERISTIC_0300 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test SetNotifyCharacteristicChanged api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SETNOTIFYCHARACTERISTIC_0300', 0, async function (done) { let ret = gattClient.setNotifyCharacteristicChanged(null, false); console.info('[bluetooth_js] setNotifyCharacteristicChanged is null ret:' + ret); expect(ret).assertEqual(false); @@ -843,14 +799,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0400 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SETNOTIFYCHARACTERISTIC_0400 * @tc.name test BLECharacteristicChangeON * @tc.desc Test On and off api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0400', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SETNOTIFYCHARACTERISTIC_0400', 0, async function (done) { function CharacteristicChange(CharacteristicChangeReq) { let serviceUuid = CharacteristicChangeReq.serviceUuid; let characteristicUuid = CharacteristicChangeReq.characteristicUuid; @@ -887,14 +842,13 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GattClose_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_GATTCLOSE_0100 * @tc.name test gattClient close * @tc.desc Test close api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattClose_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_GATTCLOSE_0100', 0, async function (done) { let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); let ret = gattClient.close(); console.info('[bluetooth_js] gattClient close ret:' + ret); @@ -903,7 +857,4 @@ describe('bluetoothBLETest', function() { }) }) -} - - - +} \ No newline at end of file diff --git a/communication/bluetooth_ble/src/main/js/test/BleService.test.js b/communication/bluetooth_gatt/src/main/js/test/BtGattService.test.js similarity index 88% rename from communication/bluetooth_ble/src/main/js/test/BleService.test.js rename to communication/bluetooth_gatt/src/main/js/test/BtGattService.test.js index 3526bc4501a0a227ff03b7047ef7b665cd1cb97a..3843ed643b9ac3ca9b2623450877b8fd854db489 100644 --- a/communication/bluetooth_ble/src/main/js/test/BleService.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/BtGattService.test.js @@ -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 diff --git a/communication/bluetooth_manager/src/main/js/test/BleAdvertiser.test.js b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattAdvertiser.test.js similarity index 91% rename from communication/bluetooth_manager/src/main/js/test/BleAdvertiser.test.js rename to communication/bluetooth_gatt/src/main/js/test/BtManagerGattAdvertiser.test.js index d9c19a149ecd33584e53dcd4d098d2bb12d50b55..18c2f2ba72a3e87c145252bb6623c318d83d8f95 100644 --- a/communication/bluetooth_manager/src/main/js/test/BleAdvertiser.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattAdvertiser.test.js @@ -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(); diff --git a/communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattManager.test.js similarity index 88% rename from communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js rename to communication/bluetooth_gatt/src/main/js/test/BtManagerGattManager.test.js index 23791fba81a9b4dff993d3409f3df49a2e8e3645..1f283092e9a9b4490f7819fbf9b1ebbed6ebc3ba 100644 --- a/communication/bluetooth_manager/src/main/js/test/BleGattManager.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattManager.test.js @@ -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(); diff --git a/communication/bluetooth_manager/src/main/js/test/BleService.test.js b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattService.test.js similarity index 92% rename from communication/bluetooth_manager/src/main/js/test/BleService.test.js rename to communication/bluetooth_gatt/src/main/js/test/BtManagerGattService.test.js index 4d81a9243664643701b829ec46b876e7349646d5..c730b80f524eeb655bfcc0561bbe6398e60fcdb0 100644 --- a/communication/bluetooth_manager/src/main/js/test/BleService.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/BtManagerGattService.test.js @@ -19,8 +19,8 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' let SppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: true, type: bluetooth.SppType.SPP_RFCOMM}; -export default function bluetoothBLETest1() { -describe('bluetoothBLETest1', function() { +export default function btManagerGattServiceTest() { +describe('btManagerGattServiceTest', function() { let gattServer = null; let gattClient = null; @@ -74,15 +74,13 @@ describe('bluetoothBLETest1', function() { /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_Connect_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_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('COMMUNICATION_BLUETOOTH_BLE_Connect_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTSERCONNECT_0100', 0, async function (done) { try { function Connected(BLEConnectChangedState) { let deviceId = BLEConnectChangedState.deviceId; @@ -105,14 +103,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0100 * @tc.name testAddService * @tc.desc Test api 401 - characteristics of service is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0100', 0, async function (done) { try { let service = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', isPrimary: true, includeServices: []}; @@ -132,14 +129,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0200 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0200', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -173,14 +169,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0300 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0300', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -219,14 +214,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_0400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0400 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_0400', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0400', 0, async function (done) { try { let characteristics = []; let arrayBufferC = new ArrayBuffer(8); @@ -254,14 +248,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_0500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0500 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_0500', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0500', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -296,14 +289,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_0600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0600 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_0600', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0600', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -343,14 +335,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_0700 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0700 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_0700', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0700', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -385,14 +376,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_0800 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0800 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_0800', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0800', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -427,14 +417,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_0900 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0900 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_0900', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_0900', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -470,14 +459,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_1000 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_1000 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_1000', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_1000', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -513,14 +501,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_1100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_1100 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_1100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_1100', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -554,14 +541,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_1200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_1200 * @tc.name testAddService * @tc.desc Test AddService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_1200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_1200', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -596,14 +582,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_2000 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2000 * @tc.name testAddService * @tc.desc Test api 401 - null gattService parameters. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_2000', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2000', 0, async function (done) { try { gattServer.addService(); expect(true).assertFalse(); @@ -618,14 +603,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_2100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2100 * @tc.name testAddService * @tc.desc Test api 401 - parameters is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_2100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2100', 0, async function (done) { try { gattServer.addService(null); expect(true).assertFalse(); @@ -640,14 +624,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_2200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2200 * @tc.name testAddService * @tc.desc Test api 401 - serviceUuid of gattService is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_2200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2200', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -682,14 +665,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_2300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2300 * @tc.name testAddService * @tc.desc Test api 401 - serviceUuid of gattService is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_2300', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2300', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -724,14 +706,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_2400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2400 * @tc.name testAddService * @tc.desc Test api 401 - isPrimary of gattService is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_2400', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2400', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -766,14 +747,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_2500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2500 * @tc.name testAddService * @tc.desc Test api 401 - isPrimary of gattService is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_2500', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2500', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -808,14 +788,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AddService_2600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2600 * @tc.name testAddService * @tc.desc Test api 401 - characteristics of gattService is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_AddService_2600', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_ADDSERVICE_2600', 0, async function (done) { try { let gattService = {serviceUuid:'00001810-0000-1000-8000-00805F9B34FB', isPrimary: true, characteristics:"123sss",includeServices:[]}; @@ -834,14 +813,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_RemoveService_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0100 * @tc.name testRemoveService * @tc.desc Test RemoveService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_RemoveService_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0100', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -879,14 +857,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_RemoveService_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0200 * @tc.name testRemoveService * @tc.desc Test RemoveService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_RemoveService_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0200', 0, async function (done) { try { gattServer.removeService('00001800-0000-1000-8000-00805f9b3442'); expect(true).assertFalse(); @@ -901,14 +878,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_RemoveService_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0300 * @tc.name testRemoveService * @tc.desc Test RemoveService api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_RemoveService_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0300', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -944,14 +920,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_RemoveService_0400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0400 * @tc.name testRemoveService * @tc.desc Test RemoveService 401-null parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_RemoveService_0400', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0400', 0, async function (done) { try { gattServer.removeService(); expect(true).assertFalse(); @@ -966,14 +941,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_RemoveService_0500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0500 * @tc.name testRemoveService * @tc.desc Test RemoveService 401-error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_RemoveService_0500', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_REMOVESERVICE_0500', 0, async function (done) { try { gattServer.removeService("sss"); expect(true).assertFalse(); @@ -987,14 +961,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_NOTIFYCHARACTERISTIC_0100 * @tc.name testNotifyCharacteristicChanged * @tc.desc Test NotifyCharacteristicChanged api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_NOTIFYCHARACTERISTIC_0100', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1024,14 +997,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_NOTIFYCHARACTERISTIC_0200 * @tc.name testNotifyCharacteristicChanged * @tc.desc Test NotifyCharacteristicChanged api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_NOTIFYCHARACTERISTIC_0200', 0, async function (done) { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1061,14 +1033,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_NOTIFYCHARACTERISTIC_0300 * @tc.name testNotifyCharacteristicChanged * @tc.desc Test NotifyCharacteristicChanged api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_NOTIFYCHARACTERISTIC_0300', 0, async function (done) { try { console.info('[bluetooth_js] COMMUNICATION_BLUETOOTH_BLE_notifyCharacteristic_0200'); gattServer.notifyCharacteristicChanged('00:11:22:33:44:55', null); @@ -1084,14 +1055,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_sendResponse_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SENDRESPONSE_0100 * @tc.name testSendResponse success * @tc.desc Test SendResponse api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_sendResponse_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SENDRESPONSE_0100', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let value = new Uint8Array(arrayBuffer); @@ -1111,14 +1081,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_sendResponse_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SENDRESPONSE_0200 * @tc.name testSendResponse success * @tc.desc Test SendResponse api. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_sendResponse_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SENDRESPONSE_0200', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let value = new Uint8Array(arrayBuffer); @@ -1138,14 +1107,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_sendResponse_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SENDRESPONSE_0300 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -null parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_sendResponse_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SENDRESPONSE_0300', 0, async function (done) { try { gattServer.sendResponse(); expect(true).assertFalse(); @@ -1160,14 +1128,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_sendResponse_0400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SENDRESPONSE_0400 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_BLE_sendResponse_0400', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SENDRESPONSE_0400', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let value = new Uint8Array(arrayBuffer); @@ -1187,14 +1154,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0333 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0333 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_SwitchOff_0333', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0333', 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); @@ -1221,14 +1187,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0555 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0555 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_SwitchOff_0555', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0555', 0, async function (done) { let SCAN_MODE_NONE = bluetooth.ScanMode.SCAN_MODE_NONE; console.info("[bluetooth_js]SCAN_MODE_NONE : " + JSON.stringify(SCAN_MODE_NONE)); expect(true).assertTrue(SCAN_MODE_NONE == 0); @@ -1257,14 +1222,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0666 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0666 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_SwitchOff_0666', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0666', 0, async function (done) { let STATE_DISCONNECTED = bluetooth.ProfileConnectionState.STATE_DISCONNECTED; console.info("[bluetooth_js]STATE_DISCONNECTED : " + JSON.stringify(STATE_DISCONNECTED)); expect(true).assertTrue(STATE_DISCONNECTED == 0); @@ -1281,14 +1245,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0777 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0777 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_SwitchOff_0777', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0777', 0, async function (done) { let SCAN_MODE_LOW_POWER = bluetooth.ScanDuty.SCAN_MODE_LOW_POWER; console.info("[bluetooth_js]STATE_DISCONNECTED : " + JSON.stringify(SCAN_MODE_LOW_POWER)); expect(true).assertTrue(SCAN_MODE_LOW_POWER == 0); @@ -1303,14 +1266,13 @@ describe('bluetoothBLETest1', function() { /** - * @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0888 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0888 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_SwitchOff_0888', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0888', 0, async function (done) { let PROFILE_A2DP_SOURCE = bluetooth.ProfileId.PROFILE_A2DP_SOURCE; console.info("[bluetooth_js]PROFILE_A2DP_SOURCE : " + JSON.stringify(PROFILE_A2DP_SOURCE)); expect(true).assertTrue(PROFILE_A2DP_SOURCE == 1); @@ -1328,14 +1290,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_0999 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0999 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_SwitchOff_0999', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_0999', 0, async function (done) { let STATE_NOT_PLAYING = bluetooth.PlayingState.STATE_NOT_PLAYING; console.info("[bluetooth_js]STATE_NOT_PLAYING : " + JSON.stringify(STATE_NOT_PLAYING)); expect(true).assertTrue(STATE_NOT_PLAYING == 0x0000); @@ -1350,14 +1311,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_1111 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_1111 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_SwitchOff_1111', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_1111', 0, async function (done) { let MAJOR_MISC = bluetooth.MajorClass.MAJOR_MISC; console.info("[bluetooth_js]MAJOR_MISC : " + JSON.stringify(MAJOR_MISC)); expect(true).assertTrue(MAJOR_MISC == 0x0000); @@ -1395,14 +1355,13 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_SwitchOff_1112 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_1112 * @tc.name testSendResponse success * @tc.desc Test SendResponse 401 -error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('COMMUNICATION_BLUETOOTH_SwitchOff_1112', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_SWITCHOFF_1112', 0, async function (done) { let COMPUTER_UNCATEGORIZED = bluetooth.MajorMinorClass.COMPUTER_UNCATEGORIZED; console.info("[bluetooth_js]COMPUTER_UNCATEGORIZED : " + JSON.stringify(COMPUTER_UNCATEGORIZED)); diff --git a/communication/bluetooth_on/src/main/js/test/List.test.js b/communication/bluetooth_gatt/src/main/js/test/List.test.js similarity index 53% rename from communication/bluetooth_on/src/main/js/test/List.test.js rename to communication/bluetooth_gatt/src/main/js/test/List.test.js index fc3472cfcec71f5146d72edd80824a09f75b76a8..21c625aaf70f0a519497cb2a4c7ab5052ae90fb2 100644 --- a/communication/bluetooth_on/src/main/js/test/List.test.js +++ b/communication/bluetooth_gatt/src/main/js/test/List.test.js @@ -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() } diff --git a/communication/bluetooth_ble/src/main/resources/base/element/string.json b/communication/bluetooth_gatt/src/main/resources/base/element/string.json similarity index 100% rename from communication/bluetooth_ble/src/main/resources/base/element/string.json rename to communication/bluetooth_gatt/src/main/resources/base/element/string.json diff --git a/communication/bluetooth_ble/src/main/resources/base/media/icon.png b/communication/bluetooth_gatt/src/main/resources/base/media/icon.png similarity index 100% rename from communication/bluetooth_ble/src/main/resources/base/media/icon.png rename to communication/bluetooth_gatt/src/main/resources/base/media/icon.png diff --git a/communication/bluetooth_profile/BUILD.gn b/communication/bluetooth_profile/BUILD.gn index 34a75db60980f98e662d2140c46ad7e4678a31cd..885db04b3e5dcc3305d207c832715461dc9adf10 100644 --- a/communication/bluetooth_profile/BUILD.gn +++ b/communication/bluetooth_profile/BUILD.gn @@ -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" } diff --git a/communication/bluetooth_profile/Test.json b/communication/bluetooth_profile/Test.json index 98c25cf1f221e623c753fdd346b3a316ba9f3ce2..4ab956907a4d87927be1cca1229e04a78a899a47 100644 --- a/communication/bluetooth_profile/Test.json +++ b/communication/bluetooth_profile/Test.json @@ -11,7 +11,7 @@ "kits": [ { "test-file-name": [ - "ActsBluetoothProFileJsTest.hap" + "ActsBluetoothProFileHapTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/communication/bluetooth_profile/src/main/js/test/BluetoothA2dp.test.js b/communication/bluetooth_profile/src/main/js/test/BluetoothA2dp.test.js index 908b846069a4612007d6387875f8f935a09dd0ab..370ba991eef8e610157583fcf47bd962876236ef 100644 --- a/communication/bluetooth_profile/src/main/js/test/BluetoothA2dp.test.js +++ b/communication/bluetooth_profile/src/main/js/test/BluetoothA2dp.test.js @@ -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 diff --git a/communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js b/communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js index 708251f61a2df7dde6c123dd0764e4740b5392e7..bd9f5f45b0088a1f4119221ec9311bfdb19c553c 100644 --- a/communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js +++ b/communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js @@ -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 diff --git a/communication/bluetooth_profile/src/main/js/test/BtManagerA2dp.test.js b/communication/bluetooth_profile/src/main/js/test/BtManagerA2dp.test.js new file mode 100644 index 0000000000000000000000000000000000000000..35b09a7849bd4bfb9616523a602889873bad72e9 --- /dev/null +++ b/communication/bluetooth_profile/src/main/js/test/BtManagerA2dp.test.js @@ -0,0 +1,84 @@ +/* + * 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 diff --git a/communication/bluetooth_profile/src/main/js/test/BtManagerHfp.test.js b/communication/bluetooth_profile/src/main/js/test/BtManagerHfp.test.js new file mode 100644 index 0000000000000000000000000000000000000000..17959e94cb1c9009670efe3fe4ef7d176071b910 --- /dev/null +++ b/communication/bluetooth_profile/src/main/js/test/BtManagerHfp.test.js @@ -0,0 +1,84 @@ +/* + * 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 diff --git a/communication/bluetooth_profile/src/main/js/test/List.test.js b/communication/bluetooth_profile/src/main/js/test/List.test.js index 53b0655583e5b5d592612648fb4ce7b62d723509..94509e607401cdd1d9fec7f92f1cfb671763c350 100644 --- a/communication/bluetooth_profile/src/main/js/test/List.test.js +++ b/communication/bluetooth_profile/src/main/js/test/List.test.js @@ -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() } diff --git a/communication/bluetooth_manager/BUILD.gn b/communication/bluetooth_scanpairing/BUILD.gn similarity index 91% rename from communication/bluetooth_manager/BUILD.gn rename to communication/bluetooth_scanpairing/BUILD.gn index 80a55acca99f0afc583948daeab8887ca174ee4c..ab7a00d2f6929fb72917cad3ab09acc22b468b2d 100644 --- a/communication/bluetooth_manager/BUILD.gn +++ b/communication/bluetooth_scanpairing/BUILD.gn @@ -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" } diff --git a/communication/bluetooth_on/Test.json b/communication/bluetooth_scanpairing/Test.json similarity index 89% rename from communication/bluetooth_on/Test.json rename to communication/bluetooth_scanpairing/Test.json index 52107048feab254c20d8c7da87f6c9402b7f855e..35729151b0ddd1cfbdb6d49f5d9c95af04ac58bd 100644 --- a/communication/bluetooth_on/Test.json +++ b/communication/bluetooth_scanpairing/Test.json @@ -11,7 +11,7 @@ "kits": [ { "test-file-name": [ - "ActsBluetoothOnHapTest.hap" + "ActsBluetoothScanPairingHapTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/communication/bluetooth_scanpairing/signature/openharmony_sx.p7b b/communication/bluetooth_scanpairing/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..36b4d13be7073b443ba69f2c5eb1f6a0bcfa1c93 Binary files /dev/null and b/communication/bluetooth_scanpairing/signature/openharmony_sx.p7b differ diff --git a/communication/bluetooth_manager/src/main/config.json b/communication/bluetooth_scanpairing/src/main/config.json similarity index 100% rename from communication/bluetooth_manager/src/main/config.json rename to communication/bluetooth_scanpairing/src/main/config.json diff --git a/communication/bluetooth_manager/src/main/js/MainAbility/app.js b/communication/bluetooth_scanpairing/src/main/js/MainAbility/app.js similarity index 100% rename from communication/bluetooth_manager/src/main/js/MainAbility/app.js rename to communication/bluetooth_scanpairing/src/main/js/MainAbility/app.js diff --git a/communication/bluetooth_on/src/main/js/MainAbility/i18n/en-US.json b/communication/bluetooth_scanpairing/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from communication/bluetooth_on/src/main/js/MainAbility/i18n/en-US.json rename to communication/bluetooth_scanpairing/src/main/js/MainAbility/i18n/en-US.json diff --git a/communication/bluetooth_on/src/main/js/MainAbility/i18n/zh-CN.json b/communication/bluetooth_scanpairing/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from communication/bluetooth_on/src/main/js/MainAbility/i18n/zh-CN.json rename to communication/bluetooth_scanpairing/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/communication/bluetooth_on/src/main/js/MainAbility/pages/index/index.css b/communication/bluetooth_scanpairing/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from communication/bluetooth_on/src/main/js/MainAbility/pages/index/index.css rename to communication/bluetooth_scanpairing/src/main/js/MainAbility/pages/index/index.css diff --git a/communication/bluetooth_on/src/main/js/MainAbility/pages/index/index.hml b/communication/bluetooth_scanpairing/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from communication/bluetooth_on/src/main/js/MainAbility/pages/index/index.hml rename to communication/bluetooth_scanpairing/src/main/js/MainAbility/pages/index/index.hml diff --git a/communication/bluetooth_on/src/main/js/MainAbility/pages/index/index.js b/communication/bluetooth_scanpairing/src/main/js/MainAbility/pages/index/index.js similarity index 100% rename from communication/bluetooth_on/src/main/js/MainAbility/pages/index/index.js rename to communication/bluetooth_scanpairing/src/main/js/MainAbility/pages/index/index.js diff --git a/communication/bluetooth_manager/src/main/js/TestAbility/app.js b/communication/bluetooth_scanpairing/src/main/js/TestAbility/app.js similarity index 100% rename from communication/bluetooth_manager/src/main/js/TestAbility/app.js rename to communication/bluetooth_scanpairing/src/main/js/TestAbility/app.js diff --git a/communication/bluetooth_manager/src/main/js/TestAbility/i18n/en-US.json b/communication/bluetooth_scanpairing/src/main/js/TestAbility/i18n/en-US.json similarity index 100% rename from communication/bluetooth_manager/src/main/js/TestAbility/i18n/en-US.json rename to communication/bluetooth_scanpairing/src/main/js/TestAbility/i18n/en-US.json diff --git a/communication/bluetooth_manager/src/main/js/TestAbility/i18n/zh-CN.json b/communication/bluetooth_scanpairing/src/main/js/TestAbility/i18n/zh-CN.json similarity index 100% rename from communication/bluetooth_manager/src/main/js/TestAbility/i18n/zh-CN.json rename to communication/bluetooth_scanpairing/src/main/js/TestAbility/i18n/zh-CN.json diff --git a/communication/bluetooth_manager/src/main/js/TestAbility/pages/index/index.css b/communication/bluetooth_scanpairing/src/main/js/TestAbility/pages/index/index.css similarity index 100% rename from communication/bluetooth_manager/src/main/js/TestAbility/pages/index/index.css rename to communication/bluetooth_scanpairing/src/main/js/TestAbility/pages/index/index.css diff --git a/communication/bluetooth_manager/src/main/js/TestAbility/pages/index/index.hml b/communication/bluetooth_scanpairing/src/main/js/TestAbility/pages/index/index.hml similarity index 100% rename from communication/bluetooth_manager/src/main/js/TestAbility/pages/index/index.hml rename to communication/bluetooth_scanpairing/src/main/js/TestAbility/pages/index/index.hml diff --git a/communication/bluetooth_manager/src/main/js/TestAbility/pages/index/index.js b/communication/bluetooth_scanpairing/src/main/js/TestAbility/pages/index/index.js similarity index 100% rename from communication/bluetooth_manager/src/main/js/TestAbility/pages/index/index.js rename to communication/bluetooth_scanpairing/src/main/js/TestAbility/pages/index/index.js diff --git a/communication/bluetooth_manager/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/communication/bluetooth_scanpairing/src/main/js/TestRunner/OpenHarmonyTestRunner.js similarity index 100% rename from communication/bluetooth_manager/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename to communication/bluetooth_scanpairing/src/main/js/TestRunner/OpenHarmonyTestRunner.js diff --git a/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js b/communication/bluetooth_scanpairing/src/main/js/test/BtBleScanResult.test.js similarity index 84% rename from communication/bluetooth_on/src/main/js/test/BleScanResult.test.js rename to communication/bluetooth_scanpairing/src/main/js/test/BtBleScanResult.test.js index 2dfd120d157bb3395c05479692fd6f5b47a676d8..d52e10ca4ab73f6b2cd8900af5df4512926c88e6 100644 --- a/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js +++ b/communication/bluetooth_scanpairing/src/main/js/test/BtBleScanResult.test.js @@ -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 diff --git a/communication/bluetooth_standard/src/main/js/test/BRDiscovery.test.js b/communication/bluetooth_scanpairing/src/main/js/test/BtDiscovery.test.js similarity index 91% rename from communication/bluetooth_standard/src/main/js/test/BRDiscovery.test.js rename to communication/bluetooth_scanpairing/src/main/js/test/BtDiscovery.test.js index e993a8599f5322264917d69d7ccc120530e488d2..ef7569c1bc4e2dc7ecd1ce0fc1097c0c3df8272a 100644 --- a/communication/bluetooth_standard/src/main/js/test/BRDiscovery.test.js +++ b/communication/bluetooth_scanpairing/src/main/js/test/BtDiscovery.test.js @@ -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(); diff --git a/communication/bluetooth_manager/src/main/js/test/BleScanResult.test.js b/communication/bluetooth_scanpairing/src/main/js/test/BtManagerBleScanResult.test.js similarity index 88% rename from communication/bluetooth_manager/src/main/js/test/BleScanResult.test.js rename to communication/bluetooth_scanpairing/src/main/js/test/BtManagerBleScanResult.test.js index 46ea77fd2130439e9abb95d7dc5d3a8917e51fb1..85c67f45a978a02d195e68531f6b452bafbc5ebf 100644 --- a/communication/bluetooth_manager/src/main/js/test/BleScanResult.test.js +++ b/communication/bluetooth_scanpairing/src/main/js/test/BtManagerBleScanResult.test.js @@ -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", diff --git a/communication/bluetooth_scanpairing/src/main/js/test/BtManagerDiscovery.test.js b/communication/bluetooth_scanpairing/src/main/js/test/BtManagerDiscovery.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7c1cd8aa2b0afd1ad3720e3796f792b4779bef86 --- /dev/null +++ b/communication/bluetooth_scanpairing/src/main/js/test/BtManagerDiscovery.test.js @@ -0,0 +1,95 @@ +/* + * 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 diff --git a/communication/bluetooth_scanpairing/src/main/js/test/BtManagerPair.test.js b/communication/bluetooth_scanpairing/src/main/js/test/BtManagerPair.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3a812967d727444592372c6de92ed772f8b10f3c --- /dev/null +++ b/communication/bluetooth_scanpairing/src/main/js/test/BtManagerPair.test.js @@ -0,0 +1,89 @@ +/* + * 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 diff --git a/communication/bluetooth_on/src/main/js/test/BluetoothPair.test.js b/communication/bluetooth_scanpairing/src/main/js/test/BtPair.test.js similarity index 86% rename from communication/bluetooth_on/src/main/js/test/BluetoothPair.test.js rename to communication/bluetooth_scanpairing/src/main/js/test/BtPair.test.js index b1230d456604c851fb65df9028ff2c12f1498fc9..cef5759927c52d69fbc195092f686b797f0eccc9 100644 --- a/communication/bluetooth_on/src/main/js/test/BluetoothPair.test.js +++ b/communication/bluetooth_scanpairing/src/main/js/test/BtPair.test.js @@ -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 diff --git a/communication/bluetooth_standard/src/main/js/test/BRScanMode.test.js b/communication/bluetooth_scanpairing/src/main/js/test/BtScanMode.test.js similarity index 89% rename from communication/bluetooth_standard/src/main/js/test/BRScanMode.test.js rename to communication/bluetooth_scanpairing/src/main/js/test/BtScanMode.test.js index 979751ab227657452967f8c740bc494f6407ddf7..93aa5806d5a27794458d244eb6bba3b2d1e15012 100644 --- a/communication/bluetooth_standard/src/main/js/test/BRScanMode.test.js +++ b/communication/bluetooth_scanpairing/src/main/js/test/BtScanMode.test.js @@ -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 diff --git a/communication/bluetooth_manager/src/main/js/test/List.test.js b/communication/bluetooth_scanpairing/src/main/js/test/List.test.js similarity index 52% rename from communication/bluetooth_manager/src/main/js/test/List.test.js rename to communication/bluetooth_scanpairing/src/main/js/test/List.test.js index c92807dcb76ea57a009e647cd1161c52dad7dc13..283570b7cc836ce694180c8e75af4483122e8539 100644 --- a/communication/bluetooth_manager/src/main/js/test/List.test.js +++ b/communication/bluetooth_scanpairing/src/main/js/test/List.test.js @@ -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() } diff --git a/communication/bluetooth_manager/src/main/resources/base/element/string.json b/communication/bluetooth_scanpairing/src/main/resources/base/element/string.json similarity index 100% rename from communication/bluetooth_manager/src/main/resources/base/element/string.json rename to communication/bluetooth_scanpairing/src/main/resources/base/element/string.json diff --git a/communication/bluetooth_manager/src/main/resources/base/media/icon.png b/communication/bluetooth_scanpairing/src/main/resources/base/media/icon.png similarity index 100% rename from communication/bluetooth_manager/src/main/resources/base/media/icon.png rename to communication/bluetooth_scanpairing/src/main/resources/base/media/icon.png diff --git a/communication/bluetooth_standard/src/main/js/test/BtManagerSetSwitch.test.js b/communication/bluetooth_standard/src/main/js/test/BtManagerSetSwitch.test.js new file mode 100644 index 0000000000000000000000000000000000000000..48d2abef152865f9394ddea041b4eabb57868c48 --- /dev/null +++ b/communication/bluetooth_standard/src/main/js/test/BtManagerSetSwitch.test.js @@ -0,0 +1,157 @@ +/* + * 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 diff --git a/communication/bluetooth_standard/src/main/js/test/BtManagerSpp.test.js b/communication/bluetooth_standard/src/main/js/test/BtManagerSpp.test.js new file mode 100644 index 0000000000000000000000000000000000000000..321ee88af6f81412e52d317d9f2319f1a6569fec --- /dev/null +++ b/communication/bluetooth_standard/src/main/js/test/BtManagerSpp.test.js @@ -0,0 +1,188 @@ +/* + * 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 diff --git a/communication/bluetooth_standard/src/main/js/test/BRSetLocalName.test.js b/communication/bluetooth_standard/src/main/js/test/BtSetLocalName.test.js similarity index 79% rename from communication/bluetooth_standard/src/main/js/test/BRSetLocalName.test.js rename to communication/bluetooth_standard/src/main/js/test/BtSetLocalName.test.js index d8aee5fdcdc9c25dcd4c59b19e341038e996a89b..b5028c73051a1c1080625699b665875566d4dced 100644 --- a/communication/bluetooth_standard/src/main/js/test/BRSetLocalName.test.js +++ b/communication/bluetooth_standard/src/main/js/test/BtSetLocalName.test.js @@ -39,8 +39,8 @@ let Btname = { +'345678901234567890123456789012345678901234567890123456789012367890123456789012345568' +'012345678901234567890123456789123' } -export default function bluetoothhostTest1() { -describe('bluetoothhostTest1', function() { +export default function btLocalNameTest() { +describe('btLocalNameTest', function() { function sleep(delay) { return new Promise(resovle => setTimeout(resovle, delay)) } @@ -86,15 +86,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0100 * @tc.name setLocalName * @tc.desc Test setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 1 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0100', 0, async function (done) { let result = bluetooth.setLocalName(Btname.LETTERS_TEST); expect(result).assertTrue(); await sleep(1000); @@ -105,15 +103,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0200 * @tc.name setLocalName * @tc.desc Test setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0200', 0, async function (done) { let result = bluetooth.setLocalName(Btname.CHINESES_TEST2); expect(result).assertTrue(); await sleep(1000); @@ -124,15 +120,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0300 * @tc.name setLocalName * @tc.desc Test setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0300', 0, async function (done) { let result = bluetooth.setLocalName(Btname.NUM_TEST); expect(result).assertTrue(); await sleep(1000); @@ -143,15 +137,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0400 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0400 * @tc.name setLocalName * @tc.desc Test setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 1 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0400', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0400', 0, async function (done) { let result = bluetooth.setLocalName(Btname.SYMBOL_TEST); expect(result).assertTrue(); await sleep(1000); @@ -162,15 +154,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0500 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0500 * @tc.name setLocalName * @tc.desc Test setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0500', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0500', 0, async function (done) { let newName = 'my bluetooth'; let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); @@ -182,15 +172,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0600 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0600 * @tc.name setLocalName * @tc.desc Test setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0600', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0600', 0, async function (done) { let newName = 'bluetooth1234ABCDEFGH'; let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); @@ -202,15 +190,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0700 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0700 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0700', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0700', 0, async function (done) { let newName = '蓝牙设备bluetooth'; let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); @@ -222,15 +208,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0800 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0800 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0800', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0800', 0, async function (done) { let result = bluetooth.setLocalName(Btname.MIXES4); expect(result).assertTrue(); await sleep(1000); @@ -241,15 +225,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0900 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0900 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0900', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_0900', 0, async function (done) { let result = bluetooth.setLocalName(Btname.MIXES2); expect(result).assertTrue(); await sleep(1000); @@ -260,15 +242,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1000 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1000 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1000', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1000', 0, async function (done) { let result = bluetooth.setLocalName(Btname.MIXES3); expect(result).assertTrue(); await sleep(1000); @@ -279,15 +259,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1100 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1100', 0, async function (done) { let newName = '蓝牙设备123'; let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); @@ -299,15 +277,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1200 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1200', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1200', 0, async function (done) { let newName = '蓝牙设备bluetooth12'; let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); @@ -319,15 +295,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1300 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1300', 0, async function (done) { let result = bluetooth.setLocalName(Btname.MIXES6); expect(result).assertTrue(); await sleep(1000); @@ -338,15 +312,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1400 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1400 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1400', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1400', 0, async function (done) { let result = bluetooth.setLocalName(Btname.MIXES); expect(result).assertTrue(); await sleep(1000); @@ -358,15 +330,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1500 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1500 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1500', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1500', 0, async function (done) { let result = bluetooth.setLocalName(Btname.MIXES5); expect(result).assertTrue(); await sleep(1000); @@ -377,15 +347,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1600 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1600 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1600', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1600', 0, async function (done) { let result = bluetooth.setLocalName(Btname.NUM_TEST1); expect(result).assertTrue(); await sleep(1000); @@ -396,15 +364,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1700 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1700 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1700', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1700', 0, async function (done) { let result = bluetooth.setLocalName(Btname.MIXES7); expect(result).assertTrue(); await sleep(1000); @@ -415,15 +381,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1800 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1800 * @tc.name TEST setLocalName * @tc.desc TEST setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1800', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1800', 0, async function (done) { let name = bluetooth.getLocalName(); let set = bluetooth.setLocalName(''); expect(set).assertFalse(); @@ -435,15 +399,13 @@ describe('bluetoothhostTest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1900 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1900 * @tc.name set LocalName * @tc.desc Test setLocalName api by promise. - * @tc.size MEDIUM - * @ since 8 * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1900', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_LOCALNAME_1900', 0, async function (done) { let localName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_1900 localName = '+ JSON.stringify(localName)); expect(true).assertEqual(localName!=null); @@ -464,7 +426,4 @@ describe('bluetoothhostTest1', function() { }) }) -} - - - +} \ No newline at end of file diff --git a/communication/bluetooth_standard/src/main/js/test/BRSwitch.test.js b/communication/bluetooth_standard/src/main/js/test/BtSetSwitch.test.js similarity index 90% rename from communication/bluetooth_standard/src/main/js/test/BRSwitch.test.js rename to communication/bluetooth_standard/src/main/js/test/BtSetSwitch.test.js index 628e1d5b6028b5b6b73067ca58d5e94b8c1b6dfb..e2db3212ef4c680f86cb886a296fb913d974f88a 100644 --- a/communication/bluetooth_standard/src/main/js/test/BRSwitch.test.js +++ b/communication/bluetooth_standard/src/main/js/test/BtSetSwitch.test.js @@ -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 diff --git a/communication/bluetooth_standard/src/main/js/test/BRSpp.test.js b/communication/bluetooth_standard/src/main/js/test/BtSpp.test.js similarity index 84% rename from communication/bluetooth_standard/src/main/js/test/BRSpp.test.js rename to communication/bluetooth_standard/src/main/js/test/BtSpp.test.js index 4748396844fe2aa383513a94a8b5f4bcb78c62e7..44d431ec8ba15b9e5df40f0ad7a735d05cf570e8 100644 --- a/communication/bluetooth_standard/src/main/js/test/BRSpp.test.js +++ b/communication/bluetooth_standard/src/main/js/test/BtSpp.test.js @@ -17,8 +17,8 @@ import bluetooth from '@ohos.bluetooth'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -export default function bluetoothhostTest4() { -describe('bluetoothhostTest4', function() { +export default function btSppTest() { +describe('btSppTest', function() { function sleep(delay) { return new Promise(resovle => setTimeout(resovle, delay)) } @@ -63,14 +63,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0100 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_0100 * @tc.name testSppListen * @tc.desc Test secure SppListen - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_0100', 0, async function (done) { let SppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: true, type: bluetooth.SppType.SPP_RFCOMM}; let serverNumber = -1; @@ -88,14 +87,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_0200 * @tc.name testSppListen * @tc.desc Test SppListen api 8 by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_0200', 0, async function (done) { let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: false, type: 0}; let serverNumber = -1; @@ -113,14 +111,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_0300 * @tc.name testSppListen * @tc.desc Test SppListen api 8 by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_0300', 0, async function (done) { let sppOption = {uuid: '00000000', secure: true, type: 0}; let serverNumber = -1; @@ -138,14 +135,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0400 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_0400 * @tc.name testSppListen * @tc.desc Test SppListen api 8 by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0400', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_0400', 0, async function (done) { let sppOption = {uuid: '00000000-0000-1000-8000-00805F9B34FB', secure: false, type: 0}; let serverNumber = -1; @@ -164,14 +160,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0500 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_0500 * @tc.name testSppAccept * @tc.desc Test SppAccept api 8 by callbck. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0500', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_0500', 0, async function (done) { function acceptClientSocket(code, number) { if (code) { @@ -186,14 +181,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0600 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_0600 * @tc.name testSppAccept * @tc.desc Test SppAccept api 8 by callbck. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0600', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_0600', 0, async function (done) { await bluetooth.sppAccept(-1, function(code, clientSocketNumber) { if (code) { console.info('[bluetooth_js] code is: ' + JSON.stringify(code)); @@ -207,14 +201,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0700 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_0700 * @tc.name testSppConnect * @tc.desc Test SppConnect api 8 by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0700', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_0700', 0, async function (done) { let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: true, type: 0}; await bluetooth.sppConnect('00:11:22:33:44:55', sppOption, function(code, number) { @@ -230,14 +223,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0800 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_0800 * @tc.name testSppConnect * @tc.desc Test SppConnect api 8 by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0800', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_0800', 0, async function (done) { let sppOption = {uuid: '0000', secure: false, type: 0}; await bluetooth.sppConnect('ABC', sppOption, function(code, clientSocketNumber) { @@ -253,14 +245,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0900 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_0900 * @tc.name testSppConnect * @tc.desc Test SppConnect api 8 by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0900', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_0900', 0, async function (done) { let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: true, type: 0}; await bluetooth.sppConnect('BT', sppOption, function(code, clientSocketNumber) { @@ -276,14 +267,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1000 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_1000 * @tc.name testsppCloseServerSocket * @tc.desc Test sppCloseServerSocket api 8 by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1000', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_1000', 0, async function (done) { let serverNumber = -1; function serverSocket(code, number) { if (code) { @@ -303,14 +293,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1000 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_1100 * @tc.name testsppCloseClientSocket * @tc.desc Test sppCloseClientSocket api 8 by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_1100', 0, async function (done) { let clientNumber = -1; await bluetooth.sppAccept(-1, function(code, clientSocketNumber) { if (code) { @@ -327,14 +316,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_1200 * @tc.name testSppWrite * @tc.desc Test sppWrite - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1200', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_1200', 0, async function (done) { let clientNumber = -1; await bluetooth.sppAccept(-1, function(code, clientSocketNumber) { if (code) { @@ -356,14 +344,13 @@ describe('bluetoothhostTest4', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_SPP_1300 * @tc.name test sppReadOn * @tc.desc Test On and Off Api - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1300', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_SPP_1300', 0, async function (done) { let clientNumber = -1; function acceptClientSocket(code, number) { if (code) { @@ -386,7 +373,4 @@ describe('bluetoothhostTest4', function() { }) -} - - - +} \ No newline at end of file diff --git a/communication/bluetooth_on/src/main/js/test/bluetoothSys.test.js b/communication/bluetooth_standard/src/main/js/test/BtSysSubscBle.test.js similarity index 94% rename from communication/bluetooth_on/src/main/js/test/bluetoothSys.test.js rename to communication/bluetooth_standard/src/main/js/test/BtSysSubscBle.test.js index 28d8d9421641726c4e92545df4a36f744fb3ef9e..bc198c5009f7f628f246cb649a26f4b96e6991de 100644 --- a/communication/bluetooth_on/src/main/js/test/bluetoothSys.test.js +++ b/communication/bluetooth_standard/src/main/js/test/BtSysSubscBle.test.js @@ -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() { diff --git a/communication/bluetooth_standard/src/main/js/test/List.test.js b/communication/bluetooth_standard/src/main/js/test/List.test.js index 31c715f0a9e80c5a219a0b3d0c46a394520bed93..7c5ca0d62262a041bd0fc939c1378c80d933e7d2 100644 --- a/communication/bluetooth_standard/src/main/js/test/List.test.js +++ b/communication/bluetooth_standard/src/main/js/test/List.test.js @@ -13,15 +13,18 @@ * limitations under the License. */ -import bluetoothhostTest1 from './BRSetLocalName.test.js' -import bluetoothhostTest2 from './BRScanMode.test.js' -import bluetoothhostTest3 from './BRDiscovery.test.js' -import bluetoothhostTest4 from './BRSpp.test.js' -import bluetoothhostTest from './BRSwitch.test.js' +import btLocalNameTest from './BtSetLocalName.test.js' +import btSwitchTest from './BtSetSwitch.test.js' +import btSppTest from './BtSpp.test.js' +import btSubscBleTest from './BtSysSubscBle.test.js' +import btManagerSppTest from './BtManagerSpp.test.js' +import btManagerSwitchTest from './BtManagerSetSwitch.test.js' + export default function testsuite() { -bluetoothhostTest1() -bluetoothhostTest2() -bluetoothhostTest3() -bluetoothhostTest4() -bluetoothhostTest() + btLocalNameTest() + btSwitchTest() + btSppTest() + btSubscBleTest() + btManagerSppTest() + btManagerSwitchTest() } diff --git a/communication/bluetooth_on/BUILD.gn b/communication/btmanager_errorcode202/BUILD.gn similarity index 91% rename from communication/bluetooth_on/BUILD.gn rename to communication/btmanager_errorcode202/BUILD.gn index ff4368703f2ce3b382d744c7d4583490b317dee5..8abe2d7506b3498dc8b4a3821e75d2e6b4b9c273 100644 --- a/communication/bluetooth_on/BUILD.gn +++ b/communication/btmanager_errorcode202/BUILD.gn @@ -12,7 +12,7 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ActsBluetoothOnJsTest") { +ohos_js_hap_suite("ActsBtManagerErrorCode202JsTest") { hap_profile = "./src/main/config.json" deps = [ ":bluetooth_js_assets", @@ -20,7 +20,7 @@ ohos_js_hap_suite("ActsBluetoothOnJsTest") { ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsBluetoothOnHapTest" + hap_name = "ActsBtManagerErrorCode202HapTest" part_name = "bluetooth" subsystem_name = "communication" } diff --git a/communication/bluetooth_manager/Test.json b/communication/btmanager_errorcode202/Test.json similarity index 89% rename from communication/bluetooth_manager/Test.json rename to communication/btmanager_errorcode202/Test.json index 7f0bc37165c15943732899c8cbd79f628aad496d..5b4a88c9e48963b48c635477dbb3ef146c2fc4b4 100644 --- a/communication/bluetooth_manager/Test.json +++ b/communication/btmanager_errorcode202/Test.json @@ -11,7 +11,7 @@ "kits": [ { "test-file-name": [ - "ActsBluetoothBleManagerHapTest.hap" + "ActsBtManagerErrorCode202HapTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/communication/bluetooth_switchoff/signature/openharmony_sx.p7b b/communication/btmanager_errorcode202/signature/openharmony_sx.p7b similarity index 62% rename from communication/bluetooth_switchoff/signature/openharmony_sx.p7b rename to communication/btmanager_errorcode202/signature/openharmony_sx.p7b index 9a224618b8d226815a7c692e3b09197a6796b502..988e6f5d8c5855aaee883014fd5f2618e0cbd89c 100644 Binary files a/communication/bluetooth_switchoff/signature/openharmony_sx.p7b and b/communication/btmanager_errorcode202/signature/openharmony_sx.p7b differ diff --git a/communication/btmanager_errorcode202/src/main/config.json b/communication/btmanager_errorcode202/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a434e4b0083c7ab3eb1b4381125ad37044cdcaec --- /dev/null +++ b/communication/btmanager_errorcode202/src/main/config.json @@ -0,0 +1,145 @@ +{ + "app": { + "bundleName": "ohos.acts.communication.bluetooth.bluetoothhost", + "vendor": "acts", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.communication.bluetooth.bluetoothhost", + "name": ".entry", + "deviceType": [ + "tablet", + "default", + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.USE_BLUETOOTH", + "reason": "", + "usedScene": { + "ability": [ + "ohos.acts.communication.bluetooth.bluetoothhost.MainAbility" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.MANAGE_BLUETOOTH", + "reason": "", + "usedScene": { + "ability": [ + "ohos.acts.communication.bluetooth.bluetoothhost.MainAbility" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.DISCOVER_BLUETOOTH", + "reason": "", + "usedScene": { + "ability": [ + "ohos.acts.communication.bluetooth.bluetoothhost.MainAbility" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.LOCATION", + "reason": "", + "usedScene": { + "ability": [ + "ohos.acts.communication.bluetooth.bluetoothhost.MainAbility" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", + "reason": "" + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + }, + "mainAbility": ".MainAbility", + "srcPath": "" + } +} \ No newline at end of file diff --git a/communication/bluetooth_on/src/main/js/MainAbility/app.js b/communication/btmanager_errorcode202/src/main/js/MainAbility/app.js similarity index 100% rename from communication/bluetooth_on/src/main/js/MainAbility/app.js rename to communication/btmanager_errorcode202/src/main/js/MainAbility/app.js diff --git a/communication/bluetooth_manager/src/main/js/MainAbility/i18n/en-US.json b/communication/btmanager_errorcode202/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from communication/bluetooth_manager/src/main/js/MainAbility/i18n/en-US.json rename to communication/btmanager_errorcode202/src/main/js/MainAbility/i18n/en-US.json diff --git a/communication/bluetooth_manager/src/main/js/MainAbility/i18n/zh-CN.json b/communication/btmanager_errorcode202/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from communication/bluetooth_manager/src/main/js/MainAbility/i18n/zh-CN.json rename to communication/btmanager_errorcode202/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/communication/bluetooth_manager/src/main/js/MainAbility/pages/index/index.css b/communication/btmanager_errorcode202/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from communication/bluetooth_manager/src/main/js/MainAbility/pages/index/index.css rename to communication/btmanager_errorcode202/src/main/js/MainAbility/pages/index/index.css diff --git a/communication/bluetooth_manager/src/main/js/MainAbility/pages/index/index.hml b/communication/btmanager_errorcode202/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from communication/bluetooth_manager/src/main/js/MainAbility/pages/index/index.hml rename to communication/btmanager_errorcode202/src/main/js/MainAbility/pages/index/index.hml diff --git a/communication/bluetooth_manager/src/main/js/MainAbility/pages/index/index.js b/communication/btmanager_errorcode202/src/main/js/MainAbility/pages/index/index.js similarity index 100% rename from communication/bluetooth_manager/src/main/js/MainAbility/pages/index/index.js rename to communication/btmanager_errorcode202/src/main/js/MainAbility/pages/index/index.js diff --git a/communication/bluetooth_on/src/main/js/TestAbility/app.js b/communication/btmanager_errorcode202/src/main/js/TestAbility/app.js similarity index 100% rename from communication/bluetooth_on/src/main/js/TestAbility/app.js rename to communication/btmanager_errorcode202/src/main/js/TestAbility/app.js diff --git a/communication/bluetooth_on/src/main/js/TestAbility/i18n/en-US.json b/communication/btmanager_errorcode202/src/main/js/TestAbility/i18n/en-US.json similarity index 100% rename from communication/bluetooth_on/src/main/js/TestAbility/i18n/en-US.json rename to communication/btmanager_errorcode202/src/main/js/TestAbility/i18n/en-US.json diff --git a/communication/bluetooth_on/src/main/js/TestAbility/i18n/zh-CN.json b/communication/btmanager_errorcode202/src/main/js/TestAbility/i18n/zh-CN.json similarity index 100% rename from communication/bluetooth_on/src/main/js/TestAbility/i18n/zh-CN.json rename to communication/btmanager_errorcode202/src/main/js/TestAbility/i18n/zh-CN.json diff --git a/communication/bluetooth_on/src/main/js/TestAbility/pages/index/index.css b/communication/btmanager_errorcode202/src/main/js/TestAbility/pages/index/index.css similarity index 100% rename from communication/bluetooth_on/src/main/js/TestAbility/pages/index/index.css rename to communication/btmanager_errorcode202/src/main/js/TestAbility/pages/index/index.css diff --git a/communication/bluetooth_on/src/main/js/TestAbility/pages/index/index.hml b/communication/btmanager_errorcode202/src/main/js/TestAbility/pages/index/index.hml similarity index 100% rename from communication/bluetooth_on/src/main/js/TestAbility/pages/index/index.hml rename to communication/btmanager_errorcode202/src/main/js/TestAbility/pages/index/index.hml diff --git a/communication/bluetooth_on/src/main/js/TestAbility/pages/index/index.js b/communication/btmanager_errorcode202/src/main/js/TestAbility/pages/index/index.js similarity index 100% rename from communication/bluetooth_on/src/main/js/TestAbility/pages/index/index.js rename to communication/btmanager_errorcode202/src/main/js/TestAbility/pages/index/index.js diff --git a/communication/bluetooth_on/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/communication/btmanager_errorcode202/src/main/js/TestRunner/OpenHarmonyTestRunner.js similarity index 100% rename from communication/bluetooth_on/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename to communication/btmanager_errorcode202/src/main/js/TestRunner/OpenHarmonyTestRunner.js diff --git a/communication/btmanager_errorcode202/src/main/js/test/BtManagerErrorCode202.test.js b/communication/btmanager_errorcode202/src/main/js/test/BtManagerErrorCode202.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6815b137a9751fa3f10c6238c13c752a1e190b7a --- /dev/null +++ b/communication/btmanager_errorcode202/src/main/js/test/BtManagerErrorCode202.test.js @@ -0,0 +1,175 @@ + +/* + * 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 bluetooth from '@ohos.bluetoothManager'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' + + +export default function btManagerErrorCode202Test() { +describe('btManagerErrorCode202Test', function() { + function sleep(delay) { + return new Promise(resovle => setTimeout(resovle, delay)) + } + + async function tryToEnableBt() { + let sta = bluetooth.getState(); + switch(sta){ + case 0: + console.info('[bluetooth_js] bt turn off:'+ JSON.stringify(sta)); + bluetooth.enableBluetooth(); + await sleep(10000); + 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: + console.info('[bluetooth_js] bt turning off:'+ JSON.stringify(sta)); + bluetooth.enableBluetooth(); + await sleep(10000); + 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_ERROR202_0100 + * @tc.name test cancelPairedDevice + * @tc.desc Test api 202 - Non-system applications are not allowed to use system APIs. + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_COMMUNICATION_BTMANAGER_PAIR_ERROR202_0100', 0, async function (done) { + try { + bluetooth.cancelPairedDevice('11:22:33:44:55:66'); + } catch (err) { + console.info('errCode: ' + err.code + ',errMessage: ' + err.message); + expect(err.code).assertEqual("202"); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BTMANAGER_HOSTCONN_ERROR202_0200 + * @tc.name test hid host disconnect + * @tc.desc Test api 202 - Non-system applications are not allowed to use system APIs. + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_COMMUNICATION_BTMANAGER_HOSTCONN_ERROR202_0200', 0, async function (done) { + try { + let hidHostProfile = bluetooth.getProfileInstance(bluetooth.ProfileId.PROFILE_HID_HOST); + hidHostProfile.disconnect('11:22:33:44:55:66'); + } catch (err) { + console.info('errCode: ' + err.code + ',errMessage: ' + err.message); + expect(err.code).assertEqual('202'); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BTMANAGER_PANDISCONN_ERROR202_0100 + * @tc.name test pan disconnect + * @tc.desc Test api 202 - Non-system applications are not allowed to use system APIs. + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_COMMUNICATION_BTMANAGER_PANDISCONN_ERROR202_0100', 0, async function (done) { + try { + let panProfile = bluetooth.getProfileInstance(bluetooth.ProfileId.PROFILE_PAN_NETWORK); + panProfile.disconnect('11:22:33:44:55:66'); + } catch (err) { + console.info('errCode: ' + err.code + ',errMessage: ' + err.message); + expect(err.code).assertEqual('202'); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BTMANAGER_TETHERING_ERROR202_0100 + * @tc.name test setTethering + * @tc.desc Test api 202 - Non-system applications are not allowed to use system APIs. + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_COMMUNICATION_BTMANAGER_TETHERING_ERROR202_0100', 0, async function (done) { + try { + let panProfile = bluetooth.getProfileInstance(bluetooth.ProfileId.PROFILE_PAN_NETWORK); + panProfile.setTethering(true); + } catch (err) { + console.info('errCode: ' + err.code + ',errMessage: ' + err.message); + expect(err.code).assertEqual('202'); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BTMANAGER_TETHERING_ERROR202_0200 + * @tc.name test setTethering + * @tc.desc Test api 202 - Non-system applications are not allowed to use system APIs. + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_COMMUNICATION_BTMANAGER_TETHERING_ERROR202_0200', 0, async function (done) { + try { + let panProfile = bluetooth.getProfileInstance(bluetooth.ProfileId.PROFILE_PAN_NETWORK); + panProfile.setTethering(false); + } catch (err) { + console.info('errCode: ' + err.code + ',errMessage: ' + err.message); + expect(err.code).assertEqual('202'); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BTMANAGER_TETHERING_ERROR202_0300 + * @tc.name test isTetheringOn + * @tc.desc Test api 202 - Non-system applications are not allowed to use system APIs. + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_COMMUNICATION_BTMANAGER_TETHERING_ERROR202_0200', 0, async function (done) { + try { + let panProfile = bluetooth.getProfileInstance(bluetooth.ProfileId.PROFILE_PAN_NETWORK); + let ret = panProfile.isTetheringOn(); + } catch (err) { + console.info('errCode: ' + err.code + ',errMessage: ' + err.message); + expect(err.code).assertEqual('202'); + } + done(); + }) + +}) + +} \ No newline at end of file diff --git a/communication/btmanager_errorcode202/src/main/js/test/List.test.js b/communication/btmanager_errorcode202/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e35ac36e03938bf89975ba88e785047b476d98ac --- /dev/null +++ b/communication/btmanager_errorcode202/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 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 btManagerErrorCode202Test from './BtManagerErrorCode202.test.js' +export default function testsuite() { + btManagerErrorCode202Test() +} diff --git a/communication/bluetooth_on/src/main/resources/base/element/string.json b/communication/btmanager_errorcode202/src/main/resources/base/element/string.json similarity index 100% rename from communication/bluetooth_on/src/main/resources/base/element/string.json rename to communication/btmanager_errorcode202/src/main/resources/base/element/string.json diff --git a/communication/bluetooth_on/src/main/resources/base/media/icon.png b/communication/btmanager_errorcode202/src/main/resources/base/media/icon.png similarity index 100% rename from communication/bluetooth_on/src/main/resources/base/media/icon.png rename to communication/btmanager_errorcode202/src/main/resources/base/media/icon.png diff --git a/communication/bluetooth_switchoff/BUILD.gn b/communication/btmanager_errorcode401/BUILD.gn similarity index 91% rename from communication/bluetooth_switchoff/BUILD.gn rename to communication/btmanager_errorcode401/BUILD.gn index 7384c1fb548877233afb66f6f964b42328300279..658b06f518cd799ade6f96083278e4cd28309ff9 100644 --- a/communication/bluetooth_switchoff/BUILD.gn +++ b/communication/btmanager_errorcode401/BUILD.gn @@ -12,7 +12,7 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ActsBluetoothSwitchTest") { +ohos_js_hap_suite("ActsBtManagerErrorCode401JsTest") { hap_profile = "./src/main/config.json" deps = [ ":bluetooth_js_assets", @@ -20,7 +20,7 @@ ohos_js_hap_suite("ActsBluetoothSwitchTest") { ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsBluetoothSwitchHapTest" + hap_name = "ActsBtManagerErrorCode401HapTest" part_name = "bluetooth" subsystem_name = "communication" } diff --git a/communication/btmanager_errorcode401/Test.json b/communication/btmanager_errorcode401/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4f882f32cdc92bd40181ae15642f67e8b828b5bf --- /dev/null +++ b/communication/btmanager_errorcode401/Test.json @@ -0,0 +1,26 @@ +{ + "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": [ + "ActsBtManagerErrorCode401HapTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "svc bluetooth enable" + ] + } + ] +} \ No newline at end of file diff --git a/communication/bluetooth_manager/signature/openharmony_sx.p7b b/communication/btmanager_errorcode401/signature/openharmony_sx.p7b similarity index 100% rename from communication/bluetooth_manager/signature/openharmony_sx.p7b rename to communication/btmanager_errorcode401/signature/openharmony_sx.p7b diff --git a/communication/bluetooth_switchoff/src/main/config.json b/communication/btmanager_errorcode401/src/main/config.json similarity index 100% rename from communication/bluetooth_switchoff/src/main/config.json rename to communication/btmanager_errorcode401/src/main/config.json diff --git a/communication/bluetooth_switchoff/src/main/js/MainAbility/app.js b/communication/btmanager_errorcode401/src/main/js/MainAbility/app.js similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/MainAbility/app.js rename to communication/btmanager_errorcode401/src/main/js/MainAbility/app.js diff --git a/communication/bluetooth_switchoff/src/main/js/MainAbility/i18n/en-US.json b/communication/btmanager_errorcode401/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/MainAbility/i18n/en-US.json rename to communication/btmanager_errorcode401/src/main/js/MainAbility/i18n/en-US.json diff --git a/communication/bluetooth_switchoff/src/main/js/MainAbility/i18n/zh-CN.json b/communication/btmanager_errorcode401/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/MainAbility/i18n/zh-CN.json rename to communication/btmanager_errorcode401/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/communication/bluetooth_switchoff/src/main/js/MainAbility/pages/index/index.css b/communication/btmanager_errorcode401/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/MainAbility/pages/index/index.css rename to communication/btmanager_errorcode401/src/main/js/MainAbility/pages/index/index.css diff --git a/communication/bluetooth_switchoff/src/main/js/MainAbility/pages/index/index.hml b/communication/btmanager_errorcode401/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/MainAbility/pages/index/index.hml rename to communication/btmanager_errorcode401/src/main/js/MainAbility/pages/index/index.hml diff --git a/communication/bluetooth_switchoff/src/main/js/MainAbility/pages/index/index.js b/communication/btmanager_errorcode401/src/main/js/MainAbility/pages/index/index.js similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/MainAbility/pages/index/index.js rename to communication/btmanager_errorcode401/src/main/js/MainAbility/pages/index/index.js diff --git a/communication/bluetooth_switchoff/src/main/js/TestAbility/app.js b/communication/btmanager_errorcode401/src/main/js/TestAbility/app.js similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/TestAbility/app.js rename to communication/btmanager_errorcode401/src/main/js/TestAbility/app.js diff --git a/communication/bluetooth_switchoff/src/main/js/TestAbility/i18n/en-US.json b/communication/btmanager_errorcode401/src/main/js/TestAbility/i18n/en-US.json similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/TestAbility/i18n/en-US.json rename to communication/btmanager_errorcode401/src/main/js/TestAbility/i18n/en-US.json diff --git a/communication/bluetooth_switchoff/src/main/js/TestAbility/i18n/zh-CN.json b/communication/btmanager_errorcode401/src/main/js/TestAbility/i18n/zh-CN.json similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/TestAbility/i18n/zh-CN.json rename to communication/btmanager_errorcode401/src/main/js/TestAbility/i18n/zh-CN.json diff --git a/communication/bluetooth_switchoff/src/main/js/TestAbility/pages/index/index.css b/communication/btmanager_errorcode401/src/main/js/TestAbility/pages/index/index.css similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/TestAbility/pages/index/index.css rename to communication/btmanager_errorcode401/src/main/js/TestAbility/pages/index/index.css diff --git a/communication/bluetooth_switchoff/src/main/js/TestAbility/pages/index/index.hml b/communication/btmanager_errorcode401/src/main/js/TestAbility/pages/index/index.hml similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/TestAbility/pages/index/index.hml rename to communication/btmanager_errorcode401/src/main/js/TestAbility/pages/index/index.hml diff --git a/communication/bluetooth_switchoff/src/main/js/TestAbility/pages/index/index.js b/communication/btmanager_errorcode401/src/main/js/TestAbility/pages/index/index.js similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/TestAbility/pages/index/index.js rename to communication/btmanager_errorcode401/src/main/js/TestAbility/pages/index/index.js diff --git a/communication/bluetooth_switchoff/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/communication/btmanager_errorcode401/src/main/js/TestRunner/OpenHarmonyTestRunner.js similarity index 100% rename from communication/bluetooth_switchoff/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename to communication/btmanager_errorcode401/src/main/js/TestRunner/OpenHarmonyTestRunner.js diff --git a/communication/bluetooth_manager/src/main/js/test/BleAdvertiser401.test.js b/communication/btmanager_errorcode401/src/main/js/test/BtMGattAdvertiser401.test.js similarity index 89% rename from communication/bluetooth_manager/src/main/js/test/BleAdvertiser401.test.js rename to communication/btmanager_errorcode401/src/main/js/test/BtMGattAdvertiser401.test.js index b6aa57671f83125f1b6a379287e3bf168faecbd8..dc8a31b0f28e996305348f0f2af5b56b0092ef2b 100644 --- a/communication/bluetooth_manager/src/main/js/test/BleAdvertiser401.test.js +++ b/communication/btmanager_errorcode401/src/main/js/test/BtMGattAdvertiser401.test.js @@ -19,8 +19,8 @@ import bluetooth from '@ohos.bluetoothManager'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -export default function bluetoothBLETest5() { -describe('bluetoothBLETest5', function() { +export default function btManagerAdvertError401Test() { +describe('btManagerAdvertError401Test', function() { let gattServer = null; function sleep(delay) { return new Promise(resovle => setTimeout(resovle, delay)) @@ -70,15 +70,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3000 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3000 * @tc.name testStartAdvertising * @tc.desc Test api 401 - parameters setting is null. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 0 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3000', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3000', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -124,15 +122,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3100 * @tc.name testStartAdvertising * @tc.desc Test api 401 - parameters setting is error type. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3100', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -178,15 +174,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3200 * @tc.name testStartAdvertising * @tc.desc Test api 401 - interval of setting is error type. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3200', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -226,15 +220,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3300 * @tc.name testStartAdvertising * @tc.desc Test api 401 - txPower of setting is error type. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3300', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3300', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -274,15 +266,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3400 * @tc.name testStartAdvertising * @tc.desc Test api 401 - connectable of setting is error type. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3400', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3400', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -322,15 +312,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3500 * @tc.name testStartAdvertising * @tc.desc Test api 401 - parameters advData is null. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3500', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3500', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -359,15 +347,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3600 * @tc.name testStartAdvertising * @tc.desc Test api 401 - serviceUuids of advData is null. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3600', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3600', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -406,15 +392,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3700 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3700 * @tc.name testStartAdvertising * @tc.desc Test api 401 - manufactureData of advData is null. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3700', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3700', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -450,15 +434,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3800 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3800 * @tc.name testStartAdvertising * @tc.desc Test api 401 - serviceData of advData is null. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3800', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3800', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; @@ -494,15 +476,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3900 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3900 * @tc.name testStartAdvertising * @tc.desc Test api 401 - manufactureValue of advData is error type. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_3900', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_3900', 0, async function (done) { let serviceValueBuffer = new Uint8Array(4); serviceValueBuffer[0] = 4; serviceValueBuffer[1] = 6; @@ -537,15 +517,13 @@ describe('bluetoothBLETest5', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_4000 + * @tc.number SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_4000 * @tc.name testStartAdvertising * @tc.desc Test api 401 - serviceValue of advData is error type. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_4000', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_GATTADVERT_ERROR_4000', 0, async function (done) { let manufactureValueBuffer = new Uint8Array(4); manufactureValueBuffer[0] = 1; manufactureValueBuffer[1] = 2; diff --git a/communication/bluetooth_manager/src/main/js/test/BleGattManager401.test.js b/communication/btmanager_errorcode401/src/main/js/test/BtMGattManager401.test.js similarity index 85% rename from communication/bluetooth_manager/src/main/js/test/BleGattManager401.test.js rename to communication/btmanager_errorcode401/src/main/js/test/BtMGattManager401.test.js index 152faeeaff962abd90f7a100c067b8b7c2dc701c..d5bbd869d6f50da132267ecae6517eb5b752364a 100644 --- a/communication/bluetooth_manager/src/main/js/test/BleGattManager401.test.js +++ b/communication/btmanager_errorcode401/src/main/js/test/BtMGattManager401.test.js @@ -17,8 +17,8 @@ import bluetooth from '@ohos.bluetoothManager'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -export default function bluetoothBLETest4() { -describe('bluetoothBLETest4', function() { +export default function btManagerMError401Test() { +describe('btManagerMError401Test', function() { let gattClient = null; function sleep(delay) { return new Promise(resovle => setTimeout(resovle, delay)) @@ -68,15 +68,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_MtuSize_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_MTUSIZE_ERROR_0200 * @tc.name testSetBLEMtuSize * @tc.desc Test api 401 - Invalid null parameters. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 1 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0200', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_MTUSIZE_ERROR_0200', 0, function () { try { gattClient.setBLEMtuSize(); expect(true).assertFalse(); @@ -88,15 +86,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_MtuSize_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_MTUSIZE_ERROR_0300 * @tc.name testSetBLEMtuSize * @tc.desc Test api 401 -error type. - * @tc.size MEDIUM - * @ since 7 * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_MtuSize_0300', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_MTUSIZE_ERROR_0300', 0, function () { try { gattClient.setBLEMtuSize(null); expect(true).assertFalse(); @@ -108,14 +104,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0100 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - Invalid null parameters. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0100', 0, async function (done) { try { await gattClient.readCharacteristicValue().then((data) => { if (object != null) { @@ -138,14 +133,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0200 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - Invalid null parameters. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0200', 0, async function (done) { try { await gattClient.readCharacteristicValue(null).then((data) => { console.info('[bluetooth_js] readCharacValue promise data:' @@ -164,14 +158,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0300 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - null serviceUuid. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0300', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -205,14 +198,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0400 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if serviceUuid type is error. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0400', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0400', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -246,14 +238,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0500 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - null characteristicUuid. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0500', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0500', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -286,14 +277,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0600 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if characteristicUuid is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0600', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0600', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -327,14 +317,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0700 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0700 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - null characteristicValue. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0700', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0700', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -364,14 +353,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0800 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0800 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if characteristicValue is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0800', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0800', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -402,14 +390,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0900 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0900 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - null descriptors. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0900', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_0900', 0, async function (done) { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); cccValue[0] = 32; @@ -433,14 +420,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1000 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1000 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if descriptors type is error. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1000', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1000', 0, async function (done) { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); cccValue[0] = 32; @@ -465,14 +451,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1100 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if serviceUuid of descriptors is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1100', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -506,14 +491,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1200 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if serviceUuid of descriptors is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1200', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -547,14 +531,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1300 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if descriptorUuid of descriptors is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1300', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1300', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -587,14 +570,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1400 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if descriptorUuid of descriptors is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1400', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1400', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -628,14 +610,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1500 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if descriptorValue of descriptors is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1500', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1500', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -668,14 +649,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1600 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - if descriptorValue of descriptors is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1600', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1600', 0, async function (done) { let descriptors = []; let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', @@ -706,14 +686,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1700 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1700 * @tc.name testReadDescriptorValue * @tc.desc Test 401 -null api by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1700', 0, async function(done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_', 0, async function(done) { try { gattClient.readCharacteristicValue(); expect(true).assertFalse(); @@ -727,14 +706,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1800 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1800 * @tc.name testReadDescriptorValue * @tc.desc Test 401 -null readCharacteristicValue by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_1800', 0, async function(done) { + it('SUB_COMMUNICATION_BTMANAGER_READCHARACTERISTIC_ERROR_1800', 0, async function(done) { try { function readCcc(code, BLECharacteristic) { if (coderror.code != 0) { @@ -758,14 +736,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0100 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - null descriptor. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0100', 0, async function (done) { try { await gattClient.readDescriptorValue().then((object) => { if (object != null) { @@ -787,14 +764,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0200 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - descriptor is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0200', 0, async function (done) { try { await gattClient.readDescriptorValue(null).then((object) => { if (object != null) { @@ -819,14 +795,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0300 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - serviceUuid of descriptor is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0300', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0300', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -858,14 +833,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0400 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - serviceUuid of descriptor is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0400', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0400', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -897,14 +871,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0500 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - characteristicUuid of descriptor is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0500', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0500', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -935,14 +908,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0600 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - characteristicUuid of descriptor is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0600', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0600', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -974,14 +946,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0700 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0700 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - descriptorUuid of descriptor is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0700', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0700', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -1012,14 +983,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0800 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0800 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - descriptorUuid of descriptor is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0800', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0800', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -1051,14 +1021,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0900 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0900 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - descriptorValue of descriptor is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0900', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_0900', 0, async function (done) { try { let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001830-0000-1000-8000-00805F9B34FB', @@ -1086,14 +1055,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1000 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_1000 * @tc.name testReadDescriptorValue * @tc.desc Test 401 - descriptorValue of descriptor is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1000', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_1000', 0, async function (done) { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -1125,14 +1093,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_1100 * @tc.name testReadDescriptorValue * @tc.desc Test 401 -null readDescriptorValue by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_1100', 0, async function (done) { try { gattClient.readDescriptorValue(); expect(true).assertFalse(); @@ -1146,14 +1113,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_1200 * @tc.name testReadDescriptorValue * @tc.desc Test 401 -null readDescriptorValue by callback. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_1200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_READDESCRIPTOR_ERROR_1200', 0, async function (done) { try { function readDesc(code, BLEDescriptor) { if (code.code != 0) { @@ -1177,14 +1143,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0100 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 - api of null parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0100', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0100', 0, function () { try { gattClient.writeCharacteristicValue(); expect(true).assertFalse(); @@ -1196,14 +1161,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0200 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 - api of error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0200', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0200', 0, function () { try { gattClient.writeCharacteristicValue(null); expect(true).assertFalse(); @@ -1215,14 +1179,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0300 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -null serviceUuid. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0300', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0300', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1248,14 +1211,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0400 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -serviceUuid is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0400', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0400', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1281,14 +1243,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0500 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 - null characteristicUuid. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0500', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0500', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1313,14 +1274,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0600 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 - characteristicUuid is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0600', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0600', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1346,14 +1306,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0700 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0700 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 - null characteristicValue. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0700', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0700', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1376,14 +1335,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0800 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0800 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 - characteristicValue is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0800', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0800', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1406,14 +1364,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0900 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0900 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 - null descriptors. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0900', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_0900', 0, function () { try { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); @@ -1431,14 +1388,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1000 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1000 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -descriptors is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1000', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1000', 0, function () { try { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); @@ -1456,14 +1412,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1100 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -null serviceUuid of descriptors. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1100', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1100', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1489,14 +1444,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1200 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -serviceUuid of descriptors is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1200', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1200', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1522,14 +1476,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1300 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -characteristicUuid of descriptors is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1300', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1300', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1554,14 +1507,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1400 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -characteristicUuid of descriptors is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1400', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1400', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1587,14 +1539,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1500 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -descriptorUuid of descriptors is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1500', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1500', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1620,14 +1571,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1600 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -descriptorUuid of descriptors is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1600', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1600', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1653,14 +1603,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1700 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1700 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -descriptorValue of descriptors is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1700', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1600', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -1686,14 +1635,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1800 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1800 * @tc.name testWriteCharacteristicValue * @tc.desc Test 401 -descriptorValue of descriptors is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_1800', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITECHARACTERISTIC_ERROR_1800', 0, function () { try { let descriptors = []; let descriptor = {serviceUuid:'00001820-0000-1000-8000-00805F9B34FB', @@ -1716,14 +1664,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0100 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - api is null parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0100', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0100', 0, function () { try { gattClient.writeDescriptorValue(); expect(true).assertFalse(); @@ -1735,14 +1682,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0200 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - api is error parameter. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0200', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0200', 0, function () { try { gattClient.writeDescriptorValue(null); expect(true).assertFalse(); @@ -1754,14 +1700,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0300 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - null serviceUuid. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0300', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0300', 0, function () { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -1779,14 +1724,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0400 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - serviceUuid is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0400', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0400', 0, function () { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -1804,14 +1748,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0500 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - characteristicUuid is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0500', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0500', 0, function () { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -1828,14 +1771,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0600 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - characteristicUuid is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0600', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0600', 0, function () { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -1853,14 +1795,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0700 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0700 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - descriptorUuid is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0700', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0700', 0, function () { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -1877,14 +1818,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0800 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0800 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - descriptorUuid is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0800', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0800', 0, function () { try { let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); @@ -1902,14 +1842,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0900 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0900 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - descriptorValue is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0900', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_0900', 0, function () { try { let descriptor = {serviceUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', @@ -1924,14 +1863,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_1000 + * @tc.number SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_1000 * @tc.name testWriteDescriptorValue * @tc.desc Test 401 - descriptorValue is error type. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_1000', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_WRITEDESCRIPTOR_ERROR_1000', 0, function () { try { let descriptor = {serviceUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', @@ -1946,14 +1884,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0100 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - parameter of api is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0100', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0100', 0, function () { try { gattClient.setNotifyCharacteristicChanged(); expect(true).assertFalse(); @@ -1965,14 +1902,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0200 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - first parameter of api is error type . - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0200', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0200', 0, function () { try { gattClient.setNotifyCharacteristicChanged(null, true); expect(true).assertFalse(); @@ -1984,14 +1920,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0300 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0300 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - second parameter of api is null . - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0300', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0300', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -2018,14 +1953,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0400 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0400 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - serviceUuid is null . - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0400', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0400', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -2052,14 +1986,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0500 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0500 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - serviceUuid is error type . - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0500', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0500', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -2086,14 +2019,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0600 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0600 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - characteristicUuid is null . - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0600', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0600', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -2119,14 +2051,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0700 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0700 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - characteristicUuid is error type . - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0700', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0700', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -2153,14 +2084,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0800 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0800 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - characteristicValue is null . - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0800', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0800', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -2186,14 +2116,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0900 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0900 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - characteristicValue is error type . - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0900', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_0900', 0, function () { try { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); @@ -2217,14 +2146,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1000 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_1000 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - descriptors is null. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1000', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_1000', 0, function () { try { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); @@ -2242,14 +2170,14 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_1100 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test 401 - descriptors is error type. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_1100', 0, function () { + it('SUB_COMMUNICATION_BTMANAGER_SETNOTIFYCHARACTERISTIC_ERROR_1100', 0, function () { try { let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); @@ -2267,14 +2195,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_createGattClientDevice_0100 + * @tc.number SUB_COMMUNICATION_BTMANAGER_CREATEGATTCLIDEV_ERROR_0100 * @tc.name test createGattClientDevice * @tc.desc Test createGattClientDevice 401. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_createGattClientDevice_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_CREATEGATTCLIDEV_ERROR_0100', 0, async function (done) { try { let gattClient = bluetooth.BLE.createGattClientDevice(); gattClient.close(); @@ -2289,14 +2216,13 @@ describe('bluetoothBLETest4', function() { }) /** - * @tc.number COMMUNICATION_BLUETOOTH_BLE_createGattClientDevice_0200 + * @tc.number SUB_COMMUNICATION_BTMANAGER_CREATEGATTCLIDEV_ERROR_0200 * @tc.name test createGattClientDevice * @tc.desc Test createGattClientDevice 401. - * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('COMMUNICATION_BLUETOOTH_BLE_createGattClientDevice_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BTMANAGER_CREATEGATTCLIDEV_ERROR_0200', 0, async function (done) { try { let gattClient = bluetooth.BLE.createGattClientDevice(null); gattClient.close(); diff --git a/communication/bluetooth_ble/src/main/js/test/List.test.js b/communication/btmanager_errorcode401/src/main/js/test/List.test.js similarity index 72% rename from communication/bluetooth_ble/src/main/js/test/List.test.js rename to communication/btmanager_errorcode401/src/main/js/test/List.test.js index 29919a2e57cb5ec15d03c46fef97a624a39cdd2d..82e9e7a38a4d024d72533a97abf16a9fb92bfb2a 100644 --- a/communication/bluetooth_ble/src/main/js/test/List.test.js +++ b/communication/btmanager_errorcode401/src/main/js/test/List.test.js @@ -13,11 +13,9 @@ * limitations under the License. */ -import bluetoothBLETest from './BleGattManager.test.js' -import bluetoothBLETest1 from './BleService.test.js' -import bluetoothBLETest2 from './BleAdvertiser.test.js' +import btManagerMError401Test from './BtMGattManager401.test.js' +import btManagerAdvertError401Test from './BtMGattAdvertiser401.test.js' export default function testsuite() { -bluetoothBLETest() -bluetoothBLETest1() -bluetoothBLETest2() + btManagerMError401Test() + btManagerAdvertError401Test() } diff --git a/communication/bluetooth_switchoff/src/main/resources/base/element/string.json b/communication/btmanager_errorcode401/src/main/resources/base/element/string.json similarity index 100% rename from communication/bluetooth_switchoff/src/main/resources/base/element/string.json rename to communication/btmanager_errorcode401/src/main/resources/base/element/string.json diff --git a/communication/bluetooth_switchoff/src/main/resources/base/media/icon.png b/communication/btmanager_errorcode401/src/main/resources/base/media/icon.png similarity index 100% rename from communication/bluetooth_switchoff/src/main/resources/base/media/icon.png rename to communication/btmanager_errorcode401/src/main/resources/base/media/icon.png diff --git a/communication/btmanager_switchoff/BUILD.gn b/communication/btmanager_switchoff/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d0dabc33ae8ead67bb2f6755fcd3098e1f1513a4 --- /dev/null +++ b/communication/btmanager_switchoff/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni") +ohos_js_hap_suite("ActsBtManagerSwitchOff003JsTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":bluetooth_js_assets", + ":bluetooth_resources", + ] + + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsBtManagerSwitchOff003HapTest" + part_name = "bluetooth" + subsystem_name = "communication" +} +ohos_js_assets("bluetooth_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} +ohos_resources("bluetooth_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/communication/bluetooth_switchoff/Test.json b/communication/btmanager_switchoff/Test.json similarity index 89% rename from communication/bluetooth_switchoff/Test.json rename to communication/btmanager_switchoff/Test.json index bd65ac1a69bf2fd57728303ce9bd293449038935..b55c8bb8914ec5092f1e3b32a737671a10be6216 100644 --- a/communication/bluetooth_switchoff/Test.json +++ b/communication/btmanager_switchoff/Test.json @@ -11,7 +11,7 @@ "kits": [ { "test-file-name": [ - "ActsBluetoothSwitchHapTest.hap" + "ActsBtManagerSwitchOff003HapTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/communication/bluetooth_on/signature/openharmony_sx.p7b b/communication/btmanager_switchoff/signature/openharmony_sx.p7b similarity index 100% rename from communication/bluetooth_on/signature/openharmony_sx.p7b rename to communication/btmanager_switchoff/signature/openharmony_sx.p7b diff --git a/communication/bluetooth_on/src/main/config.json b/communication/btmanager_switchoff/src/main/config.json similarity index 96% rename from communication/bluetooth_on/src/main/config.json rename to communication/btmanager_switchoff/src/main/config.json index 2881d7e36b17fb50f9d69629c2008eee39328eab..be7e6e67b672c79944d9cde31ee3614848f82b80 100644 --- a/communication/bluetooth_on/src/main/config.json +++ b/communication/btmanager_switchoff/src/main/config.json @@ -96,10 +96,6 @@ "when": "inuse" } }, - { - "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", - "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" - }, { "name": "ohos.permission.MANAGE_BLUETOOTH", "reason": "", @@ -110,6 +106,10 @@ "when": "inuse" } }, + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, { "name": "ohos.permission.DISCOVER_BLUETOOTH", "reason": "", diff --git a/communication/btmanager_switchoff/src/main/js/MainAbility/app.js b/communication/btmanager_switchoff/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..363f2555b1badec9fec342a93141db084083fcb8 --- /dev/null +++ b/communication/btmanager_switchoff/src/main/js/MainAbility/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2021 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. + */ + +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/communication/btmanager_switchoff/src/main/js/MainAbility/i18n/en-US.json b/communication/btmanager_switchoff/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..a4c13dcbdc39c537073f638393d7726ac9a5cdc4 --- /dev/null +++ b/communication/btmanager_switchoff/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/communication/btmanager_switchoff/src/main/js/MainAbility/i18n/zh-CN.json b/communication/btmanager_switchoff/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..b1c02368f72f929e4375a43170444de95dcc5984 --- /dev/null +++ b/communication/btmanager_switchoff/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/communication/btmanager_switchoff/src/main/js/MainAbility/pages/index/index.css b/communication/btmanager_switchoff/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..e84b0d6300d7a299aed5376be2cba12327f9d9d2 --- /dev/null +++ b/communication/btmanager_switchoff/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/communication/btmanager_switchoff/src/main/js/MainAbility/pages/index/index.hml b/communication/btmanager_switchoff/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..43848d302f5c5cd40b7aad5e19f6c7ea15373d91 --- /dev/null +++ b/communication/btmanager_switchoff/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,20 @@ +/* + * 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. + */ + +