Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4f3575f0
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4f3575f0
编写于
3月 18, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2616 fix appexecfwk review comments
Merge pull request !2616 from dy/master
上级
fb250908
17e6a0c6
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
30 addition
and
246 deletion
+30
-246
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
.../main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
+4
-37
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
...try/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
+15
-40
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets
...src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets
+1
-36
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets
...main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets
+1
-23
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
...ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
+1
-24
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
...in/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
+8
-86
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
浏览文件 @
4f3575f0
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {describe,
beforeAll, beforeEach, afterEach, afterAll,
it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
import Bundle from '@ohos.bundle';
...
@@ -29,16 +29,6 @@ const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility'
...
@@ -29,16 +29,6 @@ const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility'
export default function getAbilityLabelJsUnit() {
export default function getAbilityLabelJsUnit() {
describe('context_getAbilityLabel_test', function () {
describe('context_getAbilityLabel_test', function () {
beforeEach(async function (done) {
console.info('context_getAbilityLabel_test before each called');
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info('context_getAbilityLabel_test after each called');
});
/*
/*
* @tc.number: context_getAbilityLabel_test_0100
* @tc.number: context_getAbilityLabel_test_0100
* @tc.name: getAbilityLabel : Gets the specified ability label
* @tc.name: getAbilityLabel : Gets the specified ability label
...
@@ -46,7 +36,6 @@ export default function getAbilityLabelJsUnit() {
...
@@ -46,7 +36,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0100', 0, async function (done) {
it('context_getAbilityLabel_test_0100', 0, async function (done) {
await Utils.sleep(1000);
let mData;
let mData;
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME)
await Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME)
...
@@ -54,7 +43,6 @@ export default function getAbilityLabelJsUnit() {
...
@@ -54,7 +43,6 @@ export default function getAbilityLabelJsUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0100]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_getAbilityLabel_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_getAbilityLabel_test_0100] promise in ');
console.info('[context_getAbilityLabel_test_0100] promise data is: ' + JSON.stringify(data));
console.info('[context_getAbilityLabel_test_0100] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
...
@@ -72,7 +60,6 @@ export default function getAbilityLabelJsUnit() {
...
@@ -72,7 +60,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0200', 0, async function (done) {
it('context_getAbilityLabel_test_0200', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mData;
let mData;
Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME, (error, data) => {
Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME, (error, data) => {
...
@@ -83,7 +70,6 @@ export default function getAbilityLabelJsUnit() {
...
@@ -83,7 +70,6 @@ export default function getAbilityLabelJsUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_getAbilityLabel_test_0200] callBack in');
console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0200] callBack data is:' + JSON.stringify(data));
console.info('[context_getAbilityLabel_test_0200] callBack data is:' + JSON.stringify(data));
});
});
...
@@ -99,14 +85,12 @@ export default function getAbilityLabelJsUnit() {
...
@@ -99,14 +85,12 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0300', 0, async function (done) {
it('context_getAbilityLabel_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mError;
let mError;
await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR)
await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR)
.then((data) => {
.then((data) => {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_getAbilityLabel_test_0300] promise in ');
console.info('[context_getAbilityLabel_test_0300] promise data is: ' + JSON.stringify(data));
console.info('[context_getAbilityLabel_test_0300] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
...
@@ -128,7 +112,6 @@ export default function getAbilityLabelJsUnit() {
...
@@ -128,7 +112,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0400', 0, async function (done) {
it('context_getAbilityLabel_test_0400', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mError;
let mError;
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
...
@@ -139,7 +122,6 @@ export default function getAbilityLabelJsUnit() {
...
@@ -139,7 +122,6 @@ export default function getAbilityLabelJsUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
mError = error;
mError = error;
console.info('[context_getAbilityLabel_test_0400] callBack in');
console.info('[context_getAbilityLabel_test_0400] callBack data is:' + JSON.stringify(data));
console.info('[context_getAbilityLabel_test_0400] callBack data is:' + JSON.stringify(data));
});
});
await Utils.sleep(2000);
await Utils.sleep(2000);
...
@@ -154,7 +136,6 @@ export default function getAbilityLabelJsUnit() {
...
@@ -154,7 +136,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0500', 0, async function (done) {
it('context_getAbilityLabel_test_0500', 0, async function (done) {
await Utils.sleep(1000);
let mData;
let mData;
let mError = null;
let mError = null;
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
...
@@ -164,13 +145,11 @@ export default function getAbilityLabelJsUnit() {
...
@@ -164,13 +145,11 @@ export default function getAbilityLabelJsUnit() {
Utils.getDurationTime('[context_getAbilityLabel_test_0500]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_getAbilityLabel_test_0500]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
expect(mData).assertFail();
expect(mData).assertFail();
console.info('[context_getAbilityLabel_test_0500] promise in ');
console.info('[context_getAbilityLabel_test_0500] promise data is: ' + JSON.stringify(data));
console.info('[context_getAbilityLabel_test_0500] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
mError = error;
mError = error;
console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error);
console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error);
expect(mError).assertEqual(1);
getAbilityLabelFailure('[context_getAbilityLabel_test_0500]', mError);
getAbilityLabelFailure('[context_getAbilityLabel_test_0500]', mError);
});
});
done();
done();
...
@@ -183,22 +162,14 @@ export default function getAbilityLabelJsUnit() {
...
@@ -183,22 +162,14 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0600', 0, async function (done) {
it('context_getAbilityLabel_test_0600', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mError = null;
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
mError = error;
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0600]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_getAbilityLabel_test_0600]', timeOldStamp, timeNewStamp);
if(mError !== null){
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
expect(mError).assertEqual(1);
getAbilityLabelFailure('[context_getAbilityLabel_test_0600]', error);
getAbilityLabelFailure('[context_getAbilityLabel_test_0600]', mError);
expect(data).assertEqual(undefined);
}
console.info('[context_getAbilityLabel_test_0600] callBack in');
console.info('[context_getAbilityLabel_test_0600] callBack data is:' + JSON.stringify(data));
});
});
await Utils.sleep(2000);
done();
done();
});
});
...
@@ -210,7 +181,6 @@ export default function getAbilityLabelJsUnit() {
...
@@ -210,7 +181,6 @@ export default function getAbilityLabelJsUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_getAbilityLabel_test_0700', 0, async function (done) {
it('context_getAbilityLabel_test_0700', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mError;
let mError;
Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME, (error, data) => {
Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME, (error, data) => {
...
@@ -219,10 +189,7 @@ export default function getAbilityLabelJsUnit() {
...
@@ -219,10 +189,7 @@ export default function getAbilityLabelJsUnit() {
mError = error;
mError = error;
if(mError !== null){
if(mError !== null){
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
expect(mError).assertEqual(1);
}
}
console.info('[context_getAbilityLabel_test_0700] callBack in');
console.info('[context_getAbilityLabel_test_0700] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0700] callBack data is:' + JSON.stringify(data));
console.info('[context_getAbilityLabel_test_0700] callBack data is:' + JSON.stringify(data));
});
});
await Utils.sleep(2000);
await Utils.sleep(2000);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
浏览文件 @
4f3575f0
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
import {describe,
beforeEach, afterEach,
it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Utils from './Utils';
import bundleManager from '@ohos.bundle';
import bundleManager from '@ohos.bundle';
...
@@ -21,54 +21,44 @@ export default function GetabilityInfo() {
...
@@ -21,54 +21,44 @@ export default function GetabilityInfo() {
describe('GetabilityInfo', function () {
describe('GetabilityInfo', function () {
let bundleName = "com.open.harmony.packagemag";
let bundleName = "com.open.harmony.packagemag";
let abilityName = "com.open.harmony.packagemag.MainAbility";
let abilityName = "com.open.harmony.packagemag.MainAbility";
let bundleName_other = "com.ohos.acecollaboration";
let bundleName_other = "com.ohos.acecollaboration";
let abilityName_other = "com.ohos.acecollaboration.MainAbility";
let abilityName_other = "com.ohos.acecollaboration.MainAbility";
let bundleName1 = "com.harmony.packagemag";
let bundleName1 = "com.harmony.packagemag";
let abilityName1 = "com.harmony.packagemag1.MainAbility";
let abilityName1 = "com.harmony.packagemag1.MainAbility";
beforeEach(async function (done) {
console.info('GetabilityInfo before each called');
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info('GetabilityInfo after each called');
});
/*
/*
* @tc.number: bundle_
getAllApplication
Info_test_0100
* @tc.number: bundle_
Getability
Info_test_0100
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
* @tc.level 0
*/
*/
it('bundle_GetabilityInfo_test_0100', 0, async function (done) {
it('bundle_GetabilityInfo_test_0100', 0, async function (done) {
await Utils.sleep(1000)
;
let mData
;
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName, abilityName)
await
bundleManager.getAbilityInfo(bundleName, abilityName)
.then((data) => {
.then((data) => {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0100', timeOldStamp, timeNewStamp)
Utils.getDurationTime('bundle_GetabilityInfo_test_0100', timeOldStamp, timeNewStamp)
console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo promise data is: ' + JSON.stringify(data));
console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo promise data is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
expect(typeof (data)).assertEqual("object");
mData = data;
}).catch((error) => {
}).catch((error) => {
console.error('[bundle_GetabilityInfo_test_0100]Operation failed. Cause: ' + JSON.stringify(error));
console.error('[bundle_GetabilityInfo_test_0100]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertFail();
expect(error).assertFail();
})
})
var promise = await bundleManager.getAbilityInfo(bundleName, abilityName);
checkAbilityInfo(mData);
checkAbilityInfo(promise);
done();
done();
});
});
/*
/*
* @tc.number: bundle_
getA
bilityInfo_test_0200
* @tc.number: bundle_
Geta
bilityInfo_test_0200
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by callback)
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
* @tc.level 0
*/
*/
it('bundle_GetabilityInfo_test_0200', 0, async function (done) {
it('bundle_GetabilityInfo_test_0200', 0, async function (done) {
await Utils.sleep(1000);
let mData;
let mData;
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
await bundleManager.getAbilityInfo(bundleName, abilityName, (err, data) => {
await bundleManager.getAbilityInfo(bundleName, abilityName, (err, data) => {
...
@@ -87,51 +77,38 @@ export default function GetabilityInfo() {
...
@@ -87,51 +77,38 @@ export default function GetabilityInfo() {
});
});
/*
/*
* @tc.number: bundle_
getAllApplication
Info_test_0300
* @tc.number: bundle_
Getability
Info_test_0300
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
* @tc.level 0
*/
*/
it('bundle_GetabilityInfo_test_0300', 0, async function (done) {
it('bundle_GetabilityInfo_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let err = null
var mData
await bundleManager.getAbilityInfo(bundleName_other, abilityName_other)
await bundleManager.getAbilityInfo(bundleName_other, abilityName_other)
.then((data) => {
.then((data) => {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0300',timeOldStamp,timeNewStamp)
Utils.getDurationTime('bundle_GetabilityInfo_test_0300',timeOldStamp,timeNewStamp)
mData = data
expect(data).assertFail();
console.info('[bundle_GetabilityInfo_test_0300] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0300] getApplicationInfo promise data is: ' + JSON.stringify(data));
expect(typeof (mData)).assertEqual("object");
}).catch((error) => {
}).catch((error) => {
err = error
console.error('[bundle_GetabilityInfo_test_0300]Operation failed. Cause: ' + JSON.stringify(error));
console.error('[bundle_GetabilityInfo_test_0300]Operation failed. Cause: ' + JSON.stringify(error));
expect(error).assertEqual(1);
});
});
if(err != null) {
await expect(err).assertEqual(1);
}else{
checkAbilityInfo_other(mData);
}
done();
done();
});
});
/*
/*
* @tc.number: bundle_
getAllApplication
Info_test_0400
* @tc.number: bundle_
Getability
Info_test_0400
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
* @tc.level 0
*/
*/
it('bundle_GetabilityInfo_test_0400', 0, async function (done) {
it('bundle_GetabilityInfo_test_0400', 0, async function (done) {
let error1;
let error1;
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName1, abilityName)
bundleManager.getAbilityInfo(bundleName1, abilityName)
.then((data) => {
.then((data) => {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0400', timeOldStamp, timeNewStamp)
Utils.getDurationTime('bundle_GetabilityInfo_test_0400', timeOldStamp, timeNewStamp)
console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo data is: ' + JSON.stringify(data));
console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo data is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
expect(typeof (data)).assertEqual("object");
}).catch((error) => {
}).catch((error) => {
...
@@ -144,7 +121,7 @@ export default function GetabilityInfo() {
...
@@ -144,7 +121,7 @@ export default function GetabilityInfo() {
});
});
/*
/*
* @tc.number: bundle_
getAllApplication
Info_test_0500
* @tc.number: bundle_
Getability
Info_test_0500
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by callback)
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
* @tc.level 0
...
@@ -163,7 +140,7 @@ export default function GetabilityInfo() {
...
@@ -163,7 +140,7 @@ export default function GetabilityInfo() {
});
});
/*
/*
* @tc.number: bundle_
getAllApplication
Info_test_0600
* @tc.number: bundle_
Getability
Info_test_0600
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
* @tc.level 0
...
@@ -171,13 +148,11 @@ export default function GetabilityInfo() {
...
@@ -171,13 +148,11 @@ export default function GetabilityInfo() {
let bundleName2 = "";
let bundleName2 = "";
it('bundle_GetabilityInfo_test_0600', 0, async function (done) {
it('bundle_GetabilityInfo_test_0600', 0, async function (done) {
let error1;
let error1;
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName2, abilityName)
bundleManager.getAbilityInfo(bundleName2, abilityName)
.then((data) => {
.then((data) => {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0600', timeOldStamp, timeNewStamp)
Utils.getDurationTime('bundle_GetabilityInfo_test_0600', timeOldStamp, timeNewStamp)
console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo data promise is: ' + JSON.stringify(data));
console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo data promise is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
expect(typeof (data)).assertEqual("object");
}).catch((error) => {
}).catch((error) => {
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets
浏览文件 @
4f3575f0
...
@@ -12,13 +12,12 @@
...
@@ -12,13 +12,12 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {describe,
beforeAll, beforeEach, afterEach, afterAll,
it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
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 ABILITY = {
const ABILITY = {
bundleName: BUNDLE_NAME,
bundleName: BUNDLE_NAME,
name: ABILITY_NAME
name: ABILITY_NAME
...
@@ -26,7 +25,6 @@ const ABILITY = {
...
@@ -26,7 +25,6 @@ const ABILITY = {
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'
const ABILITY_ERROR = {
const ABILITY_ERROR = {
bundleName: BUNDLE_NAME_ERROR,
bundleName: BUNDLE_NAME_ERROR,
name: ABILITY_NAME_ERROR
name: ABILITY_NAME_ERROR
...
@@ -34,16 +32,6 @@ const ABILITY_ERROR = {
...
@@ -34,16 +32,6 @@ const ABILITY_ERROR = {
export default function isAbilityEnabledETSUnit() {
export default function isAbilityEnabledETSUnit() {
describe('context_isAbilityEnabled_test', function () {
describe('context_isAbilityEnabled_test', function () {
beforeEach(async function (done) {
console.info('context_isAbilityEnabled_test before each called');
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info('context_isAbilityEnabled_test after each called');
});
/*
/*
* @tc.number: context_isAbilityEnabled_test_0100
* @tc.number: context_isAbilityEnabled_test_0100
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
* @tc.name: isAbilityEnabled : Get whether to enable a specified ability
...
@@ -51,7 +39,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -51,7 +39,6 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isAbilityEnabled_test_0100', 0, async function (done) {
it('context_isAbilityEnabled_test_0100', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mData;
let mData;
await Bundle.isAbilityEnabled(ABILITY)
await Bundle.isAbilityEnabled(ABILITY)
...
@@ -59,7 +46,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -59,7 +46,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isAbilityEnabled_test_0100] promise in ');
console.info('[context_isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
...
@@ -77,7 +63,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -77,7 +63,6 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isAbilityEnabled_test_0200', 0, async function (done) {
it('context_isAbilityEnabled_test_0200', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mData;
let mData;
Bundle.isAbilityEnabled(ABILITY, (error, data) => {
Bundle.isAbilityEnabled(ABILITY, (error, data) => {
...
@@ -88,7 +73,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -88,7 +73,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0200]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isAbilityEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isAbilityEnabled_test_0200] callBack in');
console.info('[context_isAbilityEnabled_test_0200] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0200] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
});
...
@@ -104,7 +88,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -104,7 +88,6 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isAbilityEnabled_test_0300', 0, async function (done) {
it('context_isAbilityEnabled_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mData;
let mData;
await Bundle.isAbilityEnabled(ABILITY_ERROR)
await Bundle.isAbilityEnabled(ABILITY_ERROR)
...
@@ -112,7 +95,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -112,7 +95,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isAbilityEnabled_test_0300] promise in ');
console.info('[context_isAbilityEnabled_test_0300] promise data is: ' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0300] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
...
@@ -132,10 +114,8 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -132,10 +114,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isAbilityEnabled_test_0400', 0, async function (done) {
it('context_isAbilityEnabled_test_0400', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mData;
let mData;
console.info('[context_isAbilityEnabled_test_0400] start c++ callBack ');
Bundle.isAbilityEnabled(ABILITY_ERROR, (error, data) => {
Bundle.isAbilityEnabled(ABILITY_ERROR, (error, data) => {
if(error){
if(error){
console.error('[context_isAbilityEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
console.error('[context_isAbilityEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
...
@@ -143,12 +123,10 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -143,12 +123,10 @@ export default function isAbilityEnabledETSUnit() {
}
}
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isAbilityEnabled_test_0400] callBack in');
mData = data;
mData = data;
console.info('[context_isAbilityEnabled_test_0400] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0400] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0400] callBack data is:' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0400] callBack data is:' + JSON.stringify(data));
});
});
console.info('[context_isAbilityEnabled_test_0400] end c++ callBack ');
await Utils.sleep(2000);
await Utils.sleep(2000);
console.info('[context_isAbilityEnabled_test_0400] Failure ');
console.info('[context_isAbilityEnabled_test_0400] Failure ');
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
...
@@ -163,10 +141,8 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -163,10 +141,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isAbilityEnabled_test_0500', 0, async function (done) {
it('context_isAbilityEnabled_test_0500', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, true)
await Bundle.setAbilityEnabled(ABILITY, true)
.then((data) => {
.then((data) => {
console.info('[context_isAbilityEnabled_test_0500] set enable true ');
console.info('[context_isAbilityEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => {
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0500] set enable true error is: ' + error);
console.info('[context_isAbilityEnabled_test_0500] set enable true error is: ' + error);
...
@@ -180,7 +156,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -180,7 +156,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0500]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isAbilityEnabled_test_0500]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isAbilityEnabled_test_0500] promise in ');
console.info('[context_isAbilityEnabled_test_0500] promise data is: ' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0500] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
...
@@ -198,11 +173,8 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -198,11 +173,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isAbilityEnabled_test_0600', 0, async function (done) {
it('context_isAbilityEnabled_test_0600', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, false)
await Bundle.setAbilityEnabled(ABILITY, false)
.then((data) => {
.then((data) => {
console.info('[context_isAbilityEnabled_test_0600] set enable false ');
console.info('[context_isAbilityEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => {
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0600] set enable false error is: ' + error);
console.info('[context_isAbilityEnabled_test_0600] set enable false error is: ' + error);
...
@@ -216,7 +188,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -216,7 +188,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0600]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isAbilityEnabled_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isAbilityEnabled_test_0600] promise in ');
console.info('[context_isAbilityEnabled_test_0600] promise data is: ' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0600] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
...
@@ -234,10 +205,8 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -234,10 +205,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isAbilityEnabled_test_0700', 0, async function (done) {
it('context_isAbilityEnabled_test_0700', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, true)
await Bundle.setAbilityEnabled(ABILITY, true)
.then((data) => {
.then((data) => {
console.info('[context_isAbilityEnabled_test_0700] set enable true ');
console.info('[context_isAbilityEnabled_test_0700] set enable true data is: ' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0700] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => {
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0700] set enable true error is: ' + error);
console.info('[context_isAbilityEnabled_test_0700] set enable true error is: ' + error);
...
@@ -254,7 +223,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -254,7 +223,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0700]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isAbilityEnabled_test_0700]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isAbilityEnabled_test_0700] callBack in');
console.info('[context_isAbilityEnabled_test_0700] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0700] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0700] callBack data is:' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0700] callBack data is:' + JSON.stringify(data));
});
});
...
@@ -270,10 +238,8 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -270,10 +238,8 @@ export default function isAbilityEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isAbilityEnabled_test_0800', 0, async function (done) {
it('context_isAbilityEnabled_test_0800', 0, async function (done) {
await Utils.sleep(1000);
await Bundle.setAbilityEnabled(ABILITY, false)
await Bundle.setAbilityEnabled(ABILITY, false)
.then((data) => {
.then((data) => {
console.info('[context_isAbilityEnabled_test_0800] set enable false ');
console.info('[context_isAbilityEnabled_test_0800] set enable false data is: ' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0800] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => {
}).catch((error) => {
console.info('[context_isAbilityEnabled_test_0800] set enable false error is: ' + error);
console.info('[context_isAbilityEnabled_test_0800] set enable false error is: ' + error);
...
@@ -290,7 +256,6 @@ export default function isAbilityEnabledETSUnit() {
...
@@ -290,7 +256,6 @@ export default function isAbilityEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0800]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isAbilityEnabled_test_0800]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isAbilityEnabled_test_0800] callBack in');
console.info('[context_isAbilityEnabled_test_0800] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0800] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0800] callBack data is:' + JSON.stringify(data));
console.info('[context_isAbilityEnabled_test_0800] callBack data is:' + JSON.stringify(data));
});
});
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets
浏览文件 @
4f3575f0
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {describe,
beforeAll, beforeEach, afterEach, afterAll,
it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
import Bundle from '@ohos.bundle';
...
@@ -22,16 +22,6 @@ const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
...
@@ -22,16 +22,6 @@ const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
export default function IsApplicationEnabledETSUnit() {
export default function IsApplicationEnabledETSUnit() {
describe('context_isApplicationEnabled_test', function () {
describe('context_isApplicationEnabled_test', function () {
beforeEach(async function (done) {
console.info('context_isApplicationEnabled_test before each called');
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info('context_isApplicationEnabled_test after each called');
});
/*
/*
* @tc.number: context_isApplicationEnabled_test_0100
* @tc.number: context_isApplicationEnabled_test_0100
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
* @tc.name: isApplicationEnabled : Get whether to enable a specified application
...
@@ -39,7 +29,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -39,7 +29,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isApplicationEnabled_test_0100', 0, async function (done) {
it('context_isApplicationEnabled_test_0100', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mData;
let mData;
await Bundle.isApplicationEnabled(BUNDLE_NAME)
await Bundle.isApplicationEnabled(BUNDLE_NAME)
...
@@ -47,7 +36,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -47,7 +36,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0100]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isApplicationEnabled_test_0100]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isApplicationEnabled_test_0100] promise in ');
console.info('[context_isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data));
console.info('[context_isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
...
@@ -65,7 +53,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -65,7 +53,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isApplicationEnabled_test_0200', 0, async function (done) {
it('context_isApplicationEnabled_test_0200', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mData;
let mData;
Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => {
Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => {
...
@@ -76,7 +63,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -76,7 +63,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isApplicationEnabled_test_0200] callBack in');
console.info('[context_isApplicationEnabled_test_0200] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0200] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data));
console.info('[context_isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
});
...
@@ -92,7 +78,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -92,7 +78,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isApplicationEnabled_test_0300', 0, async function (done) {
it('context_isApplicationEnabled_test_0300', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mData;
let mData;
await Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR)
await Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR)
...
@@ -100,7 +85,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -100,7 +85,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isApplicationEnabled_test_0300] promise in ');
console.info('[context_isApplicationEnabled_test_0300] promise data is: ' + JSON.stringify(data));
console.info('[context_isApplicationEnabled_test_0300] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
...
@@ -120,7 +104,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -120,7 +104,6 @@ export default function IsApplicationEnabledETSUnit() {
* @tc.level 0
* @tc.level 0
*/
*/
it('context_isApplicationEnabled_test_0400', 0, async function (done) {
it('context_isApplicationEnabled_test_0400', 0, async function (done) {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
var timeOldStamp = await Utils.getNowTime();
let mData;
let mData;
Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR, (error, data) => {
Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR, (error, data) => {
...
@@ -131,7 +114,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -131,7 +114,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0400]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isApplicationEnabled_test_0400]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isApplicationEnabled_test_0400] callBack in');
console.info('[context_isApplicationEnabled_test_0400] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0400] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data));
console.info('[context_isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data));
});
});
...
@@ -150,7 +132,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -150,7 +132,6 @@ export default function IsApplicationEnabledETSUnit() {
it('context_isApplicationEnabled_test_0500', 0, async function (done) {
it('context_isApplicationEnabled_test_0500', 0, async function (done) {
await Bundle.setApplicationEnabled(BUNDLE_NAME, true)
await Bundle.setApplicationEnabled(BUNDLE_NAME, true)
.then((data) => {
.then((data) => {
console.info('[context_isApplicationEnabled_test_0500] set enable true ');
console.info('[context_isApplicationEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
console.info('[context_isApplicationEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
}).catch((error) => {
}).catch((error) => {
console.info('[context_isApplicationEnabled_test_0500] set enable true error is: ' + error);
console.info('[context_isApplicationEnabled_test_0500] set enable true error is: ' + error);
...
@@ -164,7 +145,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -164,7 +145,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0500]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isApplicationEnabled_test_0500]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isApplicationEnabled_test_0500] promise in ');
console.info('[context_isApplicationEnabled_test_0500] promise data is: ' + JSON.stringify(data));
console.info('[context_isApplicationEnabled_test_0500] promise data is: ' + JSON.stringify(data));
})
})
.catch((error) => {
.catch((error) => {
...
@@ -184,7 +164,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -184,7 +164,6 @@ export default function IsApplicationEnabledETSUnit() {
it('context_isApplicationEnabled_test_0600', 0, async function (done) {
it('context_isApplicationEnabled_test_0600', 0, async function (done) {
await Bundle.setApplicationEnabled(BUNDLE_NAME, false)
await Bundle.setApplicationEnabled(BUNDLE_NAME, false)
.then((data) => {
.then((data) => {
console.info('[context_isApplicationEnabled_test_0600] set enable false ');
console.info('[context_isApplicationEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
console.info('[context_isApplicationEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
}).catch((error) => {
}).catch((error) => {
console.info('[context_isApplicationEnabled_test_0600] set enable false error is: ' + error);
console.info('[context_isApplicationEnabled_test_0600] set enable false error is: ' + error);
...
@@ -202,7 +181,6 @@ export default function IsApplicationEnabledETSUnit() {
...
@@ -202,7 +181,6 @@ export default function IsApplicationEnabledETSUnit() {
var timeNewStamp = Utils.getNowTime();
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0600]', timeOldStamp, timeNewStamp);
Utils.getDurationTime('[context_isApplicationEnabled_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
mData = data;
console.info('[context_isApplicationEnabled_test_0600] callBack in');
console.info('[context_isApplicationEnabled_test_0600] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0600] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0600] callBack data is:' + JSON.stringify(data));
console.info('[context_isApplicationEnabled_test_0600] callBack data is:' + JSON.stringify(data));
});
});
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
浏览文件 @
4f3575f0
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {describe,
beforeEach, afterEach,
it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
import Bundle from '@ohos.bundle';
...
@@ -27,21 +27,9 @@ const TAG_TEST_0400_001 = ' bundle_getAllApplicationInfo_test_0400_008 ';
...
@@ -27,21 +27,9 @@ const TAG_TEST_0400_001 = ' bundle_getAllApplicationInfo_test_0400_008 ';
const TAG_TEST_0500_001 = ' bundle_getAllApplicationInfo_test_0500_009 ';
const TAG_TEST_0500_001 = ' bundle_getAllApplicationInfo_test_0500_009 ';
const TAG_TEST_0500_002 = ' bundle_getAllApplicationInfo_test_0500_0010 ';
const TAG_TEST_0500_002 = ' bundle_getAllApplicationInfo_test_0500_0010 ';
const USER_ID_100 = 100;
const USER_ID_100 = 100;
const SLEEP_TIME_1000 = 1000;
const SLEEP_TIME_2000 = 2000;
export default function applicationBundleJsunit() {
export default function applicationBundleJsunit() {
describe('appInfoTest', function () {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info('applicationBundle before each called');
done()
});
afterEach(async function () {
await Utils.sleep(SLEEP_TIME_2000);
console.info('applicationBundle after each called');
});
/**
/**
* @tc.number: bundle_getApplicationInfo_test_0100_001
* @tc.number: bundle_getApplicationInfo_test_0100_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
...
@@ -49,7 +37,6 @@ export default function applicationBundleJsunit() {
...
@@ -49,7 +37,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0100_001, 0, async function (done) {
it(TAG_TEST_0100_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100)
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100)
.catch((error) => {
.catch((error) => {
...
@@ -71,7 +58,6 @@ export default function applicationBundleJsunit() {
...
@@ -71,7 +58,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0100_002, 0, async function (done) {
it(TAG_TEST_0100_002, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
.catch((error) => {
.catch((error) => {
...
@@ -93,7 +79,6 @@ export default function applicationBundleJsunit() {
...
@@ -93,7 +79,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0100_003, 0, async function (done) {
it(TAG_TEST_0100_003, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, USER_ID_100)
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, USER_ID_100)
.catch((error) => {
.catch((error) => {
...
@@ -116,7 +101,6 @@ export default function applicationBundleJsunit() {
...
@@ -116,7 +101,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0200_001, 0, async function (done) {
it(TAG_TEST_0200_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.catch((error) => {
.catch((error) => {
...
@@ -138,7 +122,6 @@ export default function applicationBundleJsunit() {
...
@@ -138,7 +122,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0200_002, 0, async function (done) {
it(TAG_TEST_0200_002, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
.catch((error) => {
.catch((error) => {
...
@@ -160,7 +143,6 @@ export default function applicationBundleJsunit() {
...
@@ -160,7 +143,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0200_003, 0, async function (done) {
it(TAG_TEST_0200_003, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
.catch((error) => {
.catch((error) => {
...
@@ -182,7 +164,6 @@ export default function applicationBundleJsunit() {
...
@@ -182,7 +164,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0300_001, 0, async function (done) {
it(TAG_TEST_0300_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
let datas;
let datas;
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100,
Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100,
...
@@ -193,7 +174,6 @@ export default function applicationBundleJsunit() {
...
@@ -193,7 +174,6 @@ export default function applicationBundleJsunit() {
expect(error).assertFail();
expect(error).assertFail();
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
}
}
console.info(TAG_TEST_0300_001 + 'UserId callBack in');
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
datas = data;
datas = data;
...
@@ -221,7 +201,6 @@ export default function applicationBundleJsunit() {
...
@@ -221,7 +201,6 @@ export default function applicationBundleJsunit() {
expect(error).assertFail();
expect(error).assertFail();
console.info(TAG_TEST_0400_001 + 'UserId callBack error: ' + error);
console.info(TAG_TEST_0400_001 + 'UserId callBack error: ' + error);
}
}
console.info(TAG_TEST_0400_001 + 'noUserId callBack in');
console.info(TAG_TEST_0400_001 + 'noUserId callBack error: ' + error);
console.info(TAG_TEST_0400_001 + 'noUserId callBack error: ' + error);
console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
datas = data;
datas = data;
...
@@ -240,7 +219,6 @@ export default function applicationBundleJsunit() {
...
@@ -240,7 +219,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0500_001, 0, async function (done) {
it(TAG_TEST_0500_001, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
let errors;
let errors;
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('0')
await Bundle.getAllApplicationInfo('0')
...
@@ -265,7 +243,6 @@ export default function applicationBundleJsunit() {
...
@@ -265,7 +243,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0500_002, 0, async function (done) {
it(TAG_TEST_0500_002, 0, async function (done) {
await Utils.sleep(SLEEP_TIME_1000);
let errors;
let errors;
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
await Bundle.getAllApplicationInfo('0', USER_ID_100)
await Bundle.getAllApplicationInfo('0', USER_ID_100)
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
浏览文件 @
4f3575f0
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {describe,
beforeEach, afterEach,
it, expect} from 'deccjsunit/index.ets';
import {describe, it, expect} from 'deccjsunit/index.ets';
import Utils from './Utils';
import Utils from './Utils';
import Bundle from '@ohos.bundle';
import Bundle from '@ohos.bundle';
...
@@ -32,21 +32,10 @@ const TAG_TEST_0600_003 = ' bundle_getApplicationInfo_test_0600_0013 ';
...
@@ -32,21 +32,10 @@ const TAG_TEST_0600_003 = ' bundle_getApplicationInfo_test_0600_0013 ';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME = 'com.open.harmony.packagemag';
const BUNDLE_NAME_OTHER = 'com.ohos.acepackage';
const BUNDLE_NAME_OTHER = 'com.ohos.acepackage';
const USER_ID_100 = 100;
const USER_ID_100 = 100;
const SLEEP_TIME_1000 = 1000;
const SLEEP_TIME_2000 = 2000;
export default function applicationBundleJsunit() {
export default function applicationBundleJsunit() {
describe('appInfoTest', function () {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info('applicationBundle before each called');
done()
});
afterEach(async function () {
await Utils.sleep(SLEEP_TIME_2000);
console.info('applicationBundle after each called');
});
/**
/**
* @tc.number: bundle_getApplicationInfo_test_0100_001
* @tc.number: bundle_getApplicationInfo_test_0100_001
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
* @tc.name: getApplicationInfo : Obtains based on a given bundle name.
...
@@ -54,8 +43,6 @@ export default function applicationBundleJsunit() {
...
@@ -54,8 +43,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0100_001, 0, async function (done) {
it(TAG_TEST_0100_001, 0, async function (done) {
console.info(TAG_TEST_0100_001 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
USER_ID_100)
USER_ID_100)
...
@@ -69,7 +56,6 @@ export default function applicationBundleJsunit() {
...
@@ -69,7 +56,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0100_001, data);
expectData(TAG_TEST_0100_001, data);
getApplicationInfoSuccess(TAG_TEST_0100_001, data);
getApplicationInfoSuccess(TAG_TEST_0100_001, data);
done();
done();
console.log('------------------ ' + TAG_TEST_0100_001 + ' end -------------------');
});
});
/**
/**
...
@@ -79,8 +65,6 @@ export default function applicationBundleJsunit() {
...
@@ -79,8 +65,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0100_002, 0, async function (done) {
it(TAG_TEST_0100_002, 0, async function (done) {
console.info(TAG_TEST_0100_002 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
.catch((error) => {
.catch((error) => {
...
@@ -93,7 +77,6 @@ export default function applicationBundleJsunit() {
...
@@ -93,7 +77,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0100_002, data);
expectData(TAG_TEST_0100_002, data);
getApplicationInfoSuccess_plus(TAG_TEST_0100_002, data);
getApplicationInfoSuccess_plus(TAG_TEST_0100_002, data);
done();
done();
console.log('------------------ ' + TAG_TEST_0100_002 + ' end -------------------');
});
});
/**
/**
...
@@ -103,8 +86,6 @@ export default function applicationBundleJsunit() {
...
@@ -103,8 +86,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0100_003, 0, async function (done) {
it(TAG_TEST_0100_003, 0, async function (done) {
console.info(TAG_TEST_0100_003 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE,
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE,
USER_ID_100)
USER_ID_100)
...
@@ -116,13 +97,8 @@ export default function applicationBundleJsunit() {
...
@@ -116,13 +97,8 @@ export default function applicationBundleJsunit() {
Utils.getDurationTime(TAG_TEST_0100_003, startTime, endTime);
Utils.getDurationTime(TAG_TEST_0100_003, startTime, endTime);
console.info(TAG_TEST_0100_003 + ' UserId promise data is: ' + JSON.stringify(data));
console.info(TAG_TEST_0100_003 + ' UserId promise data is: ' + JSON.stringify(data));
expectData(TAG_TEST_0100_003, data);
expectData(TAG_TEST_0100_003, data);
if ('' === data.name) {
getApplicationInfoFail(TAG_TEST_0100_003, data);
} else {
getApplicationInfoSuccess_plus(TAG_TEST_0100_003, data);
getApplicationInfoSuccess_plus(TAG_TEST_0100_003, data);
}
done();
done();
console.log('------------------ ' + TAG_TEST_0100_003 + ' end -------------------');
});
});
...
@@ -133,8 +109,6 @@ export default function applicationBundleJsunit() {
...
@@ -133,8 +109,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0200_001, 0, async function (done) {
it(TAG_TEST_0200_001, 0, async function (done) {
console.info(TAG_TEST_0200_001 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
.catch((error) => {
.catch((error) => {
...
@@ -147,7 +121,6 @@ export default function applicationBundleJsunit() {
...
@@ -147,7 +121,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0200_001, data);
expectData(TAG_TEST_0200_001, data);
getApplicationInfoSuccess(TAG_TEST_0200_001, data);
getApplicationInfoSuccess(TAG_TEST_0200_001, data);
done();
done();
console.log('------------------ ' + TAG_TEST_0200_001 + ' end -------------------');
});
});
/**
/**
...
@@ -157,8 +130,6 @@ export default function applicationBundleJsunit() {
...
@@ -157,8 +130,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0200_002, 0, async function (done) {
it(TAG_TEST_0200_002, 0, async function (done) {
console.info(TAG_TEST_0200_002 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
.catch((error) => {
.catch((error) => {
...
@@ -171,7 +142,6 @@ export default function applicationBundleJsunit() {
...
@@ -171,7 +142,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0200_002, data);
expectData(TAG_TEST_0200_002, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_002, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_002, data);
done();
done();
console.log('------------------ ' + TAG_TEST_0200_002 + ' end -------------------');
});
});
/**
/**
...
@@ -181,8 +151,6 @@ export default function applicationBundleJsunit() {
...
@@ -181,8 +151,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0200_003, 0, async function (done) {
it(TAG_TEST_0200_003, 0, async function (done) {
console.info(TAG_TEST_0200_003 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
.catch((error) => {
.catch((error) => {
...
@@ -195,7 +163,6 @@ export default function applicationBundleJsunit() {
...
@@ -195,7 +163,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0200_003, data);
expectData(TAG_TEST_0200_003, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_003, data);
getApplicationInfoSuccess_plus(TAG_TEST_0200_003, data);
done();
done();
console.log('------------------ ' + TAG_TEST_0200_003 + ' end -------------------');
});
});
/**
/**
...
@@ -205,8 +172,6 @@ export default function applicationBundleJsunit() {
...
@@ -205,8 +172,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0300_001, 0, async function (done) {
it(TAG_TEST_0300_001, 0, async function (done) {
console.info(TAG_TEST_0300_001 + 'callBack START');
await Utils.sleep(SLEEP_TIME_1000);
let errors;
let errors;
let datas;
let datas;
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
...
@@ -219,7 +184,6 @@ export default function applicationBundleJsunit() {
...
@@ -219,7 +184,6 @@ export default function applicationBundleJsunit() {
expect(errors).assertFail();
expect(errors).assertFail();
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
}
}
console.info(TAG_TEST_0300_001 + 'UserId callBack in');
console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
datas = data;
datas = data;
});
});
...
@@ -228,7 +192,6 @@ export default function applicationBundleJsunit() {
...
@@ -228,7 +192,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0300_001, datas);
expectData(TAG_TEST_0300_001, datas);
getApplicationInfoSuccess(TAG_TEST_0300_001, datas);
getApplicationInfoSuccess(TAG_TEST_0300_001, datas);
done();
done();
console.log('------------------ ' + TAG_TEST_0300_001 + ' end -------------------');
});
});
/**
/**
...
@@ -238,7 +201,6 @@ export default function applicationBundleJsunit() {
...
@@ -238,7 +201,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0400_001, 0, async function (done) {
it(TAG_TEST_0400_001, 0, async function (done) {
console.info(TAG_TEST_0400_001 + 'callBack START');
let errors;
let errors;
let datas;
let datas;
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
...
@@ -250,7 +212,6 @@ export default function applicationBundleJsunit() {
...
@@ -250,7 +212,6 @@ export default function applicationBundleJsunit() {
console.info(TAG_TEST_0400_001 + 'UserId callBack error: ' + error);
console.info(TAG_TEST_0400_001 + 'UserId callBack error: ' + error);
}
}
Utils.getDurationTime(TAG_TEST_0400_001, startTime, endTime);
Utils.getDurationTime(TAG_TEST_0400_001, startTime, endTime);
console.info(TAG_TEST_0400_001 + 'noUserId callBack in');
console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
datas = data;
datas = data;
});
});
...
@@ -259,7 +220,6 @@ export default function applicationBundleJsunit() {
...
@@ -259,7 +220,6 @@ export default function applicationBundleJsunit() {
expectData(TAG_TEST_0400_001, datas);
expectData(TAG_TEST_0400_001, datas);
getApplicationInfoSuccess(TAG_TEST_0400_001, datas);
getApplicationInfoSuccess(TAG_TEST_0400_001, datas);
done();
done();
console.log('------------------ ' + TAG_TEST_0400_001 + ' end -------------------');
});
});
/**
/**
...
@@ -269,8 +229,6 @@ export default function applicationBundleJsunit() {
...
@@ -269,8 +229,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0500_001, 0, async function (done) {
it(TAG_TEST_0500_001, 0, async function (done) {
console.info(TAG_TEST_0500_001 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', 0)
await Bundle.getApplicationInfo('', 0)
.then((data) => {
.then((data) => {
...
@@ -284,7 +242,6 @@ export default function applicationBundleJsunit() {
...
@@ -284,7 +242,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime();
var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime);
Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime);
done();
done();
console.log('------------------ ' + TAG_TEST_0500_001 + ' end -------------------');
});
});
/**
/**
...
@@ -294,8 +251,6 @@ export default function applicationBundleJsunit() {
...
@@ -294,8 +251,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0500_002, 0, async function (done) {
it(TAG_TEST_0500_002, 0, async function (done) {
console.info(TAG_TEST_0500_002 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo('', '0', USER_ID_100)
await Bundle.getApplicationInfo('', '0', USER_ID_100)
.then((data) => {
.then((data) => {
...
@@ -309,7 +264,6 @@ export default function applicationBundleJsunit() {
...
@@ -309,7 +264,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime();
var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
done();
done();
console.log('------------------ ' + TAG_TEST_0500_002 + ' end -------------------');
});
});
/**
/**
...
@@ -319,8 +273,6 @@ export default function applicationBundleJsunit() {
...
@@ -319,8 +273,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0600_001, 0, async function (done) {
it(TAG_TEST_0600_001, 0, async function (done) {
console.info(TAG_TEST_0600_001 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
let errors
let errors
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER,
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER,
...
@@ -337,7 +289,6 @@ export default function applicationBundleJsunit() {
...
@@ -337,7 +289,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime();
var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_001, startTime, endTime);
Utils.getDurationTime(TAG_TEST_0600_001, startTime, endTime);
done();
done();
console.log('------------------ ' + TAG_TEST_0600_001 + ' end -------------------');
});
});
/**
/**
...
@@ -347,8 +298,6 @@ export default function applicationBundleJsunit() {
...
@@ -347,8 +298,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0600_002, 0, async function (done) {
it(TAG_TEST_0600_002, 0, async function (done) {
console.info(TAG_TEST_0600_002 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
let errors
let errors
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
...
@@ -365,7 +314,6 @@ export default function applicationBundleJsunit() {
...
@@ -365,7 +314,6 @@ export default function applicationBundleJsunit() {
var endTime = Utils.getNowTime();
var endTime = Utils.getNowTime();
Utils.getDurationTime(TAG_TEST_0600_002, startTime, endTime);
Utils.getDurationTime(TAG_TEST_0600_002, startTime, endTime);
done();
done();
console.log('------------------ ' + TAG_TEST_0600_002 + ' end -------------------');
});
});
/**
/**
...
@@ -375,8 +323,6 @@ export default function applicationBundleJsunit() {
...
@@ -375,8 +323,6 @@ export default function applicationBundleJsunit() {
* @tc.level 0
* @tc.level 0
*/
*/
it(TAG_TEST_0600_003, 0, async function (done) {
it(TAG_TEST_0600_003, 0, async function (done) {
console.info(TAG_TEST_0600_003 + 'promise START');
await Utils.sleep(SLEEP_TIME_1000);
var startTime = await Utils.getNowTime();
var startTime = await Utils.getNowTime();
await Bundle.getApplicationInfo(BUNDLE_NAME, 0)
await Bundle.getApplicationInfo(BUNDLE_NAME, 0)
.then((data) => {
.then((data) => {
...
@@ -392,7 +338,6 @@ export default function applicationBundleJsunit() {
...
@@ -392,7 +338,6 @@ export default function applicationBundleJsunit() {
expect(error).assertFail();
expect(error).assertFail();
});
});
done();
done();
console.log('------------------ ' + TAG_TEST_0600_003 + ' end -------------------');
});
});
...
@@ -496,28 +441,5 @@ export default function applicationBundleJsunit() {
...
@@ -496,28 +441,5 @@ export default function applicationBundleJsunit() {
'com.open.harmony.packagemag/com.open.harmony.packagemag');
'com.open.harmony.packagemag/com.open.harmony.packagemag');
console.log(msg + ' end ' + JSON.stringify(data));
console.log(msg + ' end ' + JSON.stringify(data));
}
}
/**
* expect属性值
* @param msg log信息
* @param data 数据源
*/
function getApplicationInfoFail(msg, data) {
expect(data.name).assertEqual('');
expect(data.codePath).assertEqual('');
expect(data.description).assertEqual('');
expect(data.descriptionId).assertEqual(0);
expect(data.icon).assertEqual('');
expect(data.iconId).assertEqual(0);
expect(data.label).assertEqual('');
expect(data.labelId).assertEqual(0);
expect(data.systemApp).assertEqual(false);
expect(data.supportedModes).assertEqual(0);
expect(data.entryDir).assertEqual('');
expect(data.enabled).assertEqual(false);
expect(data.entityType).assertEqual('');
expect(data.removable).assertEqual(true);
console.log(msg + ' end ' + JSON.stringify(data));
}
});
});
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录