Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6a34aec6
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看板
提交
6a34aec6
编写于
8月 03, 2023
作者:
Q
quanli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quanli1@huawei.com
Signed-off-by:
N
quanli
<
quanli1@huawei.com
>
上级
8afacda3
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
130 addition
and
18 deletion
+130
-18
communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js
...n/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js
+1
-1
communication/bluetooth_profile/src/main/js/test/BtA2dp.test.js
...ication/bluetooth_profile/src/main/js/test/BtA2dp.test.js
+6
-5
communication/bluetooth_scanpairing/src/main/js/test/BtConnection.test.js
...uetooth_scanpairing/src/main/js/test/BtConnection.test.js
+43
-5
communication/bluetooth_scanpairing/src/main/js/test/BtDiscovery.test.js
...luetooth_scanpairing/src/main/js/test/BtDiscovery.test.js
+16
-4
communication/wifi_ErrorCode201/signature/openharmony_sx.p7b
communication/wifi_ErrorCode201/signature/openharmony_sx.p7b
+0
-0
communication/wifi_ErrorCode201/src/main/config.json
communication/wifi_ErrorCode201/src/main/config.json
+58
-0
communication/wifi_ErrorCode201/src/main/js/test/ActWifiErrorCode201.test.js
...ErrorCode201/src/main/js/test/ActWifiErrorCode201.test.js
+4
-1
communication/wifi_ErrorCode202/src/main/js/test/ActWifiErrorCode202.test.js
...ErrorCode202/src/main/js/test/ActWifiErrorCode202.test.js
+1
-1
communication/wifi_ErrorCode401/src/main/js/test/ActWifiErrorCode401.test.js
...ErrorCode401/src/main/js/test/ActWifiErrorCode401.test.js
+1
-1
未找到文件。
communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js
浏览文件 @
6a34aec6
...
...
@@ -147,7 +147,7 @@ describe('btHfpConnTest', function () {
}
let
hfpSrc
=
bluetooth
.
getProfile
(
bluetooth
.
ProfileId
.
PROFILE_HANDS_FREE_AUDIO_GATEWAY
);
hfpSrc
.
on
(
'
connectionStateChange
'
,
StateChangeParam
);
await
sleep
(
10
000
);
await
sleep
(
6
000
);
let
conn
=
hfpSrc
.
disconnect
(
'
11:22:33:44:55:66
'
);
console
.
info
(
'
[bluetooth_js]hfp disconnect result:
'
+
JSON
.
stringify
(
conn
));
expect
(
conn
).
assertFalse
();
...
...
communication/bluetooth_profile/src/main/js/test/BtA2dp.test.js
浏览文件 @
6a34aec6
...
...
@@ -14,6 +14,7 @@
*/
import
bluetooth
from
'
@ohos.bluetooth.a2dp
'
;
import
btAccess
from
'
@ohos.bluetooth.access
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
export
default
function
btA2dpTest
()
{
...
...
@@ -24,12 +25,12 @@ describe('btA2dpTest', function() {
}
async
function
tryToEnableBt
()
{
let
sta
=
b
luetooth
.
getState
();
let
sta
=
b
tAccess
.
getState
();
switch
(
sta
)
{
case
0
:
b
luetooth
.
enableBluetooth
();
b
tAccess
.
enableBluetooth
();
await
sleep
(
10000
);
let
sta1
=
b
luetooth
.
getState
();
let
sta1
=
b
tAccess
.
getState
();
console
.
info
(
'
[bluetooth_js] bt turn off:
'
+
JSON
.
stringify
(
sta1
));
break
;
case
1
:
...
...
@@ -40,9 +41,9 @@ describe('btA2dpTest', function() {
console
.
info
(
'
[bluetooth_js] bt turn on:
'
+
JSON
.
stringify
(
sta
));
break
;
case
3
:
b
luetooth
.
enableBluetooth
();
b
tAccess
.
enableBluetooth
();
await
sleep
(
10000
);
let
sta2
=
b
luetooth
.
getState
();
let
sta2
=
b
tAccess
.
getState
();
console
.
info
(
'
[bluetooth_js] bt turning off:
'
+
JSON
.
stringify
(
sta2
));
break
;
default
:
...
...
communication/bluetooth_scanpairing/src/main/js/test/BtConnection.test.js
浏览文件 @
6a34aec6
...
...
@@ -84,7 +84,7 @@ describe('btConnectionTest', function() {
bluetooth
.
on
(
'
pinRequired
'
,
onReceiveEvent
);
bluetooth
.
off
(
'
pinRequired
'
,
onReceiveEvent
);
}
catch
(
error
)
{
console
.
error
(
`[bluetooth_js]
PairDevice
error, code is
${
error
.
code
}
,
console
.
error
(
`[bluetooth_js]
pinRequired
error, code is
${
error
.
code
}
,
message is
${
error
.
message
}
`
);
expect
(
error
.
code
).
assertEqual
(
'
2900099
'
);
}
...
...
@@ -130,8 +130,8 @@ describe('btConnectionTest', function() {
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTHCONNECTION_PAIR_0400
* @tc.name Test
On pair StateChange
* @tc.desc Test
bondStateChange ON
api10
* @tc.name Test
pairDevice callback
* @tc.desc Test
pairDevice callback
api10
* @tc.type Function
* @tc.level Level 3
*/
...
...
@@ -142,15 +142,21 @@ describe('btConnectionTest', function() {
}
try
{
bluetooth
.
on
(
'
bondStateChange
'
,
BondStateParam
);
bluetooth
.
pairDevice
(
"
11:22:55:66:33:44
"
);
bluetooth
.
pairDevice
(
"
11:22:55:66:33:44
"
,
err
=>
{
if
(
err
)
{
console
.
info
(
'
pairDevice errCode:
'
+
err
.
code
+
'
, errMessage:
'
+
err
.
message
);
}
console
.
info
(
'
pairDevice, err:
'
+
JSON
.
stringify
(
err
));
});
bluetooth
.
off
(
'
bondStateChange
'
,
BondStateParam
);
expect
(
bluetooth
.
BondState
.
BOND_STATE_INVALID
==
0
).
assertTrue
();
expect
(
bluetooth
.
BondState
.
BOND_STATE_BONDING
==
1
).
assertTrue
();
expect
(
bluetooth
.
BondState
.
BOND_STATE_BONDED
==
2
).
assertTrue
();
bluetooth
.
off
(
'
bondStateChange
'
,
BondStateParam
);
}
catch
(
err
)
{
console
.
error
(
"
errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
expect
(
error
.
code
).
assertEqual
(
'
2900099
'
);
}
bluetooth
.
off
(
'
bondStateChange
'
,
BondStateParam
);
done
();
})
...
...
@@ -238,6 +244,37 @@ describe('btConnectionTest', function() {
done
();
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTHCONNECTION_PAIR_0900
* @tc.name Test pairDevice promise
* @tc.desc Test pairDevice promise api10
* @tc.type Function
* @tc.level Level 3
*/
it
(
'
SUB_COMMUNICATION_BLUETOOTHCONNECTION_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
);
}
try
{
bluetooth
.
on
(
'
bondStateChange
'
,
BondStateParam
);
bluetooth
.
pairDevice
(
"
11:22:55:66:33:44
"
).
then
((
data
)
=>
{
console
.
info
(
'
pairDevice info success
'
);
},
err
=>
{
console
.
info
(
'
pairDevice:errCode
'
+
err
.
code
+
'
, errMessage:
'
+
err
.
message
);
});
bluetooth
.
off
(
'
bondStateChange
'
,
BondStateParam
);
expect
(
bluetooth
.
BondState
.
BOND_STATE_INVALID
==
0
).
assertTrue
();
expect
(
bluetooth
.
BondState
.
BOND_STATE_BONDING
==
1
).
assertTrue
();
expect
(
bluetooth
.
BondState
.
BOND_STATE_BONDED
==
2
).
assertTrue
();
}
catch
(
err
)
{
console
.
error
(
"
errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
expect
(
error
.
code
).
assertEqual
(
'
2900099
'
);
}
bluetooth
.
off
(
'
bondStateChange
'
,
BondStateParam
);
done
();
})
/**
* @tc.number SUB_COMMUNICATION_BLUETOOTHCONNECTION_SCANMODE_0100
* @tc.name TEST scanmode
...
...
@@ -335,6 +372,7 @@ describe('btConnectionTest', function() {
console
.
error
(
`[bluetooth_js]bluetoothDeviceFin error, code is
${
error
.
code
}
,message is
${
error
.
message
}
`
);
expect
(
error
.
code
).
assertEqual
(
'
2900099
'
);
}
bluetooth
.
off
(
'
bluetoothDeviceFind
'
,
onReceiveEvent
);
done
();
})
...
...
communication/bluetooth_scanpairing/src/main/js/test/BtDiscovery.test.js
浏览文件 @
6a34aec6
...
...
@@ -28,10 +28,22 @@ async function grantPerm() {
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
"
accessTokenId
"
+
appInfo
.
accessTokenId
+
"
bundleName:
"
+
appInfo
.
bundleName
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
let
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
PERMISSION_USER_NAME1
,
PERMISSION_USER_SET
);
if
(
atManager
!=
null
)
{
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
PERMISSION_USER_NAME1
,
PERMISSION_USER_SET
).
then
((
result
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success :
'
+
JSON
.
stringify
(
result
));
console
.
info
(
"
tokenId
"
+
tokenID
+
"
result:
"
+
result
);
let
result1
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
PERMISSION_USER_NAME2
,
PERMISSION_USER_SET
);
console
.
info
(
"
tokenId
"
+
tokenID
+
"
result1:
"
+
result1
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission failed :
'
+
JSON
.
stringify
(
err
));
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
PERMISSION_USER_NAME2
,
PERMISSION_USER_SET
).
then
((
results
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission success :
'
+
JSON
.
stringify
(
results
));
console
.
info
(
"
tokenId
"
+
tokenID
+
"
result:
"
+
results
);
}).
catch
((
error
)
=>
{
console
.
info
(
'
[permission] case grantUserGrantedPermission failed :
'
+
JSON
.
stringify
(
error
));
});
}
else
{
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
}
console
.
info
(
"
====grant Permission end====
"
);
}
export
default
function
btDiscoveryTest
()
{
...
...
communication/wifi_ErrorCode201/signature/openharmony_sx.p7b
浏览文件 @
6a34aec6
无法预览此类型文件
communication/wifi_ErrorCode201/src/main/config.json
浏览文件 @
6a34aec6
...
...
@@ -122,6 +122,64 @@
{
"name"
:
"ohos.permission.GET_NFC_INFO"
,
"reason"
:
"use ohos.permission.GET_NFC_INFO"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
,
"reason"
:
"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name"
:
"ohos.permission.LOCATION"
,
"reason"
:
"need use ohos.permission.LOCATION"
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.location.geolocation.function.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.ACCESS_LOCATION"
,
"reason"
:
"need use ohos.permission.ACCESS_LOCATION"
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.location.geolocation.function.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.LOCATION_IN_BACKGROUND"
,
"reason"
:
"need use ohos.permission.LOCATION_IN_BACKGROUND"
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.location.geolocation.function.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.MANAGE_SECURE_SETTINGS"
,
"reason"
:
"need use ohos.permission.MANAGE_SECURE_SETTINGS"
,
"usedScene"
:
{
"ability"
:
[
"ohos.acts.location.geolocation.function.MainAbility"
],
"when"
:
"inuse"
}
},
{
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name"
:
"ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
}
],
"testRunner"
:
{
...
...
communication/wifi_ErrorCode201/src/main/js/test/ActWifiErrorCode201.test.js
浏览文件 @
6a34aec6
...
...
@@ -26,7 +26,7 @@ async function applyPermission() {
console
.
info
(
"
=== getAccountManager finish
"
);
let
localId
=
await
osAccountManager
.
getOsAccountLocalIdFromProcess
();
console
.
info
(
"
LocalId is :
"
+
localId
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.wifi
Mg
.wifidevice
'
,
0
,
localId
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.wifi.wifidevice
'
,
0
,
localId
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
...
...
@@ -40,6 +40,9 @@ async function applyPermission() {
}
else
{
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
}
}
function
sleep
(
delay
)
{
...
...
communication/wifi_ErrorCode202/src/main/js/test/ActWifiErrorCode202.test.js
浏览文件 @
6a34aec6
...
...
@@ -26,7 +26,7 @@ async function applyPermission() {
console
.
info
(
"
=== getAccountManager finish
"
);
let
localId
=
await
osAccountManager
.
getOsAccountLocalIdFromProcess
();
console
.
info
(
"
LocalId is :
"
+
localId
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.wifi
Mg
.wifidevice
'
,
0
,
localId
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.wifi.wifidevice
'
,
0
,
localId
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
...
...
communication/wifi_ErrorCode401/src/main/js/test/ActWifiErrorCode401.test.js
浏览文件 @
6a34aec6
...
...
@@ -26,7 +26,7 @@ async function applyPermission() {
console
.
info
(
"
=== getAccountManager finish
"
);
let
localId
=
await
osAccountManager
.
getOsAccountLocalIdFromProcess
();
console
.
info
(
"
LocalId is :
"
+
localId
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.wifi
Mg
.wifidevice
'
,
0
,
localId
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.communication.wifi.wifidevice
'
,
0
,
localId
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录