提交 12cab440 编写于 作者: M mingxihua

IssueNo:#I4XB8A: 元能力适配新任务栈xts测试用例修改

Description: 元能力适配新任务栈xts测试用例修改
Sig:SIG_ApplicationFramework
Feature or Bugfix:Bugfix
Binary Source:No
Signed-off-by: Nmingxihua <mingxihua@huawei.com>
上级 dc7cf1a5
......@@ -61,6 +61,10 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
}
],
"js": [
......
......@@ -61,6 +61,14 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
},
{
"name":"ohos.permission.GET_RUNNING_INFO",
"reason":"need use ohos.permission.GET_RUNNING_INFO"
}
],
"js": [
......
......@@ -61,6 +61,14 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
},
{
"name":"ohos.permission.GET_RUNNING_INFO",
"reason":"need use ohos.permission.GET_RUNNING_INFO"
}
],
"js": [
......
......@@ -262,7 +262,7 @@ describe('ActsAmsCallBackFourthScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it('Acts_Ams_test_6400', 0, async function (done) {
missionManager.killProcessesByBundleName('xxxxxxxxx',
appManager.killProcessesByBundleName('xxxxxxxxx',
(error, info) => {
console.info('Acts_Ams_test_6400 killProcessesByBundleName error.code \
' + error.code + ',data [' + info + ']');
......
......@@ -61,6 +61,14 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
},
{
"name":"ohos.permission.GET_RUNNING_INFO",
"reason":"need use ohos.permission.GET_RUNNING_INFO"
}
],
"js": [
......
......@@ -218,16 +218,16 @@ describe('ActsAmsCallBackSecondScene', function () {
})
/*
* @tc.number : Acts_Ams_test_3200
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
* @tc.number : Acts_Ams_test_3200
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it('Acts_Ams_test_3200', 0, async function (done) {
appManager.killProcessesByBundleName('XXXXXXXXXXXX',
(error, info) => {
console.info('Acts_Ams_test_3200 killProcessesByBundleName error.code: \
' + error.code + ',data [' + info + ']');
expect(info).assertEqual(2097215);
expect(error.code).assertEqual(2097215);
done();
});
setTimeout(timeout, 5000);
......
......@@ -61,6 +61,14 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
},
{
"name":"ohos.permission.GET_RUNNING_INFO",
"reason":"need use ohos.permission.GET_RUNNING_INFO"
}
],
"js": [
......
......@@ -61,6 +61,14 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
},
{
"name":"ohos.permission.GET_RUNNING_INFO",
"reason":"need use ohos.permission.GET_RUNNING_INFO"
}
],
"js": [
......
......@@ -43,13 +43,15 @@ describe('ActsAmsTestFifthScene', function () {
var data = await missionManager.getMissionInfos("", maxnum);
console.log('ActsAmsTestFifthScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
console.log("ActsAmsTestFifthScene, missionId: " + data[i].missionId)
missionManager.clearMission(data[i].missionId,
(error, info) => {
console.info('ActsAmsTestFifthScene beforeAll clearMission error.code \
' + error.code + ', want.bundleName:' + data[i].want.bundleName);
}
);
if (data[i].want.bundleName != 'com.example.actsamstestfifthscene') {
console.log("ActsAmsTestFifthScene, missionId: " + data[i].missionId)
missionManager.clearMission(data[i].missionId,
(error, info) => {
console.info('ActsAmsTestFifthScene beforeAll clearMission error.code \
' + error.code + ', want.bundleName:' + data[i].want.bundleName);
}
);
}
}
await featureAbility.startAbility(
......@@ -170,6 +172,7 @@ describe('ActsAmsTestFifthScene', function () {
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_1100', 0, async function (done) {
console.log('Acts_Ams_test_1100 begin');
var maxnum = 10;
var result = await missionManager.getMissionInfos("", maxnum).catch(err => {
console.log('Acts_Ams_test_1100 getMissionInfos failed: ' + err);
......@@ -177,9 +180,11 @@ describe('ActsAmsTestFifthScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_1100 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.moveMissionToFront(result[0].missionId);
var info = await missionManager.moveMissionToFront(result[0].missionId).catch(err => {
console.log('Acts_Ams_test_1100 moveMissionToFront failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_1100 moveMissionToFront data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......@@ -231,9 +236,11 @@ describe('ActsAmsTestFifthScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_0700 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.clearMission(result[1].missionId);
var info = await missionManager.clearMission(result[1].missionId).catch(err => {
console.log('Acts_Ams_test_0700 clearMission failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_0700 clearMission data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......
......@@ -70,6 +70,14 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
},
{
"name":"ohos.permission.GET_RUNNING_INFO",
"reason":"need use ohos.permission.GET_RUNNING_INFO"
}
],
"js": [
......
......@@ -133,9 +133,11 @@ describe('ActsAmsTestFirstScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_0100 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.moveMissionToFront(result[0].missionId);
var info = await missionManager.moveMissionToFront(result[0].missionId).catch(err => {
console.log('Acts_Ams_test_1100 moveMissionToFront failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_1100 moveMissionToFront data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......@@ -182,9 +184,11 @@ describe('ActsAmsTestFirstScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_0700 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.clearMission(result[0].missionId);
var info = await missionManager.clearMission(result[0].missionId).catch(err => {
console.log('Acts_Ams_test_0700 clearMission failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_0700 clearMission data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......@@ -202,9 +206,11 @@ describe('ActsAmsTestFirstScene', function () {
}
expect(result.length).assertEqual(1);
var missionID = result[0].missionId + 1;
var info = await missionManager.clearMission(missionID);
var info = await missionManager.clearMission(missionID).catch(err => {
console.log('Acts_Ams_test_11100 clearMission failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_11100 clearMissions data [' + info + ']');
expect(info).assertLarger(0);
done();
setTimeout(timeout, 5000);
})
......
......@@ -61,6 +61,14 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
},
{
"name":"ohos.permission.GET_RUNNING_INFO",
"reason":"need use ohos.permission.GET_RUNNING_INFO"
}
],
"js": [
......
......@@ -46,7 +46,7 @@ describe('ActsAmsTestFourthScene', function () {
console.log('ActsAmsTestFourthScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
if (data[i].want.bundleName != 'com.example.actsamstestfourthscene') {
console.log("ActsAmsTestFourthScene, missionId: " + data[i].missionId)
console.log("ActsAmsTestFourthScene, missionId: " + + JSON.stringify(data))
missionManager.clearMission(data[i].missionId,
(error, info) => {
console.info('ActsAmsTestFourthScene beforeAll clearMission error.code \
......@@ -234,9 +234,10 @@ describe('ActsAmsTestFourthScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_5500 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await abilityManager.clearMission(result[0].id);
expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0);
var info = await abilityManager.clearMission(result[0].id).catch(err => {
console.log('Acts_Ams_test_5500 clearMission failed: ' + err);
expect(err).assertEqual(0);
});
done();
setTimeout(timeout, 5000);
})
......@@ -252,9 +253,11 @@ describe('ActsAmsTestFourthScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_5900 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.moveMissionToFront(result[0].missionId);
var info = await missionManager.moveMissionToFront(result[0].missionId).catch(err => {
console.log('Acts_Ams_test_5900 moveMissionToFront failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_5900 moveMissionToFront data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......@@ -270,9 +273,11 @@ describe('ActsAmsTestFourthScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_6100 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.clearAllMissions();
var info = await missionManager.clearAllMissions().catch(err => {
console.log('Acts_Ams_test_6100 clearMissionInfos failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_6100 clearAllMissions data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......
......@@ -61,6 +61,14 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
},
{
"name":"ohos.permission.GET_RUNNING_INFO",
"reason":"need use ohos.permission.GET_RUNNING_INFO"
}
],
"js": [
......
......@@ -127,7 +127,6 @@ describe('ActsAmsTestSecondScene', function () {
sleep(5000);
console.info("sleep end");
var info = await appManager.getProcessRunningInfos();
console.info('Acts_Ams_test_1700 getProcessRunningInfos JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
......@@ -158,9 +157,11 @@ describe('ActsAmsTestSecondScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_2700 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.moveMissionToFront(result[0].missionId);
var info = await missionManager.moveMissionToFront(result[0].missionId).catch(err => {
console.log('Acts_Ams_test_2700 moveMissionToFront failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_2700 moveMissionToFront data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......@@ -173,7 +174,6 @@ describe('ActsAmsTestSecondScene', function () {
it('Acts_Ams_test_1900', 0, async function (done) {
var maxnum = 20;
var data = await missionManager.getMissionInfos("", maxnum);
console.info('Acts_Ams_test_1900 getMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(3);
for (var i = 0; i < data.length; i++) {
......@@ -208,9 +208,11 @@ describe('ActsAmsTestSecondScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_2300 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.clearMission(result[0].missionId);
var info = await missionManager.clearMission(result[0].missionId).catch(err => {
console.log('Acts_Ams_test_2300 clearMission failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_2300 clearMission data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......
......@@ -61,6 +61,14 @@
{
"name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
},
{
"name":"ohos.permission.GET_RUNNING_INFO",
"reason":"need use ohos.permission.GET_RUNNING_INFO"
}
],
"js": [
......
......@@ -190,9 +190,11 @@ describe('ActsAmsTestThirdScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_3900 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.clearMission(result[1].missionId);
var info = await missionManager.clearMission(result[1].missionId).catch(err => {
console.log('Acts_Ams_test_3900 clearMission failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_3900 clearMission data [' + info + ']');
expect(info.code).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......@@ -208,9 +210,11 @@ describe('ActsAmsTestThirdScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_4300 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.moveMissionToFront(result[0].missionId);
var info = await missionManager.moveMissionToFront(result[0].missionId).catch(err => {
console.log('Acts_Ams_test_4300 moveMissionToFront failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_4300 moveMissionToFront data [' + info + ']');
expect(info.code).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......@@ -226,9 +230,11 @@ describe('ActsAmsTestThirdScene', function () {
for (var i = 0; i < result.length; i++) {
console.info('Acts_Ams_test_4500 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
var info = await missionManager.clearMission(result[0].missionId);
var info = await missionManager.clearMission(result[0].missionId).catch(err => {
console.log('Acts_Ams_test_4500 clearMission failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_4500 clearMission data [' + info + ']');
expect(info.code).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
......
......@@ -56,6 +56,10 @@
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
}
],
"js": [
......
......@@ -54,8 +54,8 @@ describe('ActsAmsCallBackSixth Scene', function () {
missionManager.clearAllMissions(
(error,info) => {
console.info('Acts_Ams_test_12200 clearMissions error.code ' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
expect(typeof(error.code)).assertEqual("number");
expect(error.code).assertEqual(0);
});
done();
})
......
......@@ -56,6 +56,10 @@
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
}
],
"js": [
......
......@@ -51,10 +51,11 @@ describe('ActsAmsCallBackSixth Scene', function () {
* @tc.desc : Clear Missions(by Promise)
*/
it('Acts_Ams_test_12100', 0, async function (done) {
var info = await missionManager.clearAllMissions();
console.info('Acts_Ams_test_12100 clearMissions data [' + info + ']');
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
var info = await missionManager.clearAllMissions().catch(err => {
console.log('Acts_Ams_test_12100 clearAllMission failed: ' + err);
expect(err).assertEqual(0);
});
console.info('Acts_Ams_test_12100 clearAllMissions data [' + info + ']');
done();
})
})
\ No newline at end of file
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "18000",
"test-timeout": "300000",
"package": "com.amsst.amsMissionSnapshotTest",
"shell-timeout": "600000"
},
......
......@@ -55,6 +55,10 @@
{
"name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name":"ohos.permission.MANAGE_MISSIONS",
"reason":"need use ohos.permission.MANAGE_MISSIONS"
}
],
"js": [
......
......@@ -35,6 +35,7 @@ export default {
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
this.timeout = 10000
require('../../../test/List.test')
core.execute()
......
......@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import abilityManager from '@ohos.app.abilityManager'
import featureAbility from '@ohos.ability.featureAbility'
import missionManager from '@ohos.application.missionManager'
import commonEvent from '@ohos.commonEvent'
import image from '@ohos.multimedia.image'
......@@ -41,23 +41,21 @@ describe('ActsMissionSnapshotTest', function () {
/*
* @tc.number: ACTS_MissionSnapshot_0100
* @tc.name: getAbilityMissionSnapshot
* @tc.name: getMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(AsyncCallback)
*/
it('ACTS_MissionSnapshot_0100', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0100====<begin');
try {
await abilityManager.getAbilityMissionSnapshot(-1, (err, data) => {
expect(err.code).assertEqual(0);
console.debug("=ACTS_MissionSnapshot_0100 err,data=======>"
+ ("json data【") + JSON.stringify(data) + ("") + " , " + data);
expect(data.topAbility.bundleName).assertEqual("");
expect(data.topAbility.abilityName).assertEqual("");
await missionManager.getMissionSnapShot("", -1, (err, data) => {
expect(err.code).assertEqual(2097172);
console.debug("=ACTS_MissionSnapshot_0100 err.code,data=======>"
+ err.code + ("json data【") + JSON.stringify(data) + ("") + " , " + data);
console.debug('ACTS_MissionSnapshot_0100====<end')
done();
});
} catch (err) {
expect(err).assertEqual("0");
console.debug('ACTS_MissionSnapshot_0100====<end err' + err);
console.debug('ACTS_MissionSnapshot_0100====<end err');
done();
}
......@@ -65,69 +63,56 @@ describe('ActsMissionSnapshotTest', function () {
/*
* @tc.number: ACTS_MissionSnapshot_0200
* @tc.name: getAbilityMissionSnapshot
* @tc.name: getMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(AsyncCallback)
*/
it('ACTS_MissionSnapshot_0200', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0200====<begin');
var m_missionId = -1;
var m_topAbility_bundleName = "";
var m_topAbility_abilityName = "";
var m_bundleName = "";
var m_abilityName = "";
try {
var upperLimit = 10;
await abilityManager.getActiveAbilityMissionInfos(upperLimit, async (err, data) => {
await missionManager.getMissionInfos("", upperLimit, async (err, data) => {
console.debug("=ACTS_MissionSnapshot_0200 err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
console.debug('ACTS_MissionSnapshot_0200 AbilityMissionInfo data.length ====>: ' + data.length);
console.debug('ACTS_MissionSnapshot_0200 MissionInfo data.length ====>: ' + data.length);
if (!data.length) {
m_missionId = -99;
m_topAbility_bundleName = "";
m_topAbility_abilityName = "";
m_bundleName = "";
m_abilityName = "";
expect("if (!data.length) ").assertEqual("0");
console.debug('ACTS_MissionSnapshot_0200====<end 0')
done();
} else {
m_missionId = data[0].missionId;
m_topAbility_bundleName = data[0].topAbility.bundleName;
m_topAbility_abilityName = data[0].topAbility.abilityName;
m_bundleName = data[0].want.bundleName;
m_abilityName = data[0].want.abilityName;
}
console.debug("=ACTS_MissionSnapshot_0200 m_missionId====>" + m_missionId);
await abilityManager.getAbilityMissionSnapshot(m_missionId, (err, data) => {
await missionManager.getMissionSnapShot("", m_missionId, async (err, data) => {
expect(err.code).assertEqual(0);
console.debug("=ACTS_MissionSnapshot_0200 err,data=======>"
+ ("json data【") + JSON.stringify(data) + ("") + " , " + data);
expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName);
expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName);
expect(data.ability.bundleName).assertEqual(m_bundleName);
expect(data.ability.abilityName).assertEqual(m_abilityName);
console.debug("=ACTS_MissionSnapshot_0200 ====> JSON.stringify(data.snapshot)="
+ JSON.stringify(data.snapshot) + " , " + data.snapshot);
try {
data.snapshot.getPixelBytesNumber().then(function (data){
console.debug("=ACTS_MissionSnapshot_0200 ====>"
+"(data.snapshot.getPixelBytesNumber()=)" + data)
expect(data > 0).assertEqual(true);
console.debug('ACTS_MissionSnapshot_0200====<end')
done();
})
} catch (err) {
console.debug('ACTS_MissionSnapshot_0200====<end catch (err) get = ');
expect("0").assertEqual(err);
done();
}
done();
});
});
} catch (err) {
expect(err).assertEqual("0");
console.debug('ACTS_MissionSnapshot_0200====<end err')
console.debug('ACTS_MissionSnapshot_0200====<end err' + err)
done();
}
})
/*
* @tc.number: ACTS_MissionSnapshot_0300
* @tc.name: getAbilityMissionSnapshot
* @tc.name: getMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(AsyncCallback)
*/
it('ACTS_MissionSnapshot_0300', 0, async function (done) {
......@@ -155,45 +140,38 @@ describe('ActsMissionSnapshotTest', function () {
unsubscribe("subscribe", subscriber);
var m_missionId = -1;
var m_topAbility_bundleName = "";
var m_topAbility_abilityName = "";
var m_bundleName = "";
var m_abilityName = "";
var upperLimit = 10;
await abilityManager.getActiveAbilityMissionInfos(upperLimit, async (err, data) => {
await missionManager.getMissionInfos("", upperLimit, async (err, data) => {
console.debug("=ACTS_MissionSnapshot_0300 err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
console.debug('ACTS_MissionSnapshot_0300 AbilityMissionInfo data.length ====>'
console.debug('ACTS_MissionSnapshot_0300 MissionInfo data.length ====>'
+ data.length);
if (!data.length) {
m_missionId = -99;
m_topAbility_bundleName = "";
m_topAbility_abilityName = "";
m_bundleName = "";
m_abilityName = "";
expect("if (!data.length) ").assertEqual(0);
unsubscribe("if (!data.length) ", subscriber);
console.debug('ACTS_MissionSnapshot_0300====<end 0')
done();
} else {
m_missionId = data[0].missionId;
m_topAbility_bundleName = data[0].topAbility.bundleName;
m_topAbility_abilityName = data[0].topAbility.abilityName;
m_bundleName = data[0].want.bundleName;
m_abilityName = data[0].want.abilityName;
}
console.debug("=ACTS_MissionSnapshot_0300 m_missionId====>" + m_missionId);
await abilityManager.getAbilityMissionSnapshot(m_missionId, (err, data) => {
await missionManager.getMissionSnapShot("", m_missionId, async (err, data) => {
expect(err.code).assertEqual(0);
console.debug("=ACTS_MissionSnapshot_0300 then data====>"
+ ("json data 【") + JSON.stringify(data) + ("") + " , " + data);
try {
expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName);
expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName);
data.snapshot.getPixelBytesNumber().then(function (data){
console.debug("=ACTS_MissionSnapshot_0300 ====> "
+("data.snapshot.getPixelBytesNumber()=" + data))
expect(data > 0).assertEqual(true);
unsubscribe(".then() ", subscriber);
console.debug('ACTS_MissionSnapshot_0300====<end')
done();
})
expect(data.ability.bundleName).assertEqual(m_bundleName);
expect(data.ability.abilityName).assertEqual(m_abilityName);
done();
} catch (err) {
expect(err).assertEqual("0");
unsubscribe("catch (err) get ", subscriber);
......@@ -230,24 +208,22 @@ describe('ActsMissionSnapshotTest', function () {
/*
* @tc.number: ACTS_MissionSnapshot_0400
* @tc.name: getAbilityMissionSnapshot
* @tc.name: getMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(Promise)
*/
it('ACTS_MissionSnapshot_0400', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0400====<begin');
try {
abilityManager.getAbilityMissionSnapshot(-1)
missionManager.getMissionSnapShot("", -1)
.then(function (data) {
console.debug("=ACTS_MissionSnapshot_0400 then data====>"
+ ("json data 【") + JSON.stringify(data) + ("") + " , " + data);
expect(data.topAbility.bundleName).assertEqual("");
expect(data.topAbility.abilityName).assertEqual("");
console.debug('ACTS_MissionSnapshot_0400====<end');
done();
}).catch(function (err) {
console.debug("=ACTS_MissionSnapshot_0400 catch err ====>"
+ ("json err 【") + JSON.stringify(err) + (""));
expect(err).assertEqual("false");
expect(err.code).assertEqual(2097172);
console.debug('ACTS_MissionSnapshot_0400====<end .catch(err)');
done();
});
......@@ -260,56 +236,44 @@ describe('ActsMissionSnapshotTest', function () {
/*
* @tc.number: ACTS_MissionSnapshot_0500
* @tc.name: getAbilityMissionSnapshot
* @tc.name: getMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(Promise)
*/
it('ACTS_MissionSnapshot_0500', 0, async function (done) {
console.debug('ACTS_MissionSnapshot_0500====<begin');
var m_missionId = -1;
var m_topAbility_bundleName = "";
var m_topAbility_abilityName = "";
var m_bundleName = "";
var m_abilityName = "";
try {
var upperLimit = 10;
await abilityManager.getActiveAbilityMissionInfos(upperLimit, async (err, data) => {
await missionManager.getMissionInfos("", upperLimit, async (err, data) => {
console.debug("=ACTS_MissionSnapshot_0500 err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
console.debug('ACTS_MissionSnapshot_0500 AbilityMissionInfo data.length ====>: ' + data.length);
console.debug('ACTS_MissionSnapshot_0500 MissionInfo data.length ====>: ' + data.length);
if (!data.length) {
m_missionId = -99;
m_topAbility_bundleName = "";
m_topAbility_abilityName = "";
m_bundleName = "";
m_abilityName = "";
expect("if (!data.length) ").assertEqual(0);
console.debug('ACTS_MissionSnapshot_0500====<end 0')
done();
} else {
m_missionId = data[0].missionId;
m_topAbility_bundleName = data[0].topAbility.bundleName;
m_topAbility_abilityName = data[0].topAbility.abilityName;
m_bundleName = data[0].want.bundleName;
m_abilityName = data[0].want.abilityName;
}
console.debug("=ACTS_MissionSnapshot_0500 m_missionId====>" + m_missionId);
abilityManager.getAbilityMissionSnapshot(m_missionId)
missionManager.getMissionSnapShot("", m_missionId)
.then(function (data) {
console.debug("=ACTS_MissionSnapshot_0500 then data====>"
+ ("json data 【") + JSON.stringify(data) + ("") + " , " + data);
expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName);
expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName);
expect(data.ability.bundleName).assertEqual(m_bundleName);
expect(data.ability.abilityName).assertEqual(m_abilityName);
console.debug("=ACTS_MissionSnapshot_0500 err,data=======> JSON.stringify(data.snapshot)="
+ JSON.stringify(data.snapshot) + " , " + data.snapshot);
try {
data.snapshot.getPixelBytesNumber().then(function (data){
console.debug("=ACTS_MissionSnapshot_0500 ====> "
+("data.snapshot.getPixelBytesNumber()=" + data))
expect(data > 0).assertEqual(true);
console.debug('ACTS_MissionSnapshot_0500====<end')
done();
})
} catch (err) {
expect(err).assertEqual("0");
console.debug('ACTS_MissionSnapshot_0500====<end catch (err) get')
done();
}
done();
}).catch(function (err) {
console.debug("=ACTS_MissionSnapshot_0500 catch err ====>"
+ ("json err 【") + JSON.stringify(err) + (""));
......@@ -336,7 +300,7 @@ describe('ActsMissionSnapshotTest', function () {
}
/*
* @tc.number: ACTS_MissionSnapshot_0600
* @tc.name: getAbilityMissionSnapshot
* @tc.name: getMissionSnapshot
* @tc.desc: Recent task stack provides current screenshot.(Promise)
*/
it('ACTS_MissionSnapshot_0600', 0, async function (done) {
......@@ -364,46 +328,39 @@ describe('ActsMissionSnapshotTest', function () {
unsubscribe("subscribe", subscriber);
var m_missionId = -1;
var m_topAbility_bundleName = "";
var m_topAbility_abilityName = "";
var m_bundleName = "";
var m_abilityName = "";
var upperLimit = 10;
await abilityManager.getActiveAbilityMissionInfos(upperLimit, (err, data) => {
await missionManager.getMissionInfos("", upperLimit, (err, data) => {
console.debug("=ACTS_MissionSnapshot_0600 err,data=======>"
+ ("json err【") + JSON.stringify(err) + ("")
+ ("json data【") + JSON.stringify(data) + ("")
+ " ,err=" + err + " ,data=" + data);
console.debug('ACTS_MissionSnapshot_0600 AbilityMissionInfo data.length ====>'
console.debug('ACTS_MissionSnapshot_0600 MissionInfo data.length ====>'
+ data.length);
if (!data.length) {
m_missionId = -99;
m_topAbility_bundleName = "";
m_topAbility_abilityName = "";
m_bundleName = "";
m_abilityName = "";
expect("if (!data.length) ").assertEqual(0);
unsubscribe("if (!data.length) ", subscriber);
console.debug('ACTS_MissionSnapshot_0600====<end 0')
done();
} else {
m_missionId = data[0].missionId;
m_topAbility_bundleName = data[0].topAbility.bundleName;
m_topAbility_abilityName = data[0].topAbility.abilityName;
m_bundleName = data[0].want.bundleName;
m_abilityName = data[0].want.abilityName;
}
console.debug("=ACTS_MissionSnapshot_0600 m_missionId====>" + m_missionId);
abilityManager.getAbilityMissionSnapshot(m_missionId).then(function (data) {
missionManager.getMissionSnapShot("", m_missionId).then(function (data) {
console.debug("=ACTS_MissionSnapshot_0600 then data====>"
+ ("json data 【") + JSON.stringify(data) + ("") + " , " + data);
try {
expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName);
expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName);
expect(data.ability.bundleName).assertEqual(m_bundleName);
expect(data.ability.abilityName).assertEqual(m_abilityName);
console.debug("=ACTS_MissionSnapshot_0600=====> JSON.stringify(data.snapshot)="
+ JSON.stringify(data.snapshot) + " , " + data.snapshot);
data.snapshot.getPixelBytesNumber().then(function (data){
console.debug("=ACTS_MissionSnapshot_0600 ====> "
+("data.snapshot.getPixelBytesNumber()=" + data))
expect(data > 0).assertEqual(true);
unsubscribe(".then() ", subscriber);
console.debug('ACTS_MissionSnapshot_0600====<end')
done();
})
done();
} catch (err) {
expect(err).assertEqual("0");
unsubscribe("catch (err) get ", subscriber);
......
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"test-timeout": "300000",
"package": "com.example.actsfeatureabilitytest",
"shell-timeout": "600000"
},
......
......@@ -1652,26 +1652,29 @@ describe('ActsFeatureAbilityTest', function () {
function SubscribeCallBack(err, data) {
clearTimeout(id);
events.set(data.event, 0);
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
console.debug("ACTS_TerminateAbility_0200 ====>Subscribe CallBack data:====>" + JSON.stringify(data));
if (events.size > 1) {
console.debug("ACTS_TerminateAbility_0200 events.size > 1");
expect(events.has("ACTS_TerminateAbility_0200_CommonEvent") &&
events.has("ACTS_TerminateAbility_0200_Return")).assertTrue();
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
} else {
console.debug("ACTS_TerminateAbility_0200 events.size <= 1");
expect(events.has("ACTS_TerminateAbility_0200_CommonEvent") ||
events.has("ACTS_TerminateAbility_0200_Return")).assertTrue();
done();
}
}
commonEvent.createSubscriber(subscriberInfo_ACTS_TerminateAbility_0200).then(async (data) => {
console.debug("====>Create Subscriber====>");
console.debug("ACTS_TerminateAbility_0200 ====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
})
function UnSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
console.debug("ACTS_TerminateAbility_0200 ====>UnSubscribe CallBack====>");
done();
}
......@@ -1681,7 +1684,7 @@ describe('ActsFeatureAbilityTest', function () {
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
}
console.log('=====start ability=====');
console.log('ACTS_TerminateAbility_0200 =====start ability=====');
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = featureAbility.startAbility(
{
......@@ -1699,6 +1702,7 @@ describe('ActsFeatureAbilityTest', function () {
}
);
expect(typeof (promise)).assertEqual("object");
done();
})
/*
......@@ -1961,13 +1965,13 @@ describe('ActsFeatureAbilityTest', function () {
// expect(info.iconId).assertEqual(0); //create by DevEco when building HAP.
expect(info.process).assertEqual("processTest");
expect(info.supportedModes).assertEqual(0);
expect(info.moduleSourceDirs[0]).assertEqual("/data/accounts/account_0/applications/" +
expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" +
"com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest");
expect(info.permissions[0]).assertEqual("ohos.permission.CAMERA");
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/app/el1/bundle/public/" +
"com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest");
expect(info.entryDir).assertEqual("/data/accounts/account_0/applications/" +
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
"com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest");
}
......@@ -2242,7 +2246,7 @@ describe('ActsFeatureAbilityTest', function () {
expect(data.type).assertEqual(1);
expect(data.subType).assertEqual(0);
expect(data.orientation).assertEqual(0);
expect(data.launchMode).assertEqual(1);
expect(data.launchMode).assertEqual(0);
expect(data.permissions[0]).assertEqual("ohos.permission.ACCELEROMETER");
expect(data.permissions[1]).assertEqual("ohos.permission.ANSWER_CALL");
......@@ -2552,7 +2556,7 @@ describe('ActsFeatureAbilityTest', function () {
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_0700 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code == 2097152).assertTrue();
expect(err.code != 0).assertTrue();
done();
});
}catch(error){
......@@ -2581,7 +2585,7 @@ describe('ActsFeatureAbilityTest', function () {
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_0800 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code == 2097155).assertTrue();
expect(err.code != 0).assertTrue();
done();
});
}catch(error){
......@@ -2637,7 +2641,7 @@ describe('ActsFeatureAbilityTest', function () {
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_1100 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code == 2097155).assertTrue();
expect(err.code != 0).assertTrue();
done();
});
}catch(error){
......@@ -2665,7 +2669,7 @@ describe('ActsFeatureAbilityTest', function () {
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_1200 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code == 2097155).assertTrue();
expect(err.code != 0).assertTrue();
done();
});
}catch(error){
......@@ -2777,7 +2781,7 @@ describe('ActsFeatureAbilityTest', function () {
expect().assertFail();
done();
}).catch((err)=>{
expect(err.code == 2097155).assertTrue();
expect(err.code != 0).assertTrue();
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册