提交 d410fc14 编写于 作者: O openharmony_ci 提交者: Gitee

!728 update all code from master to lts

Merge pull request !728 from yexiangbin/OpenHarmony-3.0-LTS

要显示的变更太多。

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -17,7 +17,7 @@ group("aafwk_standard") {
testonly = true
if (is_standard_system) {
deps = [
"abilitymanager:actsAbilityManagerTest",
"abilitymanager:actsabilitymanagertest",
"context:context",
"featureability:featureability",
"want:want",
......
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......@@ -13,20 +13,25 @@
import("//build/ohos_var.gni")
group("actsAbilityManagerTest") {
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",
"actsamscallbackfifthscene:ActsAmsCallBackFifthSceneTest",
"actsamscallbackfirstscene:ActsAmsCallBackFirstSceneTest",
"actsamscallbackfourthscene:ActsAmsCallBackFourthSceneTest",
"actsamscallbacksecondscene:ActsAmsCallBackSecondSceneTest",
"actsamscallbackthirdscene:ActsAmsCallBackThirdSceneTest",
"actsamstestfifthscene:ActsAmsTestFifthSceneTest",
"actsamstestfirstscene:ActsAmsTestFirstSceneTest",
"actsamstestfourthscene:ActsAmsTestFourthSceneTest",
"actsamstestsecondscene:ActsAmsTestSecondSceneTest",
"actsamstestthirdscene:ActsAmsTestThirdSceneTest",
"sceneProject/simulateEAbility:simulateEAbility",
"sceneProject/simulateFAbilityFir:simulateFAbilityFir",
"sceneProject/simulateFAbilitySed:simulateFAbilitySed",
"sceneProject/verifyAAbility:verifyAAbility",
"sceneProject/verifyIAbility:verifyIAbility",
]
}
}
# 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
......@@ -10,9 +10,22 @@
# 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"
ohos_js_hap_suite("ActsAmsCallBackFifthSceneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackFifthSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -2,14 +2,17 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "300000",
"package": "com.example.actsamscallbackfifthscene",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackFifthScene.hap"
"ActsAmsCallBackFifthSceneTest.hap",
"simulateFAbilityFir.hap",
"simulateFAbilitySed.hap",
"verifyIAbility.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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
......@@ -15,9 +18,7 @@ export default {
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')
......
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
# Copyright (C) 2021 Huawei Device Co., Ltd.
# 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
......@@ -10,9 +10,22 @@
# 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"
ohos_js_hap_suite("ActsAmsCallBackFirstSceneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackFirstSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -2,14 +2,15 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "300000",
"package": "com.example.actsamscallbackfirstscene",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackFirstScene.hap"
"ActsAmsCallBackFirstSceneTest.hap",
"simulateFAbilityFir.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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
......
/*
* 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
......@@ -15,9 +32,7 @@ export default {
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')
......
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
......@@ -14,25 +14,38 @@
*/
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
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
}
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.example.SimulateFeatureAbilityFir",
"com.example.actsamscallbackfirstscene.MainAbility"
]
var bundleNameList = [
"com.ohos.launcher",
"com.ohos.systemui",
"com.ix.simulate.feature",
"com.example.actsamscallbackfirstscene"
]
describe('ActsAmsCallBackFirstScene', function () {
console.info('----ActsAmsCallBackFirstScene----');
it('startlauncher_callback_01', 0, async function (done) {
var callback = featureAbility.startAbility(
beforeAll(async function (done) {
featureAbility.startAbility(
{
want:
{
......@@ -41,34 +54,21 @@ describe('ActsAmsCallBackFirstScene', function () {
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(
var maxnum = 10, flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
if (data[i].baseAbility.bundleName != 'com.example.actsamscallbackfirstscene' &&
data[i].topAbility.bundleName != 'com.example.actsamscallbackfirstscene') {
var info = abilitymanager.removeMission(data[i].id);
console.log(' removeMission data [' + info + ']');
}
};
featureAbility.startAbility(
{
want:
{
......@@ -77,159 +77,238 @@ describe('ActsAmsCallBackFirstScene', function () {
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
parameters:
{},
{},
},
},
(err, data) => {
done();
}
);
})
setTimeout(done(), 5000);
});
function timeout() {
expect().assertFail();
console.debug('Acts_Ams_test=========timeout========');
done();
}
/*
* @tc.number : Acts_Ams_test_0200
* @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
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) );
(error, info) => {
console.info('getAllRunningProcesses error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_0200 getAllRunningProcesses data ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(4);
for (var i = 0; i < info.length; i++) {
expect(typeof(info[i].pid)).assertEqual("number");
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof(info[i].processName)).assertEqual("string");
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(0);
expect(typeof(info[i].uid)).assertEqual("number");
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(typeof (info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(typeof (info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_0400
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
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) );
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_0400 queryRunningAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(2);
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(info[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_0600
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
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) );
var maxnum = 10, flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag,
(error, info) => {
console.info('queryRunningAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_0600 queryRecentAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(2);
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(info[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_0800
* @tc.name : removeMission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_0800 removeMission error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_1200
* @tc.name : moveMissionToTop : Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_1200 moveMissionToTop error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertEqual(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_1400
* @tc.name : removeMissions : Remove Missions
* @tc.desc : Remove Missions(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_1400 removeMissions error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_1000
* @tc.name : clearMissions : Clear Missions
* @tc.desc : Clear Missions(by CallBack)
*/
it('Acts_Ams_test_1000', 0, async function (done) {
abilitymanager.clearMissions(
(error,info) => {
console.info('============== clearMissions error.code ' + error.code + ',info [' + info + ']' );
(error, info) => {
console.info('Acts_Ams_test_1000 clearMissions error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_1600
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_1600 killProcessesByBundleName error.code: \
' + error.code + ',data [' + info + ']');
expect(info).assertEqual(0);
done();
});
done();
setTimeout(timeout, 5000);
})
})
......
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......@@ -10,9 +10,22 @@
# 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"
ohos_js_hap_suite("ActsAmsCallBackFourthSceneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackFourthSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -2,14 +2,18 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "300000",
"package": "com.example.actsamscallbackfourthscene",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackFourthScene.hap"
"ActsAmsCallBackFourthSceneTest.hap",
"simulateFAbilityFir.hap",
"verifyAAbility.hap",
"verifyIAbility.hap",
"simulateEAbility.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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
......
/*
* 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
......@@ -15,9 +32,7 @@ export default {
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')
......
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
# Copyright (C) 2021 Huawei Device Co., Ltd.
# 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
......@@ -10,9 +10,22 @@
# 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"
ohos_js_hap_suite("ActsAmsCallBackSecondSceneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackSecondSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -2,14 +2,16 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "300000",
"package": "com.example.actsamscallbacksecondscene",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackSecondScene.hap"
"ActsAmsCallBackSecondSceneTest.hap",
"verifyIAbility.hap",
"simulateFAbilityFir.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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
......
/*
* 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
......@@ -15,9 +32,7 @@ export default {
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')
......
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
......@@ -14,25 +14,40 @@
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit'
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
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
}
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.example.SimulateFeatureAbilityFir",
"com.example.VerifyIoThirdAbility",
"com.example.actsamscallbacksecondscene.MainAbility"
]
var bundleNameList = [
"com.ohos.launcher",
"com.ohos.systemui",
"com.ix.simulate.feature",
"com.ix.verify.io",
"com.example.actsamscallbacksecondscene"
]
describe('ActsAmsCallBackSecondScene', function () {
console.info('----ActsAmsCallBackSecondScene----');
it('startlauncher_callbackscene2_01', 0, async function (done) {
var callback = featureAbility.startAbility(
beforeAll(async function (done) {
featureAbility.startAbility(
{
want:
{
......@@ -41,34 +56,21 @@ describe('ActsAmsCallBackSecondScene', function () {
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(
var maxnum = 10, flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
if (data[i].baseAbility.bundleName != 'com.example.actsamscallbacksecondscene' &&
data[i].topAbility.bundleName != 'com.example.actsamscallbacksecondscene') {
var info = abilitymanager.removeMission(data[i].id);
console.log(' removeMission data [' + info + ']');
}
};
featureAbility.startAbility(
{
want:
{
......@@ -77,17 +79,11 @@ describe('ActsAmsCallBackSecondScene', function () {
abilityName: "com.example.VerifyIoThirdAbility",
action: "action1",
parameters:
{},
{},
},
},
(err, data) => {
done();
}
);
})
it('startability_callback2_02', 0, async function (done) {
var callback = featureAbility.startAbility(
featureAbility.startAbility(
{
want:
{
......@@ -96,180 +92,238 @@ describe('ActsAmsCallBackSecondScene', function () {
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
parameters:
{},
{},
},
},
(err, data) => {
done();
}
);
})
setTimeout(done(), 5000);
});
function timeout() {
expect().assertFail();
console.debug('Acts_Ams_test=========timeout========');
done();
}
/*
* @tc.number : Acts_Ams_test_1800
* @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
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) );
(error, info) => {
console.info('getAllRunningProcesses error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_1800 getAllRunningProcesses data ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(5);
for (var i = 0; i < info.length; i++) {
expect(typeof(info[i].pid)).assertEqual("number");
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof(info[i].processName)).assertEqual("string");
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(0);
expect(typeof(info[i].uid)).assertEqual("number");
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(typeof (info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(typeof (info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_2000
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
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) );
(error, info) => {
console.info('queryRecentAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_2000 queryRunningAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].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(info[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_2200
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
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) );
var maxnum = 20, flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag,
(error, info) => {
console.info('queryRunningAbilityMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
console.info('Acts_Ams_test_2200 queryRecentAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
expect(typeof (info[i].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(info[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_2400
* @tc.name : removeMission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_2400 removeMission error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertEqual(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_2800
* @tc.name : moveMissionToTop : Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_2800 moveMissionToTop error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertEqual(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_3000
* @tc.name : removeMissions: Remove Missions
* @tc.desc : Remove Missions(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_3000 removeMissions error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_2600
* @tc.name : clearMissions: Clear Missions
* @tc.desc : Clear Missions(by CallBack)
*/
it('Acts_Ams_test_2600', 0, async function (done) {
abilitymanager.clearMissions(
(error,info) => {
console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' );
(error, info) => {
console.info('Acts_Ams_test_2600 clearMissions error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_3200
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it('Acts_Ams_test_3200', 0, async function (done) {
abilitymanager.killProcessesByBundleName('XXXXXXXXXXXX',
(error,info) => {
console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' );
(error, info) => {
console.info('Acts_Ams_test_3200 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();
}
);
});
setTimeout(timeout, 5000);
})
})
......
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......@@ -10,9 +10,22 @@
# 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"
ohos_js_hap_suite("ActsAmsCallBackThirdSceneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsCallBackThirdSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -2,14 +2,16 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "300000",
"package": "com.example.actsamscallbackthirdscene",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsCallBackThirdScene.hap"
"ActsAmsCallBackThirdSceneTest.hap",
"simulateFAbilityFir.hap",
"verifyIAbility.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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
......
/*
* 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
......@@ -15,9 +32,7 @@ export default {
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')
......
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
......@@ -14,25 +14,38 @@
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
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
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
}
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.example.SimulateFeatureAbilityFir",
"com.example.VerifyIoThirdAbility",
"com.example.actsamscallbackthirdscene.MainAbility"
]
var bundleNameList = [
"com.ohos.launcher",
"com.ohos.systemui",
"com.ix.simulate.feature",
"com.ix.verify.io",
"com.example.actsamscallbackthirdscene"
]
describe('ActsAmsCallBackThirdScene', function () {
console.info('----ActsAmsCallBackThirdScene----');
it('startlauncher_callbackscene3_01', 0, async function (done) {
var callback = featureAbility.startAbility(
beforeAll(async function (done) {
featureAbility.startAbility(
{
want:
{
......@@ -41,34 +54,21 @@ describe('ActsAmsCallBackThirdScene', function () {
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(
var maxnum = 10, flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
if (data[i].baseAbility.bundleName != 'com.example.actsamscallbackthirdscene' &&
data[i].topAbility.bundleName != 'com.example.actsamscallbackthirdscene') {
var info = abilitymanager.removeMission(data[i].id);
console.log(' removeMission data [' + info + ']');
}
};
featureAbility.startAbility(
{
want:
{
......@@ -77,17 +77,11 @@ describe('ActsAmsCallBackThirdScene', function () {
abilityName: "com.example.SimulateFeatureAbilityFir",
action: "action1",
parameters:
{},
{},
},
},
(err, data) => {
done();
}
);
})
it('startability_callback3_02', 0, async function (done) {
var callback = featureAbility.startAbility(
featureAbility.startAbility(
{
want:
{
......@@ -96,17 +90,11 @@ describe('ActsAmsCallBackThirdScene', function () {
abilityName: "com.ohos.launcher.MainAbility",
action: "action1",
parameters:
{},
{},
},
},
(err, data) => {
done();
}
);
})
it('startability_callback3_03', 0, async function (done) {
var callback = featureAbility.startAbility(
featureAbility.startAbility(
{
want:
{
......@@ -115,180 +103,238 @@ describe('ActsAmsCallBackThirdScene', function () {
abilityName: "com.example.VerifyIoThirdAbility",
action: "action1",
parameters:
{},
{},
},
},
(err, data) => {
done();
}
);
})
setTimeout(done(), 5000);
});
function timeout() {
expect().assertFail();
console.debug('Acts_Ams_test=========timeout========');
done();
}
/*
* @tc.number : Acts_Ams_test_3400
* @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
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) );
(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);
expect(info.length).assertEqual(5);
for (var i = 0; i < info.length; i++) {
expect(typeof(info[i].pid)).assertEqual("number");
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof(info[i].processName)).assertEqual("string");
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(0);
expect(typeof(info[i].uid)).assertEqual("number");
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
expect(typeof(info[i].lastMemoryLevel)).assertEqual("number");
expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
expect(info[i].lastMemoryLevel).assertEqual(-1);
expect(typeof(info[i].weight)).assertEqual("number");
expect(typeof (info[i].weight)).assertEqual("number");
expect(info[i].weight).assertEqual(-1);
expect(typeof(info[i].weightReasonCode)).assertEqual("number");
expect(typeof (info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_3600
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
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) );
(error, info) => {
console.info('queryRecentAbilityMissionInfos 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);
expect(info.length).assertEqual(3);
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(info[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_3800
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
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) );
var maxnum = 20, flag = 1;
abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag,
(error, info) => {
console.info('queryRunningAbilityMissionInfos 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);
expect(info.length).assertEqual(3);
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(info[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
expect(info[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
expect(info[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].topAbility)).assertEqual("object");
expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
expect(info[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
expect(info[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
expect(info[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (info[i].missionDescription)).assertEqual("object");
expect(typeof (info[i].missionDescription.label)).assertEqual("string");
expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
}
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_4000
* @tc.name : removeMission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_4000 removeMission error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertEqual(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_4400
* @tc.name : moveMissionToTop : Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_4400 moveMissionToTop error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertEqual(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_4600
* @tc.name : removeMissions: Remove Missions
* @tc.desc : Remove Missions(by CallBack)
*/
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 + ']' );
(error, info) => {
console.info('Acts_Ams_test_4600 removeMissions error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_4200
* @tc.name : clearMissions: Clear Missions
* @tc.desc : Clear Missions(by CallBack)
*/
it('Acts_Ams_test_4200', 0, async function (done) {
abilitymanager.clearMissions(
(error,info) => {
console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' );
(error, info) => {
console.info('Acts_Ams_test_4200 clearMissions error.code \
' + error.code + ',data [' + info + ']');
expect(info).assertLarger(0);
done();
});
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_4800
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it('Acts_Ams_test_4800', 0, async function (done) {
abilitymanager.killProcessesByBundleName('xxxxxxxxxxx',
(error,info) => {
console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' );
(error, info) => {
console.info('Acts_Ams_test_4800 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();
}
);
});
setTimeout(timeout, 5000);
})
})
......
......@@ -12,7 +12,19 @@
# 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"
ohos_js_hap_suite("ActsAmsTestFifthSceneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsTestFifthSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -2,14 +2,16 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "120000",
"package": "com.example.actsamstestfifthscene",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsTestFifthScene.hap"
"ActsAmsTestFifthSceneTest.hap",
"simulateFAbilitySed.hap",
"verifyIAbility.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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
......@@ -13,7 +13,10 @@
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
......@@ -29,9 +32,7 @@ export default {
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')
......
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
......@@ -14,26 +14,41 @@
*/
import featureAbility from '@ohos.ability.featureability'
import abilitymanager from '@ohos.app.abilitymanager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
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
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
}
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.example.SimulateFeatureAbilityFir",
"com.example.VerifyIoThirdAbility",
"com.example.actsamstestfifthscene.MainAbility",
"com.example.SimulateFeatureAbilitySed"
]
var bundleNameList = [
"com.ohos.launcher",
"com.ohos.systemui",
"com.ix.simulate.feature",
"com.example.actsamstestfifthscene",
"com.ix.verify.io"
]
describe('ActsAmsTestFifthScene', function () {
console.info('----ActsAmsTestFifthScene----');
it('startlauncher_scene5_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
beforeAll(async function (done) {
featureAbility.startAbility(
{
want:
{
......@@ -45,30 +60,23 @@ describe('ActsAmsTestFifthScene', function () {
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
{},
parameters:
{},
{},
},
},
);
done();
})
it('removeMission_05', 0, async function (done) {
var maxnum = 10,flag = 1;
var maxnum = 10, flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
console.log('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'){
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 + ']' );
console.log(' removeMission data [' + info + ']');
}
}
done();
})
it('startAbility_scene5_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
};
featureAbility.startAbility(
{
want:
{
......@@ -80,17 +88,13 @@ describe('ActsAmsTestFifthScene', function () {
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
{},
parameters:
{},
{},
},
},
);
done();
})
it('startAbility_scene5_02', 0, async function (done) {
var promise = await featureAbility.startAbility(
featureAbility.startAbility(
{
want:
{
......@@ -102,17 +106,13 @@ describe('ActsAmsTestFifthScene', function () {
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
{},
parameters:
{},
{},
},
},
);
done();
})
it('startAbility_scene5_03', 0, async function (done) {
var promise = await featureAbility.startAbility(
featureAbility.startAbility(
{
want:
{
......@@ -124,68 +124,88 @@ describe('ActsAmsTestFifthScene', function () {
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
{},
parameters:
{},
{},
},
},
);
done();
})
});
/*
* @tc.number : Acts_Ams_test_6500
* @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
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);
setTimeout(async function () {
var info = await abilitymanager.getAllRunningProcesses();
console.info('getAllRunningProcesses data length [' + info.length + ']');
console.info('Acts_Ams_test_6500 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(5);
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(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].pkgList)).assertEqual(true);
expect(info[i].pkgList.length).assertEqual(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].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].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].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();
expect(typeof (info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
}, 2000);
})
/*
* @tc.number : Acts_Ams_test_6900
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_6900', 0, async function (done) {
var maxnum = 10,flag = 1;
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) );
console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']');
console.info('Acts_Ams_test_6900 queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(3);
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(data[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
......@@ -194,29 +214,40 @@ describe('ActsAmsTestFifthScene', function () {
done();
})
/*
* @tc.number : Acts_Ams_test_6700
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by Promise)
*/
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) );
console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']');
console.info('Acts_Ams_test_6700 queryRunningAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(3);
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(data[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
......@@ -225,78 +256,74 @@ describe('ActsAmsTestFifthScene', function () {
done();
})
/*
* @tc.number : Acts_Ams_test_7100
* @tc.name : removeMission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
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");
console.info('Acts_Ams_test_7100 removeMission data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
/*
* @tc.number : Acts_Ams_test_7500
* @tc.name : moveMissionToTop : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_7500', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.moveMissionToTop(result[0].id);
console.info('============== moveMissionToTop data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
console.info('Acts_Ams_test_7500moveMissionToTop data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
/*
* @tc.number : Acts_Ams_test_7700
* @tc.name : removeMissions: Remove Missions
* @tc.desc : Remove Missions(by Promise)
*/
it('Acts_Ams_test_7700', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.removeMissions([result[0].id]);
console.info('============== removeMissions data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
console.info('Acts_Ams_test_7700 removeMissions data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertLarger(0);
done();
})
/*
* @tc.number : Acts_Ams_test_7300
* @tc.name : clearMissions: Clear Missions
* @tc.desc : Clear Missions(by Promise)
*/
it('Acts_Ams_test_7300', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('============== clearMissions data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
console.info('Acts_Ams_test_7300 clearMissions data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertLarger(0);
done();
})
/*
* @tc.number : Acts_Ams_test_7900
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
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");
console.info('Acts_Ams_test_7900 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
......@@ -12,7 +12,19 @@
# 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"
ohos_js_hap_suite("ActsAmsTestFirstSceneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsTestFirstSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -2,14 +2,15 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "120000",
"package": "com.example.actsamstestfirstscene",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsTestFirstScene.hap"
"ActsAmsTestFirstSceneTest.hap",
"simulateFAbilityFir.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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
......@@ -13,7 +13,10 @@
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
......@@ -29,9 +32,7 @@ export default {
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')
......
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
......@@ -14,25 +14,38 @@
*/
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
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
}
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.example.SimulateFeatureAbilityFir",
"com.example.actsamstestfirstscene.MainAbility"
]
var bundleNameList = [
"com.ohos.launcher",
"com.ohos.systemui",
"com.ix.simulate.feature",
"com.example.actsamstestfirstscene"
]
describe('ActsAmsTestFirstScene', function () {
console.info('----ActsAmsTestFirstScene----');
it('startlauncher_scene1', 0, async function (done) {
var promise = await featureAbility.startAbility(
beforeAll(async function (done) {
featureAbility.startAbility(
{
want:
{
......@@ -44,28 +57,23 @@ describe('ActsAmsTestFirstScene', function () {
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
{},
parameters:
{},
{},
},
},
);
done();
})
it('removeMission_01', 0, async function (done) {
var maxnum = 10,flag = 1;
var maxnum = 10, flag = 1;
var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag);
console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) );
console.log('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'){
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 + ']' );
console.log(' removeMission data [' + info + ']');
}
}
done();
})
it('startAbility_01', 0, async function (done) {
var promise = await featureAbility.startAbility(
};
featureAbility.startAbility(
{
want:
{
......@@ -77,66 +85,87 @@ describe('ActsAmsTestFirstScene', function () {
type: "MIMETYPE",
uri: "key={true,true,false}",
options:
{},
{},
parameters:
{},
{},
},
},
);
done();
})
});
/*
* @tc.number : Acts_Ams_test_0100
* @tc.name : getAllRunningProcesses : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
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);
setTimeout(async function () {
var info = await abilitymanager.getAllRunningProcesses();
console.info('Acts_Ams_test_0100 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(4);
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(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(bundleNameList.indexOf(info[i].processName)).assertLarger(-1);
expect(Array.isArray(info[i].pkgList)).assertEqual(true);
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].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].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].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();
expect(typeof (info[i].weightReasonCode)).assertEqual("number");
expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
}, 5000);
})
/*
* @tc.number : Acts_Ams_test_0300
* @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by Promise)
*/
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) );
console.info('Acts_Ams_test_0300 queryRunningAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(2);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].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(data[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);;
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(data[i].topAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
......@@ -145,29 +174,39 @@ describe('ActsAmsTestFirstScene', function () {
done();
})
/*
* @tc.number : Acts_Ams_test_0500
* @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_0500', 0, async function (done) {
var maxnum = 10,flag = 1;
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) );
console.info('Acts_Ams_test_0500 queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(2);
for (var i = 0; i < data.length; i++) {
expect(typeof (data[i].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(data[i].baseAbility.deviceId.length).assertEqual(0);
expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
expect(data[i].baseAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
expect(data[i].baseAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].topAbility)).assertEqual("object");
expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
expect(data[i].topAbility.bundleName.length).assertLarger(0);
expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
expect(data[i].topAbility.abilityName.length).assertLarger(0);
expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
expect(typeof (data[i].missionDescription)).assertEqual("object");
expect(typeof (data[i].missionDescription.label)).assertEqual("string");
......@@ -176,44 +215,68 @@ describe('ActsAmsTestFirstScene', function () {
done();
})
/*
* @tc.number : Acts_Ams_test_0700
* @tc.name : removeMission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
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 + ']' );
console.info('Acts_Ams_test_0700 removeMission data [' + info + ']');
expect(info).assertLarger(0);
done();
})
/*
* @tc.number : Acts_Ams_test_1100
* @tc.name : moveMissionToTop : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_1100', 0, async function (done) {
var maxnum = 10;
var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum);
var info = await abilitymanager.moveMissionToTop(result[0].id);
console.info('============== moveMissionToTop data [' + info + ']' );
console.info('Acts_Ams_test_1100 moveMissionToTop data [' + info + ']');
expect(info).assertEqual(0);
done();
})
/*
* @tc.number : Acts_Ams_test_1300
* @tc.name : removeMissions: Remove Missions
* @tc.desc : Remove Missions(by Promise)
*/
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 + ']' );
console.info('Acts_Ams_test_1300 removeMissions data [' + info + ']');
expect(info).assertLarger(0);
done();
})
/*
* @tc.number : Acts_Ams_test_0900
* @tc.name : clearMissions: Clear Missions
* @tc.desc : Clear Missions(by Promise)
*/
it('Acts_Ams_test_0900', 0, async function (done) {
var info = await abilitymanager.clearMissions();
console.info('============== clearMissions data [' + info + ']' );
console.info('Acts_Ams_test_0900 clearMissions data [' + info + ']');
expect(info).assertLarger(0);
done();
})
/*
* @tc.number : Acts_Ams_test_1500
* @tc.name : killProcessesByBundleName : Kill Processes By BundleName
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it('Acts_Ams_test_1500', 0, async function (done) {
var info = await abilitymanager.killProcessesByBundleName('com.ix.simulate.feature');
console.info('============== killProcessesByBundleName data [' + info + ']' );
console.info('Acts_Ams_test_1500 killProcessesByBundleName data [' + info + ']');
expect(info).assertEqual(0);
done();
})
......
......@@ -12,7 +12,19 @@
# 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"
ohos_js_hap_suite("ActsAmsTestFourthSceneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsTestFourthSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
......@@ -2,14 +2,18 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "21600000",
"test-timeout": "120000",
"package": "com.example.actsamstestfourthscene",
"shell-timeout": "21600000"
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAmsTestFourthScene.hap"
"ActsAmsTestFourthSceneTest.hap",
"simulateFAbilityFir.hap",
"simulateEAbility.hap",
"verifyAAbility.hap",
"verifyIAbility.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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
......@@ -13,7 +13,10 @@
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
......@@ -29,9 +32,7 @@ export default {
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')
......
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
......@@ -12,7 +12,19 @@
# 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"
ohos_js_hap_suite("ActsAmsTestSecondSceneTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAmsTestSecondSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册