Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
92eab25f
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
92eab25f
编写于
3月 14, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2372 【communication】修改BT JS L2测试用例
Merge pull request !2372 from 权力/cherry-pick-1646991771
上级
a45e2451
2f9fa783
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
94 addition
and
53 deletion
+94
-53
communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js
...uetooth_ble/src/main/js/default/test/BluetoothBle.test.js
+70
-33
communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
...bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
+22
-17
communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js
...tooth_standard/src/main/js/default/test/Bluetooth.test.js
+2
-3
未找到文件。
communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js
浏览文件 @
92eab25f
...
...
@@ -100,10 +100,10 @@ describe('bluetoothhostTest', function() {
default
:
console
.
info
(
'
[bluetooth_js] enable success
'
);
}
await
sleep
(
2
000
);
await
sleep
(
3
000
);
var
state
=
bluetooth
.
getState
();
console
.
info
(
'
[bluetooth_js] getState On =
'
+
JSON
.
stringify
(
state
));
console
.
info
(
'
bluetooth enable done
'
);
expect
(
state
).
assertEqual
(
2
);
done
();
})
...
...
@@ -148,20 +148,60 @@ describe('bluetoothhostTest', function() {
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_ST
OP_BLESCAN
_0001
* @tc.name test
ClassicStopBLEScan
* @tc.desc Test
ClassicStopBLEScan
api.
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_ST
ART_ADVERTISING
_0001
* @tc.name test
StartAdvertising
* @tc.desc Test
StartAdvertising
api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_ble_stop_scan
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] BLE stop scan start
'
);
var
result
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan ->
"
+
JSON
.
stringify
(
result
));
expect
(
result
).
assertNull
();
console
.
info
(
'
[bluetooth_js] BLE stop scan end
'
);
it
(
'
bluetooth_ble_start_advertising
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
BLE advertising start
'
);
var
manufactureValueBuffer
=
new
Uint8Array
(
4
);
manufactureValueBuffer
[
0
]
=
1
;
manufactureValueBuffer
[
1
]
=
2
;
manufactureValueBuffer
[
2
]
=
3
;
manufactureValueBuffer
[
3
]
=
4
;
var
serviceValueBuffer
=
new
Uint8Array
(
4
);
serviceValueBuffer
[
0
]
=
4
;
serviceValueBuffer
[
1
]
=
6
;
serviceValueBuffer
[
2
]
=
7
;
serviceValueBuffer
[
3
]
=
8
;
console
.
info
(
'
manufactureValueBuffer =
'
+
JSON
.
stringify
(
manufactureValueBuffer
))
console
.
info
(
'
serviceValueBuffer =
'
+
JSON
.
stringify
(
serviceValueBuffer
))
let
promise
=
new
Promise
((
resolve
)
=>
{
var
gattServer
=
bluetooth
.
BLE
.
createGattServer
()
gattServer
.
startAdvertising
({
interval
:
150
,
txPower
:
60
,
connectable
:
true
,
},{
serviceUuids
:[
"
12
"
],
manufactureData
:[{
manufactureId
:
4567
,
manufactureValue
:
manufactureValueBuffer
.
buffer
}],
serviceData
:[{
serviceUuid
:
"
1234
"
,
serviceValue
:
serviceValueBuffer
.
buffer
}],
},{
serviceUuids
:[
"
12
"
],
manufactureData
:[{
manufactureId
:
1789
,
manufactureValue
:
manufactureValueBuffer
.
buffer
}],
serviceData
:[{
serviceUuid
:
"
1794
"
,
serviceValue
:
serviceValueBuffer
.
buffer
}],
});
resolve
()
})
await
promise
.
then
(
done
)
done
();
})
/**
...
...
@@ -180,6 +220,25 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] BLE stop advertising end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_CONNRCT_0001
* @tc.name testConnect
* @tc.desc Test Connect api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_connect
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] gatt connect start
'
);
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
00:00:00:00:00:00
"
);
let
ret
=
gattClient
.
connect
();
console
.
info
(
'
[bluetooth_js] gatt connect ret :
'
+
ret
);
expect
(
ret
).
assertEqual
(
false
);
console
.
info
(
'
[bluetooth_js] gatt connect end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GET_DEVICE_NAME_PROMISE_0001
* @tc.name testGetDeviceName
...
...
@@ -251,24 +310,6 @@ describe('bluetoothhostTest', function() {
});
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_CONNRCT_0001
* @tc.name testConnect
* @tc.desc Test Connect api.
* @tc.author quanli 00313334
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_gatt_connect
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] gatt connect start
'
);
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
00:00:00:00:00:00
"
);
let
ret
=
gattClient
.
connect
();
console
.
info
(
'
[bluetooth_js] gatt connect ret :
'
+
ret
);
expect
(
ret
).
assertEqual
(
true
);
console
.
info
(
'
[bluetooth_js] gatt connect end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_GETSERVICES_CALLBACK_0001
...
...
@@ -667,7 +708,6 @@ describe('bluetoothhostTest', function() {
}
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_DISCONNRCT_0001
* @tc.name testDisConnect
...
...
@@ -685,7 +725,6 @@ describe('bluetoothhostTest', function() {
console
.
info
(
'
[bluetooth_js] gatt disconnect end
'
);
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GATT_CLIENT_CLOSE_0001
* @tc.name testGattClientClose
...
...
@@ -713,6 +752,4 @@ describe('bluetoothhostTest', function() {
}
})
})
communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
浏览文件 @
92eab25f
...
...
@@ -86,9 +86,10 @@ describe('bluetoothhostTest', function() {
default
:
console
.
info
(
'
[bluetooth_js] enable success
'
);
}
await
sleep
(
2
000
);
await
sleep
(
3
000
);
var
state
=
bluetooth
.
getState
();
console
.
info
(
'
[bluetooth_js] getState On =
'
+
JSON
.
stringify
(
state
));
expect
(
state
).
assertEqual
(
2
);
await
bluetooth
.
off
(
'
stateChange
'
,
result
=>
{
console
.
info
(
"
stateChange off:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
...
...
@@ -138,24 +139,30 @@ describe('bluetoothhostTest', function() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_ble_start_scan_without_param
'
,
0
,
async
function
(
done
)
{
it
(
'
bluetooth_ble_start_scan_without_param
_001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] BLE scan start without scan options start
'
);
var
state
=
bluetooth
.
getState
();
console
.
info
(
'
[bluetooth_js] getState On1 =
'
+
JSON
.
stringify
(
state
));
await
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result3 =
'
+
JSON
.
stringify
(
data
))
expect
(
data
.
length
).
assertLarger
(
0
);
done
();
}
bluetooth
.
BLE
.
startBLEScan
([{}]);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] BLE scan device find off2:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
done
();
});
console
.
info
(
'
[bluetooth_js] BLE scan start end
'
);
let
promise
=
new
Promise
((
resolve
)
=>
{
bluetooth
.
BLE
.
on
(
"
BLEDeviceFind
"
,
onReceiveEvent
)
function
onReceiveEvent
(
data
)
{
console
.
info
(
'
[bluetooth_js] BLE scan device find result3 =
'
+
JSON
.
stringify
(
data
));
expect
(
data
.
length
).
assertLarger
(
0
);
done
();
}
bluetooth
.
BLE
.
startBLEScan
([{}]);
bluetooth
.
BLE
.
off
(
'
BLEDeviceFind
'
,
result
=>
{
console
.
info
(
"
[bluetooth_js] BLE scan device find off2:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
==
null
);
done
();
});
var
result
=
bluetooth
.
BLE
.
stopBLEScan
();
console
.
info
(
"
[bluetooth_js] onStopBLEScan ->
"
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[bluetooth_js] BLE scan start end
'
);
resolve
()
})
await
promise
.
then
(
done
)
done
();
})
...
...
@@ -435,7 +442,6 @@ describe('bluetoothhostTest', function() {
console
.
info
(
"
[bluetooth_js] desWriOn jsondata:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[bluetooth_js] desWriOn data:
"
+
data
);
expect
(
true
).
assertEqual
(
data
!=
null
);
console
.
info
(
'
[bluetooth_js] desWrite callback data ->
'
);
console
.
info
(
'
[bluetooth_js] desWriOn deviceId:
'
+
data
.
deviceId
);
console
.
info
(
'
[bluetooth_js] desWriOn transId:
'
+
data
.
transId
);
...
...
@@ -635,4 +641,3 @@ describe('bluetoothhostTest', function() {
})
communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js
浏览文件 @
92eab25f
...
...
@@ -93,9 +93,10 @@ describe('bluetoothhostTest', function() {
default
:
console
.
info
(
'
[bluetooth_js] enable success
'
);
}
await
sleep
(
2
000
);
await
sleep
(
3
000
);
var
state
=
bluetooth
.
getState
();
console
.
info
(
'
[bluetooth_js] getState On =
'
+
JSON
.
stringify
(
state
));
expect
(
state
).
assertEqual
(
2
);
console
.
info
(
'
[bluetooth_js]state on:
'
+
JSON
.
stringify
(
bluetooth
.
BluetoothState
.
STATE_ON
));
console
.
info
(
'
[bluetooth_js]off :
'
+
JSON
.
stringify
(
bluetooth
.
BluetoothState
.
STATE_OFF
));
console
.
info
(
'
[bluetooth_js] turning on :
'
...
...
@@ -869,7 +870,6 @@ describe('bluetoothhostTest', function() {
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
bluetooth_classic_disable_bluetooth
'
,
0
,
function
()
{
console
.
info
(
'
[bluetooth_js] disable test start
'
);
let
disable
=
bluetooth
.
disableBluetooth
();
...
...
@@ -881,4 +881,3 @@ describe('bluetoothhostTest', function() {
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录