提交 aa542986 编写于 作者: J jy

add configuration test

Signed-off-by: Njy <jiyong@huawei.com>
上级 9ba56df7
......@@ -13,14 +13,14 @@
* limitations under the License.
*/
import commonEvent from '@ohos.commonEvent';
import ability_featureAbility from '@ohos.ability.featureAbility';
import abilityFeatureAbility from '@ohos.ability.featureAbility';
export default {
onCreate() {
commonEvent.publish("ApplicationMainAbility1_onCreate",()=>{
console.log("ApplicationMainAbility1_onCreate publish callBack ApplicationMainAbility1_onCreate");
});
setTimeout(()=>{
ability_featureAbility.terminateSelf().then((data)=>{
abilityFeatureAbility.terminateSelf().then((data)=>{
console.log("ApplicationMainAbility2 terminateSelf data:" + JSON.stringify(data) )
}).catch((error)=>{
console.log("ApplicationMainAbility2 terminateSelf error:" + JSON.stringify(error) )
......
......@@ -13,7 +13,6 @@
* limitations under the License.
*/
import ability_featureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
export default {
......@@ -22,14 +21,6 @@ export default {
console.log("ApplicationMainAbility2_onCreate publish callBack ApplicationMainAbility2_onCreate");
});
console.info("ApplicationMainAbility2 onCreate");
// setTimeout(()=>{
// console.info("ApplicationMainAbility2 terminateSelf");
// ability_featureAbility.terminateSelf().then((data)=>{
// console.log("ApplicationMainAbility2 terminateSelf data:" + JSON.stringify(data) )
// }).catch((error)=>{
// console.log("ApplicationMainAbility2 terminateSelf error:" + JSON.stringify(error) )
// })
// },1000);
},
onDestroy() {
console.log("singletonEntryAbulity_onDestroy222");
......@@ -37,11 +28,5 @@ export default {
console.log("singletonEntryAbulity2_onDestroy publish callBack singletonEntryAbulity2onDestroy");
});
},
// onForgeGround(){
// console.log("singletonEntryAbulity_onForgeGround");
// commonEvent.publish("ApplicationMainAbility2_onForgeGround",()=>{
// console.log("ApplicationMainAbility2_onHide publish callBack ApplicationMainAbility2_onForgeGround");
// });
// }
};
......@@ -12,13 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ability_featureAbility from '@ohos.ability.featureAbility';
import abilityFeatureAbility from '@ohos.ability.featureAbility';
import commonEvent from '@ohos.commonEvent';
export default {
onCreate() {
console.info("Application onCreate MainAbility3");
setTimeout(()=>{
ability_featureAbility.terminateSelf().then((data)=>{
abilityFeatureAbility.terminateSelf().then((data)=>{
console.log("Application terminateSelf data:" + JSON.stringify(data) )
}).catch((error)=>{
console.log("Application terminateSelf data:" + JSON.stringify(error) )
......
......@@ -18,7 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
import missionManager from '@ohos.application.missionManager';
import featureAbility from '@ohos.ability.featureAbility';
import bundleManager from '@ohos.bundle';
import app_manager from "@ohos.application.appManager"
import appManager from "@ohos.application.appManager"
import commonEvent from '@ohos.commonEvent';
import {onDestroys} from "../MainAbility2/app.js"
import abilityManager from '@ohos.application.abilityManager'
......@@ -195,12 +195,12 @@ function fns(){
describe('AbilityDisableTests', function () {
let mainAbility1ListS = new Array()
let lists = new Array()
function subscriberCallBack_mainAbility2_Destory(err,data){
function subscriberCallBackMainAbility2Destory(err,data){
console.log("Subscribe2 CallBack data:" + JSON.stringify(data));
lists.push(data["event"]);
console.log("subscriberCallBack_mainAbility2_Destory lists:"+lists);
console.log("subscriberCallBackMainAbility2Destory lists:"+lists);
};
function subscriberCallBack_mainAbility1_Destory(err,data){
function subscriberCallBackMainAbility1Destory(err,data){
console.log("Subscribe3 CallBack data:" + JSON.stringify(data));
mainAbility1ListS.push(data["event"])
console.log("subscriberCallBack_mainAbility3_Destory mainAbility1ListS:"+mainAbility1ListS);
......@@ -242,13 +242,13 @@ describe('AbilityDisableTests', function () {
console.log("Create Subscriber2=======>:"+JSON.stringify(data));
Subscriber2 = data;
console.log("data2 is:" + JSON.stringify(Subscriber2));
await commonEvent.subscribe(Subscriber2,subscriberCallBack_mainAbility2_Destory)
await commonEvent.subscribe(Subscriber2,subscriberCallBackMainAbility2Destory)
});
commonEvent.createSubscriber(ability1LifeEvents).then(async (data)=>{
console.log("Create Subscriber1=======>:"+JSON.stringify(data));
Subscriber1 = data;
console.log("data2 is:" + JSON.stringify(Subscriber1));
await commonEvent.subscribe(Subscriber1,subscriberCallBack_mainAbility1_Destory)
await commonEvent.subscribe(Subscriber1,subscriberCallBackMainAbility1Destory)
});
setTimeout(()=>{
featureAbility.startAbility({ want: {
......@@ -269,13 +269,14 @@ describe('AbilityDisableTests', function () {
});
},1000);
setTimeout(()=>{
console.log("1111subscriberCallBack_mainAbility2_Destory lists:"+lists);
console.log("1111subscriberCallBackMainAbility2Destory lists:"+lists);
expect(lists.indexOf(JSON.stringify("singletonEntryAbulity2_onShow"))!=-1).assertTrue();
expect(lists.indexOf(JSON.stringify("ApplicationMainAbility2_onCreate"))!=-1).assertTrue();
},2500)
setTimeout(()=>{
missionManager.getMissionInfos("", 100, (err, data) => {
console.log('SUB_AA_OpenHarmony_MoveMissionToFront_2900 getMissionInfos errCode: '+ JSON.stringify(err) + " data: " + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_MoveMissionToFront_2900 getMissionInfos errCode: '+
JSON.stringify(err) + " data: " + JSON.stringify(data));
for (var i = 0;i < data.length; i++) {
if(data[i].want["abilityName"] == "com.example.abilitydisable.MainAbility2"){
mainAbility1missinds.push(data[i]["missionId"])
......@@ -298,7 +299,7 @@ describe('AbilityDisableTests', function () {
});
},3888);
setTimeout(()=>{
console.log("1111subscriberCallBack_mainAbility1_Destory lists:"+ mainAbility1ListS);
console.log("1111subscriberCallBackMainAbility1Destory lists:"+ mainAbility1ListS);
expect(mainAbility1ListS.indexOf(JSON.stringify("singletonEntrymainAb" +
"ility1ListSAbulity1_onInactive"))!=-1).assertTrue();
expect(mainAbility1ListS.indexOf(JSON.stringify("singletonEntryA" +
......@@ -322,13 +323,13 @@ describe('AbilityDisableTests', function () {
console.log("Create Subscriber2=======>:"+JSON.stringify(data));
Subscriber2 = data;
console.log("data2 is:" + JSON.stringify(Subscriber2));
await commonEvent.subscribe(Subscriber2,subscriberCallBack_mainAbility2_Destory)
await commonEvent.subscribe(Subscriber2,subscriberCallBackMainAbility2Destory)
});
commonEvent.createSubscriber(ability1LifeEvents).then(async (data)=>{
console.log("Create Subscriber1=======>:"+JSON.stringify(data));
Subscriber1 = data;
console.log("data2 is:" + JSON.stringify(Subscriber1));
await commonEvent.subscribe(Subscriber1,subscriberCallBack_mainAbility1_Destory)
await commonEvent.subscribe(Subscriber1,subscriberCallBackMainAbility1Destory)
});
setTimeout(()=>{
......@@ -350,7 +351,8 @@ describe('AbilityDisableTests', function () {
});
},1000);
setTimeout(()=>{
console.log("1111subscriberCallBack_mainAbility2_lists:singletonEntryAbulity2_onShow:"+lists);
console.log("1111subscriberCallBack_mainAbility2_lists:
singletonEntryAbulity2_onShow:"+lists);
console.log("+++++++++++++++++"+lists.indexOf("singletonEntryAbulity2_onShow")+"+++++++"+lists.indexOf("ApplicationMainAbility2_onCreate")+lists)
expect(lists.indexOf(JSON.stringify("singletonEntryAbulity2_onShow"))!=-1).assertTrue();
expect(lists.indexOf(JSON.stringify("ApplicationMainAbility2_onCreate"))!=-1).assertTrue();
......@@ -372,9 +374,11 @@ describe('AbilityDisableTests', function () {
console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000 moveMissionToFront dataCode:++++++');
missionManager.moveMissionToFront(parseInt(mainAbility1missinds[0]),{
parameters:{ "windowMode":100 }}).then((data)=>{
console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000 moveMissionToFront dataCode:'+ " data:" + JSON.stringify(data));
console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000
moveMissionToFront dataCode:'+ " data:" + JSON.stringify(data));
}).catch((err)=>{
console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000 moveMissionToFront errCode:'+ " err:" + JSON.stringify(err));
console.log('SUB_AA_OpenHarmony_MoveMissionToFront_3000
moveMissionToFront errCode:'+ " err:" + JSON.stringify(err));
});
},3888);
setTimeout(()=>{
......@@ -383,4 +387,4 @@ describe('AbilityDisableTests', function () {
},3999);
done();
});
})
\ No newline at end of file
})
......@@ -16,15 +16,16 @@
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import missionManager from '@ohos.application.missionManager';
import ability_featureAbility from '@ohos.ability.featureAbility';
import abilityFeatureAbility from '@ohos.ability.featureAbility';
import bundleManager from '@ohos.bundle';
import app_manager from "@ohos.application.appManager"
import appManager from "@ohos.application.appManager"
import commonEvent from '@ohos.commonEvent';
import {onDestroys} from "../MainAbility2/app.js"
import abilityManager from '@ohos.application.abilityManager'
import ConfigurationConstant from "@ohos.application.ConfigurationConstant";
import AbilityConstant from '@ohos.application.AbilityConstant'
describe('AbilityDisableTests', function () {
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6200
* @tc.name Verify the enumeration values LaunchReason. CONTINUATION
......@@ -32,11 +33,12 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it("SUB_AA_OpenHarmony_AbilityStart_6200", 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6300-------------------");
console.info("--------logMessage SUB_AA_OpenHarmony_AbilityStart_6300----");
console.info("SUB_AA_OpenHarmony_AbilityStart_6200 LaunchReason.CONTINUATION: " + AbilityConstant.LaunchReason.CONTINUATION);
expect(AbilityConstant.LaunchReason.CONTINUATION==3).assertTrue();
done();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6300
* @tc.name Verify the enumeration value launchreason.start UNKNOWN
......@@ -44,11 +46,13 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it("SUB_AA_OpenHarmony_AbilityStart_6300", 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6300-------------------");
console.info("SUB_AA_OpenHarmony_AbilityStart_6300 LaunchReason.UNKNOWN: " + AbilityConstant.LaunchReason.UNKNOWN);
console.info("--------logMessage SUB_AA_OpenHarmony_AbilityStart_6300----");
console.info("SUB_AA_OpenHarmony_AbilityStart_6300 LaunchReason.UNKNOWN: " +
AbilityConstant.LaunchReason.UNKNOWN);
expect(AbilityConstant.LaunchReason.UNKNOWN==0).assertTrue();
done();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6400
* @tc.name Verify the enumeration value launchreason.START_ABILITY
......@@ -56,11 +60,12 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it("SUB_AA_OpenHarmony_AbilityStart_6400", 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6400-------------------");
console.info("------logMessage SUB_AA_OpenHarmony_AbilityStart_6400-----");
console.info("SUB_AA_OpenHarmony_AbilityStart_6400 LaunchReason.START_ABILITY: " + AbilityConstant.LaunchReason.START_ABILITY);
expect(AbilityConstant.LaunchReason.START_ABILITY==1).assertTrue();
done();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6500
* @tc.name Verify the enumeration values LaunchReason. CALL
......@@ -68,11 +73,13 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it("SUB_AA_OpenHarmony_AbilityStart_6500", 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6500-------------------");
console.info("SUB_AA_OpenHarmony_AbilityStart_6500 LaunchReason.CALL: " + AbilityConstant.LaunchReason.CALL);
console.info("-------logMessage SUB_AA_OpenHarmony_AbilityStart_6500-----");
console.info("SUB_AA_OpenHarmony_AbilityStart_6500 LaunchReason.CALL: " +
AbilityConstant.LaunchReason.CALL);
expect(AbilityConstant.LaunchReason.CALL==2).assertTrue();
done();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6600
* @tc.name Verify the enumeration values LastExitReason.UNKNOWN
......@@ -80,11 +87,13 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it("SUB_AA_OpenHarmony_AbilityStart_6600", 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6600-------------------");
console.info("SUB_AA_OpenHarmony_AbilityStart_6600 LastExitReason.UNKNOWN: " + AbilityConstant.LastExitReason.UNKNOWN);
console.info("---------logMessage SUB_AA_OpenHarmony_AbilityStart_6600---------");
console.info("SUB_AA_OpenHarmony_AbilityStart_6600 LastExitReason.UNKNOWN: " +
AbilityConstant.LastExitReason.UNKNOWN);
expect(AbilityConstant.LastExitReason.UNKNOWN==0).assertTrue();
done();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6700
* @tc.name Verify the enumeration values LastExitReason.ABILITY_NOT_RESPONDING
......@@ -92,11 +101,12 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it("SUB_AA_OpenHarmony_AbilityStart_6700", 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6700-------------------");
console.info("--------logMessage SUB_AA_OpenHarmony_AbilityStart_6700---------");
console.info("SUB_AA_OpenHarmony_AbilityStart_6700 LastExitReason.ABILITY_NOT_RESPONDING: " + AbilityConstant.LastExitReason.ABILITY_NOT_RESPONDING);
expect(AbilityConstant.LastExitReason.ABILITY_NOT_RESPONDING==1).assertTrue();
done();
});
/*
* @tc.number SUB_AA_OpenHarmony_AbilityStart_6700
* @tc.name Verify the enumeration values LastExitReason.NORMAL
......@@ -104,9 +114,10 @@ describe('AbilityDisableTests', function () {
* @tc.level 0
*/
it("SUB_AA_OpenHarmony_AbilityStart_6800", 0, async function (done) {
console.info("------------------logMessage SUB_AA_OpenHarmony_AbilityStart_6800-------------------");
console.info("SUB_AA_OpenHarmony_AbilityStart_6800 LastExitReason.NORMAL: " + AbilityConstant.LastExitReason.NORMAL);
console.info("-----logMessage SUB_AA_OpenHarmony_AbilityStart_6800-----------");
console.info("SUB_AA_OpenHarmony_AbilityStart_6800 LastExitReason.NORMAL: " +
AbilityConstant.LastExitReason.NORMAL);
expect(AbilityConstant.LastExitReason.NORMAL==2).assertTrue();
done();
});
})
\ No newline at end of file
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册