提交 73c3293a 编写于 作者: J jiyong

jiyong@huawei.com

Signed-off-by: Njiyong <jiyong@huawei.com>
上级 e3240098
...@@ -17,10 +17,10 @@ group("aafwk_standard") { ...@@ -17,10 +17,10 @@ group("aafwk_standard") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"abilitymanager:actsabilitymanagertest", #"abilitymanager:actsabilitymanagertest",
"context:context", "context:context",
"featureability:featureability", #"featureability:featureability",
"want:want", #"want:want",
] ]
} }
} }
...@@ -48,7 +48,7 @@ var bundleNameList = [ ...@@ -48,7 +48,7 @@ var bundleNameList = [
describe('ActsAmsCallBackFifthScene', function () { describe('ActsAmsCallBackFifthScene', function () {
console.info('----ActsAmsCallBackFifthScene----'); console.info('----ActsAmsCallBackFifthScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -71,7 +71,7 @@ describe('ActsAmsCallBackFifthScene', function () { ...@@ -71,7 +71,7 @@ describe('ActsAmsCallBackFifthScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -84,7 +84,7 @@ describe('ActsAmsCallBackFifthScene', function () { ...@@ -84,7 +84,7 @@ describe('ActsAmsCallBackFifthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -97,7 +97,7 @@ describe('ActsAmsCallBackFifthScene', function () { ...@@ -97,7 +97,7 @@ describe('ActsAmsCallBackFifthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -113,18 +113,28 @@ describe('ActsAmsCallBackFifthScene', function () { ...@@ -113,18 +113,28 @@ describe('ActsAmsCallBackFifthScene', function () {
setTimeout(done(), 5000); setTimeout(done(), 5000);
}); });
function timeout() { function timeout(done) {
expect().assertFail(); expect().assertFail();
console.debug('Acts_Ams_test=========timeout========'); console.debug('Acts_Ams_test=========timeout========');
done(); done();
} }
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_6600 * @tc.number : Acts_Ams_test_6600
* @tc.name : getAllRunningProcesses : Get All Running Processes Info * @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack) * @tc.desc : Get All Running Processes Info(by CallBack)
*/ */
it('Acts_Ams_test_6600', 0, async function (done) { it('Acts_Ams_test_6600', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
abilitymanager.getAllRunningProcesses( abilitymanager.getAllRunningProcesses(
(error, info) => { (error, info) => {
console.info('getAllRunningProcesses error.code \ console.info('getAllRunningProcesses error.code \
...@@ -293,55 +303,179 @@ describe('ActsAmsCallBackFifthScene', function () { ...@@ -293,55 +303,179 @@ describe('ActsAmsCallBackFifthScene', function () {
}) })
/* /*
* @tc.number : Acts_Ams_test_7800 * @tc.number : Acts_Ams_test_12000
* @tc.name : removeMissions : Remove Missions * @tc.name : deleteMissions : Remove Missions
* @tc.desc : Remove Missions(by CallBack) * @tc.desc : Remove Missions(by CallBack)
*/ */
it('Acts_Ams_test_7800', 0, async function (done) { it('Acts_Ams_test_12000', 0, async function (done) {
var maxnum = 10; var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMissions([result[0].id], abilitymanager.deleteMissions([result[0].id],
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_7800 removeMissions error.code \ console.info('Acts_Ams_test_12000 deleteMissions error.code \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
expect(typeof (info)).assertEqual("number"); expect(typeof (info)).assertEqual("number");
expect(info).assertLarger(0); expect(info).assertEqual(0);
done(); done();
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_7400 * @tc.number : Acts_Ams_test_8000
* @tc.name : clearMissions : Clear Missions * @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Clear Missions(by CallBack) * @tc.desc : Kill Processes By BundleName(by CallBack)
*/ */
it('Acts_Ams_test_7400', 0, async function (done) { it('Acts_Ams_test_8000', 0, async function (done) {
abilitymanager.clearMissions( abilitymanager.killProcessesByBundleName('com.ix.verify.io',
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_7400 clearMissions error.code \ console.info('Acts_Ams_test_8000 killProcessesByBundleName error.code: \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
expect(typeof (info)).assertEqual("number"); expect(typeof (info)).assertEqual("number");
expect(info).assertLarger(0); expect(info).assertEqual(0);
done(); done();
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_8000 * @tc.number : Acts_Ams_test_9000
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName * @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Kill Processes By BundleName(by CallBack) * @tc.desc : Get All Active Processes Info(by CallBack)
*/ */
it('Acts_Ams_test_8000', 0, async function (done) { it('Acts_Ams_test_9000', 0, async function (done) {
abilitymanager.killProcessesByBundleName('com.ix.verify.io', abilitymanager.getActiveProcessInfos(
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_8000 killProcessesByBundleName error.code: \ console.info('getActiveProcessInfos error.code \
' + error.code + ',data [' + info + ']'); ' + error.code + ', data length [' + info.length + ']');
expect(typeof (info)).assertEqual("number"); console.info('Acts_Ams_test_9000 getActiveProcessInfos data ' + JSON.stringify(info));
expect(info).assertEqual(0); expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
});
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_10000
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_10000', 0, async function (done) {
var maxnum = 10;
abilitymanager.getActiveAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_10000 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done(); done();
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
}) })
/*
* @tc.number : Acts_Ams_test_11000
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_11000', 0, async function (done) {
var maxnum = 10;
abilitymanager.getPreviousAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_11000 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done();
});
setTimeout(timeout, 5000);
})
}) })
...@@ -45,7 +45,7 @@ var bundleNameList = [ ...@@ -45,7 +45,7 @@ var bundleNameList = [
describe('ActsAmsCallBackFirstScene', function () { describe('ActsAmsCallBackFirstScene', function () {
console.info('----ActsAmsCallBackFirstScene----'); console.info('----ActsAmsCallBackFirstScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -68,7 +68,7 @@ describe('ActsAmsCallBackFirstScene', function () { ...@@ -68,7 +68,7 @@ describe('ActsAmsCallBackFirstScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -84,11 +84,18 @@ describe('ActsAmsCallBackFirstScene', function () { ...@@ -84,11 +84,18 @@ describe('ActsAmsCallBackFirstScene', function () {
setTimeout(done(), 5000); setTimeout(done(), 5000);
}); });
function timeout() { function timeout(done) {
expect().assertFail(); expect().assertFail();
console.debug('Acts_Ams_test=========timeout========'); console.debug('Acts_Ams_test=========timeout========');
done(); done();
} }
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_0200 * @tc.number : Acts_Ams_test_0200
...@@ -96,6 +103,9 @@ describe('ActsAmsCallBackFirstScene', function () { ...@@ -96,6 +103,9 @@ describe('ActsAmsCallBackFirstScene', function () {
* @tc.desc : Get All Running Processes Info(by CallBack) * @tc.desc : Get All Running Processes Info(by CallBack)
*/ */
it('Acts_Ams_test_0200', 0, async function (done) { it('Acts_Ams_test_0200', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
abilitymanager.getAllRunningProcesses( abilitymanager.getAllRunningProcesses(
(error, info) => { (error, info) => {
console.info('getAllRunningProcesses error.code \ console.info('getAllRunningProcesses error.code \
...@@ -237,7 +247,7 @@ describe('ActsAmsCallBackFirstScene', function () { ...@@ -237,7 +247,7 @@ describe('ActsAmsCallBackFirstScene', function () {
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_0800 removeMission error.code \ console.info('Acts_Ams_test_0800 removeMission error.code \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0); expect(info).assertEqual(0);
done(); done();
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
...@@ -269,7 +279,9 @@ describe('ActsAmsCallBackFirstScene', function () { ...@@ -269,7 +279,9 @@ describe('ActsAmsCallBackFirstScene', function () {
it('Acts_Ams_test_1400', 0, async function (done) { it('Acts_Ams_test_1400', 0, async function (done) {
var maxnum = 10; var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMissions([result[0].id], expect(result.length).assertEqual(1);
var missionID = result[0].id + 1;
abilitymanager.removeMissions([missionID],
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_1400 removeMissions error.code \ console.info('Acts_Ams_test_1400 removeMissions error.code \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
...@@ -280,37 +292,162 @@ describe('ActsAmsCallBackFirstScene', function () { ...@@ -280,37 +292,162 @@ describe('ActsAmsCallBackFirstScene', function () {
}) })
/* /*
* @tc.number : Acts_Ams_test_1000 * @tc.number : Acts_Ams_test_1600
* @tc.name : clearMissions : Clear Missions * @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Clear Missions(by CallBack) * @tc.desc : Kill Processes By BundleName(by CallBack)
*/ */
it('Acts_Ams_test_1000', 0, async function (done) { it('Acts_Ams_test_1600', 0, async function (done) {
abilitymanager.clearMissions( abilitymanager.killProcessesByBundleName('com.ix.simulate.feature',
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_1000 clearMissions error.code \ console.info('Acts_Ams_test_1600 killProcessesByBundleName error.code: \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0); expect(info).assertEqual(0);
done(); done();
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_1600 * @tc.number : Acts_Ams_test_8600
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName * @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Kill Processes By BundleName(by CallBack) * @tc.desc : Get All Active Processes Info(by CallBack)
*/ */
it('Acts_Ams_test_1600', 0, async function (done) { it('Acts_Ams_test_8600', 0, async function (done) {
abilitymanager.killProcessesByBundleName('com.ix.simulate.feature', abilitymanager.getActiveProcessInfos(
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_1600 killProcessesByBundleName error.code: \ console.info('getActiveProcessInfos error.code \
' + error.code + ',data [' + info + ']'); ' + error.code + ', data length [' + info.length + ']');
expect(info).assertEqual(0); console.info('Acts_Ams_test_8600 getActiveProcessInfos data ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done(); done();
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_9600
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_9600', 0, async function (done) {
var maxnum = 10;
abilitymanager.getActiveAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_9600 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done();
});
setTimeout(timeout, 5000);
}) })
/*
* @tc.number : Acts_Ams_test_10600
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_10600', 0, async function (done) {
var maxnum = 10;
abilitymanager.getPreviousAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_10600 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done();
});
setTimeout(timeout, 5000);
})
}) })
...@@ -51,7 +51,7 @@ var bundleNameList = [ ...@@ -51,7 +51,7 @@ var bundleNameList = [
describe('ActsAmsCallBackFourthScene', function () { describe('ActsAmsCallBackFourthScene', function () {
console.info('----ActsAmsCallBackFourthScene----'); console.info('----ActsAmsCallBackFourthScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -74,7 +74,7 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -74,7 +74,7 @@ describe('ActsAmsCallBackFourthScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -87,7 +87,7 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -87,7 +87,7 @@ describe('ActsAmsCallBackFourthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -100,7 +100,7 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -100,7 +100,7 @@ describe('ActsAmsCallBackFourthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -113,7 +113,7 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -113,7 +113,7 @@ describe('ActsAmsCallBackFourthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -129,18 +129,28 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -129,18 +129,28 @@ describe('ActsAmsCallBackFourthScene', function () {
setTimeout(done(), 5000); setTimeout(done(), 5000);
}); });
function timeout() { function timeout(done) {
expect().assertFail(); expect().assertFail();
console.debug('Acts_Ams_test=========timeout========'); console.debug('Acts_Ams_test=========timeout========');
done(); done();
} }
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_5000 * @tc.number : Acts_Ams_test_5000
* @tc.name : getAllRunningProcesses : Get All Running Processes Info * @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack) * @tc.desc : Get All Running Processes Info(by CallBack)
*/ */
it('Acts_Ams_test_5000', 0, async function (done) { it('Acts_Ams_test_5000', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
abilitymanager.getAllRunningProcesses( abilitymanager.getAllRunningProcesses(
(error, info) => { (error, info) => {
console.info('getAllRunningProcesses error.code \ console.info('getAllRunningProcesses error.code \
...@@ -304,7 +314,7 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -304,7 +314,7 @@ describe('ActsAmsCallBackFourthScene', function () {
console.info('Acts_Ams_test_5600 removeMission error.code \ console.info('Acts_Ams_test_5600 removeMission error.code \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
expect(typeof (info)).assertEqual("number"); expect(typeof (info)).assertEqual("number");
expect(info).assertLarger(0); expect(info).assertEqual(0);
done(); done();
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
...@@ -318,7 +328,7 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -318,7 +328,7 @@ describe('ActsAmsCallBackFourthScene', function () {
it('Acts_Ams_test_6000', 0, async function (done) { it('Acts_Ams_test_6000', 0, async function (done) {
var maxnum = 30; var maxnum = 30;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.moveMissionToTop(result[0].id, abilitymanager.moveMissionToTop(result[1].id,
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_6000 moveMissionToTop error.code \ console.info('Acts_Ams_test_6000 moveMissionToTop error.code \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
...@@ -329,23 +339,6 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -329,23 +339,6 @@ describe('ActsAmsCallBackFourthScene', function () {
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
}) })
/*
* @tc.number : Acts_Ams_test_5800
* @tc.name : clearMissions : Clear Missions
* @tc.desc : Clear Missions(by CallBack)
*/
it('Acts_Ams_test_5800', 0, async function (done) {
abilitymanager.clearMissions(
(error, info) => {
console.info('Acts_Ams_test_5800 clearMissions error.code \
' + error.code + ',data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertLarger(0);
done();
});
setTimeout(timeout, 5000);
})
/* /*
* @tc.number : Acts_Ams_test_6400 * @tc.number : Acts_Ams_test_6400
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName * @tc.name : killProcessesByBundleName : Kill Processes By BundleName
...@@ -364,16 +357,16 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -364,16 +357,16 @@ describe('ActsAmsCallBackFourthScene', function () {
}) })
/* /*
* @tc.number : Acts_Ams_test_6200 * @tc.number : Acts_Ams_test_11900
* @tc.name : removeMissions : Remove Missions * @tc.name : deleteMissions : delete Missions
* @tc.desc : Remove Missions(by CallBack) * @tc.desc : delete Missions(by CallBack)
*/ */
it('Acts_Ams_test_6200', 0, async function (done) { it('Acts_Ams_test_11900', 0, async function (done) {
var maxnum = 30; var maxnum = 30;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMissions([result[1].id, result[2].id], abilitymanager.deleteMissions([result[1].id, result[0].id],
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_6200 removeMissions error.code: \ console.info('Acts_Ams_test_11900 deleteMissions error.code: \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
expect(typeof (info)).assertEqual("number"); expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0); expect(info).assertEqual(0);
...@@ -381,4 +374,144 @@ describe('ActsAmsCallBackFourthScene', function () { ...@@ -381,4 +374,144 @@ describe('ActsAmsCallBackFourthScene', function () {
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
}) })
/*
* @tc.number : Acts_Ams_test_8900
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by CallBack)
*/
it('Acts_Ams_test_8900', 0, async function (done) {
abilitymanager.getActiveProcessInfos(
(error, info) => {
console.info('getActiveProcessInfos error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_8900 getActiveProcessInfos data ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
});
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_9900
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_9900', 0, async function (done) {
var maxnum = 10;
abilitymanager.getActiveAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_9900 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done();
});
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_10900
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_10900', 0, async function (done) {
var maxnum = 10;
abilitymanager.getPreviousAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_10900 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done();
});
setTimeout(timeout, 5000);
})
}) })
...@@ -47,7 +47,7 @@ var bundleNameList = [ ...@@ -47,7 +47,7 @@ var bundleNameList = [
describe('ActsAmsCallBackSecondScene', function () { describe('ActsAmsCallBackSecondScene', function () {
console.info('----ActsAmsCallBackSecondScene----'); console.info('----ActsAmsCallBackSecondScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -70,7 +70,7 @@ describe('ActsAmsCallBackSecondScene', function () { ...@@ -70,7 +70,7 @@ describe('ActsAmsCallBackSecondScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -83,7 +83,7 @@ describe('ActsAmsCallBackSecondScene', function () { ...@@ -83,7 +83,7 @@ describe('ActsAmsCallBackSecondScene', function () {
}, },
} }
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -99,18 +99,28 @@ describe('ActsAmsCallBackSecondScene', function () { ...@@ -99,18 +99,28 @@ describe('ActsAmsCallBackSecondScene', function () {
setTimeout(done(), 5000); setTimeout(done(), 5000);
}); });
function timeout() { function timeout(done) {
expect().assertFail(); expect().assertFail();
console.debug('Acts_Ams_test=========timeout========'); console.debug('Acts_Ams_test=========timeout========');
done(); done();
} }
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_1800 * @tc.number : Acts_Ams_test_1800
* @tc.name : getAllRunningProcesses : Get All Running Processes Info * @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack) * @tc.desc : Get All Running Processes Info(by CallBack)
*/ */
it('Acts_Ams_test_1800', 0, async function (done) { it('Acts_Ams_test_1800', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
abilitymanager.getAllRunningProcesses( abilitymanager.getAllRunningProcesses(
(error, info) => { (error, info) => {
console.info('getAllRunningProcesses error.code \ console.info('getAllRunningProcesses error.code \
...@@ -288,23 +298,7 @@ describe('ActsAmsCallBackSecondScene', function () { ...@@ -288,23 +298,7 @@ describe('ActsAmsCallBackSecondScene', function () {
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_3000 removeMissions error.code \ console.info('Acts_Ams_test_3000 removeMissions error.code \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0); expect(info).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_2600
* @tc.name : clearMissions: Clear Missions
* @tc.desc : Clear Missions(by CallBack)
*/
it('Acts_Ams_test_2600', 0, async function (done) {
abilitymanager.clearMissions(
(error, info) => {
console.info('Acts_Ams_test_2600 clearMissions error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0);
done(); done();
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
...@@ -325,6 +319,147 @@ describe('ActsAmsCallBackSecondScene', function () { ...@@ -325,6 +319,147 @@ describe('ActsAmsCallBackSecondScene', function () {
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
}) })
/*
* @tc.number : Acts_Ams_test_8700
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by CallBack)
*/
it('Acts_Ams_test_8700', 0, async function (done) {
abilitymanager.getActiveProcessInfos(
(error, info) => {
console.info('getActiveProcessInfos error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_8700 getActiveProcessInfos data ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
});
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_9700
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_9700', 0, async function (done) {
var maxnum = 10;
abilitymanager.getActiveAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_9700 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done();
});
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_10700
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_10700', 0, async function (done) {
var maxnum = 10;
abilitymanager.getPreviousAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_10700 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done();
});
setTimeout(timeout, 5000);
})
}) })
...@@ -45,7 +45,7 @@ var bundleNameList = [ ...@@ -45,7 +45,7 @@ var bundleNameList = [
describe('ActsAmsCallBackThirdScene', function () { describe('ActsAmsCallBackThirdScene', function () {
console.info('----ActsAmsCallBackThirdScene----'); console.info('----ActsAmsCallBackThirdScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -68,7 +68,7 @@ describe('ActsAmsCallBackThirdScene', function () { ...@@ -68,7 +68,7 @@ describe('ActsAmsCallBackThirdScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -81,7 +81,7 @@ describe('ActsAmsCallBackThirdScene', function () { ...@@ -81,7 +81,7 @@ describe('ActsAmsCallBackThirdScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -94,7 +94,7 @@ describe('ActsAmsCallBackThirdScene', function () { ...@@ -94,7 +94,7 @@ describe('ActsAmsCallBackThirdScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -110,18 +110,28 @@ describe('ActsAmsCallBackThirdScene', function () { ...@@ -110,18 +110,28 @@ describe('ActsAmsCallBackThirdScene', function () {
setTimeout(done(), 5000); setTimeout(done(), 5000);
}); });
function timeout() { function timeout(done) {
expect().assertFail(); expect().assertFail();
console.debug('Acts_Ams_test=========timeout========'); console.debug('Acts_Ams_test=========timeout========');
done(); done();
} }
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_3400 * @tc.number : Acts_Ams_test_3400
* @tc.name : getAllRunningProcesses : Get All Running Processes Info * @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack) * @tc.desc : Get All Running Processes Info(by CallBack)
*/ */
it('Acts_Ams_test_3400', 0, async function (done) { it('Acts_Ams_test_3400', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
abilitymanager.getAllRunningProcesses( abilitymanager.getAllRunningProcesses(
(error, info) => { (error, info) => {
console.info('getAllRunningProcesses error.code \ console.info('getAllRunningProcesses error.code \
...@@ -210,7 +220,7 @@ describe('ActsAmsCallBackThirdScene', function () { ...@@ -210,7 +220,7 @@ describe('ActsAmsCallBackThirdScene', function () {
* @tc.desc : Query Recent Ability Mission Infos(by CallBack) * @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/ */
it('Acts_Ams_test_3800', 0, async function (done) { it('Acts_Ams_test_3800', 0, async function (done) {
var maxnum = 20, flag = 1; var maxnum = 20, flag = 2;
abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag, abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag,
(error, info) => { (error, info) => {
console.info('queryRunningAbilityMissionInfos error.code : \ console.info('queryRunningAbilityMissionInfos error.code : \
...@@ -288,34 +298,18 @@ describe('ActsAmsCallBackThirdScene', function () { ...@@ -288,34 +298,18 @@ describe('ActsAmsCallBackThirdScene', function () {
}) })
/* /*
* @tc.number : Acts_Ams_test_4600 * @tc.number : Acts_Ams_test_11800
* @tc.name : removeMissions: Remove Missions * @tc.name : deleteMissions : delete Missions
* @tc.desc : Remove Missions(by CallBack) * @tc.desc : delete Missions(by CallBack)
*/ */
it('Acts_Ams_test_4600', 0, async function (done) { it('Acts_Ams_test_11800', 0, async function (done) {
var maxnum = 20; var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMissions([result[0].id], abilitymanager.deleteMissions([result[0].id],
(error, info) => { (error, info) => {
console.info('Acts_Ams_test_4600 removeMissions error.code \ console.info('Acts_Ams_test_11800 deleteMissions error.code \
' + error.code + ',data [' + info + ']'); ' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0); expect(info).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_4200
* @tc.name : clearMissions: Clear Missions
* @tc.desc : Clear Missions(by CallBack)
*/
it('Acts_Ams_test_4200', 0, async function (done) {
abilitymanager.clearMissions(
(error, info) => {
console.info('Acts_Ams_test_4200 clearMissions error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0);
done(); done();
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
...@@ -336,6 +330,147 @@ describe('ActsAmsCallBackThirdScene', function () { ...@@ -336,6 +330,147 @@ describe('ActsAmsCallBackThirdScene', function () {
}); });
setTimeout(timeout, 5000); setTimeout(timeout, 5000);
}) })
/*
* @tc.number : Acts_Ams_test_8800
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by CallBack)
*/
it('Acts_Ams_test_8800', 0, async function (done) {
abilitymanager.getActiveProcessInfos(
(error, info) => {
console.info('getActiveProcessInfos error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_8800 getActiveProcessInfos data ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
});
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_9800
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_9800', 0, async function (done) {
var maxnum = 10;
abilitymanager.getActiveAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_9800 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done();
});
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_10800
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_10800', 0, async function (done) {
var maxnum = 10;
abilitymanager.getPreviousAbilityMissionInfos(maxnum,
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_10800 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(1);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
expect(typeof (info[i].bottomAbility)).assertEqual("object");
expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
expect(info[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
expect(info[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility.uri)).assertEqual("string");
expect(info[i].topAbility.uri.length).assertEqual(0);
expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
expect(info[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (info[i].windowMode)).assertEqual("number");
expect(info[i].windowMode).assertEqual(0);
}
done();
});
setTimeout(timeout, 5000);
})
}) })
...@@ -48,7 +48,7 @@ var bundleNameList = [ ...@@ -48,7 +48,7 @@ var bundleNameList = [
describe('ActsAmsTestFifthScene', function () { describe('ActsAmsTestFifthScene', function () {
console.info('----ActsAmsTestFifthScene----'); console.info('----ActsAmsTestFifthScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -76,7 +76,7 @@ describe('ActsAmsTestFifthScene', function () { ...@@ -76,7 +76,7 @@ describe('ActsAmsTestFifthScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -94,7 +94,7 @@ describe('ActsAmsTestFifthScene', function () { ...@@ -94,7 +94,7 @@ describe('ActsAmsTestFifthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -112,7 +112,7 @@ describe('ActsAmsTestFifthScene', function () { ...@@ -112,7 +112,7 @@ describe('ActsAmsTestFifthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -130,46 +130,80 @@ describe('ActsAmsTestFifthScene', function () { ...@@ -130,46 +130,80 @@ describe('ActsAmsTestFifthScene', function () {
}, },
}, },
); );
done(); setTimeout(done(), 5000);
}); });
function timeout(done) {
expect().assertFail();
console.debug('Acts_Ams_test=========timeout========');
done();
}
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_6500 * @tc.number : Acts_Ams_test_6500
* @tc.name : getAllRunningProcesses : Get All Running Processes Info * @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise) * @tc.desc : Get All Running Processes Info(by Promise)
*/ */
it('Acts_Ams_test_6500', 0, async function (done) { it('Acts_Ams_test_6500', 0, async function (done) {
setTimeout(async function () { console.info("sleep begin");
var info = await abilitymanager.getAllRunningProcesses(); sleep(5000);
console.info('getAllRunningProcesses data length [' + info.length + ']'); console.info("sleep end");
console.info('Acts_Ams_test_6500 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); var info = await abilitymanager.getAllRunningProcesses();
expect(Array.isArray(info)).assertEqual(true); console.info('getAllRunningProcesses data length [' + info.length + ']');
expect(info.length).assertEqual(5); console.info('Acts_Ams_test_6500 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
for (var i = 0; i < info.length; i++) { expect(Array.isArray(info)).assertEqual(true);
expect(typeof (info[i].pid)).assertEqual("number"); expect(info.length).assertEqual(5);
expect(info[i].pid).assertLarger(0); for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(typeof (info[i].processName)).assertEqual("string"); expect(info[i].pid).assertLarger(0);
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].pkgList)).assertEqual(true); expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(info[i].pkgList.length).assertEqual(0);
expect(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(typeof (info[i].uid)).assertEqual("number"); expect(info[i].pkgList.length).assertEqual(0);
expect(info[i].uid).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number"); expect(info[i].uid).assertLarger(0);
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
expect(typeof (info[i].weight)).assertEqual("number"); expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(info[i].weight).assertEqual(-1);
expect(typeof (info[i].weight)).assertEqual("number");
expect(typeof (info[i].weightReasonCode)).assertEqual("number"); expect(info[i].weight).assertEqual(-1);
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
} expect(typeof (info[i].weightReasonCode)).assertEqual("number");
done(); expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}, 2000); }
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_7500
* @tc.name : moveMissionToTop : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_7500', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.moveMissionToTop(result[1].id);
console.info('Acts_Ams_test_7500 moveMissionToTop data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0);
var ret = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
expect(result[1].baseAbility.bundleName).assertEqual(ret[0].baseAbility.bundleName);
expect(result[1].topAbility.bundleName).assertEqual(ret[0].topAbility.bundleName);
done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -212,6 +246,22 @@ describe('ActsAmsTestFifthScene', function () { ...@@ -212,6 +246,22 @@ describe('ActsAmsTestFifthScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_11500
* @tc.name : deleteMissions: delete Missions
* @tc.desc : delete Missions(by Promise)
*/
it('Acts_Ams_test_11500', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.deleteMissions([result[1].id]);
console.info('Acts_Ams_test_11500 deleteMissions data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -225,7 +275,7 @@ describe('ActsAmsTestFifthScene', function () { ...@@ -225,7 +275,7 @@ describe('ActsAmsTestFifthScene', function () {
console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']'); console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']');
console.info('Acts_Ams_test_6700 queryRunningAbilityMissionInfos data ' + JSON.stringify(data)); console.info('Acts_Ams_test_6700 queryRunningAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true); expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(3); expect(data.length).assertEqual(2);
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number"); expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0); expect(data[i].id).assertLarger(0);
...@@ -254,65 +304,134 @@ describe('ActsAmsTestFifthScene', function () { ...@@ -254,65 +304,134 @@ describe('ActsAmsTestFifthScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_7100 * @tc.number : Acts_Ams_test_8500
* @tc.name : removeMission : Remove Mission * @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Remove Mission(by Promise) * @tc.desc : Get All Active Processes Info(by Promise)
*/ */
it('Acts_Ams_test_7100', 0, async function (done) { it('Acts_Ams_test_8500', 0, async function (done) {
var maxnum = 10; var info = await abilitymanager.getActiveProcessInfos();
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); console.info('Acts_Ams_test_8500 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
var info = await abilitymanager.removeMission(result[1].id); expect(Array.isArray(info)).assertEqual(true);
console.info('Acts_Ams_test_7100 removeMission data [' + info + ']'); expect(info.length).assertEqual(4);
expect(typeof (info)).assertEqual("number"); for (var i = 0; i < info.length; i++) {
expect(info).assertEqual(0); expect(typeof (info[i].pid)).assertEqual("number");
done(); expect(info[i].pid).assertLarger(0);
})
/* expect(typeof (info[i].processName)).assertEqual("string");
* @tc.number : Acts_Ams_test_7500 expect(info[i].processName.length).assertLarger(0);
* @tc.name : moveMissionToTop : Move Mission To Top expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_7500', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.moveMissionToTop(result[0].id);
console.info('Acts_Ams_test_7500moveMissionToTop data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
/* expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
* @tc.number : Acts_Ams_test_7700 expect(info[i].bundleNames.length).assertEqual(0);
* @tc.name : removeMissions: Remove Missions
* @tc.desc : Remove Missions(by Promise)
*/
it('Acts_Ams_test_7700', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMissions([result[0].id]);
console.info('Acts_Ams_test_7700 removeMissions data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertLarger(0);
done();
})
/* expect(typeof (info[i].uid)).assertEqual("number");
* @tc.number : Acts_Ams_test_7300 expect(info[i].uid).assertLarger(0);
* @tc.name : clearMissions: Clear Missions }
* @tc.desc : Clear Missions(by Promise) done();
*/ setTimeout(timeout, 5000);
it('Acts_Ams_test_7300', 0, async function (done) { })
var info = await abilitymanager.clearMissions();
console.info('Acts_Ams_test_7300 clearMissions data [' + info + ']'); /*
expect(typeof (info)).assertEqual("number"); * @tc.number : Acts_Ams_test_9500
expect(info).assertLarger(0); * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
done(); * @tc.desc : Get Active Ability Mission Infos(by Promise)
}) */
it('Acts_Ams_test_9500', 0, async function (done) {
var upperLimit = 20;
var data = await abilitymanager.getActiveAbilityMissionInfos(upperLimit);
console.info('Acts_Ams_test_9500 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(2);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_10500
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_10500', 0, async function (done) {
var upperLimit = 20;
var data = await abilitymanager.getPreviousAbilityMissionInfos(upperLimit);
console.info('Acts_Ams_test_10500 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(2);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done();
setTimeout(timeout, 5000);
})
/* /*
* @tc.number : Acts_Ams_test_7900 * @tc.number : Acts_Ams_test_7900
...@@ -325,5 +444,7 @@ describe('ActsAmsTestFifthScene', function () { ...@@ -325,5 +444,7 @@ describe('ActsAmsTestFifthScene', function () {
expect(typeof (info)).assertEqual("number"); expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
}) })
\ No newline at end of file
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
] ]
} }
], ],
"visible": true,
"name": "com.example.actsamstestfirstscene.MainAbility", "name": "com.example.actsamstestfirstscene.MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:mainability_description", "description": "$string:mainability_description",
......
...@@ -45,7 +45,7 @@ var bundleNameList = [ ...@@ -45,7 +45,7 @@ var bundleNameList = [
describe('ActsAmsTestFirstScene', function () { describe('ActsAmsTestFirstScene', function () {
console.info('----ActsAmsTestFirstScene----'); console.info('----ActsAmsTestFirstScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -73,7 +73,7 @@ describe('ActsAmsTestFirstScene', function () { ...@@ -73,7 +73,7 @@ describe('ActsAmsTestFirstScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -91,45 +91,75 @@ describe('ActsAmsTestFirstScene', function () { ...@@ -91,45 +91,75 @@ describe('ActsAmsTestFirstScene', function () {
}, },
}, },
); );
done(); setTimeout(done(), 5000);
}); });
function timeout(done) {
expect().assertFail();
console.debug('Acts_Ams_test=========timeout========');
done();
}
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_0100 * @tc.number : Acts_Ams_test_0100
* @tc.name : getAllRunningProcesses : Get All Running Processes Info * @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise) * @tc.desc : Get All Running Processes Info(by Promise)
*/ */
it('Acts_Ams_test_0100', 0, async function (done) { it('Acts_Ams_test_0100', 0, async function (done) {
setTimeout(async function () { console.info("sleep begin");
var info = await abilitymanager.getAllRunningProcesses(); sleep(5000);
console.info('Acts_Ams_test_0100 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); console.info("sleep end");
expect(Array.isArray(info)).assertEqual(true); var info = await abilitymanager.getAllRunningProcesses();
expect(info.length).assertEqual(4); console.info('Acts_Ams_test_0100 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
for (var i = 0; i < info.length; i++) { expect(Array.isArray(info)).assertEqual(true);
expect(typeof (info[i].pid)).assertEqual("number"); expect(info.length).assertEqual(4);
expect(info[i].pid).assertLarger(0); for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1); expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].pkgList)).assertEqual(true); expect(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(0); expect(info[i].pkgList.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number"); expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number"); expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1); expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof (info[i].weight)).assertEqual("number"); expect(typeof (info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1); expect(info[i].weight).assertEqual(-1);
expect(typeof (info[i].weightReasonCode)).assertEqual("number"); expect(typeof (info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
} }
done(); done();
}, 5000); setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_1100
* @tc.name : moveMissionToTop : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_1100', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.moveMissionToTop(result[0].id);
console.info('Acts_Ams_test_1100 moveMissionToTop data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -172,6 +202,7 @@ describe('ActsAmsTestFirstScene', function () { ...@@ -172,6 +202,7 @@ describe('ActsAmsTestFirstScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -213,6 +244,7 @@ describe('ActsAmsTestFirstScene', function () { ...@@ -213,6 +244,7 @@ describe('ActsAmsTestFirstScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -225,48 +257,26 @@ describe('ActsAmsTestFirstScene', function () { ...@@ -225,48 +257,26 @@ describe('ActsAmsTestFirstScene', function () {
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMission(result[0].id); var info = await abilitymanager.removeMission(result[0].id);
console.info('Acts_Ams_test_0700 removeMission data [' + info + ']'); console.info('Acts_Ams_test_0700 removeMission data [' + info + ']');
expect(info).assertLarger(0);
done();
})
/*
* @tc.number : Acts_Ams_test_1100
* @tc.name : moveMissionToTop : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_1100', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.moveMissionToTop(result[0].id);
console.info('Acts_Ams_test_1100 moveMissionToTop data [' + info + ']');
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_1300 * @tc.number : Acts_Ams_test_11100
* @tc.name : removeMissions: Remove Missions * @tc.name : deleteMissions: delete Missions
* @tc.desc : Remove Missions(by Promise) * @tc.desc : delete Missions(by Promise)
*/ */
it('Acts_Ams_test_1300', 0, async function (done) { it('Acts_Ams_test_11100', 0, async function (done) {
var maxnum = 10; var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMissions([result[0].id]); expect(result.length).assertEqual(1);
console.info('Acts_Ams_test_1300 removeMissions data [' + info + ']'); var missionID = result[0].id + 1;
expect(info).assertLarger(0); var info = await abilitymanager.deleteMissions([missionID]);
done(); console.info('Acts_Ams_test_11100 deleteMissions data [' + info + ']');
})
/*
* @tc.number : Acts_Ams_test_0900
* @tc.name : clearMissions: Clear Missions
* @tc.desc : Clear Missions(by Promise)
*/
it('Acts_Ams_test_0900', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('Acts_Ams_test_0900 clearMissions data [' + info + ']');
expect(info).assertLarger(0); expect(info).assertLarger(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -279,5 +289,133 @@ describe('ActsAmsTestFirstScene', function () { ...@@ -279,5 +289,133 @@ describe('ActsAmsTestFirstScene', function () {
console.info('Acts_Ams_test_1500 killProcessesByBundleName data [' + info + ']'); console.info('Acts_Ams_test_1500 killProcessesByBundleName data [' + info + ']');
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/*
* @tc.number : Acts_Ams_test_8100
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by Promise)
*/
it('Acts_Ams_test_8100', 0, async function (done) {
var info = await abilitymanager.getActiveProcessInfos();
console.info('Acts_Ams_test_8100 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_9100
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_9100', 0, async function (done) {
var upperLimit = 20;
var data = await abilitymanager.getActiveAbilityMissionInfos(upperLimit);
console.info('Acts_Ams_test_9100 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_10100
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_10100', 0, async function (done) {
var upperLimit = 20;
var data = await abilitymanager.getPreviousAbilityMissionInfos(upperLimit);
console.info('Acts_Ams_test_10100 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done();
setTimeout(timeout, 5000);
})
}) })
...@@ -50,7 +50,7 @@ var bundleNameList = [ ...@@ -50,7 +50,7 @@ var bundleNameList = [
describe('ActsAmsTestFourthScene', function () { describe('ActsAmsTestFourthScene', function () {
console.info('----ActsAmsTestFourthScene----'); console.info('----ActsAmsTestFourthScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -78,7 +78,7 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -78,7 +78,7 @@ describe('ActsAmsTestFourthScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -96,7 +96,7 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -96,7 +96,7 @@ describe('ActsAmsTestFourthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -114,7 +114,7 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -114,7 +114,7 @@ describe('ActsAmsTestFourthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -132,7 +132,7 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -132,7 +132,7 @@ describe('ActsAmsTestFourthScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -150,46 +150,61 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -150,46 +150,61 @@ describe('ActsAmsTestFourthScene', function () {
}, },
}, },
); );
done(); setTimeout(done(), 5000);
}); });
function timeout(done) {
expect().assertFail();
console.debug('Acts_Ams_test=========timeout========');
done();
}
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_4900 * @tc.number : Acts_Ams_test_4900
* @tc.name : getAllRunningProcesses : Get All Running Processes Info * @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise) * @tc.desc : Get All Running Processes Info(by Promise)
*/ */
it('Acts_Ams_test_4900', 0, async function (done) { it('Acts_Ams_test_4900', 0, async function (done) {
setTimeout(async function () { console.info("sleep begin");
var info = await abilitymanager.getAllRunningProcesses(); sleep(5000);
console.info('getAllRunningProcesses data length [' + info.length + ']'); console.info("sleep end");
console.info('Acts_Ams_test_4900 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); var info = await abilitymanager.getAllRunningProcesses();
expect(Array.isArray(info)).assertEqual(true); console.info('getAllRunningProcesses data length [' + info.length + ']');
expect(info.length).assertEqual(6); console.info('Acts_Ams_test_4900 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
for (var i = 0; i < info.length; i++) { expect(Array.isArray(info)).assertEqual(true);
expect(typeof (info[i].pid)).assertEqual("number"); expect(info.length).assertEqual(6);
expect(info[i].pid).assertLarger(0); for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(typeof (info[i].processName)).assertEqual("string"); expect(info[i].pid).assertLarger(0);
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].pkgList)).assertEqual(true); expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(info[i].pkgList.length).assertEqual(0);
expect(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(typeof (info[i].uid)).assertEqual("number"); expect(info[i].pkgList.length).assertEqual(0);
expect(info[i].uid).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number"); expect(info[i].uid).assertLarger(0);
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
expect(typeof (info[i].weight)).assertEqual("number"); expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(info[i].weight).assertEqual(-1);
expect(typeof (info[i].weight)).assertEqual("number");
expect(typeof (info[i].weightReasonCode)).assertEqual("number"); expect(info[i].weight).assertEqual(-1);
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
} expect(typeof (info[i].weightReasonCode)).assertEqual("number");
done(); expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}, 5000); }
done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -242,6 +257,7 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -242,6 +257,7 @@ describe('ActsAmsTestFourthScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -294,6 +310,7 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -294,6 +310,7 @@ describe('ActsAmsTestFourthScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -307,8 +324,9 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -307,8 +324,9 @@ describe('ActsAmsTestFourthScene', function () {
var info = await abilitymanager.removeMission(result[0].id); var info = await abilitymanager.removeMission(result[0].id);
console.info('Acts_Ams_test_5500 removeMission data [' + info + ']'); console.info('Acts_Ams_test_5500 removeMission data [' + info + ']');
expect(typeof (info)).assertEqual("number"); expect(typeof (info)).assertEqual("number");
expect(info).assertLarger(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -324,19 +342,23 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -324,19 +342,23 @@ describe('ActsAmsTestFourthScene', function () {
expect(typeof (info)).assertEqual("number"); expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_5700 * @tc.number : Acts_Ams_test_6100
* @tc.name : clearMissions: Clear Missions * @tc.name : removeMissions: Remove Missions
* @tc.desc : Clear Missions(by Promise) * @tc.desc : Remove Missions(by Promise)
*/ */
it('Acts_Ams_test_5700', 0, async function (done) { it('Acts_Ams_test_6100', 0, async function (done) {
var info = await abilitymanager.clearMissions(); var maxnum = 30;
console.info('Acts_Ams_test_5700 clearMissions data [' + info + ']'); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMissions([result[0].id, result[1].id]);
console.info('Acts_Ams_test_6100 removeMissions data [' + info + ']');
expect(typeof (info)).assertEqual("number"); expect(typeof (info)).assertEqual("number");
expect(info).assertLarger(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -350,20 +372,133 @@ describe('ActsAmsTestFourthScene', function () { ...@@ -350,20 +372,133 @@ describe('ActsAmsTestFourthScene', function () {
expect(typeof (info)).assertEqual("number"); expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_6100 * @tc.number : Acts_Ams_test_8400
* @tc.name : removeMissions: Remove Missions * @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Remove Missions(by Promise) * @tc.desc : Get All Active Processes Info(by Promise)
*/ */
it('Acts_Ams_test_6100', 0, async function (done) { it('Acts_Ams_test_8400', 0, async function (done) {
var maxnum = 30; var info = await abilitymanager.getActiveProcessInfos();
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); console.info('Acts_Ams_test_8400 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
var info = await abilitymanager.removeMissions([result[1].id, result[2].id]); expect(Array.isArray(info)).assertEqual(true);
console.info('Acts_Ams_test_6100 removeMissions data [' + info + ']'); expect(info.length).assertEqual(3);
expect(typeof (info)).assertEqual("number"); for (var i = 0; i < info.length; i++) {
expect(info).assertEqual(0); expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done(); done();
setTimeout(timeout, 5000);
}) })
/*
* @tc.number : Acts_Ams_test_9400
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_9400', 0, async function (done) {
var upperLimit = 20;
var data = await abilitymanager.getActiveAbilityMissionInfos(upperLimit);
console.info('Acts_Ams_test_9400 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_10400
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_10400', 0, async function (done) {
var upperLimit = 20;
var data = await abilitymanager.getPreviousAbilityMissionInfos(upperLimit);
console.info('Acts_Ams_test_10400 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done();
setTimeout(timeout, 5000);
})
}) })
\ No newline at end of file
...@@ -47,7 +47,7 @@ var bundleNameList = [ ...@@ -47,7 +47,7 @@ var bundleNameList = [
describe('ActsAmsTestSecondScene', function () { describe('ActsAmsTestSecondScene', function () {
console.info('----ActsAmsTestSecondScene----'); console.info('----ActsAmsTestSecondScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -75,7 +75,7 @@ describe('ActsAmsTestSecondScene', function () { ...@@ -75,7 +75,7 @@ describe('ActsAmsTestSecondScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -93,7 +93,7 @@ describe('ActsAmsTestSecondScene', function () { ...@@ -93,7 +93,7 @@ describe('ActsAmsTestSecondScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -111,45 +111,75 @@ describe('ActsAmsTestSecondScene', function () { ...@@ -111,45 +111,75 @@ describe('ActsAmsTestSecondScene', function () {
}, },
}, },
); );
done(); setTimeout(done(), 5000);
}); });
function timeout(done) {
expect().assertFail();
console.debug('Acts_Ams_test=========timeout========');
done();
}
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_1700 * @tc.number : Acts_Ams_test_1700
* @tc.name : getAllRunningProcesses : Get All Running Processes Info * @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise) * @tc.desc : Get All Running Processes Info(by Promise)
*/ */
it('Acts_Ams_test_1700', 0, async function (done) { it('Acts_Ams_test_1700', 0, async function (done) {
setTimeout(async function () { console.info("sleep begin");
var info = await abilitymanager.getAllRunningProcesses(); sleep(5000);
console.info('Acts_Ams_test_1700 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); console.info("sleep end");
expect(Array.isArray(info)).assertEqual(true); var info = await abilitymanager.getAllRunningProcesses();
expect(info.length).assertEqual(5); console.info('Acts_Ams_test_1700 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
for (var i = 0; i < info.length; i++) { expect(Array.isArray(info)).assertEqual(true);
expect(typeof (info[i].pid)).assertEqual("number"); expect(info.length).assertEqual(5);
expect(info[i].pid).assertLarger(0); for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1); expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].pkgList)).assertEqual(true); expect(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(0); expect(info[i].pkgList.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number"); expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number"); expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1); expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof (info[i].weight)).assertEqual("number"); expect(typeof (info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1); expect(info[i].weight).assertEqual(-1);
expect(typeof (info[i].weightReasonCode)).assertEqual("number"); expect(typeof (info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
} }
done(); done();
}, 5000); setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_2700
* @tc.name : moveMissionToTop : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_2700', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.moveMissionToTop(result[0].id);
console.info('Acts_Ams_test_2700 moveMissionToTop data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -192,6 +222,22 @@ describe('ActsAmsTestSecondScene', function () { ...@@ -192,6 +222,22 @@ describe('ActsAmsTestSecondScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_11200
* @tc.name : deleteMissions: delete Missions
* @tc.desc : delete Missions(by Promise)
*/
it('Acts_Ams_test_11200', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.deleteMissions([result[0].id]);
console.info('Acts_Ams_test_11200 deleteMissions data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -205,7 +251,7 @@ describe('ActsAmsTestSecondScene', function () { ...@@ -205,7 +251,7 @@ describe('ActsAmsTestSecondScene', function () {
console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']'); console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']');
console.info('Acts_Ams_test_2100 queryRecentAbilityMissionInfos data ' + JSON.stringify(data)); console.info('Acts_Ams_test_2100 queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true); expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(3); expect(data.length).assertEqual(2);
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number"); expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0); expect(data[i].id).assertLarger(0);
...@@ -234,6 +280,7 @@ describe('ActsAmsTestSecondScene', function () { ...@@ -234,6 +280,7 @@ describe('ActsAmsTestSecondScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -244,62 +291,151 @@ describe('ActsAmsTestSecondScene', function () { ...@@ -244,62 +291,151 @@ describe('ActsAmsTestSecondScene', function () {
it('Acts_Ams_test_2300', 0, async function (done) { it('Acts_Ams_test_2300', 0, async function (done) {
var maxnum = 20; var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMission(result[1].id); var info = await abilitymanager.removeMission(result[0].id);
console.info('Acts_Ams_test_2300 removeMission data [' + info + ']'); console.info('Acts_Ams_test_2300 removeMission data [' + info + ']');
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_2700 * @tc.number : Acts_Ams_test_3100
* @tc.name : moveMissionToTop : Move Mission To Top * @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Move Mission To Top(by Promise) * @tc.desc : Kill Processes By BundleName(by Promise)
*/ */
it('Acts_Ams_test_2700', 0, async function (done) { it('Acts_Ams_test_3100', 0, async function (done) {
var maxnum = 20; var info = await abilitymanager.killProcessesByBundleName('XXXXXXXXXXXX');
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); console.info('Acts_Ams_test_3100 killProcessesByBundleName data [' + info + ']');
var info = await abilitymanager.moveMissionToTop(result[0].id);
console.info('Acts_Ams_test_2700 moveMissionToTop data [' + info + ']');
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_2900 * @tc.number : Acts_Ams_test_8200
* @tc.name : removeMissions: Remove Missions * @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Remove Missions(by Promise) * @tc.desc : Get All Active Processes Info(by Promise)
*/ */
it('Acts_Ams_test_2900', 0, async function (done) { it('Acts_Ams_test_8200', 0, async function (done) {
var maxnum = 20; var info = await abilitymanager.getActiveProcessInfos();
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); console.info('Acts_Ams_test_8200 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
var info = await abilitymanager.removeMissions([result[0].id]); expect(Array.isArray(info)).assertEqual(true);
console.info('Acts_Ams_test_2900 removeMissions data [' + info + ']'); expect(info.length).assertEqual(3);
expect(info).assertLarger(0); for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_2500 * @tc.number : Acts_Ams_test_9200
* @tc.name : clearMissions: Clear Missions * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Clear Missions(by Promise) * @tc.desc : Get Active Ability Mission Infos(by Promise)
*/ */
it('Acts_Ams_test_2500', 0, async function (done) { it('Acts_Ams_test_9200', 0, async function (done) {
var info = await abilitymanager.clearMissions(); var upperLimit = 20;
console.info('Acts_Ams_test_2500 clearMissions data [' + info + ']'); var data = await abilitymanager.getActiveAbilityMissionInfos(upperLimit);
expect(info).assertLarger(0); console.info('Acts_Ams_test_9200 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
* @tc.number : Acts_Ams_test_3100 * @tc.number : Acts_Ams_test_10200
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Kill Processes By BundleName(by Promise) * @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/ */
it('Acts_Ams_test_3100', 0, async function (done) { it('Acts_Ams_test_10200', 0, async function (done) {
var info = await abilitymanager.killProcessesByBundleName('XXXXXXXXXXXX'); var upperLimit = 20;
console.info('Acts_Ams_test_3100 killProcessesByBundleName data [' + info + ']'); var data = await abilitymanager.getPreviousAbilityMissionInfos(upperLimit);
expect(info).assertEqual(0); console.info('Acts_Ams_test_10200 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done(); done();
setTimeout(timeout, 5000);
}) })
}) })
...@@ -47,7 +47,7 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -47,7 +47,7 @@ describe('ActsAmsTestThirdScene', function () {
console.info('----ActsAmsTestThirdScene----'); console.info('----ActsAmsTestThirdScene----');
beforeAll(async function (done) { beforeAll(async function (done) {
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -75,7 +75,7 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -75,7 +75,7 @@ describe('ActsAmsTestThirdScene', function () {
console.log(' removeMission data [' + info + ']'); console.log(' removeMission data [' + info + ']');
} }
}; };
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -93,7 +93,7 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -93,7 +93,7 @@ describe('ActsAmsTestThirdScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -111,7 +111,7 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -111,7 +111,7 @@ describe('ActsAmsTestThirdScene', function () {
}, },
}, },
); );
featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -129,46 +129,60 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -129,46 +129,60 @@ describe('ActsAmsTestThirdScene', function () {
}, },
}, },
); );
done(); setTimeout(done(), 5000);
}); });
function timeout(done) {
expect().assertFail();
console.debug('Acts_Ams_test=========timeout========');
done();
}
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/* /*
* @tc.number : Acts_Ams_test_3300 * @tc.number : Acts_Ams_test_3300
* @tc.name : getAllRunningProcesses : Get All Running Processes Info * @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise) * @tc.desc : Get All Running Processes Info(by Promise)
*/ */
it('Acts_Ams_test_3300', 0, async function (done) { it('Acts_Ams_test_3300', 0, async function (done) {
setTimeout(async function () { console.info("sleep begin");
var info = await abilitymanager.getAllRunningProcesses(); sleep(5000);
console.info('Acts_Ams_test_3300 getAllRunningProcesses JSON String: ' + JSON.stringify(info)); console.info("sleep end");
expect(Array.isArray(info)).assertEqual(true); var info = await abilitymanager.getAllRunningProcesses();
expect(info.length).assertEqual(4); console.info('Acts_Ams_test_3300 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
for (var i = 0; i < info.length; i++) { expect(Array.isArray(info)).assertEqual(true);
expect(typeof (info[i].pid)).assertEqual("number"); expect(info.length).assertEqual(5);
expect(info[i].pid).assertLarger(0); for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(typeof (info[i].processName)).assertEqual("string"); expect(info[i].pid).assertLarger(0);
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].pkgList)).assertEqual(true); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].pkgList.length).assertEqual(0); expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(typeof (info[i].uid)).assertEqual("number"); expect(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].uid).assertLarger(0); expect(info[i].pkgList.length).assertEqual(0);
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number"); expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1); expect(info[i].uid).assertLarger(0);
expect(typeof (info[i].weight)).assertEqual("number"); expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].weight).assertEqual(-1); expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof (info[i].weightReasonCode)).assertEqual("number"); expect(typeof (info[i].weight)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); expect(info[i].weight).assertEqual(-1);
}
done();
}, 5000);
expect(typeof (info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -210,6 +224,7 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -210,6 +224,7 @@ describe('ActsAmsTestThirdScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -218,7 +233,7 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -218,7 +233,7 @@ describe('ActsAmsTestThirdScene', function () {
* @tc.desc : Query Recent Ability Mission Infos(by Promise) * @tc.desc : Query Recent Ability Mission Infos(by Promise)
*/ */
it('Acts_Ams_test_3700', 0, async function (done) { it('Acts_Ams_test_3700', 0, async function (done) {
var maxnum = 20, flag = 1; var maxnum = 20, flag = 2;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag); var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info('Acts_Ams_test_3700 queryRecentAbilityMissionInfos data ' + JSON.stringify(data)); console.info('Acts_Ams_test_3700 queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true); expect(Array.isArray(data)).assertEqual(true);
...@@ -251,6 +266,7 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -251,6 +266,7 @@ describe('ActsAmsTestThirdScene', function () {
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
} }
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -265,6 +281,7 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -265,6 +281,7 @@ describe('ActsAmsTestThirdScene', function () {
console.info('Acts_Ams_test_3900 removeMission data [' + info + ']'); console.info('Acts_Ams_test_3900 removeMission data [' + info + ']');
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -279,6 +296,7 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -279,6 +296,7 @@ describe('ActsAmsTestThirdScene', function () {
console.info('Acts_Ams_test_4300 moveMissionToTop data [' + info + ']'); console.info('Acts_Ams_test_4300 moveMissionToTop data [' + info + ']');
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -291,20 +309,9 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -291,20 +309,9 @@ describe('ActsAmsTestThirdScene', function () {
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMissions([result[0].id]); var info = await abilitymanager.removeMissions([result[0].id]);
console.info('Acts_Ams_test_4500 removeMissions data [' + info + ']'); console.info('Acts_Ams_test_4500 removeMissions data [' + info + ']');
expect(info).assertLarger(0); expect(info).assertEqual(0);
done();
})
/*
* @tc.number : Acts_Ams_test_4100
* @tc.name : clearMissions: Clear Missions
* @tc.desc : Clear Missions(by Promise)
*/
it('Acts_Ams_test_4100', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('Acts_Ams_test_4100 clearMissions data [' + info + ']');
expect(info).assertLarger(0);
done(); done();
setTimeout(timeout, 5000);
}) })
/* /*
...@@ -317,6 +324,134 @@ describe('ActsAmsTestThirdScene', function () { ...@@ -317,6 +324,134 @@ describe('ActsAmsTestThirdScene', function () {
console.info('Acts_Ams_test_4700 killProcessesByBundleName data [' + info + ']'); console.info('Acts_Ams_test_4700 killProcessesByBundleName data [' + info + ']');
expect(info).assertEqual(0); expect(info).assertEqual(0);
done(); done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_8300
* @tc.name : getActiveProcessInfos : Get All Active Processes Info
* @tc.desc : Get All Active Processes Info(by Promise)
*/
it('Acts_Ams_test_8300', 0, async function (done) {
var info = await abilitymanager.getActiveProcessInfos();
console.info('Acts_Ams_test_8300 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
}
done();
setTimeout(timeout, 5000);
}) })
/*
* @tc.number : Acts_Ams_test_9300
* @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
* @tc.desc : Get Active Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_9300', 0, async function (done) {
var upperLimit = 20;
var data = await abilitymanager.getActiveAbilityMissionInfos(upperLimit);
console.info('Acts_Ams_test_9300 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_10300
* @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
* @tc.desc : Get Previous Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_10300', 0, async function (done) {
var upperLimit = 20;
var data = await abilitymanager.getPreviousAbilityMissionInfos(upperLimit);
console.info('Acts_Ams_test_10300 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(1);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
expect(typeof (data[i].bottomAbility)).assertEqual("object");
expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
expect(data[i].bottomAbility.uri.length).assertEqual(0);
expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
expect(data[i].bottomAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility.uri)).assertEqual("string");
expect(data[i].topAbility.uri.length).assertEqual(0);
expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
expect(data[i].topAbility.shortName.length).assertEqual(0);
expect(typeof (data[i].windowMode)).assertEqual("number");
expect(data[i].windowMode).assertEqual(0);
}
done();
setTimeout(timeout, 5000);
})
}) })
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ClearMissionsCallBack") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ClearMissionsCallBack"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "120000",
"package": "com.ohos.launcher",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ClearMissionsCallBack.hap",
"verifyIAbility.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.launcher",
"vendor": "example",
"version": {
"code": 1000013,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.myapplication11",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "myapplication1",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.ohos.launcherSed11.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
*/ */
require('./MangerAbilityJsunit.test.js')
require('./WantTest.js') \ No newline at end of file
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsAmsCallBackSixth Scene', function () {
console.info('----ActsAmsCallBackSixth----');
beforeAll(function () {
featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.verify.io",
abilityName: "com.example.VerifyIoThirdAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
});
/*
* @tc.number : Acts_Ams_test_12200
* @tc.name : clearMissions : Clear Missions
* @tc.desc : Clear Missions(by CallBack)
*/
it('Acts_Ams_test_12200', 0, async function (done) {
setTimeout(function (){
abilitymanager.clearMissions(
(error,info) => {
console.info('Acts_Ams_test_12200 clearMissions error.code ' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
});
done();
},5000)
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ClearMissionsPromise") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ClearMissionsPromise"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "120000",
"package": "com.ohos.launcher",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ClearMissionsPromise.hap",
"verifyIAbility.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.launcher",
"vendor": "example",
"version": {
"code": 1000013,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.myapplication111",
"name": ".MyApplication111",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "myapplication111",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.ohos.launcherSed111.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "MyApplication"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsAmsCallBackSixth Scene', function () {
console.info('----ActsAmsCallBackSixth----');
beforeAll(function() {
featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.verify.io",
abilityName: "com.example.VerifyIoThirdAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
});
/*
* @tc.number : Acts_Ams_test_12100
* @tc.name : clearMissions : Clear Missions
* @tc.desc : Clear Missions(by Promise)
*/
it('Acts_Ams_test_12100', 0, async function (done) {
setTimeout(async function(){
var info = await abilitymanager.clearMissions();
console.info('Acts_Ams_test_12100 clearMissions data [' + info + ']');
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
done();
},5000);
})
})
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
"kits": [ "kits": [
{ {
"test-file-name": [ "test-file-name": [
"ActsContextTest.hap", "DefPermission.hap",
"DefPermission.hap" "ActsContextTest.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
......
...@@ -17,140 +17,92 @@ import bundle from '@ohos.bundle' ...@@ -17,140 +17,92 @@ import bundle from '@ohos.bundle'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsContextTest', function () { describe('ActsContextTest', function () {
// @tc.number: ACTS_VerifySelfPermission_0100
// @tc.name: verifySelfPermission : Check specific permissions
// @tc.desc: Check the return type of the interface (by Promise)
it('ACTS_VerifySelfPermission_0100', 0, async function (done) {
var context = featureAbility.getContext().then(
data=> {
var promise = data.verifySelfPermission("com.example.permission");
expect(typeof(promise)).assertEqual("object");
}
).catch(error =>
console.log("getContext promise::catch : " + error)
);
expect(typeof(context)).assertEqual("object");
done();
})
// @tc.number: ACTS_VerifySelfPermission_0200
// @tc.name: verifySelfPermission : Check the status of the specified permission
// @tc.desc: Check the status of the specified permission and return the authorized status (by Promise)
it('ACTS_VerifySelfPermission_0200', 0, async function (done) {
var context = await featureAbility.getContext();
var result = await context.verifySelfPermission("com.example.permission");
expect(result).assertEqual(0);
done();
})
// @tc.number: ACTS_VerifySelfPermission_0300
// @tc.name: verifySelfPermission : Check the status of the specified permission
// @tc.desc: Check the status of the specified permission and return the unauthorized status (by Promise)
it('ACTS_VerifySelfPermission_0300', 0, async function (done) {
var context = await featureAbility.getContext();
var result = await context.verifySelfPermission("com.myability.permission.MYPERMISSION_NOT");
expect(result).assertEqual(-1);
done();
})
// @tc.number: ACTS_VerifySelfPermission_0400
// @tc.name: verifySelfPermission : Check the status of the specified permission
// @tc.desc: Check the status of the specified permission and return the authorized status (by callback)
it('ACTS_VerifySelfPermission_0400', 0, async function (done) {
var context = featureAbility.getContext(
(errContext, dataContext) => {
var info = dataContext.verifySelfPermission("com.example.permission",
(err, data) => {
expect(data).assertEqual(0);
done();
}
);
}
);
})
// @tc.number: ACTS_VerifySelfPermission_0500
// @tc.name: verifySelfPermission : Check the status of the specified permission
// @tc.desc: Check the status of the specified permission and return the unauthorized status (by callback)
it('ACTS_VerifySelfPermission_0500', 0, async function (done) {
var context = featureAbility.getContext(
(errContext, dataContext) => {
var info = dataContext.verifySelfPermission("com.myability.permission.MYPERMISSION",
(err, data) => {
console.log("ACTS_VerifySelfPermission_0500>>>data=" + data);
expect(data).assertEqual(-1);
done();
}
);
}
);
})
// @tc.number: ACTS_GetBundleName_0100 // @tc.number: ACTS_GetBundleName_0100
// @tc.name: getBundleName : Query return value type // @tc.name: getBundleName : Query return value type
// @tc.desc: The class of the test return value is made Promise // @tc.desc: The class of the test return value is made Promise
it('ACTS_GetBundleName_0100', 0, async function (done) { it('ACTS_GetBundleName_0100', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
var result = await context.getBundleName(); var result = await context.getBundleName();
expect(typeof(context)).assertEqual("object"); expect(typeof(context)).assertEqual("object");
ret = true
done(); done();
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_GetBundleName_0200 // @tc.number: ACTS_GetBundleName_0200
// @tc.name: getBundleName : Get the bundlename of the hap package // @tc.name: getBundleName : Get the bundlename of the hap package
// @tc.desc: Get the bundlename of the hap package(by promise) // @tc.desc: Get the bundlename of the hap package(by promise)
it('ACTS_GetBundleName_0200', 0, async function (done) { it('ACTS_GetBundleName_0200', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
var result = await context.getBundleName(); var result = await context.getBundleName();
expect(result).assertEqual('com.example.actscontext'); expect(result).assertEqual('com.example.actscontext');
ret = true
done(); done();
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_GetBundleName_0300 // @tc.number: ACTS_GetBundleName_0300
// @tc.name: getBundleName : Get the bundlename of the hap package // @tc.name: getBundleName : Get the bundlename of the hap package
// @tc.desc: Get the value of return is void (by callback) // @tc.desc: Get the value of return is void (by callback)
it('ACTS_GetBundleName_0300', 0, async function (done) { it('ACTS_GetBundleName_0300', 0, async function (done) {
var context = featureAbility.getContext( var ret = false
(errContext, dataContext) => { var context = featureAbility.getContext();
var info = dataContext.getBundleName( var info = context.getBundleName(
(err, data) => { (err, data) => {
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data).assertEqual('com.example.actscontext'); expect(data).assertEqual('com.example.actscontext');
ret = true
done(); done();
} })
)
}
); setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_GetBundleName_0400 // @tc.number: ACTS_GetBundleName_0400
// @tc.name: getBundleName : Get the bundlename of the hap package // @tc.name: getBundleName : Get the bundlename of the hap package
// @tc.desc: Get the bundlename of the hap package(by callback) // @tc.desc: Get the bundlename of the hap package(by callback)
it('ACTS_GetBundleName_0400', 0, async function (done) { it('ACTS_GetBundleName_0400', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
var info = context.getBundleName( var info = context.getBundleName(
(err, data) => { (err, data) => {
expect(data).assertEqual('com.example.actscontext'); expect(data).assertEqual('com.example.actscontext');
ret = true
done(); done();
} }
); );
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_GetBundleName_0500 // @tc.number: ACTS_GetBundleName_0500
// @tc.name: getBundleName : Get the bundlename of the hap package // @tc.name: getBundleName : Get the bundlename of the hap package
// @tc.desc: Wrong parameters are provided, and the test return type is void (by callback) // @tc.desc: Wrong parameters are provided, and the test return type is void (by callback)
it('ACTS_GetBundleName_0500', 0, async function (done) { it('ACTS_GetBundleName_0500', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
var info = context.getBundleName("error_param", var info = context.getBundleName("error_param",
(err, data) => { (err, data) => {
expect(data).assertEqual('com.example.actscontext'); expect(data).assertEqual('com.example.actscontext');
done();
} }
); );
expect(info).assertEqual(null); expect(info).assertEqual(null);
ret = true
done(); done();
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_VerifyPermission_0100 // @tc.number: ACTS_VerifyPermission_0100
...@@ -159,13 +111,23 @@ describe('ActsContextTest', function () { ...@@ -159,13 +111,23 @@ describe('ActsContextTest', function () {
// @tc.desc: Query whether the application of the specified PID and UID has been granted // @tc.desc: Query whether the application of the specified PID and UID has been granted
// a certain permission (by callback) // a certain permission (by callback)
it('ACTS_VerifyPermission_0100', 0, async function (done) { it('ACTS_VerifyPermission_0100', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
var datainfo = await bundle.getBundleInfo('com.example.actscontext',1); var datainfo = await bundle.getBundleInfo('com.example.actscontext',1);
var result = context.verifyPermission("com.example.permission",0,datainfo.uid, var options = {
pid :0,
uid :datainfo.uid
}
context.verifyPermission("com.example.permission",options,
(err, data) => { (err, data) => {
console.info("ACTS_VerifyPermission_0100 in verifyPermission")
expect(data).assertEqual(0); expect(data).assertEqual(0);
ret = true
done(); done();
}); });
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_VerifyPermission_0200 // @tc.number: ACTS_VerifyPermission_0200
...@@ -174,11 +136,20 @@ describe('ActsContextTest', function () { ...@@ -174,11 +136,20 @@ describe('ActsContextTest', function () {
// @tc.desc: Query whether the application of the specified PID and UID has been granted // @tc.desc: Query whether the application of the specified PID and UID has been granted
// a certain permission (by Promise) // a certain permission (by Promise)
it('ACTS_VerifyPermission_0200', 0, async function (done) { it('ACTS_VerifyPermission_0200', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
var datainfo = await bundle.getBundleInfo('com.example.actscontext',1); var datainfo = await bundle.getBundleInfo('com.example.actscontext',1);
var promise = await context.verifyPermission("com.example.permission",0,datainfo.uid ); var options = {
pid :0,
uid :datainfo.uid
}
var promise = await context.verifyPermission("com.example.permission",options );
expect(promise).assertEqual(0); expect(promise).assertEqual(0);
ret = true
done(); done();
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_VerifyPermission_0300 // @tc.number: ACTS_VerifyPermission_0300
...@@ -187,13 +158,22 @@ describe('ActsContextTest', function () { ...@@ -187,13 +158,22 @@ describe('ActsContextTest', function () {
// @tc.desc: Query whether the application of the specified PID and UID has been granted // @tc.desc: Query whether the application of the specified PID and UID has been granted
// a certain permission (by Promise) // a certain permission (by Promise)
it('ACTS_VerifyPermission_0300', 0, async function (done) { it('ACTS_VerifyPermission_0300', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
var datainfo = await bundle.getBundleInfo('com.example.actscontext',1); var datainfo = await bundle.getBundleInfo('com.example.actscontext',1);
var result = context.verifyPermission("com.example.permission.NOT",0,datainfo.uid, var options = {
pid :0,
uid :datainfo.uid
}
var result = context.verifyPermission("com.example.permission.NOT",options,
(err, data) => { (err, data) => {
expect(data).assertEqual(-1); expect(data).assertEqual(-1);
ret = true
done(); done();
}); });
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_VerifyPermission_0400 // @tc.number: ACTS_VerifyPermission_0400
...@@ -202,11 +182,20 @@ describe('ActsContextTest', function () { ...@@ -202,11 +182,20 @@ describe('ActsContextTest', function () {
// @tc.desc: Query whether the application of the specified PID and UID has been granted // @tc.desc: Query whether the application of the specified PID and UID has been granted
// a certain permission (by Promise) // a certain permission (by Promise)
it('ACTS_VerifyPermission_0400', 0, async function (done) { it('ACTS_VerifyPermission_0400', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
var datainfo = await bundle.getBundleInfo('com.example.actscontext',1); var datainfo = await bundle.getBundleInfo('com.example.actscontext',1);
var promise = await context.verifyPermission("ohos.permission.CAMERA.NOT",0,datainfo.uid ); var options = {
pid :0,
uid :datainfo.uid
}
var promise = await context.verifyPermission("ohos.permission.CAMERA.NOT",options );
expect(promise).assertEqual(-1); expect(promise).assertEqual(-1);
ret = true
done(); done();
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_VerifyPermission_0500 // @tc.number: ACTS_VerifyPermission_0500
...@@ -215,117 +204,45 @@ describe('ActsContextTest', function () { ...@@ -215,117 +204,45 @@ describe('ActsContextTest', function () {
// @tc.desc: Query whether the application of the specified PID and UID has been granted // @tc.desc: Query whether the application of the specified PID and UID has been granted
// a certain permission (by Promise) // a certain permission (by Promise)
it('ACTS_VerifyPermission_0500', 0, async function (done) { it('ACTS_VerifyPermission_0500', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
var datainfo = await bundle.getBundleInfo('com.example.actscontext',1); var datainfo = await bundle.getBundleInfo('com.example.actscontext',1);
var promise = await context.verifyPermission(2000,0,datainfo.uid ); var options = {
pid :0,
uid :datainfo.uid
}
var promise = await context.verifyPermission(2000,options );
expect(promise).assertEqual(null); expect(promise).assertEqual(null);
ret = true
done(); done();
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
// @tc.number: ACTS_CanRequestPermission_0100
// @tc.name: CanRequestPermission : Whether to request the camera function permission to
// the authorization management module to have the permission
// @tc.desc: Whether to request the camera function permission to the authorization management
// module to have the permission (by CallBack)
it('ACTS_CanRequestPermission_0100', 0, async function (done) {
var context = await featureAbility.getContext();
var result = context.canRequestPermission("com.example.permission.user",
(err, data) => {
expect(data).assertEqual(true);
done();
});
})
// @tc.number: ACTS_CanRequestPermission_0200
// @tc.name: CanRequestPermission : Whether to request the camera function permission to
// the authorization management module to have the permission
// @tc.desc: Whether to request the camera function permission to the authorization management
// module to have the permission (by Promise)
it('ACTS_CanRequestPermission_0200', 0, async function (done){
var context = await featureAbility.getContext();
var promise = await context.canRequestPermission("com.example.permission.user");
expect(promise).assertEqual(true);
done();
})
// @tc.number: ACTS_CanRequestPermission_0300
// @tc.name: CanRequestPermission : Whether to request the camera function permission to
// the authorization management module to have the permission
// @tc.desc: Whether to request the camera function permission to the authorization management
// module to have the permission (by CallBack)
it('ACTS_CanRequestPermission_0300', 0, async function (done) {
var context = await featureAbility.getContext();
var result = context.canRequestPermission("com.example.permission",
(err, data) => {
expect(data).assertEqual(false);
done();
});
})
// @tc.number: ACTS_CanRequestPermission_0400
// @tc.name: CanRequestPermission : Whether to request the camera function permission to
// the authorization management module to have the permission
// @tc.desc: Whether to request the camera function permission to the authorization management
// module to have the permission (by Promise)
it('ACTS_CanRequestPermission_0400', 0, async function (done){
var context = await featureAbility.getContext();
var promise = await context.canRequestPermission("com.example.permission");
expect(promise).assertEqual(false);
done();
})
// @tc.number: ACTS_CanRequestPermission_0500
// @tc.name: CanRequestPermission : Whether to request the camera function permission to
// the authorization management module to have the permission
// @tc.desc: Whether to request the camera function permission to the authorization management
// module to have the permission (by Promise)
it('ACTS_CanRequestPermission_0500', 0, async function (done){
var context = await featureAbility.getContext();
var promise = await context.canRequestPermission(1000);
expect(promise).assertEqual(null);
done();
})
// @tc.number: ACTS_VerifyCallingPermission_0100
// @tc.name: verifyCallingPermission : Checks whether the calling process for inter-process communication has the given
// permission.The calling process is not the current process.
// @tc.desc: Checks whether the calling process for inter-process communication has the given permission.The calling
// process is not the current process. (by callback)
it('ACTS_Calling_0100', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:{
deviceId: "",
bundleName: "com.example.actscontextcallingtest",
abilityName: "com.example.actscontextcallingtest.MainAbility"
}
});
done();
})
// @tc.number: ACTS_RequestPermissionForUser_0100 // @tc.number: ACTS_RequestPermissionForUser_0100
// @tc.name: requestPermissionsFromUser : Requests certain permissions from the system. // @tc.name: requestPermissionsFromUser : Requests certain permissions from the system.
// permission: The list of permissions to be requested. // permission: The list of permissions to be requested.
// @tc.desc: Requests certain permissions from the system. // @tc.desc: Requests certain permissions from the system.
// process is the current process. (by callback) // process is the current process. (by callback)
it('ACTS_RequestPermissionForUser_0100', 0, async function (done) { it('ACTS_RequestPermissionForUser_0100', 0, async function (done) {
var ret = false
var context = await featureAbility.getContext(); var context = await featureAbility.getContext();
console.log("RequestPermissionForUser ----------1"); console.log("RequestPermissionForUser ----------1");
context.requestPermissionsFromUser(["com.example.permission1", "com.example.permission2", "com.example.permission3", context.requestPermissionsFromUser([], 1,
"com.example.permission4", "com.example.permission5"], 1,
(err, data)=>{ (err, data)=>{
console.log("RequestPermissionForUser ----------2 requestCode=" + data.requestCode); console.log("====>requestdata====>" + JSON.stringify(data));
for(var j = 0; j < data.permissions.length; j++) { console.log("====>requesterrcode====>" + JSON.stringify(err.code));
console.log("====RequestPermissionForUser permissions : " + data.permissions[j]); expect(err.code).assertEqual(-104)
}
for(var j = 0; j < data.grantResults.length; j++) {
console.log("====RequestPermissionForUser grantResults : " + data.grantResults[j]);
}
}); });
console.log("RequestPermissionForUser ----------3"); console.log("RequestPermissionForUser ----------2");
ret = true
done(); done();
setTimeout(function(){
expect(ret).assertEqual(true)
},1000)
}) })
}) })
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -25,7 +25,12 @@ ...@@ -25,7 +25,12 @@
"StartAbilityForResult.hap->/data/StartAbilityForResult.hap", "StartAbilityForResult.hap->/data/StartAbilityForResult.hap",
"TerminateAbilityTest.hap->/data/TerminateAbilityTest.hap" "TerminateAbilityTest.hap->/data/TerminateAbilityTest.hap"
] ]
},
} {
"type": "ShellKit",
"run-command": [
"chmod 644 /data/*.hap"
]
}
] ]
} }
...@@ -1126,8 +1126,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1126,8 +1126,7 @@ describe('ActsFeatureAbilityTest', function () {
bundleName: "com.example.startabilityforresult", bundleName: "com.example.startabilityforresult",
abilityName: "com.example.startabilityforresult.MainAbility", abilityName: "com.example.startabilityforresult.MainAbility",
uri: "" uri: ""
}, }
requestCode: 2,
}, },
(error, result) => { (error, result) => {
console.log('featureAbilityTest ACTS_StartAbilityForResult_0400 first asyncCallback ' + console.log('featureAbilityTest ACTS_StartAbilityForResult_0400 first asyncCallback ' +
...@@ -1645,33 +1644,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1645,33 +1644,6 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_FinishWithResult_0200', 0, async function (done) { it('ACTS_FinishWithResult_0200', 0, async function (done) {
var Subscriber;
let id;
function SubscribeCallBack(err, data) {
clearTimeout(id);
expect(data.event).assertEqual("ACTS_FinishWithResult_0200_CommonEvent");
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
}
commonEvent.createSubscriber(subscriberInfo_ACTS_FinishWithResult_0200).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
})
function UnSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
}
function timeout() {
expect().assertFail();
console.debug('ACTS_FinishWithResult_0200=====timeout======');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = await featureAbility.startAbilityForResult( var promise = await featureAbility.startAbilityForResult(
{ {
want: want:
...@@ -1719,7 +1691,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1719,7 +1691,7 @@ describe('ActsFeatureAbilityTest', function () {
done(); done();
setTimeout(function () { setTimeout(function () {
console.info('====> ACTS_FinishWithResult_0200 =====>') console.info('====> ACTS_FinishWithResult_0200 =====>')
}, TIMEOUTFORRESULT) }, 10000)
}) })
/** /**
...@@ -1729,34 +1701,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1729,34 +1701,6 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_FinishWithResult_0300', 0, async function (done) { it('ACTS_FinishWithResult_0300', 0, async function (done) {
var Subscriber;
let id;
function SubscribeCallBack(err, data) {
clearTimeout(id);
expect(data.event).assertEqual("ACTS_FinishWithResult_0300_CommonEvent");
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
}
commonEvent.createSubscriber(subscriberInfo_ACTS_FinishWithResult_0300).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
})
function UnSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
}
function timeout() {
expect().assertFail();
console.debug('ACTS_FinishWithResult_0300=====timeout======');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = await featureAbility.startAbilityForResult( var promise = await featureAbility.startAbilityForResult(
{ {
want: want:
...@@ -1875,7 +1819,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1875,7 +1819,6 @@ describe('ActsFeatureAbilityTest', function () {
console.log("info.moduleInfos[" + j + "].moduleName : " + info.moduleInfos[j].moduleName); console.log("info.moduleInfos[" + j + "].moduleName : " + info.moduleInfos[j].moduleName);
console.log("info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir); console.log("info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir);
} }
console.log("flags : " + info.flags);
console.log("entryDir : " + info.entryDir); console.log("entryDir : " + info.entryDir);
expect(typeof (info)).assertEqual("object"); expect(typeof (info)).assertEqual("object");
...@@ -1893,7 +1836,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1893,7 +1836,6 @@ describe('ActsFeatureAbilityTest', function () {
expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true); expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
expect(Array.isArray(info.permissions)).assertEqual(true); expect(Array.isArray(info.permissions)).assertEqual(true);
expect(Array.isArray(info.moduleInfos)).assertEqual(true); expect(Array.isArray(info.moduleInfos)).assertEqual(true);
expect(typeof (info.flags)).assertEqual("number");
expect(typeof (info.entryDir)).assertEqual("string"); expect(typeof (info.entryDir)).assertEqual("string");
expect(info.name).assertEqual("com.example.actsfeatureabilitytest"); expect(info.name).assertEqual("com.example.actsfeatureabilitytest");
...@@ -1913,7 +1855,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1913,7 +1855,6 @@ describe('ActsFeatureAbilityTest', function () {
expect(info.moduleInfos[0].moduleName).assertEqual("entry"); expect(info.moduleInfos[0].moduleName).assertEqual("entry");
expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/accounts/account_0/applications/" + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/accounts/account_0/applications/" +
"com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest");
expect(info.flags).assertEqual(0);
expect(info.entryDir).assertEqual("/data/accounts/account_0/applications/" + expect(info.entryDir).assertEqual("/data/accounts/account_0/applications/" +
"com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest");
} }
...@@ -1924,9 +1865,10 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1924,9 +1865,10 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by Promise) * @tc.desc: Check the return type of the interface (by Promise)
*/ */
it('ACTS_GetApplicationInfo_0100', 0, async function (done) { it('ACTS_GetApplicationInfo_0100', 0, async function (done) {
var promise = featureAbility.getApplicationInfo(); var context = featureAbility.getContext();
var promise = context.getApplicationInfo();
expect(typeof (promise)).assertEqual("object"); expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.getApplicationInfo(); var info = await context.getApplicationInfo();
checkApplicationInfo(info); checkApplicationInfo(info);
done(); done();
setTimeout(function () { setTimeout(function () {
...@@ -1940,7 +1882,8 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1940,7 +1882,8 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_GetApplicationInfo_0200', 0, async function (done) { it('ACTS_GetApplicationInfo_0200', 0, async function (done) {
var result = featureAbility.getApplicationInfo( var context = featureAbility.getContext()
var result = context.getApplicationInfo(
(err, data) => { (err, data) => {
checkApplicationInfo(data); checkApplicationInfo(data);
done() done()
...@@ -1969,9 +1912,10 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1969,9 +1912,10 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by promise) * @tc.desc: Check the return type of the interface (by promise)
*/ */
it('ACTS_GetProcessInfo_0100', 0, async function (done) { it('ACTS_GetProcessInfo_0100', 0, async function (done) {
var promise = featureAbility.getProcessInfo(); var context = featureAbility.getContext()
var promise = context.getProcessInfo();
expect(typeof (promise)).assertEqual("object"); expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.getProcessInfo(); var info = await context.getProcessInfo();
checkProcessInfo(info); checkProcessInfo(info);
done(); done();
setTimeout(function () { setTimeout(function () {
...@@ -1985,7 +1929,8 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1985,7 +1929,8 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by AsyncCallback) * @tc.desc: Check the return type of the interface (by AsyncCallback)
*/ */
it('ACTS_GetProcessInfo_0200', 0, async function (done) { it('ACTS_GetProcessInfo_0200', 0, async function (done) {
var result = featureAbility.getProcessInfo( var context = featureAbility.getContext()
var result = context.getProcessInfo(
(err, data) => { (err, data) => {
checkProcessInfo(data); checkProcessInfo(data);
done() done()
...@@ -2025,9 +1970,10 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2025,9 +1970,10 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_GetElementName_0100', 0, async function (done) { it('ACTS_GetElementName_0100', 0, async function (done) {
var promise = featureAbility.getElementName(); var context = featureAbility.getContext()
var promise = context.getElementName();
expect(typeof (promise)).assertEqual("object"); expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.getElementName(); var info = await context.getElementName();
checkElementName(info); checkElementName(info);
done(); done();
setTimeout(function () { setTimeout(function () {
...@@ -2041,7 +1987,8 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2041,7 +1987,8 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_GetElementName_0200', 0, async function (done) { it('ACTS_GetElementName_0200', 0, async function (done) {
var result = featureAbility.getElementName( var context = featureAbility.getContext()
var result = context.getElementName(
(err, data) => { (err, data) => {
checkElementName(data); checkElementName(data);
done() done()
...@@ -2347,9 +2294,10 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2347,9 +2294,10 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_GetProcessName_0100', 0, async function (done) { it('ACTS_GetProcessName_0100', 0, async function (done) {
var promise = featureAbility.getProcessName(); var context = featureAbility.getContext();
var promise = context.getProcessName();
expect(typeof (promise)).assertEqual("object"); expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.getProcessName(); var info = await context.getProcessName();
checkProcessName(info); checkProcessName(info);
done(); done();
setTimeout(function () { setTimeout(function () {
...@@ -2363,7 +2311,8 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2363,7 +2311,8 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_GetProcessName_0200', 0, async function (done) { it('ACTS_GetProcessName_0200', 0, async function (done) {
var result = featureAbility.getProcessName( var context = featureAbility.getContext();
var result = context.getProcessName(
(err, data) => { (err, data) => {
checkProcessName(data); checkProcessName(data);
done() done()
...@@ -2386,8 +2335,20 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2386,8 +2335,20 @@ describe('ActsFeatureAbilityTest', function () {
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
clearTimeout(id); clearTimeout(id);
events.set(data.event, 0) if (typeof data.event != 'undefined') {
events.set(data.event, 0)
}
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
if (events.size == 1) {
expect(events.has("ACTS_GetCallingBundle_0100_CommonEvent") ||
events.has("com.example.actsfeatureabilitytest.promise") ||
events.has("com.example.actsfeatureabilitytest.callback")).assertTrue();
} else if (events.size == 2) {
expect(events.has("com.example.actsfeatureabilitytest.promise") ||
events.has("com.example.actsfeatureabilitytest.callback")).assertTrue();
} else if (events.size == 3) {
checkResult();
}
} }
commonEvent.createSubscriber(subscriberInfo_ACTS_GetCallingBundle_0100).then(async (data) => { commonEvent.createSubscriber(subscriberInfo_ACTS_GetCallingBundle_0100).then(async (data) => {
...@@ -2416,7 +2377,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2416,7 +2377,6 @@ describe('ActsFeatureAbilityTest', function () {
done(); done();
} }
setTimeout(checkResult, TERMINATE_ABILITY_TIMEOUT);
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
// startAbility // startAbility
var result = await featureAbility.startAbility( var result = await featureAbility.startAbility(
...@@ -2429,8 +2389,43 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2429,8 +2389,43 @@ describe('ActsFeatureAbilityTest', function () {
} }
); );
expect(result).assertEqual(0); expect(result).assertEqual(0);
setTimeout(timeout, TIMEOUTFORRESULT)
})
// checkGetOrCreateLocalDir
function checkGetOrCreateLocalDir(info) {
console.log("checkGetOrCreateLocalDir root dir : " + info);
expect(typeof (info)).assertEqual("string");
}
// @tc.number: ACTS_GetOrCreateLocalDir_0100
// @tc.name: GetProcessName : Obtains the name of the current process.
// @tc.desc: Check the return value of the interface (by promise)
it('ACTS_GetOrCreateLocalDir_0100', 0, async function (done) {
var context = featureAbility.getContext();
var promise = context.getOrCreateLocalDir();
expect(typeof (promise)).assertEqual("object");
var info = await context.getOrCreateLocalDir();
checkGetOrCreateLocalDir(info);
done();
setTimeout(function () { setTimeout(function () {
console.info('====> ACTS_GetCallingBundle_0100 =====>') console.info('====> ACTS_GetOrCreateLocalDir_0100 =====>')
}, TIMEOUTFORRESULT) }, TIMEOUT)
})
// @tc.number: ACTS_GetOrCreateLocalDir_0200
// @tc.name: GetProcessName : Obtains the name of the current process.
// @tc.desc: Check the return value of the interface (by AsyncCallback)
it('ACTS_GetOrCreateLocalDir_0200', 0, async function (done) {
var context = featureAbility.getContext();
var result = context.getOrCreateLocalDir(
(err, data) => {
checkGetOrCreateLocalDir(data);
done()
}
);
setTimeout(function () {
console.info('====> ACTS_GetOrCreateLocalDir_0200 =====>')
}, TIMEOUT)
}) })
}) })
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
}, },
async onShow() { async onShow() {
commonEvent.publish("ACTS_FinishWithResult_0300_CommonEvent", PublishCallBackOne); commonEvent.publish("ACTS_FinishWithResult_0300_CommonEvent", PublishCallBackOne);
var promise = await featureAbility.finishWithResult( var promise = await featureAbility.terminateSelfWithResult(
{ {
resultCode: 1, resultCode: 1,
want: want:
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
}, },
async onShow() { async onShow() {
commonevent.publish("ACTS_FinishWithResult_0100_CommonEvent", PublishCallBack); commonevent.publish("ACTS_FinishWithResult_0100_CommonEvent", PublishCallBack);
var promise = await featureAbility.finishWithResult( var promise = await featureAbility.terminateSelfWithResult(
{ {
resultCode: 1, resultCode: 1,
want: want:
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
}, },
async onShow() { async onShow() {
commonEvent.publish("ACTS_FinishWithResult_0200_CommonEvent", PublishCallBack); commonEvent.publish("ACTS_FinishWithResult_0200_CommonEvent", PublishCallBack);
var promise = await featureAbility.finishWithResult( var promise = await featureAbility.terminateSelfWithResult(
{ {
resultCode: 1, resultCode: 1,
want: want:
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -36,9 +36,10 @@ export default { ...@@ -36,9 +36,10 @@ export default {
}, },
async onShow() { async onShow() {
commonEvent.publish("ACTS_GetCallingBundle_0100_CommonEvent", PublishCallBackOne); commonEvent.publish("ACTS_GetCallingBundle_0100_CommonEvent", PublishCallBackOne);
var info = await featureAbility.getCallingBundle(); var context = featureAbility.getContext();
var info = await context.getCallingBundle();
commonEvent.publish(info + ".promise", PublishCallBackTwo); commonEvent.publish(info + ".promise", PublishCallBackTwo);
featureAbility.getCallingBundle( context.getCallingBundle(
(err, data) => { (err, data) => {
console.debug("getCallingBundle : " + data) console.debug("getCallingBundle : " + data)
commonEvent.publish(data + ".callback", PublishCallBackThree); commonEvent.publish(data + ".callback", PublishCallBackThree);
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
commonEvent.publish("ACTS_StartAbilityForResult_0400_CommonEvent", PublishCallBackfour); commonEvent.publish("ACTS_StartAbilityForResult_0400_CommonEvent", PublishCallBackfour);
commonEvent.publish("ACTS_StartAbilityForResult_0500_CommonEvent", PublishCallBackfive); commonEvent.publish("ACTS_StartAbilityForResult_0500_CommonEvent", PublishCallBackfive);
commonEvent.publish("ACTS_StartAbilityForResult_0600_CommonEvent", PublishCallBacksix); commonEvent.publish("ACTS_StartAbilityForResult_0600_CommonEvent", PublishCallBacksix);
var promise = await featureAbility.finishWithResult( var promise = await featureAbility.terminateSelfWithResult(
{ {
resultCode: 1, resultCode: 1,
want: want:
......
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -18,7 +18,6 @@ group("want") { ...@@ -18,7 +18,6 @@ group("want") {
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"actsgetwantalltest:ActsGetWantAllTest", "actsgetwantalltest:ActsGetWantAllTest",
"actssetwanttest:ActsSetWantTest",
"sceneProject/actsgetwantalltesthap:ActsGetWantAllTestHap", "sceneProject/actsgetwantalltesthap:ActsGetWantAllTestHap",
] ]
} }
......
...@@ -12,14 +12,13 @@ ...@@ -12,14 +12,13 @@
* 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 commenEvent from '@ohos.commonevent'
import featureAbility from '@ohos.ability.featureability' import featureAbility from '@ohos.ability.featureability'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
import wantConstant from '@ohos.ability.wantConstant'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const installPath = "/data/ActsGetWantAllTestHap.hap" const installPath = "/data/ActsGetWantAllTestHap.hap"
describe('ActsGetWantTest', function () {
describe('ActsgetWantTest', async function () {
beforeAll(async (done) => { beforeAll(async (done) => {
console.debug('=======before all install========'); console.debug('=======before all install========');
bundle.getBundleInstaller().then(data => { bundle.getBundleInstaller().then(data => {
...@@ -62,143 +61,232 @@ describe('ActsgetWantTest', async function () { ...@@ -62,143 +61,232 @@ describe('ActsgetWantTest', async function () {
}) })
// @tc.number: ACTS_GetWant_0100 // @tc.number: ACTS_GetWant_0100
// @tc.name: getWant : get want in current ability // @tc.name: getWant : get want in current ability
// @tc.desc: get want in current ability (by Promise) // @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data
it('ACTS_GetWant_0100', 0, async function (done) { it('ACTS_GetWant_0100', 0, async function (done) {
var Subscriber; featureAbility.startAbilityForResult({
var CommonEventSubscriberInfo = { want: {
events: ["ACTS_GetWant_0100_CommonEvent"], deviceId: "",
}; bundleName: "com.example.actsgetwantalltesthap",
abilityName: "com.example.actsgetwantalltesthap.MainAbility",
action: "action1",
parameters:
{
mykey0: 1,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "str",
mykey4: [false, true, false],
mykey5: ["str", "STR", "helloopenharmony"],
},
}
},
(err, data) => {
console.info('====> ACTS_StartAbilityForResult_0100 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.action).assertEqual("action1");
expect(data.want.parameters.mykey0).assertEqual(1);
expect(data.want.parameters.mykey1[0]).assertEqual(1);
expect(data.want.parameters.mykey1[1]).assertEqual(2);
expect(data.want.parameters.mykey1[2]).assertEqual(3);
expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]");
expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
function SubscribeCallBack(err, data) { console.info('====> before done=====>')
console.debug("====>Subscriber CallBack====>"); done();
console.debug("====>Subscriber CallBack data:====>" + JSON.stringify(data)); setTimeout(function () {
expect(data.data).assertEqual("succeed"); console.info('====> ACTS_StartAbilityForResult_0100 =====>')
Subscriber.unsubscribe(Subscriber, unsubscribeCallback) }, 5000)
} console.info('====> after done=====>')
})
})
function unsubscribeCallback() {
console.debug("====>UnSubscriber CallBack====>");
}
await commenEvent.createSubscriber(CommonEventSubscriberInfo).then(async (data) => { // @tc.number: ACTS_GetWant_0200
console.debug("====>Creat Subscriber====>"); // @tc.name: getWant : get want in current ability
Subscriber = data; // @tc.desc:Start the ability through startabilityforresult,
console.debug("====>subscribe start====>"); // and then use terminateselfwithresult to return the data
await commenEvent.subscribe(Subscriber, SubscribeCallBack); it('ACTS_GetWant_0200', 0, async function (done) {
console.debug("====>subscribe finish====>"); featureAbility.startAbilityForResult({
}) want: {
console.debug("====>startAbility start====>"); deviceId: "",
var promise = await featureAbility.startAbility( bundleName: "com.example.actsgetwantalltesthap",
{ abilityName: "com.example.actsgetwantalltesthap.MainAbility",
action: "action2",
}
},
(err, data) => {
console.info('====> ACTS_StartAbilityForResult_0200 start ability=====>' + JSON.stringify(data))
expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.action).assertEqual("action2");
console.info('====> before done=====>')
done();
setTimeout(function () {
console.info('====> ACTS_StartAbilityForResult_0200 =====>')
}, 5000)
console.info('====> after done=====>')
})
})
// @tc.number: ACTS_GetWant_0200
// @tc.name: getWant : get want in current ability
// @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data
it('ACTS_GetWant_0300', 0, async function (done) {
featureAbility.startAbilityForResult({
want: want:
{ {
deviceId: "", deviceId: "",
bundleName: "com.example.actsgetwantalltest", bundleName: "com.example.actsgetwantalltesthap",
abilityName: "com.example.actsgetwantalltest.MainAbility", abilityName: "com.example.actsgetwantalltesthap.MainAbility",
action: "action1", action: "action1",
entities: ["entity1"], entities: ["entity1"],
type: "MIMETYPE", type: "MIMETYPE",
uri: "key={true,true,false}", uri: "key={true,true,false}",
options: },
{ },
authReadUriPermission: true, (err, data) => {
authWriteUriPermission: true, console.info('====> ACTS_StartAbilityForResult_0300 start ability=====>' + JSON.stringify(data))
abilityForwardResult: false, expect(data.want.deviceId).assertEqual("");
abilityContinuation: false, expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
notOhosComponent: true, expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
abilityFormEnabled: true, expect(data.want.action).assertEqual("action1");
authPersistableUriPermission: true, expect(data.want.entities[0]).assertEqual("entity1");
authPrefixUriPermission: false, expect(data.want.type).assertEqual("MIMETYPE");
abilitySliceMultiDevice: false, expect(data.want.uri).assertEqual("key={true,true,false}");
startForegroundAbility: true, console.info('====> before done=====>')
installOnDemand: false, done();
abilitySliceForwardResult: true, setTimeout(function () {
installWithBackgroundMode: true, console.info('====> ACTS_StartAbilityForResult_0300 =====>')
}, }, 5000)
console.info('====> after done=====>')
})
})
// @tc.number: ACTS_GetWant_0400
// @tc.name: getWant : get want in current ability
// @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data
it('ACTS_GetWant_0400', 0, async function (done) {
featureAbility.startAbilityForResult({
want:
{
deviceId: "",
bundleName: "com.example.actsgetwantalltesthap",
abilityName: "com.example.actsgetwantalltesthap.MainAbility",
action: "action2",
entities: ["entity1","entity2"],
type: "MIMETYPE",
uri: "key={true,true,false}",
flags:wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT,
parameters: parameters:
{ {
mykey0: 2222, mykey0: 0.1,
mykey1: [1, 2, 3], mykey1: [0.1, 0.2, 0.3],
mykey2: "[1, 2, 3]", mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss", mykey3: "str",
mykey4: [false, true, false], mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], mykey5: ["str", "!@#$%", "helloopenharmony"],
}, },
}, },
}, },
); (err, data) => {
console.debug("====>startAbility finish====>"); console.info('====> ACTS_StartAbilityForResult_0400 start ability=====>' + JSON.stringify(data))
done(); expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.action).assertEqual("action2");
expect(data.want.entities[0]).assertEqual("entity1");
expect(data.want.entities[1]).assertEqual("entity2");
expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT);
expect(data.want.parameters.mykey0).assertEqual(0.1);
expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.parameters.mykey1[2]).assertEqual(0.3);
expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]");
expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey5[1]).assertEqual("!@#$%");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
console.info('====> before done=====>')
done();
setTimeout(function () {
console.info('====> ACTS_StartAbilityForResult_0400 =====>')
}, 5000)
console.info('====> after done=====>')
})
}) })
// @tc.number: ACTS_GetWant_0200
// @tc.name: getWant : get want in current ability
// @tc.desc: get want in current ability (by callback)
it('ACTS_GetWant_0200', 0, async function (done) {
var Subscriber;
var CommonEventSubscriberInfo = {
events: ["ACTS_GetWant_0200_CommonEvent"],
};
function SubscribeCallBack(err, data) {
console.debug("====>Subscriber CallBack====>");
console.debug("====>Subscriber CallBack data:====>" + JSON.stringify(data));
expect(data.data).assertEqual("succeed");
Subscriber.unsubscribe(Subscriber, unsubscribeCallback)
}
function unsubscribeCallback() {
console.debug("====>UnSubscriber CallBack====>");
}
await commenEvent.createSubscriber(CommonEventSubscriberInfo).then(async (data) => { // @tc.number: ACTS_GetWant_0500
console.debug("====>Creat Subscriber====>"); // @tc.name: getWant : get want in current ability
Subscriber = data; // @tc.desc:Start the ability through startabilityforresult,
console.debug("====>subscribe start====>"); // and then use terminateselfwithresult to return the data
await commenEvent.subscribe(Subscriber, SubscribeCallBack); it('ACTS_GetWant_0500', 0, async function (done) {
console.debug("====>subscribe finish====>"); featureAbility.startAbilityForResult({
})
console.debug("====>startAbility start====>");
var promise = await featureAbility.startAbility(
{
want: want:
{ {
deviceId: "", deviceId: "",
bundleName: "com.example.actsgetwantalltest", bundleName: "com.example.actsgetwantalltesthap",
abilityName: "com.example.actsgetwantalltest.MainAbility", abilityName: "com.example.actsgetwantalltesthap.MainAbility",
action: "action1", action: "action1",
entities: ["entity1"], entities: ["entity1"],
type: "MIMETYPE", type: "MIMETYPE",
uri: "key={true,true,false}", uri: "key={true,true,false}",
options: flags:wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED,
{
authReadUriPermission: true,
authWriteUriPermission: true,
abilityForwardResult: false,
abilityContinuation: false,
notOhosComponent: true,
abilityFormEnabled: true,
authPersistableUriPermission: true,
authPrefixUriPermission: false,
abilitySliceMultiDevice: false,
startForegroundAbility: true,
installOnDemand: false,
abilitySliceForwardResult: true,
installWithBackgroundMode: true,
},
parameters: parameters:
{ {
mykey0: 2222, mykey0: 0.1,
mykey1: [1, 2, 3], mykey1: [0.1, 0.2, 0.0000000003],
mykey2: "[1, 2, 3]", mykey2: "[a, b, c]",
mykey3: "ssssssssssssssssssssssssss", mykey3: "str",
mykey4: [false, true, false], mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
}, },
}, },
}, },
); (err, data) => {
console.debug("====>startAbility finish====>"); console.info('====> ACTS_StartAbilityForResult_0500 start ability=====>' + JSON.stringify(data))
done(); expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.action).assertEqual("action1");
expect(data.want.entities[0]).assertEqual("entity1");
expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED);
expect(data.want.parameters.mykey0).assertEqual(0.1);
expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> before done=====>')
done();
setTimeout(function () {
console.info('====> ACTS_StartAbilityForResult_0500 =====>')
}, 5000)
console.info('====> after done=====>')
})
}) })
}) })
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsSetWantTest', function () {
// @tc.number: ACTS_SetWant_0100
// @tc.name: startAbility
// @tc.desc: Check the return value of the interface (by Promise)
it('ACTS_SetWant_0100', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsgetwantalltest",
abilityName: "com.example.actsgetwantalltest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{
authReadUriPermission: true,
// indicates the grant to perform write operations on the URI
authWriteUriPermission: true,
// support forward intent result to origin ability
abilityForwardResult: false,
// used for marking the ability start-up is triggered by continuation
abilityContinuation: false,
// specifies whether a component does not belong to ohos
notOhosComponent: true,
// specifies whether an ability is started
abilityFormEnabled: true,
// indicates the grant for possible persisting on the URI.
authPersistableUriPermission: true,
// indicates the grant for possible persisting on the URI.
authPrefixUriPermission: false,
// support distributed scheduling system start up multiple devices
abilitySliceMultiDevice: false,
// indicates that an ability using the service template is started regardless of whether the
// host application has been started.
startForegroundAbility: true,
// install the specified ability if it's not installed.
installOnDemand: false,
// return result to origin ability slice
abilitySliceForwardResult: true,
// install the specified ability with background mode if it's not installed.
installWithBackgroundMode: true,
},
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
mykey7: {
wp1: 100,
wp2: [32.221,34,324.5,44.65],
wp3: "want params test",
},
mykey8: 3.2,
},
},
},
);
done();
})
// @tc.number: ACTS_SetWant_0200
// @tc.name: startAbility
// @tc.desc: Check the return value of the interface (by Promise)
it('ACTS_SetWant_0200', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsgetwanttest",
abilityName: "com.example.actsgetwanttest.MainAbility",
action: "action1",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
},
},
},
(err, data) => {
done();
}
);
})
})
\ No newline at end of file
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -16,6 +16,9 @@ import("//build/ohos_var.gni") ...@@ -16,6 +16,9 @@ import("//build/ohos_var.gni")
group("appexecfwk") { group("appexecfwk") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ "bundle_standard:bundle_standard" ] deps = [
"ams_standard:ams_standard",
"bundle_standard:bundle_standard",
]
} }
} }
...@@ -17,8 +17,14 @@ group("ams_standard") { ...@@ -17,8 +17,14 @@ group("ams_standard") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"amszipfileunzipfilest:amsZipfileUnzipfileST", "amsdatauriutils:amsDataUriUtils",
"fwkdataaccessor:FWKDataAccessor", #"amszipfileunzipfilest:amsZipfileUnzipfileST",
#"fwkdataaccessor:FWKDataAccessor",
#"serviceability/actsparticleabilitytest:ActsParticleAbilityTest",
#"serviceability/sceneProject/particlestartability:ParticleStartAbility",
#"serviceability/sceneProject/particletestserver:ParticleTestServer",
"serviceability/stserviceabilityclient:amsStServiceAbilityClient",
"serviceability/stserviceabilityserver:amsStServiceAilityServer",
] ]
} }
} }
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsSetWantTest") { ohos_js_hap_suite("amsDataUriUtils") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./entry/src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsSetWantTest" hap_name = "amsDataUriUtils"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" source_dir = "./entry/src/main/js/default"
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "JSUnitTest",
"test-timeout": "40000", "test-timeout": "180000",
"package": "com.example.actssetwanttest", "package": "com.amsst.amsdatauriutils",
"shell-timeout": "60000" "shell-timeout": "60000"
}, },
"kits": [ "kits": [
{ {
"test-file-name": [ "test-file-name": [
"ActsSetWantTest.hap" "amsDataUriUtils.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
......
{
"app": {
"bundleName": "com.amsst.amsdatauriutils",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.amsdatauriutils",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.amsst.amsdatauriutils.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
.titleST {
font-size: 32px;
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STDataUriUtils
</text>
</div>
{
"string": [
{
"name": "app_name",
"value": "DataUriUtils"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./DataUriUtilsJsSt.test.js')
\ No newline at end of file
<div class="container"> <div class="container">
<text class="title"> <text class="title">
测试zlib-0906-test 测试zlib-1515-test
{{ $t('strings.hello') }} {{ title }} {{ $t('strings.hello') }} {{ title }}
</text> </text>
</div> </div>
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册