Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8a848c90
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看板
未验证
提交
8a848c90
编写于
6月 01, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3398 修改getAbilityLabel测试套中done的执行顺序
Merge pull request !3398 from ry/OpenHarmony-3.1-Release
上级
d5a06aa9
26883b2f
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
291 addition
and
275 deletion
+291
-275
appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js
...est/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js
+15
-3
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js
.../entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js
+25
-13
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js
.../entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js
+19
-10
appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js
...etest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js
+0
-10
appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js
...ctsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js
+0
-12
appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
.../entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
+22
-10
appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js
...tatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js
+18
-6
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
.../main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
+89
-134
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
...try/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
+0
-8
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
...ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
+19
-9
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
...in/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
+20
-11
appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js
...emanagertest/entry/src/main/js/test/ExampleJsunit.test.js
+64
-49
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js
浏览文件 @
8a848c90
...
...
@@ -14,22 +14,34 @@
*/
import
bundle
from
'
@ohos.bundle
'
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
account
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
BUNDLE_NAME1
=
'
com.example.bmsaccesstoken1
'
;
const
BUNDLE_NAME2
=
'
com.example.bmsaccesstoken2
'
;
const
BUNDLE_NAME3
=
'
com.example.bmsaccesstoken3
'
;
const
USERID
=
10
0
;
let
userId
=
0
;
describe
(
'
ActsBmsAccessTokenTest
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
done
();
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
done
();
})
});
/*
* @tc.number: bms_AccessTokenId_0100
* @tc.name: test accessTokenId
* @tc.desc: get the accessTokenId
*/
it
(
'
bms_AccessTokenId_0100
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getApplicationInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
)
await
bundle
.
getApplicationInfo
(
BUNDLE_NAME1
,
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
)
.
then
(
applicationInfo
=>
{
console
.
info
(
'
accessTokenId:
'
+
applicationInfo
.
accessTokenId
);
expect
(
applicationInfo
.
name
).
assertEqual
(
BUNDLE_NAME1
);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js
浏览文件 @
8a848c90
...
...
@@ -14,6 +14,7 @@
*/
import
bundle
from
'
@ohos.bundle
'
import
account
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit
'
const
BUNDLE_NAME1
=
'
com.example.third1
'
;
...
...
@@ -31,7 +32,6 @@ const NUM_TWO = 2;
const
NUM_THREE
=
3
;
const
NUM_FOUR
=
4
;
const
NUM_NINE
=
9
;
const
USERID
=
100
;
const
DATATRANSFER
=
1
;
const
AUDIOPLAYBACK
=
2
;
const
AUDIORECORDING
=
4
;
...
...
@@ -41,9 +41,21 @@ const MULTIDEVICECONNECTION = 32;
const
WIFIINTERACTION
=
64
;
const
VOIP
=
128
;
const
TASKKEEPING
=
256
;
let
userId
=
0
;
describe
(
'
ActsBmsGetBackGroundModes
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
done
();
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
done
();
})
});
/*
* @tc.number: bms_backGroundModes_0100
* @tc.name: Get the backgroundModes information of the application through queryAbilityByWant
...
...
@@ -58,7 +70,7 @@ describe('ActsBmsGetBackGroundModes', function () {
bundleName
:
BUNDLE_NAME5
,
abilityName
:
''
,
},
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
);
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
NUM_FOUR
);
if
(
dataInfos
.
length
==
NUM_FOUR
)
{
expect
(
dataInfos
[
NUM_TWO
].
name
).
assertEqual
(
ABILITIY_NAME1
);
...
...
@@ -67,7 +79,7 @@ describe('ActsBmsGetBackGroundModes', function () {
expect
(
dataInfos
[
NUM_THREE
].
name
).
assertEqual
(
ABILITIY_NAME2
);
expect
(
dataInfos
[
NUM_THREE
].
backgroundModes
).
assertEqual
(
DATATRANSFER
|
VOIP
);
}
let
bundleInfos
=
await
bundle
.
getAllBundleInfo
(
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
USERID
);
let
bundleInfos
=
await
bundle
.
getAllBundleInfo
(
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
userId
);
for
(
let
i
=
0
;
i
<
bundleInfos
.
length
;
i
++
)
{
if
(
bundleInfos
[
i
].
name
==
BUNDLE_NAME5
)
{
for
(
let
j
=
0
;
j
<
bundleInfos
[
i
].
abilityInfos
.
length
;
j
++
)
{
...
...
@@ -103,7 +115,7 @@ describe('ActsBmsGetBackGroundModes', function () {
bundleName
:
BUNDLE_NAME6
,
abilityName
:
''
,
},
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
);
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
NUM_NINE
);
for
(
let
i
=
0
,
len
=
dataInfos
.
length
;
i
<
len
;
i
++
)
{
expect
(
dataInfos
[
i
].
backgroundModes
).
assertEqual
(
1
<<
i
);
...
...
@@ -125,14 +137,14 @@ describe('ActsBmsGetBackGroundModes', function () {
bundleName
:
BUNDLE_NAME2
,
abilityName
:
''
,
},
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
);
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
NUM_TWO
);
if
(
dataInfos
.
length
==
NUM_TWO
)
{
expect
(
dataInfos
[
1
].
name
).
assertEqual
(
ABILITIY_NAME3
)
expect
(
dataInfos
[
1
].
backgroundModes
).
assertEqual
(
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
)
}
bundle
.
getAllBundleInfo
(
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
USERID
,
(
err
,
bundleInfos
)
=>
{
bundle
.
getAllBundleInfo
(
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
userId
,
(
err
,
bundleInfos
)
=>
{
for
(
let
i
=
0
;
i
<
bundleInfos
.
length
;
i
++
)
{
if
(
bundleInfos
[
i
].
name
==
BUNDLE_NAME2
)
{
for
(
let
j
=
0
;
j
<
bundleInfos
[
i
].
abilityInfos
.
length
;
j
++
)
{
...
...
@@ -144,12 +156,12 @@ describe('ActsBmsGetBackGroundModes', function () {
}
}
}
bundle
.
getBundleInfo
(
BUNDLE_NAME2
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
(
err
,
data3
)
=>
{
expect
(
data3
.
abilityInfos
[
1
].
backgroundModes
).
assertEqual
(
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
);
done
();
});
});
bundle
.
getBundleInfo
(
BUNDLE_NAME2
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
(
err
,
data3
)
=>
{
expect
(
data3
.
abilityInfos
[
1
].
backgroundModes
).
assertEqual
(
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
)
});
done
();
});
/*
...
...
@@ -166,7 +178,7 @@ describe('ActsBmsGetBackGroundModes', function () {
bundleName
:
BUNDLE_NAME4
,
abilityName
:
''
,
},
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
);
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
1
);
if
(
dataInfos
.
length
==
1
)
{
expect
(
dataInfos
[
0
].
name
).
assertEqual
(
ABILITIY_NAME4
)
...
...
@@ -189,7 +201,7 @@ describe('ActsBmsGetBackGroundModes', function () {
bundleName
:
BUNDLE_NAME1
,
abilityName
:
''
,
},
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
);
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
NUM_FOUR
);
if
(
dataInfos
.
length
==
NUM_FOUR
)
{
expect
(
dataInfos
[
1
].
name
).
assertEqual
(
ABILITIY_NAME5
)
...
...
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js
浏览文件 @
8a848c90
...
...
@@ -13,15 +13,27 @@
* limitations under the License.
*/
import
bundle
from
'
@ohos.bundle
'
import
account
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit
'
const
BUNDLE_NAME1
=
'
com.example.third1
'
;
const
SYSTEM_NAME
=
'
com.example.system2
'
;
const
ABILITIY_NAME8
=
'
com.example.system2.MainAbility
'
;
const
USERID
=
10
0
;
let
userId
=
0
;
describe
(
'
ActsBmsQueryAbilityByWant
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
done
();
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
done
();
})
});
/*
* @tc.number: bms_queryAbilityByWant_0100
* @tc.name: queryAbilityByWant callback by other callback
...
...
@@ -34,7 +46,7 @@ describe('ActsBmsQueryAbilityByWant', function () {
entities
:
[
'
entity.system.home
'
],
bundleName
:
BUNDLE_NAME1
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
USERID
).
then
(
data
=>
{
userId
).
then
(
data
=>
{
expect
(
data
).
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
1
);
...
...
@@ -44,7 +56,7 @@ describe('ActsBmsQueryAbilityByWant', function () {
entities
:
[
'
entity.system.home
'
],
bundleName
:
BUNDLE_NAME1
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
USERID
,
(
err
,
data
)
=>
{
userId
,
(
err
,
data
)
=>
{
expect
(
err
).
assertEqual
(
1
);
expect
(
data
).
assertEqual
(
"
QueryAbilityInfos failed
"
);
done
();
...
...
@@ -64,7 +76,7 @@ describe('ActsBmsQueryAbilityByWant', function () {
entities
:
[
'
entity.system.home
'
]
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
USERID
).
then
(
data
=>
{
userId
).
then
(
data
=>
{
expect
(
data
.
length
).
assertLarger
(
0
);
for
(
let
i
=
0
;
i
<
data
.
length
;
++
i
)
{
expect
(
data
[
i
].
applicationInfo
.
systemApp
).
assertEqual
(
true
);
...
...
@@ -79,7 +91,7 @@ describe('ActsBmsQueryAbilityByWant', function () {
entities
:
[
'
entity.system.home
'
]
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
bundle
.
BundleFlag
.
GET_ABILITY_INFO_SYSTEMAPP_ONLY
,
USERID
,
(
err
,
data
)
=>
{
userId
,
(
err
,
data
)
=>
{
if
(
err
)
{
expect
(
err
).
assertFail
();
}
...
...
@@ -113,7 +125,7 @@ describe('ActsBmsQueryAbilityByWant', function () {
bundleName
:
''
,
abilityName
:
''
,
},
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
);
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
dataInfos
.
length
).
assertEqual
(
1
);
cheackAbilityInfos
(
dataInfos
[
0
]);
bundle
.
queryAbilityByWant
({
...
...
@@ -132,7 +144,7 @@ describe('ActsBmsQueryAbilityByWant', function () {
bundleName
:
''
,
abilityName
:
''
,
},
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
,
(
err
,
data
)
=>
{
},
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
,
(
err
,
data
)
=>
{
expect
(
data
.
length
).
assertEqual
(
1
);
cheackAbilityInfos
(
data
[
0
]);
done
();
...
...
@@ -144,8 +156,6 @@ describe('ActsBmsQueryAbilityByWant', function () {
expect
(
data
.
label
).
assertEqual
(
'
$string:app_name
'
);
expect
(
data
.
description
).
assertEqual
(
'
$string:mainability_description
'
);
expect
(
data
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
data
.
srcPath
).
assertEqual
(
""
);
expect
(
data
.
srcLanguage
).
assertEqual
(
"
js
"
);
expect
(
data
.
isVisible
).
assertEqual
(
false
);
expect
(
data
.
permissions
.
length
).
assertEqual
(
0
);
expect
(
data
.
deviceCapabilities
.
length
).
assertEqual
(
0
);
...
...
@@ -167,7 +177,6 @@ describe('ActsBmsQueryAbilityByWant', function () {
expect
(
data
.
readPermission
).
assertEqual
(
""
);
expect
(
data
.
writePermission
).
assertEqual
(
""
);
expect
(
data
.
targetAbility
).
assertEqual
(
""
);
expect
(
data
.
theme
).
assertEqual
(
""
);
expect
(
data
.
metaData
.
length
).
assertEqual
(
0
);
expect
(
data
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
data
.
enabled
).
assertEqual
(
true
);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js
浏览文件 @
8a848c90
...
...
@@ -43,7 +43,6 @@ describe('ActsBmsHapModuleTest', function () {
expect
(
hapModuleInfo
.
moduleName
).
assertEqual
(
'
entry
'
);
expect
(
hapModuleInfo
.
description
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
descriptionId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
iconPath
).
assertEqual
(
"
$media:icon
"
);
expect
(
hapModuleInfo
.
icon
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
label
).
assertEqual
(
'
$string:app_name
'
);
expect
(
hapModuleInfo
.
labelId
).
assertEqual
(
0
);
...
...
@@ -55,7 +54,6 @@ describe('ActsBmsHapModuleTest', function () {
expect
(
hapModuleInfo
.
mainAbilityName
).
assertEqual
(
FIRSTMAINABILITY
);
expect
(
hapModuleInfo
.
mainElementName
).
assertEqual
(
FIRSTMAINABILITY
);
expect
(
hapModuleInfo
.
abilityInfo
.
length
).
assertLarger
(
0
);
expect
(
hapModuleInfo
.
colorMode
).
assertEqual
(
-
1
);
expect
(
hapModuleInfo
.
extensionAbilityInfo
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
installationFree
).
assertEqual
(
false
);
...
...
@@ -109,7 +107,6 @@ describe('ActsBmsHapModuleTest', function () {
expect
(
hapModuleInfo
.
moduleName
).
assertEqual
(
'
entry
'
);
expect
(
hapModuleInfo
.
description
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
descriptionId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
iconPath
).
assertEqual
(
"
$media:icon
"
);
expect
(
hapModuleInfo
.
icon
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
label
).
assertEqual
(
'
$string:app_name
'
);
expect
(
hapModuleInfo
.
labelId
).
assertEqual
(
0
);
...
...
@@ -121,7 +118,6 @@ describe('ActsBmsHapModuleTest', function () {
expect
(
hapModuleInfo
.
mainAbilityName
).
assertEqual
(
""
);
expect
(
hapModuleInfo
.
mainElementName
).
assertEqual
(
""
);
expect
(
hapModuleInfo
.
abilityInfo
.
length
).
assertLarger
(
0
);
expect
(
hapModuleInfo
.
colorMode
).
assertEqual
(
-
1
);
expect
(
hapModuleInfo
.
extensionAbilityInfo
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
installationFree
).
assertEqual
(
false
);
...
...
@@ -146,7 +142,6 @@ describe('ActsBmsHapModuleTest', function () {
expect
(
hapModuleInfo
.
moduleName
).
assertEqual
(
'
entry
'
);
expect
(
hapModuleInfo
.
description
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
descriptionId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
iconPath
).
assertEqual
(
"
$media:icon
"
);
expect
(
hapModuleInfo
.
icon
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
label
).
assertEqual
(
'
$string:app_name
'
);
expect
(
hapModuleInfo
.
labelId
).
assertEqual
(
0
);
...
...
@@ -158,7 +153,6 @@ describe('ActsBmsHapModuleTest', function () {
expect
(
hapModuleInfo
.
mainAbilityName
).
assertEqual
(
"
com.example.third5.AMainAbility
"
);
expect
(
hapModuleInfo
.
mainElementName
).
assertEqual
(
"
com.example.third5.AMainAbility
"
);
expect
(
hapModuleInfo
.
abilityInfo
.
length
).
assertLarger
(
0
);
expect
(
hapModuleInfo
.
colorMode
).
assertEqual
(
-
1
);
expect
(
hapModuleInfo
.
extensionAbilityInfo
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
installationFree
).
assertEqual
(
false
);
...
...
@@ -184,7 +178,6 @@ describe('ActsBmsHapModuleTest', function () {
expect
(
hapModuleInfo
.
moduleName
).
assertEqual
(
'
entry
'
);
expect
(
hapModuleInfo
.
description
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
descriptionId
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
iconPath
).
assertEqual
(
"
$media:icon
"
);
expect
(
hapModuleInfo
.
icon
).
assertEqual
(
''
);
expect
(
hapModuleInfo
.
label
).
assertEqual
(
'
$string:app_name
'
);
expect
(
hapModuleInfo
.
labelId
).
assertEqual
(
0
);
...
...
@@ -196,7 +189,6 @@ describe('ActsBmsHapModuleTest', function () {
expect
(
hapModuleInfo
.
mainAbilityName
).
assertEqual
(
"
com.example.system1.MainAbility
"
);
expect
(
hapModuleInfo
.
mainElementName
).
assertEqual
(
"
com.example.system1.MainAbility
"
);
expect
(
hapModuleInfo
.
abilityInfo
.
length
).
assertLarger
(
0
);
expect
(
hapModuleInfo
.
colorMode
).
assertEqual
(
-
1
);
expect
(
hapModuleInfo
.
extensionAbilityInfo
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
hapModuleInfo
.
installationFree
).
assertEqual
(
false
);
...
...
@@ -208,7 +200,6 @@ describe('ActsBmsHapModuleTest', function () {
function
checkHapMoudleInfos
(
info
)
{
expect
(
info
.
description
).
assertEqual
(
''
);
expect
(
info
.
descriptionId
).
assertEqual
(
0
);
expect
(
info
.
iconPath
).
assertEqual
(
"
$media:icon
"
);
expect
(
info
.
icon
).
assertEqual
(
''
);
expect
(
info
.
labelId
).
assertEqual
(
0
);
expect
(
info
.
iconId
).
assertEqual
(
0
);
...
...
@@ -217,7 +208,6 @@ describe('ActsBmsHapModuleTest', function () {
expect
(
info
.
reqCapabilities
.
length
).
assertEqual
(
0
);
expect
(
info
.
deviceTypes
[
0
]).
assertEqual
(
'
phone
'
);
expect
(
info
.
abilityInfo
.
length
).
assertLarger
(
0
);
expect
(
info
.
colorMode
).
assertEqual
(
-
1
);
expect
(
info
.
extensionAbilityInfo
.
length
).
assertEqual
(
0
);
expect
(
info
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
info
.
installationFree
).
assertEqual
(
false
);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js
浏览文件 @
8a848c90
...
...
@@ -48,8 +48,6 @@ describe('ActsBmsJsTest', function () {
let
abilityInfo2
=
result
.
abilityInfos
[
1
];
expect
(
abilityInfo1
.
name
).
assertEqual
(
ABILITIY_NAME1
);
expect
(
abilityInfo2
.
name
).
assertEqual
(
ABILITIY_NAME6
);
expect
(
abilityInfo1
.
srcLanguage
).
assertEqual
(
'
js
'
);
expect
(
abilityInfo1
.
srcPath
).
assertEqual
(
''
);
expect
(
abilityInfo1
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
abilityInfo1
.
description
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
abilityInfo1
.
icon
).
assertEqual
(
"
$media:icon
"
);
...
...
@@ -75,7 +73,6 @@ describe('ActsBmsJsTest', function () {
expect
(
abilityInfo1
.
readPermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
writePermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
targetAbility
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
theme
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
metaData
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
enabled
).
assertEqual
(
true
);
...
...
@@ -127,8 +124,6 @@ describe('ActsBmsJsTest', function () {
console
.
info
(
"
getBundleIno result
"
+
JSON
.
stringify
(
result
));
let
abilityInfo1
=
result
.
abilityInfos
[
0
];
expect
(
abilityInfo1
.
name
).
assertEqual
(
ABILITIY_NAME4
);
expect
(
abilityInfo1
.
srcLanguage
).
assertEqual
(
'
js
'
);
expect
(
abilityInfo1
.
srcPath
).
assertEqual
(
'
default
'
);
expect
(
abilityInfo1
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
abilityInfo1
.
description
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
abilityInfo1
.
icon
).
assertEqual
(
"
$media:icon
"
);
...
...
@@ -152,7 +147,6 @@ describe('ActsBmsJsTest', function () {
expect
(
abilityInfo1
.
readPermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
writePermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
targetAbility
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
theme
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
metaData
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
enabled
).
assertEqual
(
true
);
...
...
@@ -173,8 +167,6 @@ describe('ActsBmsJsTest', function () {
console
.
info
(
"
getBundleIno result
"
+
JSON
.
stringify
(
result
));
let
abilityInfo1
=
result
.
abilityInfos
[
0
];
expect
(
abilityInfo1
.
name
).
assertEqual
(
ABILITIY_NAME5
);
expect
(
abilityInfo1
.
srcLanguage
).
assertEqual
(
'
c++
'
);
expect
(
abilityInfo1
.
srcPath
).
assertEqual
(
'
default/c++/
'
);
expect
(
abilityInfo1
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
abilityInfo1
.
description
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
abilityInfo1
.
icon
).
assertEqual
(
"
$media:icon
"
);
...
...
@@ -198,7 +190,6 @@ describe('ActsBmsJsTest', function () {
expect
(
abilityInfo1
.
readPermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
writePermission
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
targetAbility
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
theme
).
assertEqual
(
""
);
expect
(
abilityInfo1
.
metaData
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
metadata
.
length
).
assertEqual
(
0
);
expect
(
abilityInfo1
.
enabled
).
assertEqual
(
true
);
...
...
@@ -208,8 +199,6 @@ describe('ActsBmsJsTest', function () {
function
checkAbilityInfos
(
info
)
{
expect
(
info
.
name
).
assertEqual
(
ABILITIY_NAME2
);
expect
(
info
.
srcLanguage
).
assertEqual
(
'
js
'
);
expect
(
info
.
srcPath
).
assertEqual
(
''
);
expect
(
info
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
info
.
description
).
assertEqual
(
"
$string:mainability_description
"
);
expect
(
info
.
icon
).
assertEqual
(
"
$media:icon
"
);
...
...
@@ -233,7 +222,6 @@ describe('ActsBmsJsTest', function () {
expect
(
info
.
readPermission
).
assertEqual
(
""
);
expect
(
info
.
writePermission
).
assertEqual
(
""
);
expect
(
info
.
targetAbility
).
assertEqual
(
""
);
expect
(
info
.
theme
).
assertEqual
(
""
);
expect
(
info
.
metaData
.
length
).
assertEqual
(
1
);
expect
(
info
.
metaData
[
0
].
name
).
assertEqual
(
"
Data5A
"
);
expect
(
info
.
metaData
[
0
].
value
).
assertEqual
(
"
float
"
);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
浏览文件 @
8a848c90
...
...
@@ -14,28 +14,40 @@
*/
import
bundle
from
'
@ohos.bundle
'
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
account
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
LAUNCHER_BUNDLE_NAME
=
'
com.ohos.launcher
'
;
const
LAUNCHER_MAIN_ABILITY
=
'
com.ohos.launcher.MainAbility
'
;
const
DEFAULT_FLAG
=
bundle
.
BundleFlag
.
GET_BUNDLE_DEFAULT
;
const
DEFAULT_USER_ID
=
100
;
const
INVALID_CODE
=
1
;
let
userId
=
0
;
describe
(
'
ActsBmsJsUnPermissionTest
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
done
();
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
done
();
})
});
/*
* @tc.number: getApplicationInfoTest_100
* @tc.name: test getApplicationInfo
* @tc.desc: test getApplicationInfo
*/
it
(
'
getApplicationInfoTest_100
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getApplicationInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_FLAG
,
DEFAULT_USER_ID
).
then
(
data
=>
{
await
bundle
.
getApplicationInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_FLAG
,
userId
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
getApplicationInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_FLAG
,
DEFAULT_USER_ID
,
(
err
,
data
)
=>
{
bundle
.
getApplicationInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_FLAG
,
userId
,
(
err
,
data
)
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
undefined
);
done
();
...
...
@@ -48,12 +60,12 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getAllApplicationInfo
*/
it
(
'
getAllApplicationInfoTest_100
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
,
DEFAULT_USER_ID
).
then
(
data
=>
{
await
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
,
userId
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
,
DEFAULT_USER_ID
,
(
err
,
data
)
=>
{
bundle
.
getAllApplicationInfo
(
DEFAULT_FLAG
,
userId
,
(
err
,
data
)
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
undefined
);
done
();
...
...
@@ -66,12 +78,12 @@ describe('ActsBmsJsUnPermissionTest', function () {
* @tc.desc: test getBundleInfo
*/
it
(
'
getBundleInfoTest_100
'
,
0
,
async
function
(
done
)
{
await
bundle
.
getBundleInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_USER_ID
).
then
(
data
=>
{
await
bundle
.
getBundleInfo
(
LAUNCHER_BUNDLE_NAME
,
userId
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
});
bundle
.
getBundleInfo
(
LAUNCHER_BUNDLE_NAME
,
DEFAULT_USER_ID
,
(
err
,
data
)
=>
{
bundle
.
getBundleInfo
(
LAUNCHER_BUNDLE_NAME
,
userId
,
(
err
,
data
)
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
undefined
);
done
();
...
...
@@ -105,7 +117,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
await
bundle
.
queryAbilityByWant
({
bundleName
:
LAUNCHER_BUNDLE_NAME
,
abilityName
:
LAUNCHER_MAIN_ABILITY
},
DEFAULT_FLAG
,
DEFAULT_USER_ID
).
then
(
data
=>
{
},
DEFAULT_FLAG
,
userId
).
then
(
data
=>
{
expect
().
assertFail
();
}).
catch
(
err
=>
{
expect
(
err
).
assertEqual
(
INVALID_CODE
);
...
...
@@ -113,7 +125,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
bundle
.
queryAbilityByWant
({
bundleName
:
LAUNCHER_BUNDLE_NAME
,
abilityName
:
LAUNCHER_MAIN_ABILITY
},
DEFAULT_FLAG
,
DEFAULT_USER_ID
,
(
err
,
data
)
=>
{
},
DEFAULT_FLAG
,
userId
,
(
err
,
data
)
=>
{
console
.
info
(
"
data ===================:
"
+
data
);
expect
(
err
).
assertEqual
(
INVALID_CODE
);
expect
(
data
).
assertEqual
(
"
QueryAbilityInfos failed
"
);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js
浏览文件 @
8a848c90
...
...
@@ -14,6 +14,7 @@
*/
import
bundle
from
'
@ohos.bundle
'
import
account
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
const
BUNDLE_NAME1
=
'
com.example.third1
'
;
...
...
@@ -26,10 +27,21 @@ const ABILITY_NAME3 = 'com.example.third5.AMainAbility';
const
ABILITY_NAME4
=
'
com.example.noexist.MainAbility
'
;
const
ABILITY_NAME5
=
'
com.example.system1.MainAbility
'
;
const
ABILITY_NAME6
=
'
com.example.vendor1.MainAbility
'
;
const
USERID
=
10
0
;
let
userId
=
0
;
describe
(
'
ActsBmsMetaDataTest
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
done
();
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
done
();
})
});
/*
* @tc.number: bms_getMetaData_0100
* @tc.name: test to get meta data for an application.
...
...
@@ -40,7 +52,7 @@ describe('ActsBmsMetaDataTest', function () {
{
"
bundleName
"
:
BUNDLE_NAME1
,
"
abilityName
"
:
ABILITY_NAME1
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
USERID
).
then
(
dataInfos
=>
{
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
console
.
info
(
"
dataInfos[0].metaData
"
+
JSON
.
stringify
(
dataInfos
[
0
].
metaData
));
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
Data1
"
);
...
...
@@ -63,7 +75,7 @@ describe('ActsBmsMetaDataTest', function () {
{
bundleName
:
BUNDLE_NAME2
,
abilityName
:
ABILITY_NAME3
,
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
USERID
).
then
(
dataInfos
=>
{
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
console
.
info
(
"
dataInfos[0].metaData
"
+
JSON
.
stringify
(
dataInfos
[
0
].
metaData
));
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
Data5A
"
);
...
...
@@ -86,7 +98,7 @@ describe('ActsBmsMetaDataTest', function () {
{
bundleName
:
BUNDLE_NAME3
,
abilityName
:
ABILITY_NAME4
,
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
USERID
).
then
(
dataInfos
=>
{
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
expect
(
dataInfos
.
length
).
assertEqual
(
0
);
done
();
}).
catch
(
err
=>
{
...
...
@@ -106,7 +118,7 @@ describe('ActsBmsMetaDataTest', function () {
{
bundleName
:
BUNDLE_NAME4
,
abilityName
:
ABILITY_NAME5
,
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
USERID
).
then
(
dataInfos
=>
{
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
console
.
info
(
"
dataInfos[0].metaData
"
+
JSON
.
stringify
(
dataInfos
[
0
].
metaData
));
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
"
Data1S
"
);
...
...
@@ -129,7 +141,7 @@ describe('ActsBmsMetaDataTest', function () {
{
bundleName
:
BUNDLE_NAME5
,
abilityName
:
ABILITY_NAME6
,
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
USERID
).
then
(
dataInfos
=>
{
},
bundle
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
userId
).
then
(
dataInfos
=>
{
console
.
info
(
"
dataInfos[0].metaData
"
+
JSON
.
stringify
(
dataInfos
[
0
].
metaData
));
let
metaData
=
dataInfos
[
0
].
metaData
;
expect
(
metaData
[
0
].
name
).
assertEqual
(
""
);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
浏览文件 @
8a848c90
...
...
@@ -19,190 +19,145 @@ import Bundle from '@ohos.bundle';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility';
const SERVICE_ABILITY_NAME = 'com.open.harmony.packagemag.ServiceAbility';
const OTHER_BUNDLE_NAME = 'com.
ohos.acepackage
';
const OTHER_ABILITY_NAME = 'com.
ohos.acepackage
.MainAbility';
const OTHER_BUNDLE_NAME = 'com.
example.l3jsdemo
';
const OTHER_ABILITY_NAME = 'com.
example.l3jsdemo
.MainAbility';
const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error';
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility';
export default function getAbilityLabelJsUnit() {
describe('context_getAbilityLabel_test', function () {
describe('getAbilityLabel_test', function () {
/*
* @tc.number: context_getAbilityLabel_test_0100
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
* @tc.number: getAbilityLabel_test_0100
* @tc.name: Test getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface
*/
it('context_getAbilityLabel_test_0100', 0, async function (done) {
let mData;
let timeOldStamp = await Utils.getNowTime();
it('getAbilityLabel_test_0100', 0, async function (done) {
await Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_getAbilityLabel_test_0100] promise data is: ' + JSON.stringify(data));
expect(data).assertEqual("entry_MainAbility");
}).catch((error) => {
console.info('[context_getAbilityLabel_test_0100] promise error is: ' + error);
expect(error).assertFail();
});
getAbilityLabelSuccess('[context_getAbilityLabel_test_0100]', mData);
done();
});
/*
* @tc.number: context_getAbilityLabel_test_0200
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('context_getAbilityLabel_test_0200', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mData;
Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME, (error, data) => {
if (error) {
console.error('[context_getAbilityLabel_test_0200]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0200] callBack data is:' + JSON.stringify(data));
expect(error).assertEqual(undefined);
expect(data).assertEqual("entry_MainAbility");
done();
});
await Utils.sleep(2000);
getAbilityLabelSuccess('[context_getAbilityLabel_test_0200]', mData);
done();
});
/*
* @tc.number:
context_getAbilityLabel_test_03
00
* @tc.number:
getAbilityLabel_test_02
00
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
* @tc.desc: Check the return value of the interface
*/
it('
context_getAbilityLabel_test_03
00', 0, async function (done) {
it('
getAbilityLabel_test_02
00', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mError;
await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR).then((data) => {
await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[
context_getAbilityLabel_test_03
00]', timeOldStamp, timeNewStamp);
console.info('[context_getAbilityLabel_test_0300] promise data is: ' + JSON.stringify(data)
);
Utils.getDurationTime('[
getAbilityLabel_test_02
00]', timeOldStamp, timeNewStamp);
expect(data).assertEqual("bmsfirstright"
);
}).catch((error) => {
expect(error).assertFail();
});
timeOldStamp = await Utils.getNowTime();
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
let timeNewStamp = Utils.getNowTime();
mError = error
;
Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp
);
console.info('[context_getAbilityLabel_test_0300] promise error is: ' + error
);
expect(mError).assertEqual(1
);
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp)
;
expect(data).assertEqual("bmsfirstright"
);
expect(error).assertEqual(undefined
);
done(
);
});
await Utils.sleep(2000);
getAbilityLabelFailure('[context_getAbilityLabel_test_0300]', mError);
done();
});
/*
* @tc.number:
context_getAbilityLabel_test_04
00
* @tc.number:
getAbilityLabel_test_03
00
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
* @tc.desc: Check the return value of the interface
*/
it('context_getAbilityLabel_test_0400', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mError;
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
if (error !== null) {
console.info('[context_getAbilityLabel_test_0400] callBack error: ' + error);
expect(error).assertEqual(1);
}
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
mError = error;
console.info('[context_getAbilityLabel_test_0400] callBack data is:' + JSON.stringify(data));
it('getAbilityLabel_test_0300', 0, async function (done) {
await Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME).then((data) => {
expect(error).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME, (error, data) => {
expect(error).assertEqual(1);
expect(data).assertEqual(undefined);
done();
});
await Utils.sleep(2000);
getAbilityLabelFailure('[context_getAbilityLabel_test_0400]', mError);
done();
});
/*
* @tc.number:
context_getAbilityLabel_test_05
00
* @tc.number:
getAbilityLabel_test_04
00
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
* @tc.desc: Check the return value of the interface
*/
it('context_getAbilityLabel_test_0500', 0, async function (done) {
let mData;
let mError = null;
it('getAbilityLabel_test_0400', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME).then((data) => {
await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR).then((data) => {
expect(error).assertFail();
}).catch((error) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0500]', timeOldStamp, timeNewStamp);
mData = data;
expect(mData).assertFail();
console.info('[context_getAbilityLabel_test_0500] promise data is: ' + JSON.stringify(data));
Utils.getDurationTime('[getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
expect(error).assertEqual(1);
});
await Bundle.getAbilityLabel("", "").then((data) => {
expect(error).assertFail();
}).catch((error) => {
mError = error;
console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error);
getAbilityLabelFailure('[context_getAbilityLabel_test_0500]', mError);
expect(error).assertEqual(1);
});
done();
});
/*
* @tc.number: context_getAbilityLabel_test_0600
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
it('context_getAbilityLabel_test_0600', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
timeOldStamp = await Utils.getNowTime();
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0600]', timeOldStamp, timeNewStamp);
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
getAbilityLabelFailure('[context_getAbilityLabel_test_0600]', error);
Utils.getDurationTime('[getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
expect(error).assertEqual(1);
expect(data).assertEqual(undefined);
Bundle.getAbilityLabel("", "", (error, data) => {
expect(error).assertEqual(1);
expect(data).assertEqual(undefined);
done();
});
});
done();
});
/*
* @tc.number:
context_getAbilityLabel_test_07
00
* @tc.number:
getAbilityLabel_test_05
00
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
* @tc.desc: Check the return value of the interface
*/
it('context_getAbilityLabel_test_0700', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let mError;
Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME, (error, data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0700]', timeOldStamp, timeNewStamp);
mError = error;
if (mError !== null) {
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
}
console.info('[context_getAbilityLabel_test_0700] callBack data is:' + JSON.stringify(data));
it('getAbilityLabel_test_0500', 0, async function (done) {
await Bundle.getAbilityLabel(undefined, OTHER_ABILITY_NAME).then((data) => {
expect(error).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, undefined).then((data) => {
expect(error).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
await Bundle.getAbilityLabel(undefined, undefined).then((data) => {
expect(error).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
Bundle.getAbilityLabel(undefined, OTHER_ABILITY_NAME, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, undefined, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.getAbilityLabel(undefined, undefined, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
done();
});
});
});
await Utils.sleep(2000);
getAbilityLabelFailure('[context_getAbilityLabel_test_0700]', mError);
done();
});
function getAbilityLabelSuccess(msg, data) {
console.log(msg + ' start ' + JSON.stringify(data));
console.log(msg + ' result ' + data);
expect(typeof (data)).assertEqual('string');
expect(data).assertEqual("entry_MainAbility");
}
function getAbilityLabelFailure(msg, error) {
console.log(msg + ' Failure ');
console.log(msg + ' error ' + JSON.stringify(error));
expect(typeof (error)).assertEqual('number');
expect(error).assertEqual(1)
}
})
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
浏览文件 @
8a848c90
...
...
@@ -227,10 +227,6 @@ export default function GetabilityInfo() {
expect
(
typeof
(
data
.
description
))
.
assertEqual
(
"string"
);
expect
(
data
.
icon
)
.
assertEqual
(
"
$media
:icon"
);
expect
(
typeof
(
data
.
icon
))
.
assertEqual
(
"string"
);
expect
(
data
.
srcPath
)
.
assertEqual
(
"MainAbility"
);
expect
(
typeof
(
data
.
srcPath
))
.
assertEqual
(
"string"
);
expect
(
data
.
srcLanguage
)
.
assertEqual
(
"ets"
);
expect
(
typeof
(
data
.
srcLanguage
))
.
assertEqual
(
"string"
);
expect
(
data
.
isVisible
)
.
assertEqual
(
true
);
expect
(
Array
.
isArray
(
data
.
permissions
))
.
assertEqual
(
true
);
expect
(
Array
.
isArray
(
data
.
deviceCapabilities
))
.
assertEqual
(
true
);
...
...
@@ -284,8 +280,6 @@ export default function GetabilityInfo() {
expect
(
data
.
label
)
.
assertEqual
(
"
$string
:app_name"
);
expect
(
data
.
description
)
.
assertEqual
(
"
$string
:mainability_description"
);
expect
(
data
.
icon
)
.
assertEqual
(
"
$media
:icon"
);
expect
(
data
.
srcPath
)
.
assertEqual
(
""
);
expect
(
data
.
srcLanguage
)
.
assertEqual
(
"js"
);
expect
(
data
.
isVisible
)
.
assertEqual
(
true
);
expect
(
data
.
deviceTypes
[
0
])
.
assertEqual
(
"phone"
);
expect
(
data
.
process
)
.
assertEqual
(
""
);
...
...
@@ -304,7 +298,6 @@ export default function GetabilityInfo() {
expect
(
data
.
readPermission
)
.
assertEqual
(
""
);
expect
(
data
.
writePermission
)
.
assertEqual
(
""
);
expect
(
data
.
targetAbility
)
.
assertEqual
(
""
);
expect
(
data
.
theme
)
.
assertEqual
(
""
);
expect
(
data
.
metaData
.
length
)
.
assertEqual
(
0
);
expect
(
data
.
metadata
.
length
)
.
assertEqual
(
0
);
checkApplicationInfo_other
(
data
.
applicationInfo
);
...
...
@@ -329,7 +322,6 @@ export default function GetabilityInfo() {
expect
(
JSON
.
stringify
(
info
.
metaData
))
.
assertEqual
(
"{}"
);
expect
(
JSON
.
stringify
(
info
.
metadata
))
.
assertEqual
(
"{}"
);
expect
(
info
.
enabled
)
.
assertEqual
(
true
);
expect
(
info
.
flags
)
.
assertEqual
(
0
);
expect
(
info
.
uid
)
.
assertLarger
(
0
);
expect
(
info
.
entityType
)
.
assertEqual
(
"unspecified"
);
expect
(
info
.
removable
)
.
assertEqual
(
true
);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
浏览文件 @
8a848c90
...
...
@@ -12,9 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, it, expect } from 'deccjsunit/index.ets';
import { describe,
beforeAll ,
it, expect } from 'deccjsunit/index.ets';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
import account from '@ohos.account.osAccount';
const TAG_TEST_0100_001 = ' bundle_getAllApplicationInfo_test_0100_001 ';
const TAG_TEST_0100_002 = ' bundle_getAllApplicationInfo_test_0100_002 ';
...
...
@@ -26,12 +27,23 @@ const TAG_TEST_0300_001 = ' bundle_getAllApplicationInfo_test_0300_007 ';
const TAG_TEST_0400_001 = ' bundle_getAllApplicationInfo_test_0400_008 ';
const TAG_TEST_0500_001 = ' bundle_getAllApplicationInfo_test_0500_009 ';
const TAG_TEST_0500_002 = ' bundle_getAllApplicationInfo_test_0500_0010 ';
const USER_ID_100 = 10
0;
let userId =
0;
export default function applicationBundleJsunit() {
describe('appInfoTest', function () {
beforeAll(async function (done) {
await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => {
console.info("getOsAccountLocalIdFromProcess userid ==========" + account);
userId = account;
done();
}).catch(err=>{
console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err));
done();
})
});
/**
* @tc.number: bundle_getApplicationInfo_test_0100_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
...
...
@@ -41,7 +53,7 @@ export default function applicationBundleJsunit() {
it(TAG_TEST_0100_001, 0, async function (done) {
let startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
USER_ID_100
).catch((error) => {
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
userId
).catch((error) => {
console.info(TAG_TEST_0100_001 + 'UserId promise error is: ' + error);
expect(error).assertFail();
});
...
...
@@ -62,7 +74,7 @@ export default function applicationBundleJsunit() {
it(TAG_TEST_0100_002, 0, async function (done) {
let startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(
Bundle.BundleFlag.GET_ALL_APPLICATION_INFO,
USER_ID_100
).catch((error) => {
Bundle.BundleFlag.GET_ALL_APPLICATION_INFO,
userId
).catch((error) => {
console.info(TAG_TEST_0100_002 + 'UserId promise error is: ' + error);
expect(error).assertFail();
});
...
...
@@ -83,7 +95,7 @@ export default function applicationBundleJsunit() {
it(TAG_TEST_0100_003, 0, async function (done) {
let startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE,
USER_ID_100
).catch((error) => {
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE,
userId
).catch((error) => {
console.info(TAG_TEST_0100_003 + 'UserId promise error is: ' + error);
expect(error).assertFail();
});
...
...
@@ -169,7 +181,7 @@ export default function applicationBundleJsunit() {
let datas;
let startTime = await Utils.getNowTime();
Bundle.getAllApplicationInfo(
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
USER_ID_100
, (error, data) => {
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
userId
, (error, data) => {
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0300_001, startTime, endTime);
if (error) {
...
...
@@ -245,7 +257,7 @@ export default function applicationBundleJsunit() {
it(TAG_TEST_0500_002, 0, async function (done) {
let errors;
let startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT',
USER_ID_100
).then((data) => {
await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT',
userId
).then((data) => {
console.info(TAG_TEST_0500_002 + 'noUserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
...
...
@@ -277,7 +289,6 @@ export default function applicationBundleJsunit() {
expect(typeof (data[i].metaData)).assertEqual('object');
expect(typeof (data[i].metadata)).assertEqual('object');
expect(typeof (data[i].enabled)).assertEqual('boolean');
expect(typeof (data[i].flags)).assertEqual('number');
expect(typeof (data[i].uid)).assertEqual('number');
expect(typeof (data[i].entityType)).assertEqual('string');
expect(typeof (data[i].removable)).assertEqual('boolean');
...
...
@@ -314,7 +325,6 @@ export default function applicationBundleJsunit() {
expect(data[i].entryDir).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag' +
'/com.open.harmony.packagemag');
expect(data[i].enabled).assertEqual(true);
expect(data[i].flags).assertEqual(0);
expect(data[i].entityType).assertEqual('unspecified');
expect(data[i].removable).assertEqual(true);
expect(data[i].moduleInfos[0].moduleName).assertEqual('entry');
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
浏览文件 @
8a848c90
...
...
@@ -12,9 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, it, expect } from 'deccjsunit/index.ets';
import { describe, it,
beforeAll,
expect } from 'deccjsunit/index.ets';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
import account from '@ohos.account.osAccount';
const TAG_TEST_0100_001 = ' bundle_getApplicationInfo_test_0100_001 ';
const TAG_TEST_0100_002 = ' bundle_getApplicationInfo_test_0100_002 ';
...
...
@@ -31,12 +32,23 @@ const TAG_TEST_0600_002 = ' bundle_getApplicationInfo_test_0600_0012 ';
const TAG_TEST_0600_003 = ' bundle_getApplicationInfo_test_0600_0013 ';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME_OTHER = 'com.ohos.acepackage';
const USER_ID_100 = 10
0;
let userId =
0;
export default function applicationBundleJsunit() {
describe('appInfoTest', function () {
beforeAll(async function (done) {
await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => {
console.info("getOsAccountLocalIdFromProcess userid ==========" + account);
userId = account;
done();
}).catch(err=>{
console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err));
done();
})
});
/**
* @tc.number: bundle_getApplicationInfo_test_0100_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
...
...
@@ -46,7 +58,7 @@ export default function applicationBundleJsunit() {
it(TAG_TEST_0100_001, 0, async function (done) {
let startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME,
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
USER_ID_100
).catch((error) => {
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
userId
).catch((error) => {
console.info(TAG_TEST_0100_001 + 'UserId promise error is: ' + error);
expect(error).assertFail();
});
...
...
@@ -67,7 +79,7 @@ export default function applicationBundleJsunit() {
it(TAG_TEST_0100_002, 0, async function (done) {
let startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME,
Bundle.BundleFlag.GET_ALL_APPLICATION_INFO,
USER_ID_100
).catch((error) => {
Bundle.BundleFlag.GET_ALL_APPLICATION_INFO,
userId
).catch((error) => {
console.info(TAG_TEST_0100_002 + 'UserId promise error is: ' + error);
expect(error).assertFail();
});
...
...
@@ -88,7 +100,7 @@ export default function applicationBundleJsunit() {
it(TAG_TEST_0100_003, 0, async function (done) {
let startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME,
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE,
USER_ID_100
).catch((error) => {
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE,
userId
).catch((error) => {
console.info(TAG_TEST_0100_003 + 'UserId promise error is: ' + error);
expect(error).assertFail();
});
...
...
@@ -175,7 +187,7 @@ export default function applicationBundleJsunit() {
let datas;
let startTime = await Utils.getNowTime();
Bundle.getApplicationInfo(BUNDLE_NAME,
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
USER_ID_100
, (error, data) => {
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
userId
, (error, data) => {
let endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0300_001, startTime, endTime);
errors = error;
...
...
@@ -250,7 +262,7 @@ export default function applicationBundleJsunit() {
*/
it(TAG_TEST_0500_002, 0, async function (done) {
let startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', 'Bundle.BundleFlag.GET_BUNDLE_DEFAULT',
USER_ID_100
).then((data) => {
await Bundle.getApplicationInfo('', 'Bundle.BundleFlag.GET_BUNDLE_DEFAULT',
userId
).then((data) => {
console.info(TAG_TEST_0500_002 + 'UserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
...
...
@@ -295,7 +307,7 @@ export default function applicationBundleJsunit() {
let startTime = await Utils.getNowTime();
let errors
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER,
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
USER_ID_100
).then((data) => {
Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
userId
).then((data) => {
console.info(TAG_TEST_0600_002 + 'other bundleName UserId promise data is: ' + data);
expect(data).assertFail();
}).catch((error) => {
...
...
@@ -348,7 +360,6 @@ export default function applicationBundleJsunit() {
expect(typeof (data.metaData)).assertEqual('object');
expect(typeof (data.metadata)).assertEqual('object');
expect(typeof (data.enabled)).assertEqual('boolean');
expect(typeof (data.flags)).assertEqual('number');
expect(typeof (data.uid)).assertEqual('number');
expect(typeof (data.entityType)).assertEqual('string');
expect(typeof (data.removable)).assertEqual('boolean');
...
...
@@ -370,7 +381,6 @@ export default function applicationBundleJsunit() {
expect(data.labelId > 0).assertEqual(true);
expect(data.systemApp).assertEqual(true);
expect(data.supportedModes).assertEqual(0);
expect(data.flags).assertEqual(0);
expect(data.process).assertEqual("");
expect(data.entryDir).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag' +
'/com.open.harmony.packagemag');
...
...
@@ -401,7 +411,6 @@ export default function applicationBundleJsunit() {
expect(data.labelId > 0).assertEqual(true);
expect(data.systemApp).assertEqual(true);
expect(data.supportedModes).assertEqual(0);
expect(data.flags).assertEqual(0);
expect(data.process).assertEqual("");
expect(data.entryDir).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag' +
'/com.open.harmony.packagemag');
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
8a848c90
...
...
@@ -14,6 +14,7 @@
*/
import
app
from
'
@system.app
'
import
account
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
demo
from
'
@ohos.bundle
'
...
...
@@ -29,10 +30,21 @@ const OBJECT = "object"
const
DIR1
=
"
/data/accounts/account_0/applications/com.example.myapplication1/com.example.myapplication1
"
const
DIR2
=
"
/data/accounts/account_0/applications/com.example.myapplication2/com.example.myapplication2
"
const
DESCRIPTION
=
"
$string:mainability_description
"
const
USERID
=
10
0
;
let
userId
=
0
;
describe
(
'
ActsBundleManagerTest
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
done
();
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
done
();
})
});
/**
* @tc.number getBundleInfo_0100
* @tc.name BUNDLEMGR::getBundleInfo
...
...
@@ -198,7 +210,7 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfos interfaces with one hap.
*/
it
(
'
getApplicationInfos_0100
'
,
0
,
async
function
(
done
)
{
let
datainfo
=
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
);
let
datainfo
=
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
userId
);
checkgetApplicationInfos
(
datainfo
);
done
();
})
...
...
@@ -216,7 +228,6 @@ describe('ActsBundleManagerTest', function () {
expect
(
datainfo
[
i
].
moduleSourceDirs
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
supportedModes
).
assertEqual
(
0
);
expect
(
datainfo
[
i
].
flags
).
assertEqual
(
0
);
for
(
let
j
=
0
;
j
<
datainfo
[
i
].
moduleInfos
;
j
++
)
{
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleName
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleSourceDir
.
length
).
assertLarger
(
0
);
...
...
@@ -232,14 +243,13 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getApplicationInfos_0600
'
,
0
,
async
function
(
done
)
{
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
,
(
error
,
datainfo
)
=>
{
userId
,
(
error
,
datainfo
)
=>
{
expect
(
datainfo
.
length
).
assertLarger
(
0
);
for
(
let
i
=
0
;
i
<
datainfo
.
length
;
i
++
)
{
expect
(
datainfo
[
i
].
name
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleSourceDirs
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
supportedModes
).
assertEqual
(
0
);
expect
(
datainfo
[
i
].
flags
).
assertEqual
(
0
);
for
(
let
j
=
0
;
j
<
datainfo
[
i
].
moduleInfos
;
j
++
)
{
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleName
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleSourceDir
.
length
).
assertLarger
(
0
);
...
...
@@ -281,7 +291,7 @@ describe('ActsBundleManagerTest', function () {
it
(
'
getApplicationInfo_0100
'
,
0
,
async
function
(
done
)
{
await
demo
.
getApplicationInfo
(
NAME1
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
|
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_METADATA
,
USERID
).
then
(
datainfo
=>
{
userId
).
then
(
datainfo
=>
{
expect
(
typeof
datainfo
).
assertEqual
(
OBJECT
);
console
.
info
(
"
getApplicationInfo success:
"
+
JSON
.
stringify
(
datainfo
));
expect
(
datainfo
.
moduleSourceDirs
.
length
).
assertLarger
(
0
);
...
...
@@ -297,7 +307,6 @@ describe('ActsBundleManagerTest', function () {
expect
(
datainfo
.
supportedModes
).
assertEqual
(
0
);
expect
(
datainfo
.
process
).
assertEqual
(
""
);
expect
(
datainfo
.
enabled
).
assertEqual
(
true
);
expect
(
datainfo
.
flags
).
assertEqual
(
0
);
expect
(
datainfo
.
metaData
.
entry
[
0
].
name
).
assertEqual
(
"
metaDataName
"
);
expect
(
datainfo
.
metaData
.
entry
[
0
].
value
).
assertEqual
(
"
metaDataValue
"
);
expect
(
datainfo
.
metaData
.
entry
[
0
].
extra
).
assertEqual
(
"
$string:app_name
"
);
...
...
@@ -344,7 +353,7 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfo interfaces with one hap.
*/
it
(
'
getApplicationInfo_0600
'
,
0
,
async
function
(
done
)
{
await
demo
.
getApplicationInfo
(
NAME1
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
,
await
demo
.
getApplicationInfo
(
NAME1
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
userId
,
(
error
,
datainfo
)
=>
{
if
(
error
)
{
console
.
info
(
"
getApplicationInfo fail:
"
+
JSON
.
stringify
(
error
));
...
...
@@ -376,7 +385,7 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfo interfaces with one hap and different param.
*/
it
(
'
getApplicationInfo_1100
'
,
0
,
async
function
(
done
)
{
await
demo
.
getApplicationInfo
(
NAME1
,
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
).
then
(
datainfo
=>
{
await
demo
.
getApplicationInfo
(
NAME1
,
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
).
then
(
datainfo
=>
{
console
.
info
(
"
getApplicationInfo success
"
+
JSON
.
stringify
(
datainfo
));
expect
(
typeof
datainfo
).
assertEqual
(
OBJECT
);
expect
(
datainfo
.
name
).
assertEqual
(
NAME1
);
...
...
@@ -401,7 +410,7 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfo interfaces with one hap and different param.
*/
it
(
'
getApplicationInfo_1200
'
,
0
,
async
function
(
done
)
{
await
demo
.
getApplicationInfo
(
NAME1
,
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
,
(
error
,
datainfo
)
=>
{
await
demo
.
getApplicationInfo
(
NAME1
,
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
,
(
error
,
datainfo
)
=>
{
if
(
error
)
{
console
.
info
(
"
getApplicationInfo fail
"
+
JSON
.
stringify
(
error
));
expect
(
error
).
assertFail
();
...
...
@@ -475,7 +484,7 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfos interfaces with two haps.
*/
it
(
'
getApplicationInfos_0200
'
,
0
,
async
function
(
done
)
{
let
datainfo
=
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
);
let
datainfo
=
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
userId
);
console
.
info
(
"
==========ActsBmsGetInfosSecondScene is ==========
"
+
JSON
.
stringify
(
datainfo
));
checkgetApplicationInfos
(
datainfo
);
done
();
...
...
@@ -487,7 +496,7 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfos interfaces with two haps and different param.
*/
it
(
'
getApplicationInfos_0400
'
,
0
,
async
function
(
done
)
{
let
datainfo
=
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
);
let
datainfo
=
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
);
expect
(
datainfo
.
length
).
assertLarger
(
0
);
checkgetApplicationInfos
(
datainfo
);
done
();
...
...
@@ -500,7 +509,7 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getApplicationInfos_0700
'
,
0
,
async
function
(
done
)
{
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
,
(
error
,
datainfo
)
=>
{
userId
,
(
error
,
datainfo
)
=>
{
for
(
let
i
=
0
;
i
<
datainfo
.
length
;
i
++
)
{
expect
(
datainfo
[
i
].
name
.
length
).
assertLarger
(
0
);
if
(
datainfo
[
i
].
name
==
NAME1
||
datainfo
[
i
].
name
==
NAME2
...
...
@@ -512,7 +521,6 @@ describe('ActsBundleManagerTest', function () {
expect
(
datainfo
[
i
].
moduleSourceDirs
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
supportedModes
).
assertEqual
(
0
);
expect
(
datainfo
[
i
].
flags
).
assertEqual
(
0
);
for
(
let
j
=
0
;
j
<
datainfo
[
i
].
moduleInfos
;
j
++
)
{
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleName
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleSourceDir
.
length
).
assertLarger
(
0
);
...
...
@@ -528,7 +536,7 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfos interfaces with three haps.
*/
it
(
'
getApplicationInfos_0800
'
,
0
,
async
function
(
done
)
{
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
,
(
error
,
datainfo
)
=>
{
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
,
(
error
,
datainfo
)
=>
{
for
(
let
i
=
0
;
i
<
datainfo
.
length
;
i
++
)
{
expect
(
datainfo
[
i
].
name
.
length
).
assertLarger
(
0
);
if
(
datainfo
[
i
].
name
==
NAME1
||
datainfo
[
i
].
name
==
NAME2
...
...
@@ -540,7 +548,6 @@ describe('ActsBundleManagerTest', function () {
expect
(
datainfo
[
i
].
moduleSourceDirs
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
supportedModes
).
assertEqual
(
0
);
expect
(
datainfo
[
i
].
flags
).
assertEqual
(
0
);
for
(
let
j
=
0
;
j
<
datainfo
[
i
].
moduleInfos
;
j
++
)
{
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleName
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleSourceDir
.
length
).
assertLarger
(
0
);
...
...
@@ -556,7 +563,7 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfos interfaces with two haps and different param.
*/
it
(
'
getApplicationInfos_0900
'
,
0
,
async
function
(
done
)
{
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
,
(
error
,
datainfo
)
=>
{
await
demo
.
getAllApplicationInfo
(
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
,
(
error
,
datainfo
)
=>
{
for
(
let
i
=
0
;
i
<
datainfo
.
length
;
i
++
)
{
expect
(
datainfo
[
i
].
name
.
length
).
assertLarger
(
0
);
if
(
datainfo
[
i
].
name
==
NAME1
||
datainfo
[
i
].
name
==
NAME2
...
...
@@ -568,7 +575,6 @@ describe('ActsBundleManagerTest', function () {
expect
(
datainfo
[
i
].
moduleSourceDirs
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
supportedModes
).
assertEqual
(
0
);
expect
(
datainfo
[
i
].
flags
).
assertEqual
(
0
);
for
(
let
j
=
0
;
j
<
datainfo
[
i
].
moduleInfos
;
j
++
)
{
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleName
.
length
).
assertLarger
(
0
);
expect
(
datainfo
[
i
].
moduleInfos
[
j
].
moduleSourceDir
.
length
).
assertLarger
(
0
);
...
...
@@ -631,7 +637,7 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getApplicationInfo_0200
'
,
0
,
async
function
(
done
)
{
let
datainfo
=
await
demo
.
getApplicationInfo
(
NAME2
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
);
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
userId
);
console
.
info
(
"
getApplicationInfo result
"
+
JSON
.
stringify
(
datainfo
));
expect
(
typeof
datainfo
).
assertEqual
(
OBJECT
);
expect
(
datainfo
.
name
.
length
).
assertLarger
(
0
);
...
...
@@ -651,7 +657,6 @@ describe('ActsBundleManagerTest', function () {
expect
(
datainfo
.
supportedModes
).
assertEqual
(
0
);
expect
(
datainfo
.
process
).
assertEqual
(
""
);
expect
(
datainfo
.
enabled
).
assertEqual
(
true
);
expect
(
datainfo
.
flags
).
assertEqual
(
0
);
expect
(
datainfo
.
moduleSourceDirs
.
length
).
assertLarger
(
0
);
for
(
let
j
=
0
;
j
<
datainfo
.
moduleInfos
;
j
++
)
{
expect
(
datainfo
.
moduleInfos
[
j
].
moduleName
).
assertEqual
(
"
entry
"
);
...
...
@@ -716,7 +721,7 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getApplicationInfo_0700
'
,
0
,
async
function
(
done
)
{
await
demo
.
getApplicationInfo
(
NAME2
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
,
(
error
,
datainfo
)
=>
{
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
userId
,
(
error
,
datainfo
)
=>
{
if
(
error
)
{
console
.
info
(
"
getApplicationInfo error
"
+
JSON
.
stringify
(
error
));
expect
(
error
).
assertFail
();
...
...
@@ -813,23 +818,33 @@ describe('ActsBundleManagerTest', function () {
* @tc.name BUNDLE::getApplicationInfo
* @tc.desc Test getApplicationInfo interfaces with three haps.
*/
it
(
'
getApplicationInfo_0300
'
,
0
,
async
function
(
done
)
{
demo
.
getApplicationInfo
(
NAME3
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
demo
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
).
then
(
datainfo
=>
{
expect
(
datainfo
.
name
).
assertEqual
(
NAME3
);
expect
(
datainfo
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
datainfo
.
description
).
assertEqual
(
DESCRIPTION
);
expect
(
datainfo
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
datainfo
.
name
).
assertEqual
(
NAME3
);
expect
(
datainfo
.
description
).
assertEqual
(
DESCRIPTION
);
expect
(
datainfo
.
descriptionId
>=
0
).
assertTrue
();
expect
(
datainfo
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
datainfo
.
iconId
>=
0
).
assertTrue
();
expect
(
datainfo
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
datainfo
.
labelId
>=
0
).
assertTrue
();
expect
(
datainfo
.
systemApp
).
assertEqual
(
true
);
expect
(
datainfo
.
supportedModes
).
assertEqual
(
0
);
});
it
(
'
getApplicationInfo_0300
'
,
0
,
async
function
(
done
)
{
let
datainfo
=
await
demo
.
getApplicationInfo
(
NAME2
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
userId
);
console
.
info
(
"
getApplicationInfo_0300 result
"
+
JSON
.
stringify
(
datainfo
));
expect
(
typeof
datainfo
).
assertEqual
(
OBJECT
);
expect
(
datainfo
.
name
.
length
).
assertLarger
(
0
);
expect
(
datainfo
.
description
.
length
).
assertLarger
(
0
);
expect
(
datainfo
.
icon
.
length
).
assertLarger
(
0
);
expect
(
datainfo
.
label
.
length
).
assertLarger
(
0
);
expect
(
datainfo
.
moduleSourceDirs
.
length
).
assertLarger
(
0
);
expect
(
datainfo
.
moduleInfos
.
length
).
assertLarger
(
0
);
expect
(
datainfo
.
name
).
assertEqual
(
NAME2
);
expect
(
datainfo
.
description
).
assertEqual
(
DESCRIPTION
);
expect
(
datainfo
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
datainfo
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
datainfo
.
systemApp
).
assertEqual
(
true
);
expect
(
datainfo
.
descriptionId
>=
0
).
assertTrue
();
expect
(
datainfo
.
iconId
>=
0
).
assertTrue
();
expect
(
datainfo
.
labelId
>=
0
).
assertTrue
();
expect
(
datainfo
.
supportedModes
).
assertEqual
(
0
);
expect
(
datainfo
.
process
).
assertEqual
(
""
);
expect
(
datainfo
.
enabled
).
assertEqual
(
true
);
expect
(
datainfo
.
moduleSourceDirs
.
length
).
assertLarger
(
0
);
for
(
let
j
=
0
;
j
<
datainfo
.
moduleInfos
;
j
++
)
{
expect
(
datainfo
.
moduleInfos
[
j
].
moduleName
).
assertEqual
(
"
entry
"
);
expect
(
datainfo
.
moduleInfos
[
j
].
moduleSourceDir
.
length
).
assertLarger
(
0
);
}
done
();
})
...
...
@@ -877,7 +892,7 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getApplicationInfo_0400
'
,
0
,
async
function
(
done
)
{
demo
.
getApplicationInfo
(
ERROR
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
).
then
(
datainfo
=>
{
userId
).
then
(
datainfo
=>
{
checkgetApplicationInfoe
(
datainfo
);
}).
catch
(
err
=>
{
console
.
info
(
"
getApplicationInfo err
"
+
JSON
.
stringify
(
err
));
...
...
@@ -898,7 +913,7 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getApplicationInfo_0900
'
,
0
,
async
function
(
done
)
{
demo
.
getApplicationInfo
(
ERROR
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
,
(
error
,
datainfo
)
=>
{
userId
,
(
error
,
datainfo
)
=>
{
if
(
error
)
{
console
.
info
(
"
getApplicationInfo fail
"
+
JSON
.
stringify
(
error
));
expect
(
error
).
assertEqual
(
1
);
...
...
@@ -938,7 +953,7 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getApplicationInfo_0500
'
,
0
,
async
function
(
done
)
{
demo
.
getApplicationInfo
(
''
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
,
(
error
,
datainfo
)
=>
{
userId
,
(
error
,
datainfo
)
=>
{
if
(
error
)
{
console
.
info
(
"
getApplicationInfo err
"
+
JSON
.
stringify
(
error
));
expect
(
error
).
assertEqual
(
1
);
...
...
@@ -975,7 +990,7 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getApplicationInfo_1000
'
,
0
,
async
function
(
done
)
{
demo
.
getApplicationInfo
(
''
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
,
(
error
,
datainfo
)
=>
{
userId
,
(
error
,
datainfo
)
=>
{
if
(
error
)
{
console
.
info
(
"
getApplicationInfo fail
"
+
JSON
.
stringify
(
error
));
expect
(
error
).
assertEqual
(
1
);
...
...
@@ -1001,7 +1016,7 @@ describe('ActsBundleManagerTest', function () {
},
demo
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
demo
.
BundleFlag
.
GET_ABILITY_INFO_WITH_PERMISSION
|
demo
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
USERID
).
then
(
data
=>
{
userId
).
then
(
data
=>
{
expect
(
data
.
length
).
assertLarger
(
0
);
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
let
datainfo
=
data
[
i
];
...
...
@@ -1049,7 +1064,7 @@ describe('ActsBundleManagerTest', function () {
{
"
bundleName
"
:
"
com.example.myapplication2
"
,
"
abilityName
"
:
"
com.example.myapplication1.MainAbility
"
,
},
demo
.
BundleFlag
.
GET_ALL_APPLICATION_INFO
,
USERID
);
},
demo
.
BundleFlag
.
GET_ALL_APPLICATION_INFO
,
userId
);
expect
(
data
.
length
).
assertLarger
(
0
);
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
let
datainfo
=
data
[
i
];
...
...
@@ -1087,7 +1102,7 @@ describe('ActsBundleManagerTest', function () {
it
(
'
queryAbilityByWant_0300
'
,
0
,
async
function
(
done
)
{
await
demo
.
queryAbilityByWant
({
entities
:
[
'
entity.system.home
'
,
'
entitiesentities
'
]
},
4
,
USERID
).
then
(
data
=>
{
},
4
,
userId
).
then
(
data
=>
{
let
queryResultCount
=
0
;
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
let
datainfo
=
data
[
i
];
...
...
@@ -1145,7 +1160,7 @@ describe('ActsBundleManagerTest', function () {
{
"
bundleName
"
:
"
wrong name
"
,
"
abilityName
"
:
"
com.example.myapplication1.MainAbility
"
},
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
USERID
).
then
(
datainfo
=>
{
},
demo
.
BundleFlag
.
GET_BUNDLE_DEFAULT
,
userId
).
then
(
datainfo
=>
{
console
.
info
(
"
queryAbilityByWant_0400 dataInfo : ===========
"
+
datainfo
);
expect
(
datainfo
).
assertFail
();
}).
catch
(
err
=>
{
...
...
@@ -1189,7 +1204,7 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getBundleInfo_1400
'
,
0
,
async
function
(
done
)
{
let
bundleOptions
=
{
userId
:
USERID
userId
:
userId
};
let
dataInfo
=
await
demo
.
getBundleInfo
(
NAME1
,
demo
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
bundleOptions
);
console
.
info
(
"
getBundleInfo_1400 start --------
"
);
...
...
@@ -1237,7 +1252,7 @@ describe('ActsBundleManagerTest', function () {
*/
it
(
'
getBundleInfo_1500
'
,
0
,
async
function
(
done
)
{
let
bundleOptions
=
{
userId
:
USERID
userId
:
userId
};
demo
.
getBundleInfo
(
NAME1
,
demo
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
bundleOptions
,
(
err
,
dataInfo
)
=>
{
expect
(
dataInfo
.
name
).
assertEqual
(
NAME1
);
...
...
@@ -1318,7 +1333,7 @@ describe('ActsBundleManagerTest', function () {
{
bundleName
:
"
wrong name
"
,
abilityName
:
"
wrong name
"
,
},
0
,
USERID
,
OnReceiveEvent
);
},
0
,
userId
,
OnReceiveEvent
);
function
OnReceiveEvent
(
err
,
datainfo
)
{
expect
(
err
).
assertEqual
(
1
);
expect
(
datainfo
.
length
).
assertLarger
(
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录