Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
96bca996
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看板
提交
96bca996
编写于
5月 31, 2022
作者:
I
inter515
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改done的位置
Signed-off-by:
N
inter515
<
ry.renyi@huawei.com
>
上级
08102a86
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
119 addition
and
153 deletion
+119
-153
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js
.../entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js
+2
-2
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/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js
...emanagertest/entry/src/main/js/test/ExampleJsunit.test.js
+28
-17
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js
浏览文件 @
96bca996
...
@@ -147,10 +147,10 @@ describe('ActsBmsGetBackGroundModes', function () {
...
@@ -147,10 +147,10 @@ describe('ActsBmsGetBackGroundModes', function () {
});
});
bundle
.
getBundleInfo
(
BUNDLE_NAME2
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
(
err
,
data3
)
=>
{
bundle
.
getBundleInfo
(
BUNDLE_NAME2
,
bundle
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
,
(
err
,
data3
)
=>
{
expect
(
data3
.
abilityInfos
[
1
].
backgroundModes
).
assertEqual
(
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
expect
(
data3
.
abilityInfos
[
1
].
backgroundModes
).
assertEqual
(
AUDIOPLAYBACK
|
AUDIORECORDING
|
LOCATION
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
)
|
BLUETOOTHINTERACTION
|
MULTIDEVICECONNECTION
|
WIFIINTERACTION
|
VOIP
|
TASKKEEPING
);
});
done
();
done
();
});
});
});
/*
/*
* @tc.number: bms_backGroundModes_0400
* @tc.number: bms_backGroundModes_0400
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
浏览文件 @
96bca996
...
@@ -19,189 +19,144 @@ import Bundle from '@ohos.bundle';
...
@@ -19,189 +19,144 @@ import Bundle from '@ohos.bundle';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility';
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility';
const SERVICE_ABILITY_NAME = 'com.open.harmony.packagemag.ServiceAbility';
const SERVICE_ABILITY_NAME = 'com.open.harmony.packagemag.ServiceAbility';
const OTHER_BUNDLE_NAME = 'com.
ohos.acepackage
';
const OTHER_BUNDLE_NAME = 'com.
example.l3jsdemo
';
const OTHER_ABILITY_NAME = 'com.
ohos.acepackage
.MainAbility';
const OTHER_ABILITY_NAME = 'com.
example.l3jsdemo
.MainAbility';
const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error';
const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error';
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility';
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility';
export default function getAbilityLabelJsUnit() {
export default function getAbilityLabelJsUnit() {
describe('context_getAbilityLabel_test', function () {
describe('getAbilityLabel_test', function () {
/*
/*
* @tc.number: context_getAbilityLabel_test_0100
* @tc.number: getAbilityLabel_test_0100
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.name: Test getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by promise)
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0100', 0, async function (done) {
it('getAbilityLabel_test_0100', 0, async function (done) {
let mData;
let timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME).then((data) => {
await Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME).then((data) => {
let timeNewStamp = Utils.getNowTime();
expect(data).assertEqual("entry_MainAbility");
Utils.getDurationTime('[context_getAbilityLabel_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_getAbilityLabel_test_0100] promise data is: ' + JSON.stringify(data));
}).catch((error) => {
}).catch((error) => {
console.info('[context_getAbilityLabel_test_0100] promise error is: ' + error);
expect(error).assertFail();
expect(error).assertFail();
});
});
getAbilityLabelSuccess('[context_getAbilityLabel_test_0100]', mData);
Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME, (error, data) => {
expect(error).assertEqual(undefined);
expect(data).assertEqual("entry_MainAbility");
done();
done();
});
});
});
/*
/*
* @tc.number:
context_
getAbilityLabel_test_0200
* @tc.number: getAbilityLabel_test_0200
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by callback)
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
*/
it('
context_
getAbilityLabel_test_0200', 0, async function (done) {
it('getAbilityLabel_test_0200', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let timeOldStamp = await Utils.getNowTime();
let mData;
await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME).then((data) => {
Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME, (error, data) => {
let timeNewStamp = Utils.getNowTime();
if (error) {
Utils.getDurationTime('[getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
console.error('[context_getAbilityLabel_test_0200]Operation failed. Cause: ' + JSON.stringify(error));
expect(data).assertEqual("bmsfirstright");
}).catch((error) => {
expect(error).assertFail();
expect(error).assertFail();
}
});
timeOldStamp = await Utils.getNowTime();
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
let timeNewStamp = Utils.getNowTime();
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
expect(data).assertEqual("bmsfirstright");
console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error);
expect(error).assertEqual(undefined);
console.info('[context_getAbilityLabel_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
getAbilityLabelSuccess('[context_getAbilityLabel_test_0200]', mData);
done();
done();
});
});
});
/*
/*
* @tc.number:
context_
getAbilityLabel_test_0300
* @tc.number: getAbilityLabel_test_0300
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by promise)
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0300', 0, async function (done) {
it('getAbilityLabel_test_0300', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME).then((data) => {
let mError;
expect(error).assertFail();
await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_getAbilityLabel_test_0300] promise data is: ' + JSON.stringify(data));
}).catch((error) => {
}).catch((error) => {
let timeNewStamp = Utils.getNowTime();
expect(error).assertEqual(1);
mError = error;
Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_getAbilityLabel_test_0300] promise error is: ' + error);
expect(mError).assertEqual(1);
});
});
await Utils.sleep(2000);
Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME, (error, data) => {
getAbilityLabelFailure('[context_getAbilityLabel_test_0300]', mError);
expect(error).assertEqual(1);
expect(data).assertEqual(undefined);
done();
done();
});
});
});
/*
/*
* @tc.number:
context_
getAbilityLabel_test_0400
* @tc.number: getAbilityLabel_test_0400
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by callback)
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
*/
it('
context_
getAbilityLabel_test_0400', 0, async function (done) {
it('getAbilityLabel_test_0400', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
let timeOldStamp = await Utils.getNowTime();
let mError;
await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR).then((data) => {
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
expect(error).assertFail();
if (error !== null) {
}).catch((error) => {
console.info('[context_getAbilityLabel_test_0400] callBack error: ' + error);
expect(error).assertEqual(1);
}
let timeNewStamp = Utils.getNowTime();
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
mError = error;
expect(error).assertEqual(1);
console.info('[context_getAbilityLabel_test_0400] callBack data is:' + JSON.stringify(data));
});
});
await Utils.sleep(2000);
await Bundle.getAbilityLabel("", "").then((data) => {
getAbilityLabelFailure('[context_getAbilityLabel_test_0400]', mError);
expect(error).assertFail();
}).catch((error) => {
expect(error).assertEqual(1);
});
timeOldStamp = await Utils.getNowTime();
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
let timeNewStamp = Utils.getNowTime();
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_0500
* @tc.number: getAbilityLabel_test_0500
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.desc: Check the return value of the interface (by promise)
* @tc.desc: Check the return value of the interface
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0500', 0, async function (done) {
it('getAbilityLabel_test_0500', 0, async function (done) {
let mData;
await Bundle.getAbilityLabel(undefined, OTHER_ABILITY_NAME).then((data) => {
let mError = null;
expect(error).assertFail();
let timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME).then((data) => {
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));
}).catch((error) => {
}).catch((error) => {
mError = error;
expect(error).assertEqual(2);
console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error);
getAbilityLabelFailure('[context_getAbilityLabel_test_0500]', mError);
});
});
done();
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();
* @tc.number: context_getAbilityLabel_test_0600
}).catch((error) => {
* @tc.name: getAbilityLabel : Gets the specified ability label
expect(error).assertEqual(2);
* @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) => {
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);
expect(data).assertEqual(undefined);
});
});
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();
done();
});
});
/*
* @tc.number: context_getAbilityLabel_test_0700
* @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_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));
});
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)
}
})
})
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
96bca996
...
@@ -814,22 +814,33 @@ describe('ActsBundleManagerTest', function () {
...
@@ -814,22 +814,33 @@ describe('ActsBundleManagerTest', function () {
* @tc.desc Test getApplicationInfo interfaces with three haps.
* @tc.desc Test getApplicationInfo interfaces with three haps.
*/
*/
it
(
'
getApplicationInfo_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
getApplicationInfo_0300
'
,
0
,
async
function
(
done
)
{
demo
.
getApplicationInfo
(
NAME3
,
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
let
datainfo
=
await
demo
.
getApplicationInfo
(
NAME2
,
demo
.
BundleFlag
.
GET_BUNDLE_WITH_ABILITIES
).
then
(
datainfo
=>
{
demo
.
BundleFlag
.
GET_APPLICATION_INFO_WITH_PERMISSION
,
USERID
);
expect
(
datainfo
.
name
).
assertEqual
(
NAME3
);
console
.
info
(
"
getApplicationInfo_0300 result
"
+
JSON
.
stringify
(
datainfo
));
expect
(
datainfo
.
label
).
assertEqual
(
"
$string:app_name
"
);
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
.
description
).
assertEqual
(
DESCRIPTION
);
expect
(
datainfo
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
datainfo
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
datainfo
.
name
).
assertEqual
(
NAME3
);
expect
(
datainfo
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
datainfo
.
description
).
assertEqual
(
DESCRIPTION
);
expect
(
datainfo
.
systemApp
).
assertEqual
(
true
);
expect
(
datainfo
.
descriptionId
>=
0
).
assertTrue
();
expect
(
datainfo
.
descriptionId
>=
0
).
assertTrue
();
expect
(
datainfo
.
icon
).
assertEqual
(
"
$media:icon
"
);
expect
(
datainfo
.
iconId
>=
0
).
assertTrue
();
expect
(
datainfo
.
iconId
>=
0
).
assertTrue
();
expect
(
datainfo
.
label
).
assertEqual
(
"
$string:app_name
"
);
expect
(
datainfo
.
labelId
>=
0
).
assertTrue
();
expect
(
datainfo
.
labelId
>=
0
).
assertTrue
();
expect
(
datainfo
.
systemApp
).
assertEqual
(
true
);
expect
(
datainfo
.
supportedModes
).
assertEqual
(
0
);
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
"
);
expect
(
datainfo
.
moduleInfos
[
j
].
moduleSourceDir
.
length
).
assertLarger
(
0
);
}
done
();
done
();
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录