提交 f1d9f078 编写于 作者: C chensi10

fix xts test

Signed-off-by: Nchensi10 <chen.s@neusoft.com>
上级 c8c7b4e2
# 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") {
testonly = true
if (is_standard_system) {
deps = [ "aafwk_standard:aafwk_standard" ]
}
}
# Copyright (C) 2021 Huawei Device Co., Ltd.
# 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
......@@ -17,10 +17,10 @@ group("aafwk_standard") {
testonly = true
if (is_standard_system) {
deps = [
"abilitymanager:ActsAbilityManagerTest",
"context:ActsContextTest",
"featureability:ActsFeatureAbilityTest",
"want:ActsSetWantTest",
"abilitymanager:actsAbilityManagerTest",
"context:context",
"featureability:featureability",
"want:want",
]
}
}
......@@ -10,19 +10,23 @@
# 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"
import("//build/ohos_var.gni")
group("actsAbilityManagerTest") {
testonly = true
if (is_standard_system) {
deps = [
"actsamscallbackfifthscene:ActsAmsCallBackFifthScene",
"actsamscallbackfirstscene:ActsAmsCallBackFirstScene",
"actsamscallbackfourthscene:ActsAmsCallBackFourthScene",
"actsamscallbacksecondscene:ActsAmsCallBackSecondScene",
"actsamscallbackthirdscene:ActsAmsCallBackThirdScene",
"actsamstestfifthscene:ActsAmsTestFifthScene",
"actsamstestfirstscene:ActsAmsTestFirstScene",
"actsamstestfourthscene:ActsAmsTestFourthScene",
"actsamstestsecondscene:ActsAmsTestSecondScene",
"actsamstestthirdscene:ActsAmsTestThirdScene",
]
}
}
{
"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
}
]
}
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackFifthScene") {
test_hap_name = "ActsAmsCallBackFifthScene"
hap_source_path = "hap/ActsAmsCallBackFifthScene.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "com.example.actsamscallbackfifthscene",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackFifthScene.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamscallbackfifthscene",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbackfifthscene",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamscallbackfifthscene.MainAbility",
"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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
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('ActsAmsCallBackFifthScene', function () {
console.info('----ActsAmsCallBackFifthScene----');
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();
}
);
})
})
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackFirstScene") {
test_hap_name = "ActsAmsCallBackFirstScene"
hap_source_path = "hap/ActsAmsCallBackFirstScene.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "com.example.actsamscallbackfirstscene",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackFirstScene.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamscallbackfirstscene",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbackfirstscene",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamscallbackfirstscene.MainAbility",
"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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit'
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('ActsAmsCallBackFirstScene', function () {
console.info('----ActsAmsCallBackFirstScene----');
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();
})
})
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackFourthScene") {
test_hap_name = "ActsAmsCallBackFourthScene"
hap_source_path = "hap/ActsAmsCallBackFourthScene.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "com.example.actsamscallbackfourthscene",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackFourthScene.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamscallbackfourthscene",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbackfourthscene",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamscallbackfourthscene.MainAbility",
"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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
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('ActsAmsCallBackFourthScene', function () {
console.info('----ActsAmsCallBackFourthScene----');
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();
}
);
})
})
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackSecondScene") {
test_hap_name = "ActsAmsCallBackSecondScene"
hap_source_path = "hap/ActsAmsCallBackSecondScene.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "com.example.actsamscallbacksecondscene",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackSecondScene.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamscallbacksecondscene",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbacksecondscene",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamscallbacksecondscene.MainAbility",
"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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit'
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('ActsAmsCallBackSecondScene', function () {
console.info('----ActsAmsCallBackSecondScene----');
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();
}
);
})
})
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackThirdScene") {
test_hap_name = "ActsAmsCallBackThirdScene"
hap_source_path = "hap/ActsAmsCallBackThirdScene.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "com.example.actsamscallbackthirdscene",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackThirdScene.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamscallbackthirdscene",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbackthirdscene",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamscallbackthirdscene.MainAbility",
"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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
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('ActsAmsCallBackThirdScene', function () {
console.info('----ActsAmsCallBackThirdScene----');
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();
}
);
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsTestFifthScene") {
test_hap_name = "ActsAmsTestFifthScene"
hap_source_path = "hap/ActsAmsTestFifthScene.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "com.example.actsamstestfifthscene",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAmsTestFifthScene.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamstestfifthscene",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamstestfifthscene",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamstestfifthscene.MainAbility",
"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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
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('ActsAmsTestFifthScene', function () {
console.info('----ActsAmsTestFifthScene----');
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.actsamstestfifthscene'&& data[i].topAbility.bundleName != 'com.example.actsamstestfifthscene'){
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
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsTestFirstScene") {
test_hap_name = "ActsAmsTestFirstScene"
hap_source_path = "hap/ActsAmsTestFirstScene.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "com.example.actsamstestfirstscene",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAmsTestFirstScene.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamstestfirstscene",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamstestfirstscene",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsamstestfirstscene.MainAbility",
"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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
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('ActsAmsTestFirstScene', function () {
console.info('----ActsAmsTestFirstScene----');
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.actsamstestfirstscene'&& data[i].topAbility.bundleName != 'com.example.actsamstestfirstscene'){
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();
})
})
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsTestFourthScene") {
test_hap_name = "ActsAmsTestFourthScene"
hap_source_path = "hap/ActsAmsTestFourthScene.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "com.example.actsamstestfourthscene",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAmsTestFourthScene.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamstestfourthscene",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamstestfourthscene",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamstestfourthscene.MainAbility",
"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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
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('ActsAmsTestFourthScene', function () {
console.info('----ActsAmsTestFourthScene----');
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.actsamstestfourthscene'&& data[i].topAbility.bundleName != 'com.example.actsamstestfourthscene'){
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
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsTestSecondScene") {
test_hap_name = "ActsAmsTestSecondScene"
hap_source_path = "hap/ActsAmsTestSecondScene.hap"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"package": "com.example.actsamstestsecondscene",
"shell-timeout": "21600000"
},
"kits": [
{
"test-file-name": [
"ActsAmsTestSecondScene.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsamstestsecondscene",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsamstestsecondscene",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.actsamstestsecondscene.MainAbility",
"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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册