Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5de4e2a8
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5de4e2a8
编写于
8月 21, 2022
作者:
Q
quanli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quanli1@huawei.com
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
f13a0964
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
913 addition
and
601 deletion
+913
-601
communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js
...tion/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js
+769
-496
communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js
...ion/bluetooth_ble/src/main/js/test/BleGattManager.test.js
+38
-39
communication/bluetooth_ble/src/main/js/test/BleService.test.js
...ication/bluetooth_ble/src/main/js/test/BleService.test.js
+23
-3
communication/bluetooth_standard/src/main/js/test/BRSetLocalName.test.js
...luetooth_standard/src/main/js/test/BRSetLocalName.test.js
+83
-63
未找到文件。
communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js
浏览文件 @
5de4e2a8
此差异已折叠。
点击以展开。
communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js
浏览文件 @
5de4e2a8
...
...
@@ -130,7 +130,6 @@ describe('bluetoothBLETest', function() {
done
()
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100
* @tc.name testgetRssiValue
...
...
@@ -149,14 +148,16 @@ describe('bluetoothBLETest', function() {
console
.
info
(
'
[bluetooth_js] BLE read rssi:
'
+
JSON
.
stringify
(
data
));
let
rssiLength
=
Object
.
keys
(
data
).
length
;
expect
(
rssiLength
).
assertEqual
(
0
);
done
();
}).
catch
(
error
=>
{
console
.
info
(
'
bluetooth getRssiValue has error:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
true
);
done
();
});
let
disconnect
=
gattClient
.
disconnect
();
console
.
info
(
'
[bluetooth_js] gatt getrssi2 disconnect:
'
+
disconnect
);
expect
(
disconnect
).
assertEqual
(
false
);
done
();
})
/**
...
...
@@ -203,14 +204,16 @@ describe('bluetoothBLETest', function() {
await
gattClient
.
getDeviceName
().
then
((
data
)
=>
{
console
.
info
(
'
[bluetooth_js] device name
'
+
JSON
.
stringify
(
data
))
expect
(
data
).
assertNull
();
done
();
}).
catch
(
err
=>
{
console
.
error
(
'
bluetooth getDeviceName has error:
'
+
err
);
expect
(
true
).
assertEqual
(
true
);
done
();
});
let
disconnect
=
gattClient
.
disconnect
();
console
.
info
(
'
[bluetooth_js] gatt getname2 disconnect:
'
+
disconnect
);
expect
(
disconnect
).
assertEqual
(
false
);
done
();
})
...
...
@@ -256,14 +259,15 @@ describe('bluetoothBLETest', function() {
await
gattClient
.
getServices
().
then
((
GattService
)
=>
{
console
.
info
(
'
[bluetooth_js] getServices successfully:
'
+
JSON
.
stringify
(
GattService
));
expect
(
GattService
).
assertNull
();
done
();
}).
catch
(
err
=>
{
console
.
error
(
'
[bluetooth_js] getServices has error:
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertEqual
(
true
);
done
();
});
let
disconnect
=
gattClient
.
disconnect
();
console
.
info
(
'
[bluetooth_js] gatt getservices1 disconnect:
'
+
disconnect
);
expect
(
disconnect
).
assertEqual
(
false
);
done
();
})
/**
...
...
@@ -383,39 +387,35 @@ describe('bluetoothBLETest', function() {
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100
'
,
0
,
async
function
(
done
)
{
let
promise
=
new
Promise
((
resolve
)
=>
{
let
descriptors
=
[];
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
descriptors
[
0
]
=
descriptor
;
let
arrayBufferCCC
=
new
ArrayBuffer
(
8
);
let
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
cccValue
[
0
]
=
32
;
let
characteristic
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
arrayBufferCCC
,
descriptors
:
descriptors
};
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
00:00:00:00:00:00
"
);
gattClient
.
readCharacteristicValue
(
characteristic
).
then
((
object
)
=>
{
if
(
object
!=
null
)
{
expect
(
true
).
assertEqual
(
true
);
}
else
{
console
.
info
(
'
[bluetooth_js] readCharacValue promise data:
'
+
JSON
.
stringify
(
data
));
expect
(
null
).
assertFail
();
}
done
();
}).
catch
(
err
=>
{
console
.
error
(
`bluetooth readCharacteValue promise has error:
${
err
}
`
);
let
descriptors
=
[];
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
descriptors
[
0
]
=
descriptor
;
let
arrayBufferCCC
=
new
ArrayBuffer
(
8
);
let
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
cccValue
[
0
]
=
32
;
let
characteristic
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
arrayBufferCCC
,
descriptors
:
descriptors
};
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
00:00:00:00:00:00
"
);
gattClient
.
readCharacteristicValue
(
characteristic
).
then
((
object
)
=>
{
if
(
object
!=
null
)
{
expect
(
true
).
assertEqual
(
true
);
done
();
});
resolve
()
}
else
{
console
.
info
(
'
[bluetooth_js] readCharacValue promise data:
'
+
JSON
.
stringify
(
data
));
expect
(
null
).
assertFail
();
}
done
();
}).
catch
(
err
=>
{
console
.
error
(
`bluetooth readCharacteValue promise has error:
${
err
}
`
);
expect
(
true
).
assertEqual
(
true
);
done
();
})
await
promise
.
then
(
done
)
})
/**
...
...
@@ -450,7 +450,7 @@ describe('bluetoothBLETest', function() {
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
arrayBufferCCC
,
descriptors
:
descriptor
};
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
11:22:33:44:55:66
"
);
gattClient
.
readCharacteristicValue
(
characteristic
,
readCcc
);
await
gattClient
.
readCharacteristicValue
(
characteristic
,
readCcc
);
done
()
})
...
...
@@ -611,7 +611,7 @@ describe('bluetoothBLETest', function() {
expect
(
ret
).
assertEqual
(
false
);
})
/**
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0200
* @tc.name testWriteCharacteristicValue
* @tc.desc Test Client WriteCharacteristicValue api.
...
...
@@ -736,7 +736,7 @@ describe('bluetoothBLETest', function() {
done
()
})
/**
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0100
* @tc.name testSetNotifyCharacteristicChanged
* @tc.desc Test SetNotifyCharacteristicChanged api.
...
...
@@ -889,4 +889,3 @@ describe('bluetoothBLETest', function() {
})
}
communication/bluetooth_ble/src/main/js/test/BleService.test.js
浏览文件 @
5de4e2a8
...
...
@@ -218,7 +218,7 @@ describe('bluetoothBLETest1', function() {
cccV
[
0
]
=
1
;
let
characteristic
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
arrayBufferC
,
descriptors
:[]
};
characteristicValue
:
arrayBufferC
};
characteristics
[
0
]
=
characteristic
;
let
gattService
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
isPrimary
:
true
,
characteristics
:
characteristics
,
includeServices
:[]};
...
...
@@ -505,7 +505,7 @@ describe('bluetoothBLETest1', function() {
expect
(
ret
).
assertFalse
();
await
sleep
(
1000
);
let
ret1
=
gattServer
.
removeService
(
'
00001810-0000-1000-8000-00805F9B34FB
'
);
console
.
info
(
'
[bluetooth_js]removeService ret:
'
+
ret1
);
console
.
info
(
'
[bluetooth_js]removeService ret:
'
+
ret1
);
expect
(
ret1
).
assertFalse
();
done
();
})
...
...
@@ -711,7 +711,7 @@ describe('bluetoothBLETest1', function() {
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0
2
00
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0
1
00
* @tc.name testSendResponse success
* @tc.desc Test SendResponse api.
* @tc.size MEDIUM
...
...
@@ -730,6 +730,26 @@ describe('bluetoothBLETest1', function() {
done
();
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_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
)
{
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
value
=
new
Uint8Array
(
arrayBuffer
);
value
[
0
]
=
1
;
let
ServerResponse
=
{
deviceId
:
'
00:11:22:33:44:55
'
,
transId
:
1
,
status
:
-
1
,
offset
:
0
,
value
:
arrayBuffer
};
let
ret
=
gattServer
.
sendResponse
(
ServerResponse
);
console
.
info
(
'
[bluetooth_js] sendResponse ret :
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
done
();
})
})
}
communication/bluetooth_standard/src/main/js/test/BRSetLocalName.test.js
浏览文件 @
5de4e2a8
...
...
@@ -91,23 +91,14 @@ describe('bluetoothhostTest1', function() {
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level
3
* @tc.level Level
1
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0100
'
,
0
,
async
function
(
done
)
{
let
localName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_0600 localName =
'
+
JSON
.
stringify
(
localName
));
expect
(
true
).
assertEqual
(
localName
!=
null
);
let
newName
=
'
bluetoothtest
'
;
let
result
=
bluetooth
.
setLocalName
(
newName
);
let
result
=
bluetooth
.
setLocalName
(
Btname
.
LETTERS_TEST
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_0100 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
newName
==
getNewName
);
let
result1
=
bluetooth
.
setLocalName
(
localName
);
expect
(
result1
).
assertTrue
();
let
getLocalName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_0100 localName =
'
+
JSON
.
stringify
(
getLocalName
));
expect
(
true
).
assertEqual
(
localName
==
getLocalName
);
expect
(
true
).
assertEqual
(
Btname
.
LETTERS_TEST
==
getNewName
);
done
();
})
...
...
@@ -118,14 +109,14 @@ describe('bluetoothhostTest1', function() {
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level
1
* @tc.level Level
3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0200
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
LETTER
S_TEST
);
let
result
=
bluetooth
.
setLocalName
(
Btname
.
CHINESE
S_TEST
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_0200 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
LETTER
S_TEST
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
CHINESE
S_TEST
==
getNewName
);
done
();
})
...
...
@@ -136,50 +127,51 @@ describe('bluetoothhostTest1', function() {
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level
3
* @tc.level Level
2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0300
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
CHINESES
_TEST
);
let
result
=
bluetooth
.
setLocalName
(
Btname
.
NUM
_TEST
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_0300 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
CHINESES
_TEST
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
NUM
_TEST
==
getNewName
);
done
();
})
/**
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0400
* @tc.name setLocalName
* @tc.desc Test setLocalName api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level
2
* @tc.level Level
1
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0400
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
NUM
_TEST
);
let
result
=
bluetooth
.
setLocalName
(
Btname
.
SYMBOL
_TEST
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_0400 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
NUM
_TEST
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
SYMBOL
_TEST
==
getNewName
);
done
();
})
/**
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0500
* @tc.name setLocalName
* @tc.desc Test setLocalName api by promise.
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level
1
* @tc.level Level
2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0500
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
SYMBOL_TEST
);
let
newName
=
'
my bluetooth
'
;
let
result
=
bluetooth
.
setLocalName
(
newName
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_0500 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
SYMBOL_TEST
==
getNewName
);
expect
(
true
).
assertEqual
(
newName
==
getNewName
);
done
();
})
...
...
@@ -190,10 +182,10 @@ describe('bluetoothhostTest1', function() {
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level
2
* @tc.level Level
3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0600
'
,
0
,
async
function
(
done
)
{
let
newName
=
'
my bluetooth
'
;
let
newName
=
'
bluetooth1234ABCDEFGH
'
;
let
result
=
bluetooth
.
setLocalName
(
newName
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
...
...
@@ -204,15 +196,15 @@ describe('bluetoothhostTest1', function() {
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0700
* @tc.name setLocalName
* @tc.desc T
est
setLocalName api by promise.
* @tc.name
TEST
setLocalName
* @tc.desc T
EST
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
)
{
let
newName
=
'
bluetooth1234ABCDEFGH
'
;
let
newName
=
'
蓝牙设备bluetooth
'
;
let
result
=
bluetooth
.
setLocalName
(
newName
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
...
...
@@ -230,13 +222,12 @@ describe('bluetoothhostTest1', function() {
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0800
'
,
0
,
async
function
(
done
)
{
let
newName
=
'
蓝牙设备bluetooth
'
;
let
result
=
bluetooth
.
setLocalName
(
newName
);
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0800
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES4
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_0800 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
newName
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
MIXES4
==
getNewName
);
done
();
})
...
...
@@ -249,12 +240,12 @@ describe('bluetoothhostTest1', function() {
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0900
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES
4
);
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0900
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES
2
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_0900 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
MIXES
4
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
MIXES
2
==
getNewName
);
done
();
})
...
...
@@ -268,11 +259,11 @@ describe('bluetoothhostTest1', function() {
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1000
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES
2
);
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES
3
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_1000 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
MIXES
2
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
MIXES
3
==
getNewName
);
done
();
})
...
...
@@ -283,14 +274,15 @@ describe('bluetoothhostTest1', function() {
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level
3
* @tc.level Level
2
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1100
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES3
);
let
newName
=
'
蓝牙设备123
'
;
let
result
=
bluetooth
.
setLocalName
(
newName
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_1100 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
MIXES3
==
getNewName
);
expect
(
true
).
assertEqual
(
newName
==
getNewName
);
done
();
})
...
...
@@ -301,14 +293,14 @@ describe('bluetoothhostTest1', function() {
* @tc.size MEDIUM
* @ since 8
* @tc.type Function
* @tc.level Level
2
* @tc.level Level
3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1200
'
,
0
,
async
function
(
done
)
{
let
newName
=
'
蓝牙设备
123
'
;
let
newName
=
'
蓝牙设备
bluetooth12
'
;
let
result
=
bluetooth
.
setLocalName
(
newName
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName
_
1200 NewName =
'
+
JSON
.
stringify
(
getNewName
));
console
.
info
(
'
[bluetooth_js] LocalName1200 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
newName
==
getNewName
);
done
();
})
...
...
@@ -322,13 +314,12 @@ describe('bluetoothhostTest1', function() {
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1300
'
,
0
,
async
function
(
done
)
{
let
newName
=
'
蓝牙设备bluetooth12
'
;
let
result
=
bluetooth
.
setLocalName
(
newName
);
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1300
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES6
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_1300 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
newName
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
MIXES6
==
getNewName
);
done
();
})
...
...
@@ -341,12 +332,13 @@ describe('bluetoothhostTest1', function() {
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1400
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES
6
);
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1400
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_1400 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
MIXES6
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
MIXES
==
getNewName
);
done
();
})
...
...
@@ -360,12 +352,11 @@ describe('bluetoothhostTest1', function() {
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1500
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES
);
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES
5
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_1500 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
MIXES
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
MIXES5
==
getNewName
);
done
();
})
...
...
@@ -379,11 +370,11 @@ describe('bluetoothhostTest1', function() {
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1600
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES5
);
let
result
=
bluetooth
.
setLocalName
(
Btname
.
NUM_TEST1
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_1600 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
MIXES5
==
getNewName
);
expect
(
true
).
assertEqual
(
Btname
.
NUM_TEST1
==
getNewName
);
done
();
})
...
...
@@ -397,11 +388,11 @@ describe('bluetoothhostTest1', function() {
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1700
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
NUM_TEST1
);
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES7
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_1700 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
Btname
.
NUM_TEST1
==
getNewName
);
expect
(
false
).
assertEqual
(
Btname
.
MIXES7
==
getNewName
);
done
();
})
...
...
@@ -415,14 +406,43 @@ describe('bluetoothhostTest1', function() {
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1800
'
,
0
,
async
function
(
done
)
{
let
result
=
bluetooth
.
setLocalName
(
Btname
.
MIXES7
);
let
name
=
bluetooth
.
getLocalName
();
let
set
=
bluetooth
.
setLocalName
(
''
);
expect
(
set
).
assertFalse
();
let
localName
=
bluetooth
.
getLocalName
();
expect
(
true
).
assertTrue
(
localName
==
name
);
console
.
info
(
'
[bluetooth_js] getLocalName1800=
'
+
JSON
.
stringify
(
localName
));
done
();
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_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
)
{
let
localName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_1900 localName =
'
+
JSON
.
stringify
(
localName
));
expect
(
true
).
assertEqual
(
localName
!=
null
);
let
newName
=
'
bluetoothtest
'
;
let
result
=
bluetooth
.
setLocalName
(
newName
);
expect
(
result
).
assertTrue
();
let
getNewName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalName_1800 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
false
).
assertEqual
(
Btname
.
MIXES7
==
getNewName
);
console
.
info
(
'
[bluetooth_js] LocalName_1900 NewName =
'
+
JSON
.
stringify
(
getNewName
));
expect
(
true
).
assertEqual
(
newName
==
getNewName
);
let
result1
=
bluetooth
.
setLocalName
(
localName
);
expect
(
result1
).
assertTrue
();
let
getLocalName
=
bluetooth
.
getLocalName
();
console
.
info
(
'
[bluetooth_js] LocalNam1900 localName =
'
+
JSON
.
stringify
(
getLocalName
));
expect
(
true
).
assertEqual
(
localName
==
getLocalName
);
done
();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录