提交 9480e858 编写于 作者: O openharmony_ci 提交者: Gitee

!443 20210817代码提交

Merge pull request !443 from chensi10/master
# 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("//build/ohos_var.gni")
group("aafwk_standard") {
testonly = true
if (is_standard_system) {
deps = [
"abilitymanager:ActsAbilityManagerTest",
"context:ActsContextTest",
"featureability:ActsFeatureAbilityTest",
"want:ActsSetWantTest",
]
}
}
# 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("//build/config/ohos/rules.gni")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAbilityManagerTest") {
test_hap_name = "ActsAbilityManagerTest"
hap_source_path = "hap/sceneTestOne.hap"
hap_source_path = "hap/sceneTestTwo.hap"
hap_source_path = "hap/sceneTestThree.hap"
hap_source_path = "hap/sceneTestFour.hap"
hap_source_path = "hap/sceneTestFive.hap"
hap_source_path = "hap/sceneCallbackTestOne.hap"
hap_source_path = "hap/sceneCallbackTestTwo.hap"
hap_source_path = "hap/sceneCallbackTestThree.hap"
hap_source_path = "hap/sceneCallbackTestFour.hap"
hap_source_path = "hap/sceneCallbackTestFive.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "ohos.acts.aafwk.ability",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"AbilityDemo.hap",
"$module.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.scene001",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.myapplication",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.SceneOneAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_test_1', function () {
console.info('----scene_test_1----');
it('startlauncher_scene1', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('removeMission_01', 0, async function (done) {
var maxnum = 10,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
for (var i = 0; i < data.length; i++) {
if(data[i].baseAbility.bundleName != 'com.example.scene001'&& data[i].topAbility.bundleName != 'com.example.scene001'){
var info = abilitymanager.removeMission(data[i].id);
console.info('============== removeMission data [' + info + ']' );
}
}
done();
})
it('startAbility_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('Acts_Ams_test_0100', 0, async function (done) {
var info = await abilitymanager.getAllRunningProcesses();
console.info('getAllRunningProcesses data length [' + info.length + ']' );
console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
})
it('Acts_Ams_test_0300', 0, async function (done) {
var maxnum = 10;
var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' );
console.info('==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_0500', 0, async function (done) {
var maxnum = 10,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' );
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_0700', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMission(result[0].id);
console.info('============== removeMission data [' + info + ']' );
expect(info).assertLarger(0);
done();
})
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('============== moveMissionToTop data [' + info + ']' );
expect(info).assertEqual(0);
done();
})
it('Acts_Ams_test_1300', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMissions([result[0].id]);
console.info('============== removeMissions data [' + info + ']' );
expect(info).assertLarger(0);
done();
})
it('Acts_Ams_test_0900', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('============== clearMissions data [' + info + ']' );
expect(info).assertLarger(0);
done();
})
it('Acts_Ams_test_1500', 0, async function (done) {
var info = await abilitymanager.killProcessesByBundleName('com.ix.simulate.feature');
console.info('============== killProcessesByBundleName data [' + info + ']' );
expect(info).assertEqual(0);
done();
})
it('clearMissions_01', 0, async function (done) {
var info = await abilitymanager.clearMissions();
done();
})
})
{
"app": {
"bundleName": "com.example.callbackscene005",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.scenecallbacktestfive",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "scenecallbacktestfive",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SceneFiveCallbackAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_callback_test_5', function () {
console.info('----scene_callback_test_5----');
it('startlauncher_callbackscene5_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('removeMission_callback_05', 0, async function (done) {
var maxnum = 10,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag,
(info) => {
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) );
for (var i = 0; i < info.length; i++) {
if(info[i].baseAbility.bundleName != 'com.example.callbackscene005'&& info[i].topAbility.bundleName != 'com.example.callbackscene005'){
abilitymanager.removeMission(info[i].id,
(info) => {
console.info('============== removeMission data [' + info + ']' );
});
}
}
done();
})
})
it('startAbility_callbackscene5_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('startAbility_callbackscene5_02', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.verify.io",
abilityName: "com.example.VerifyIoThirdAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('startAbility_callbackscene5_03', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilitySed",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('Acts_Ams_test_6600', 0, async function (done) {
abilitymanager.getAllRunningProcesses(
(error,info) => {
console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' );
console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(0);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
});
done();
})
it('Acts_Ams_test_7000', 0, async function (done) {
var maxnum = 10,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag,
(error,data) => {
console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + data.length + ']' );
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_6800', 0, async function (done) {
var maxnum = 10;
abilitymanager.queryRunningAbilityMissionInfos(maxnum,
(error,data) => {
console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + data.length + ']' );
console.info('==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_7200', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMission(result[1].id,
(error,info) => {
console.info('============== removeMission error.code:' + error.code +', data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
});
done();
})
it('Acts_Ams_test_7600', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.moveMissionToTop(result[0].id,
(error,info) => {
console.info('============== moveMissionToTop error.code:' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
});
done();
})
it('Acts_Ams_test_7800', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMissions([result[0].id],
(error,info) => {
console.info('============== removeMissions error.code :' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_7400', 0, async function (done) {
abilitymanager.clearMissions(
(error,info) => {
console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_8000', 0, async function (done) {
abilitymanager.killProcessesByBundleName('com.ix.verify.io',
(error,info) => {
console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
});
done();
})
it('startlauncher_callbackscene5_02', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('clearMissions_callback_05', 0, async function (done) {
abilitymanager.clearMissions(
(info) => {
console.info('============== clearMissions data [' + info + ']' );
});
done();
})
})
{
"app": {
"bundleName": "com.example.callbackscene004",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.scenecallbacktestfour",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "scenecallbacktestfour",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SceneFourCallbackAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_callback_test_4', function () {
console.info('----scene_callback_test_4----');
it('startlauncher_callbackscene4_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('removeMission_callback_04', 0, async function (done) {
var maxnum = 20,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag,
(info) => {
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) );
for (var i = 0; i < info.length; i++) {
if(info[i].baseAbility.bundleName != 'com.example.callbackscene004'&& info[i].topAbility.bundleName != 'com.example.callbackscene004'){
abilitymanager.removeMission(info[i].id,
(info) => {
console.info('============== removeMission data [' + info + ']' );
});
}
}
done();
})
})
it('startAbility_callbackscene4_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.verify.io",
abilityName: "com.example.VerifyIoThirdAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('startAbility_callbackscene4_02', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('startAbility_callbackscene4_03', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.verify.act",
abilityName: "com.example.VerifyActThirdAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('startAbility_callbackscene4_04', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.entry",
abilityName: "com.example.SimulateEntryAbilityFir",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('Acts_Ams_test_5000', 0, async function (done) {
abilitymanager.getAllRunningProcesses(
(error,info) => {
console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' );
console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(0);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
});
done();
})
it('Acts_Ams_test_5400', 0, async function (done) {
var maxnum = 100,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag,
(error,data) => {
console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + data.length + ']' );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
console.info('queryRecentAbilityMissionInfos id: ' + data[i].id + ' baseAbility.deviceId: ' + data[i].baseAbility.deviceId +
' baseAbility.bundleName: ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: ' + data[i].baseAbility.abilityName +
' topAbility.deviceId: ' + data[i].topAbility.deviceId + ' topAbility.bundleName: ' + data[i].topAbility.bundleName +
' topAbility.abilityName: ' + data[i].topAbility.abilityName + ' missionDescription.label: ' + data[i].missionDescription.label
+ ' missionDescription.iconPath: ' + data[i].missionDescription.iconPath);
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_5200', 0, async function (done) {
var maxnum = 30;
abilitymanager.queryRunningAbilityMissionInfos(maxnum,
(error,data) => {
console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + data.length + ']' );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
console.info('queryRunningAbilityMissionInfos id: ' + data[i].id + ' baseAbility.deviceId: ' + data[i].baseAbility.deviceId +
' baseAbility.bundleName: ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: ' + data[i].baseAbility.abilityName +
' topAbility.deviceId: ' + data[i].topAbility.deviceId + ' topAbility.bundleName: ' + data[i].topAbility.bundleName +
' topAbility.abilityName: ' + data[i].topAbility.abilityName + ' missionDescription.label: ' + data[i].missionDescription.label
+ ' missionDescription.iconPath: ' + data[i].missionDescription.iconPath);
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_5600', 0, async function (done) {
var maxnum = 30;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMission(result[0].id,
(error,info) => {
console.info('============== removeMission error.code:' + error.code +', data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_6000', 0, async function (done) {
var maxnum = 30;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.moveMissionToTop(result[0].id,
(error,info) => {
console.info('============== moveMissionToTop error.code:' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
});
done();
})
it('Acts_Ams_test_5800', 0, async function (done) {
abilitymanager.clearMissions(
(error,info) => {
console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_6400', 0, async function (done) {
abilitymanager.killProcessesByBundleName('xxxxxxxxx',
(error,info) => {
console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
});
done();
})
it('Acts_Ams_test_6200', 0, async function (done) {
var maxnum = 30;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMissions([result[1].id,result[2].id],
(error,info) => {
console.info('============== removeMissions error.code :' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
});
done();
})
it('startlauncher_callbackscene4_02', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('clearMissions_callback_04', 0, async function (done) {
abilitymanager.clearMissions(
(info) => {
console.info('============== clearMissions data [' + info + ']' );
});
done();
})
})
{
"app": {
"bundleName": "com.example.callbackscene001",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.scenecallbacktestone",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "scenecallbacktestone",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SceneOneCallbackAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_callback_test_1', function () {
console.info('----scene_callback_test_1----');
it('startlauncher_callback_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('removeMission_callback_01', 0, async function (done) {
var maxnum = 10,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag,
(info) => {
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) );
for (var i = 0; i < info.length; i++) {
if(info[i].baseAbility.bundleName != 'com.example.callbackscene001'&& info[i].topAbility.bundleName != 'com.example.callbackscene001'){
abilitymanager.removeMission(info[i].id,
(info) => {
console.info('============== removeMission data [' + info + ']' );
});
}
}
done();
})
})
it('startability_callback_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('Acts_Ams_test_0200', 0, async function (done) {
abilitymanager.getAllRunningProcesses(
(error,info) => {
console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' );
console.info('==================== getAllRunningProcesses data ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
});
done();
})
it('Acts_Ams_test_0400', 0, async function (done) {
var maxnum = 10;
abilitymanager.queryRunningAbilityMissionInfos(maxnum,
(error,info) => {
console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' );
console.info('==================== queryRunningAbilityMissionInfos info ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].id)).assertEqual("number");
expect(info[i].id).assertLarger(0);
expect(typeof (info[i].baseAbility)).assertEqual("object");
expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_0600', 0, async function (done) {
var maxnum = 10,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag,
(error,info) => {
console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' );
console.info('==================== queryRecentAbilityMissionInfos info ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].id)).assertEqual("number");
expect(info[i].id).assertLarger(0);
expect(typeof (info[i].baseAbility)).assertEqual("object");
expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_0800', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMission(result[0].id,
(error,info) => {
console.info('============== removeMission error.code:' + error.code +', info [' + info + ']' );
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_1200', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.moveMissionToTop(result[0].id,
(error,info) => {
console.info('============== moveMissionToTop error.code:' + error.code + ',info [' + info + ']' );
expect(info).assertEqual(0);
});
done();
})
it('Acts_Ams_test_1400', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMissions([result[0].id],
(error,info) => {
console.info('============== removeMissions error.code :' + error.code + ',info [' + info + ']' );
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_1000', 0, async function (done) {
abilitymanager.clearMissions(
(error,info) => {
console.info('============== clearMissions error.code ' + error.code + ',info [' + info + ']' );
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_1600', 0, async function (done) {
abilitymanager.killProcessesByBundleName('com.ix.simulate.feature',
(error,info) => {
console.info('============== killProcessesByBundleName error.code: ' + error.code + ',info [' + info + ']' );
expect(info).assertEqual(0);
});
done();
})
it('ClearMinssion_callback_01', 0, async function (done) {
abilitymanager.clearMissions(
(info) => {
console.info('============== clearMissions data [' + info + ']' );
});
done();
})
})
{
"app": {
"bundleName": "com.example.callbackscene003",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.scenecallbacktestthree",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "scenecallbacktestthree",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SceneThreeCallbackAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_callback_test_3', function () {
console.info('----scene_callback_test_3----');
it('startlauncher_callbackscene3_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('removeMission_callback_03', 0, async function (done) {
var maxnum = 20,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag,
(info) => {
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) );
for (var i = 0; i < info.length; i++) {
if(info[i].baseAbility.bundleName != 'com.example.callbackscene003'&& info[i].topAbility.bundleName != 'com.example.callbackscene003'){
abilitymanager.removeMission(info[i].id,
(info) => {
console.info('============== removeMission data [' + info + ']' );
});
}
}
done();
})
})
it('startability_callback3_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('startability_callback3_02', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('startability_callback3_03', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.verify.io",
abilityName: "com.example.VerifyIoThirdAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('Acts_Ams_test_3400', 0, async function (done) {
abilitymanager.getAllRunningProcesses(
(error,info) => {
console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' );
console.info('Acts_Ams_test_3400==================== getAllRunningProcesses data ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
});
done();
})
it('Acts_Ams_test_3600', 0, async function (done) {
var maxnum = 20;
abilitymanager.queryRunningAbilityMissionInfos(maxnum,
(error,info) => {
console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' );
console.info('Acts_Ams_test_3600==================== queryRunningAbilityMissionInfos info ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].id)).assertEqual("number");
expect(info[i].id).assertLarger(0);
expect(typeof (info[i].baseAbility)).assertEqual("object");
expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_3800', 0, async function (done) {
var maxnum = 20,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag,
(error,info) => {
console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' );
console.info('Acts_Ams_test_3800==================== queryRecentAbilityMissionInfos info ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].id)).assertEqual("number");
expect(info[i].id).assertLarger(0);
expect(typeof (info[i].baseAbility)).assertEqual("object");
expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_4000', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMission(result[1].id,
(error,info) => {
console.info('============== removeMission error.code:' + error.code +', data [' + info + ']' );
expect(info).assertEqual(0);
});
done();
})
it('Acts_Ams_test_4400', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.moveMissionToTop(result[0].id,
(error,info) => {
console.info('============== moveMissionToTop error.code:' + error.code + ',data [' + info + ']' );
expect(info).assertEqual(0);
});
done();
})
it('Acts_Ams_test_4600', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMissions([result[0].id],
(error,info) => {
console.info('============== removeMissions error.code :' + error.code + ',data [' + info + ']' );
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_4200', 0, async function (done) {
abilitymanager.clearMissions(
(error,info) => {
console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' );
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_4800', 0, async function (done) {
abilitymanager.killProcessesByBundleName('xxxxxxxxxxx',
(error,info) => {
console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' );
expect(info).assertEqual(0);
});
done();
})
it('startlauncher_callbackscene3_02', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('clearMissions_callback_03', 0, async function (done) {
abilitymanager.clearMissions(
(info) => {
console.info('============== clearMissions data [' + info + ']' );
});
done();
})
})
{
"app": {
"bundleName": "com.example.callbackscene002",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.scenecallbacktesttwo",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "scenecallbacktesttwo",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SceneTwoCallbackAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_callback_test_2', function () {
console.info('----scene_callback_test_2----');
it('startlauncher_callbackscene2_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('removeMission_callback_02', 0, async function (done) {
var maxnum = 20,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag,
(info) => {
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) );
for (var i = 0; i < info.length; i++) {
if(info[i].baseAbility.bundleName != 'com.example.callbackscene002'&& info[i].topAbility.bundleName != 'com.example.callbackscene002'){
abilitymanager.removeMission(info[i].id,
(info) => {
console.info('============== removeMission data [' + info + ']' );
});
}
}
done();
})
})
it('startability_callback2_01', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.verify.io",
abilityName: "com.example.VerifyIoThirdAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('startability_callback2_02', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('Acts_Ams_test_1800', 0, async function (done) {
abilitymanager.getAllRunningProcesses(
(error,info) => {
console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' );
console.info('==================== getAllRunningProcesses data ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
});
done();
})
it('Acts_Ams_test_2000', 0, async function (done) {
var maxnum = 20;
abilitymanager.queryRunningAbilityMissionInfos(maxnum,
(error,info) => {
console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' );
console.info('==================== queryRunningAbilityMissionInfos info ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].id)).assertEqual("number");
expect(info[i].id).assertLarger(0);
expect(typeof (info[i].baseAbility)).assertEqual("object");
expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_2200', 0, async function (done) {
var maxnum = 20,flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag,
(error,info) => {
console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' );
console.info('==================== queryRecentAbilityMissionInfos info ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].id)).assertEqual("number");
expect(info[i].id).assertLarger(0);
expect(typeof (info[i].baseAbility)).assertEqual("object");
expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
});
done();
})
it('Acts_Ams_test_2400', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMission(result[1].id,
(error,info) => {
console.info('============== removeMission error.code:' + error.code +', data [' + info + ']' );
expect(info).assertEqual(0);
});
done();
})
it('Acts_Ams_test_2800', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.moveMissionToTop(result[0].id,
(error,info) => {
console.info('============== moveMissionToTop error.code:' + error.code + ',data [' + info + ']' );
expect(info).assertEqual(0);
});
done();
})
it('Acts_Ams_test_3000', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
abilitymanager.removeMissions([result[0].id],
(error,info) => {
console.info('============== removeMissions error.code :' + error.code + ',data [' + info + ']' );
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_2600', 0, async function (done) {
abilitymanager.clearMissions(
(error,info) => {
console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' );
expect(info).assertLarger(0);
});
done();
})
it('Acts_Ams_test_3200', 0, async function (done) {
abilitymanager.killProcessesByBundleName('XXXXXXXXXXXX',
(error,info) => {
console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' );
expect(info).assertEqual(0);
});
done();
})
it('startlauncher_callbackscene2_02', 0, async function (done) {
var callback = featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
},
},
(err, data) => {
done();
}
);
})
it('clearMissions_callback_02', 0, async function (done) {
abilitymanager.clearMissions(
(info) => {
console.info('============== clearMissions data [' + info + ']' );
});
done();
})
})
{
"app": {
"bundleName": "com.example.scene005",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.scenetestfive",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "scenetestfive",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SceneFiveAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_test_5', function () {
console.info('----scene_test_5----');
it('startlauncher_scene5_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('removeMission_05', 0, async function (done) {
var maxnum = 10,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
for (var i = 0; i < data.length; i++) {
if(data[i].baseAbility.bundleName != 'com.example.scene005'&& data[i].topAbility.bundleName != 'com.example.scene005'){
var info = abilitymanager.removeMission(data[i].id);
console.info('============== removeMission data [' + info + ']' );
}
}
done();
})
it('startAbility_scene5_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('startAbility_scene5_02', 0, async function (done) {
var promise = await 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:
{},
},
},
);
done();
})
it('startAbility_scene5_03', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilitySed",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('Acts_Ams_test_6500', 0, async function (done) {
var info = await abilitymanager.getAllRunningProcesses();
console.info('getAllRunningProcesses data length [' + info.length + ']' );
console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(0);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
})
it('Acts_Ams_test_6900', 0, async function (done) {
var maxnum = 10,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' );
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_6700', 0, async function (done) {
var maxnum = 10;
var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' );
console.info('==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_7100', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMission(result[1].id);
console.info('============== removeMission data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
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('============== moveMissionToTop data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
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('============== removeMissions data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertLarger(0);
done();
})
it('Acts_Ams_test_7300', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('============== clearMissions data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertLarger(0);
done();
})
it('Acts_Ams_test_7900', 0, async function (done) {
var info = await abilitymanager.killProcessesByBundleName('com.ix.verify.io');
console.info('============== killProcessesByBundleName data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
it('startlauncher_scene5_02', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('ClearMinssion_05', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('============== clearMissions data [' + info + ']' );
done();
})
})
\ No newline at end of file
{
"app": {
"bundleName": "com.example.scene004",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.scenetestfour",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "scenetestfour",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SceneFourAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_test_4', function () {
console.info('----scene_test_4----');
it('startlauncher_scene4_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('removeMission_04', 0, async function (done) {
var maxnum = 20,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
for (var i = 0; i < data.length; i++) {
if(data[i].baseAbility.bundleName != 'com.example.scene004'&& data[i].topAbility.bundleName != 'com.example.scene004'){
var info = abilitymanager.removeMission(data[i].id);
console.info('============== removeMission data [' + info + ']' );
}
}
done();
})
it('startAbility_scene4_01', 0, async function (done) {
var promise = await 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:
{},
},
},
);
done();
})
it('startAbility_scene4_02', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('startAbility_scene4_03', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.verify.act",
abilityName: "com.example.VerifyActThirdAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('startAbility_scene4_04', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.entry",
abilityName: "com.example.SimulateEntryAbilityFir",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('Acts_Ams_test_4900', 0, async function (done) {
var info = await abilitymanager.getAllRunningProcesses();
console.info('getAllRunningProcesses data length [' + info.length + ']' );
console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(0);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
})
it('Acts_Ams_test_5300', 0, async function (done) {
var maxnum = 100,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
console.info('queryRunningAbilityMissionInfos id: ' + data[i].id + ' baseAbility.deviceId: ' + data[i].baseAbility.deviceId +
' baseAbility.bundleName: ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: ' + data[i].baseAbility.abilityName +
' topAbility.deviceId: ' + data[i].topAbility.deviceId + ' topAbility.bundleName: ' + data[i].topAbility.bundleName +
' topAbility.abilityName: ' + data[i].topAbility.abilityName + ' missionDescription.label: ' + data[i].missionDescription.label
+ ' missionDescription.iconPath: ' + data[i].missionDescription.iconPath);
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_5100', 0, async function (done) {
var maxnum = 30;
var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
console.info('queryRunningAbilityMissionInfos id: ' + data[i].id + ' baseAbility.deviceId: ' + data[i].baseAbility.deviceId +
' baseAbility.bundleName: ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: ' + data[i].baseAbility.abilityName +
' topAbility.deviceId: ' + data[i].topAbility.deviceId + ' topAbility.bundleName: ' + data[i].topAbility.bundleName +
' topAbility.abilityName: ' + data[i].topAbility.abilityName + ' missionDescription.label: ' + data[i].missionDescription.label
+ ' missionDescription.iconPath: ' + data[i].missionDescription.iconPath);
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_5500', 0, async function (done) {
var maxnum = 30;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMission(result[0].id);
console.info('============== removeMission data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertLarger(0);
done();
})
it('Acts_Ams_test_5900', 0, async function (done) {
var maxnum = 30;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.moveMissionToTop(result[0].id);
console.info('============== moveMissionToTop data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
it('Acts_Ams_test_5700', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('============== clearMissions data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertLarger(0);
done();
})
it('Acts_Ams_test_6300', 0, async function (done) {
var info = await abilitymanager.killProcessesByBundleName('xxxxxxxxxxxx');
console.info('============== killProcessesByBundleName data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
it('Acts_Ams_test_6100', 0, async function (done) {
var maxnum = 30;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMissions([result[1].id,result[2].id]);
console.info('============== removeMissions data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
it('startlauncher_scene4_02', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('ClearMinssion_04', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('============== clearMissions data [' + info + ']' );
done();
})
})
\ No newline at end of file
{
"app": {
"bundleName": "com.example.scene003",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.scenetestthree",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "scenetestthree",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SceneThreeAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_test_3', function () {
console.info('----scene_test_3----');
it('startlauncher_scene3_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('removeMission_03', 0, async function (done) {
var maxnum = 20,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag);
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
for (var i = 0; i < data.length; i++) {
if(data[i].baseAbility.bundleName != 'com.example.scene003'&& data[i].topAbility.bundleName != 'com.example.scene003'){
var info = abilitymanager.removeMission(data[i].id);
console.info('============== removeMission data [' + info + ']' );
}
}
done();
})
it('startAbility_scene3_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('startAbility_scene3_02', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('startAbility_scene3_03', 0, async function (done) {
var promise = await 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:
{},
},
},
);
done();
})
it('Acts_Ams_test_3300', 0, async function (done) {
var info = await abilitymanager.getAllRunningProcesses();
console.info('getAllRunningProcesses data length [' + info.length + ']' );
console.info('Acts_Ams_test_3300==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
})
it('Acts_Ams_test_3500', 0, async function (done) {
var maxnum = 20;
var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' );
console.info('Acts_Ams_test_3500==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_3700', 0, async function (done) {
var maxnum = 20,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' );
console.info('Acts_Ams_test_3700==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_3900', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMission(result[1].id);
console.info('Acts_Ams_test_3900============== removeMission data [' + info + ']' );
expect(info).assertEqual(0);
done();
})
it('Acts_Ams_test_4300', 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_4300============== moveMissionToTop data [' + info + ']' );
expect(info).assertEqual(0);
done();
})
it('Acts_Ams_test_4500', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMissions([result[0].id]);
console.info('Acts_Ams_test_4500============== removeMissions data [' + info + ']' );
expect(info).assertLarger(0);
done();
})
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();
})
it('Acts_Ams_test_4700', 0, async function (done) {
var info = await abilitymanager.killProcessesByBundleName('XXXXXXXX');
console.info('Acts_Ams_test_4700============== killProcessesByBundleName data [' + info + ']' );
expect(info).assertEqual(0);
done();
})
it('startlauncher_scene3_02', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('clearMissions_03', 0, async function (done) {
var info = await abilitymanager.clearMissions();
done();
})
})
{
"app": {
"bundleName": "com.example.scene002",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.scenetesttwo",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "scenetesttwo",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SceneTwoAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
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
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');
},
}
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var WeightReasonCode = {
REASON_UNKNOWN : 0,
WEIGHT_FOREGROUND : 100,
WEIGHT_FOREGROUND_SERVICE : 125,
WEIGHT_VISIBLE : 200,
WEIGHT_PERCEPTIBLE : 230,
WEIGHT_SERVICE : 300,
WEIGHT_TOP_SLEEPING : 325,
WEIGHT_CANT_SAVE_STATE : 350,
WEIGHT_CACHED : 400,
WEIGHT_GONE : 1000
}
describe('scene_test_2', function () {
console.info('----scene_test_2----');
it('startlauncher_scene2_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('removeMission_02', 0, async function (done) {
var maxnum = 20,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
for (var i = 0; i < data.length; i++) {
if(data[i].baseAbility.bundleName != 'com.example.scene002'&& data[i].topAbility.bundleName != 'com.example.scene002'){
var info = abilitymanager.removeMission(data[i].id);
console.info('============== removeMission data [' + info + ']' );
}
}
done();
})
it('startAbility_scene2_01', 0, async function (done) {
var promise = await 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:
{},
},
},
);
done();
})
it('startAbility_scene2_02', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.feature",
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('Acts_Ams_test_1700', 0, async function (done) {
var info = await abilitymanager.getAllRunningProcesses();
console.info('getAllRunningProcesses data length [' + info.length + ']' );
console.info('Acts_Ams_test_1700==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) );
expect(Array.isArray(info)).assertEqual(true);
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(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(typeof(info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
})
it('Acts_Ams_test_1900', 0, async function (done) {
var maxnum = 20;
var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' );
console.info('Acts_Ams_test_1900==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_2100', 0, async function (done) {
var maxnum = 20,flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag);
console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' );
console.info('Acts_Ams_test_2100==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
expect(Array.isArray(data)).assertEqual(true);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].id)).assertEqual("number");
expect(data[i].id).assertLarger(0);
expect(typeof (data[i].baseAbility)).assertEqual("object");
expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(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(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
})
it('Acts_Ams_test_2300', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMission(result[1].id);
console.info('Acts_Ams_test_2300============== removeMission data [' + info + ']' );
expect(info).assertEqual(0);
done();
})
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();
})
it('Acts_Ams_test_2900', 0, async function (done) {
var maxnum = 20;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMissions([result[0].id]);
console.info('Acts_Ams_test_2900============== removeMissions data [' + info + ']' );
expect(info).assertLarger(0);
done();
})
it('Acts_Ams_test_2500', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('Acts_Ams_test_2500============== clearMissions data [' + info + ']' );
expect(info).assertLarger(0);
done();
})
it('Acts_Ams_test_3100', 0, async function (done) {
var info = await abilitymanager.killProcessesByBundleName('XXXXXXXXXXXX');
console.info('Acts_Ams_test_3100============== killProcessesByBundleName data [' + info + ']' );
expect(info).assertEqual(0);
done();
})
it('startlauncher_scene2_02', 0, async function (done) {
var promise = await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
parameters:
{},
},
},
);
done();
})
it('clearMissions_02', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('============== clearMissions data [' + info + ']' );
done();
})
})
{
"app": {
"bundleName": "com.ix.simulate.entry",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.simulateeability",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "simulateEAbility",
"moduleType": "feature",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.SimulateEntryAbility",
"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
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册