未验证 提交 64e2dbcc 编写于 作者: O openharmony_ci 提交者: Gitee

!4287 元能力失败用例适配

Merge pull request !4287 from chengxingzhen/OpenHarmony-3.1-Release
......@@ -31,8 +31,7 @@ describe('ActsAmsCallBackFifthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code' + error.code);
}
);
......@@ -48,8 +47,7 @@ describe('ActsAmsCallBackFifthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code' + error.code);
}
);
......@@ -65,8 +63,7 @@ describe('ActsAmsCallBackFifthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code' + error.code);
}
);
setTimeout(done, 5000);
......@@ -98,8 +95,7 @@ describe('ActsAmsCallBackFifthScene', function () {
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code ' + error.code);
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (let i = 0; i < info.length; i++) {
......@@ -110,7 +106,7 @@ describe('ActsAmsCallBackFifthScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......@@ -120,4 +116,4 @@ describe('ActsAmsCallBackFifthScene', function () {
);
setTimeout(timeout, 5000);
})
})
\ No newline at end of file
})
......@@ -31,8 +31,7 @@ describe('ActsAmsCallBackFirstScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code ' + error.code);
}
);
done();
......@@ -64,8 +63,7 @@ describe('ActsAmsCallBackFirstScene', function () {
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code ' + error.code);
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
......@@ -76,7 +74,7 @@ describe('ActsAmsCallBackFirstScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......
......@@ -31,8 +31,7 @@ describe('ActsAmsCallBackFourthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code ' + error.code);
}
);
......@@ -48,8 +47,7 @@ describe('ActsAmsCallBackFourthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code ' + error.code);
}
);
......@@ -65,8 +63,7 @@ describe('ActsAmsCallBackFourthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code ' + error.code);
}
);
......@@ -82,8 +79,7 @@ describe('ActsAmsCallBackFourthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code ' + error.code);
}
);
done();
......@@ -115,8 +111,7 @@ describe('ActsAmsCallBackFourthScene', function () {
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code ' + error.code);
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (let i = 0; i < info.length; i++) {
......@@ -127,7 +122,7 @@ describe('ActsAmsCallBackFourthScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......
......@@ -31,8 +31,7 @@ describe('ActsAmsCallBackSecondScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackSecondScene VerifyIoThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackSecondScene VerifyIoThirdAbility start:' + error.code)
}
);
......@@ -48,8 +47,7 @@ describe('ActsAmsCallBackSecondScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code ' + error.code);
}
);
done();
......@@ -81,8 +79,7 @@ describe('ActsAmsCallBackSecondScene', function () {
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code ' + error.code);
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (let i = 0; i < info.length; i++) {
......@@ -93,7 +90,7 @@ describe('ActsAmsCallBackSecondScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......
......@@ -31,8 +31,7 @@ describe('ActsAmsCallBackThirdScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code ' + error.code);
}
);
......@@ -48,8 +47,7 @@ describe('ActsAmsCallBackThirdScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code' + error.code);
}
);
done();
......@@ -75,8 +73,7 @@ describe('ActsAmsCallBackThirdScene', function () {
console.info("sleep end");
appManager.getProcessRunningInfos(
(error, info) => {
console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code ' + error.code);
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (let i = 0; i < info.length; i++) {
......@@ -87,7 +84,7 @@ describe('ActsAmsCallBackThirdScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......
......@@ -16,28 +16,6 @@ import featureAbility from '@ohos.ability.featureAbility'
import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
let abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
"com.example.SimulateFeatureAbilityFir",
"com.example.SimulateFeatureAbilitySed",
"com.example.VerifyIoThirdAbility",
"com.example.actsamstestfifthscene.MainAbility"
]
let bundleNameList = [
"com.ohos.launcher",
"com.ohos.systemui",
"com.ohos.callui",
"com.ohos.contacts",
"com.ohos.mms",
"com.ohos.telephonydataability",
"com.ohos.contactsdataability",
"com.ix.simulate.feature",
"com.ix.verify.io",
"com.example.actsamstestfifthscene"
]
describe('ActsAmsTestFifthScene', function () {
console.info('----ActsAmsTestFifthScene----');
beforeAll(async function (done) {
......@@ -58,8 +36,7 @@ describe('ActsAmsTestFifthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code ' + error.code);
}
);
......@@ -80,8 +57,7 @@ describe('ActsAmsTestFifthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code ' + error.code);
}
);
......@@ -102,8 +78,7 @@ describe('ActsAmsTestFifthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code' + error.code);
}
);
done();
......@@ -144,7 +119,7 @@ describe('ActsAmsTestFifthScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......
......@@ -36,8 +36,7 @@ describe('ActsAmsTestFirstScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code ' + error.code);
}
);
done();
......@@ -78,7 +77,7 @@ describe('ActsAmsTestFirstScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......
......@@ -36,8 +36,7 @@ describe('ActsAmsTestFourthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code ' + error.code);
}
);
......@@ -58,8 +57,7 @@ describe('ActsAmsTestFourthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code' + error.code);
}
);
......@@ -80,8 +78,7 @@ describe('ActsAmsTestFourthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestFourthScene VerifyActThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestFourthScene VerifyActThirdAbility start, error.code' + error.code);
}
);
......@@ -102,8 +99,7 @@ describe('ActsAmsTestFourthScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestFourthScene SimulateEntryAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestFourthScene SimulateEntryAbility start, error.code ' + error.code);
}
);
done();
......@@ -144,7 +140,7 @@ describe('ActsAmsTestFourthScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......
......@@ -36,8 +36,7 @@ describe('ActsAmsTestSecondScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code ' + error.code);
}
);
......@@ -58,8 +57,8 @@ describe('ActsAmsTestSecondScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code ' + error.code);
}
);
done();
......@@ -100,7 +99,7 @@ describe('ActsAmsTestSecondScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......
......@@ -37,8 +37,7 @@ describe('ActsAmsTestThirdScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code ' + error.code);
}
);
......@@ -59,8 +58,7 @@ describe('ActsAmsTestThirdScene', function () {
{},
},
}, (error, data) => {
console.info('ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code \
' + error.code + ', data length [' + data.length + ']');
console.info('ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code ' + error.code);
}
);
done();
......@@ -102,7 +100,7 @@ describe('ActsAmsTestThirdScene', function () {
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
expect(info[i].bundleNames.length).assertEqual(0);
expect(info[i].bundleNames.length).assertLarger(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
......
......@@ -99,7 +99,7 @@ describe('ActsStServiceAbilityTest', function () {
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_AAbilityStartSetting_0100 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(2097152).assertEqual(err.code);
expect(1).assertEqual(err.code);
done();
});
}catch(error){
......@@ -137,7 +137,7 @@ describe('ActsStServiceAbilityTest', function () {
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_AAbilityStartSettingNew_0200 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(2097152).assertEqual(err.code);
expect(1).assertEqual(err.code);
done();
});
}catch(error){
......@@ -175,7 +175,7 @@ it("ACTS_AAbilityStartSettingNew_0300",0, async function(done){
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_AAbilityStartSettingNew_0300 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(2097152).assertEqual(err.code);
expect(1).assertEqual(err.code);
done();
});
}catch(error){
......@@ -213,7 +213,7 @@ it("ACTS_AAbilityStartSettingNew_0400",0, async function(done){
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_AAbilityStartSettingNew_0400 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(2097152).assertEqual(err.code);
expect(1).assertEqual(err.code);
done();
});
}catch(error){
......@@ -251,7 +251,7 @@ it("ACTS_AAbilityStartSettingNew_0500",0, async function(done){
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_AAbilityStartSettingNew_0500 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(2097152).assertEqual(err.code);
expect(1).assertEqual(err.code);
done();
});
}catch(error){
......
......@@ -55,11 +55,24 @@ describe('CoverApiTest', function () {
"test":11,
"test3":true
}
var result = formBindingData.createFormBindingData(dataObj)
console.log(TAG + " result is : " + JSON.stringify(result))
expect(JSON.stringify(result)).
assertEqual(JSON.stringify(
{"data":"{\"temperature\":\"11c\",\"time\":\"11:00\",\"test\":11,\"test3\":true}"}));
var formData = formBindingData.createFormBindingData(dataObj)
console.info(TAG + " result is : " + JSON.stringify(formData))
let formDataStr = JSON.stringify(formData.data);
let formDataStrToObj = JSON.parse(formDataStr);
if (typeof(formDataStrToObj) == "string" ) {
console.info(TAG + " formDataStrToObj1 is : " + typeof formDataStrToObj)
let formDataStrToObj2 = JSON.parse(formDataStrToObj)
console.info(TAG + " formDataStrToObj2 is : " + typeof formDataStrToObj2)
expect(formDataStrToObj2.test).assertEqual(11)
expect(formDataStrToObj2.test3).assertTrue()
expect(formDataStrToObj2.time).assertEqual("11:00")
} else {
console.info(TAG + " formDataStrToObj is : " + typeof formDataStrToObj)
expect(formDataStrToObj.test).assertEqual(11)
expect(formDataStrToObj.test3).assertTrue()
expect(formDataStrToObj.time).assertEqual("11:00")
}
done();
console.info('------------end SUB_AA_OpenHarmony_FormBase_1000-------------');
});
......
......@@ -16,73 +16,48 @@ import featureAbility from '@ohos.ability.featureAbility'
import wantconstant from '@ohos.ability.wantConstant'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import commonEvent from '@ohos.commonEvent'
import notification from '@ohos.notification';
import wantAgent from '@ohos.wantAgent';
import particleAbility from '@ohos.ability.particleAbility'
import backgroundTaskManager from '@ohos.backgroundTaskManager'
const START_ABILITY_TIMEOUT = 4000;
const TERMINATE_ABILITY_TIMEOUT = 1000;
const TIMEOUT = 1000;
var subscriberInfo_ACTS_StartAbility_0100 = {
let subscriberInfoActsStartAbility0100 = {
events: ["ACTS_StartAbility_0100_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbility_0200 = {
let subscriberInfoActsStartAbility0200 = {
events: ["ACTS_StartAbility_0200_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbility_0300 = {
let subscriberInfoActsStartAbility0300 = {
events: ["ACTS_StartAbility_0300_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbility_0400 = {
let subscriberInfoActsStartAbility0400 = {
events: ["ACTS_StartAbility_0400_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbility_0500 = {
let subscriberInfoActsStartAbility0500 = {
events: ["ACTS_StartAbility_0500_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbility_0600 = {
let subscriberInfoActsStartAbility0600 = {
events: ["ACTS_StartAbility_0600_CommonEvent"],
};
var subscriberInfoStartAbilityTen = {
let subscriberInfoStartAbilityTen = {
events: ["ACTS_StartAbility_1000_CommonEvent"],
};
var subscriberInfoStartAbilityThirteen = {
let subscriberInfoStartAbilityThirteen = {
events: ["ACTS_StartAbility_1300_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbilityForResult_0100 = {
events: ["ACTS_StartAbilityForResult_0100_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbilityForResult_0200 = {
events: ["ACTS_StartAbilityForResult_0200_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbilityForResult_0300 = {
events: ["ACTS_StartAbilityForResult_0300_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbilityForResult_0400 = {
events: ["ACTS_StartAbilityForResult_0400_CommonEvent"],
};
var subscriberInfo_ACTS_StartAbilityForResult_0500 = {
events: ["ACTS_StartAbilityForResult_0500_CommonEvent"],
};
var subscriberInfoStartAbilityForResultSix = {
events: ["ACTS_StartAbilityForResult_0600_CommonEvent"],
};
var subscriberInfo_ACTS_TerminateAbility_0100 = {
events: ["ACTS_TerminateAbility_0100_CommonEvent",
"ACTS_TerminateAbility_0100_Return"],
};
var subscriberInfoTerminateAbilityTwo = {
let subscriberInfoTerminateAbilityTwo = {
events: ["ACTS_TerminateAbility_0200_CommonEvent",
"ACTS_TerminateAbility_0200_Return"],
};
var subscriberInfo_ACTS_FinishWithResult_0100 = {
events: ["ACTS_FinishWithResult_0100_CommonEvent"],
};
var subscriberInfo_ACTS_GetCallingBundle_0100 = {
let subscriberInfoActsGetCallingBundle0100 = {
events: ["ACTS_GetCallingBundle_0100_CommonEvent",
"com.example.actsfeatureabilitytest.promise",
"com.example.actsfeatureabilitytest.callback"],
};
function sleep(time) {
return new Promise((resolve)=>setTimeout(resolve,time));
}
describe('ActsFeatureAbilityTest', function () {
beforeAll(function() {
......@@ -121,344 +96,6 @@ describe('ActsFeatureAbilityTest', function () {
setTimeout(() => {}, 500);
})
/*
* @tc.name:Acts_ContinuousTask_0100
* @tc.desc:verify new startBackgroundrunning interface promise mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7U AR000GH6ER AR000GH6EM AR000GH6EN AR000GH6EO
*/
it("Acts_ContinuousTask_0100", 0, async function (done) {
console.log("Acts_ContinuousTask_0100 start");
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.actsfeatureabilitytest",
abilityName: "com.example.actsfeatureabilitytest.MainAbility"
}
],
operationType: 2,
requestCode: 0,
wantAgentFlags: [3]
};
wantAgent.getWantAgent(wantAgentInfo).then((data) => {
backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(),
backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data).then(() => {
console.log("Acts_ContinuousTask_0100 startBackgroundRunning success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}).catch((err) => {
expect(false).assertTrue();
console.log("Acts_ContinuousTask_0100 startBackgroundRunning failure");
setTimeout(() => {
done();
}, 500);
});
});
})
/*
* @tc.name:Acts_ContinuousTask_0200
* @tc.desc:verify new startBackgroundrunning interface callback mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7T AR000GH6ER AR000GH6EP AR000GJ9PR AR000GH6G8
*/
it("Acts_ContinuousTask_0200", 0, async function (done) {
console.log("Acts_ContinuousTask_0200 start");
function conTaskCallback(err, data) {
if (err) {
console.info('Acts_ContinuousTask_0200 startBackgroundRunning failed');
expect(false).assertTrue();
} else {
console.info('Acts_ContinuousTask_0200 startBackgroundRunning succeed');
expect(true).assertTrue();
}
setTimeout(()=>{
done();
}, 500);
}
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.actsfeatureabilitytest",
abilityName: "com.example.actsfeatureabilitytest.MainAbility"
}
],
operationType: 2,
requestCode: 0,
wantAgentFlags: [3]
};
wantAgent.getWantAgent(wantAgentInfo).then((data) => {
backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(),
backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data, conTaskCallback);
});
})
/*
* @tc.name:Acts_ContinuousTask_0300
* @tc.desc:verify old startBackgroundrunning interface promise mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7V AR000GH6ER AR000GH6EM AR000GH6G9 AR000GH56K
*/
it("Acts_ContinuousTask_0300", 0, async function (done) {
console.log("Acts_ContinuousTask_0300 start");
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.actsfeatureabilitytest",
abilityName: "com.example.actsfeatureabilitytest.MainAbility"
}
],
operationType: 2,
requestCode: 0,
wantAgentFlags: [3]
};
wantAgent.getWantAgent(wantAgentInfo).then((data) => {
let basicContent = {
title: "title",
text: "text"
};
let notificationContent = {
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: basicContent
};
let request = {
content: notificationContent,
wantAgent: data
}
let id = 1;
particleAbility.startBackgroundRunning(id, request).then((data) => {
console.log("Acts_ContinuousTask_0300 startBackgroundRunning success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}).catch((err) => {
expect(false).assertTrue();
console.log("Acts_ContinuousTask_0300 startBackgroundRunning failure");
setTimeout(() => {
done();
}, 500);
});
});
})
/*
* @tc.name:Acts_ContinuousTask_0400
* @tc.desc:verify old startBackgroundrunning interface callback mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT81 AR000GH6ER AR000GH6EM AR000GH6G9 AR000GH6ET
*/
it("Acts_ContinuousTask_0400", 0, async function (done) {
console.log("Acts_ContinuousTask_0400 start");
function conTaskCallback(err, data) {
if (err) {
console.info('Acts_ContinuousTask_0400 startBackgroundRunning failure');
expect(false).assertTrue();
} else {
console.info('Acts_ContinuousTask_0400 startBackgroundRunning success');
expect(true).assertTrue();
}
setTimeout(()=>{
done();
}, 500);
}
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.actsfeatureabilitytest",
abilityName: "com.example.actsfeatureabilitytest.MainAbility"
}
],
operationType: 2,
requestCode: 0,
wantAgentFlags: [3]
};
wantAgent.getWantAgent(wantAgentInfo).then((data) => {
let basicContent = {
title: "title",
text: "text"
};
let notificationContent = {
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: basicContent
};
let request = {
content: notificationContent,
wantAgent: data
}
let id = 1;
particleAbility.startBackgroundRunning(id, request, conTaskCallback);
});
})
/*
* @tc.name:Acts_ContinuousTask_0500
* @tc.desc:verify new api stopBackgroundrunning interface promise mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7U AR000GH6ES AR000GH6EM AR000GH6EN AR000GH6EO
*/
it("Acts_ContinuousTask_0500", 0, async function (done) {
console.log("Acts_ContinuousTask_0500 start");
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.actsfeatureabilitytest",
abilityName: "com.example.actsfeatureabilitytest.MainAbility"
}
],
operationType: 2,
requestCode: 0,
wantAgentFlags: [3]
};
wantAgent.getWantAgent(wantAgentInfo).then((data) => {
backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(),
backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data).then((data) => {
backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then((data) => {
console.log("Acts_ContinuousTask_0500 cancelBackgroundRunning success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}).catch((err) => {
expect(false).assertTrue();
console.log("Acts_ContinuousTask_0500 cancelBackgroundRunning failure");
setTimeout(() => {
done();
}, 500);
});
})
});
})
/*
* @tc.name:Acts_ContinuousTask_0600
* @tc.desc:verify new api stopBackgroundrunning interface callback mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7T AR000GH6ES AR000GH6EP AR000GJ9PR AR000GH6G8
*/
it("Acts_ContinuousTask_0600", 0, async function (done) {
console.log("Acts_ContinuousTask_0600 start");
function conTaskCallback(err, data) {
if (err) {
console.info('Acts_ContinuousTask_0600 startBackgroundRunning failure');
expect(false).assertTrue();
} else {
console.info('Acts_ContinuousTask_0600 startBackgroundRunning success');
expect(true).assertTrue();
}
setTimeout(()=>{
done();
}, 500);
}
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.actsfeatureabilitytest",
abilityName: "com.example.actsfeatureabilitytest.MainAbility"
}
],
operationType: 2,
requestCode: 0,
wantAgentFlags: [3]
};
wantAgent.getWantAgent(wantAgentInfo).then((data) => {
backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(),
backgroundTaskManager.BackgroundMode.DATA_TRANSFER, data).then((data) => {
backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext(), conTaskCallback);
})
});
})
/*
* @tc.name:Acts_ContinuousTask_0700
* @tc.desc:verify old api cancelBackgroundrunning interface promise mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT7V AR000GH6ES AR000GH6EM AR000GH6G9 AR000GH56K
*/
it("Acts_ContinuousTask_0700", 0, async function (done) {
console.log("Acts_ContinuousTask_0700 start");
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.actsfeatureabilitytest",
abilityName: "com.example.actsfeatureabilitytest.MainAbility"
}
],
operationType: 2,
requestCode: 0,
wantAgentFlags: [3]
};
await wantAgent.getWantAgent(wantAgentInfo).then((data) => {
particleAbility.startBackgroundRunning(data);
setTimeout(()=>{
}, 500);
});
particleAbility.cancelBackgroundRunning().then(() => {
console.log("Acts_ContinuousTask_0700 cancelBackgroundRunning success");
expect(true).assertTrue();
setTimeout(() => {
done();
}, 500);
}).catch( (err) => {
expect(false).assertTrue();
console.log("Acts_ContinuousTask_0700 cancelBackgroundRunning failure");
setTimeout(() => {
done();
}, 500);
});
})
/*
* @tc.name:Acts_ContinuousTask_0800
* @tc.desc:verify old cancelBackgroundrunning interface callback mode work properly
* @tc.type: FUNC
* @tc.require: SR000GGT81 AR000GH6ES AR000GH6EM AR000GH6G9 AR000GH6ET
*/
it("Acts_ContinuousTask_0800", 0, async function (done) {
console.log("Acts_ContinuousTask_0800 start");
function conTaskCallback(err, data) {
if (err) {
console.info('Acts_ContinuousTask_0800 startBackgroundRunning failure');
expect(false).assertTrue();
} else {
console.info('Acts_ContinuousTask_0800 startBackgroundRunning success');
expect(true).assertTrue();
}
setTimeout(()=>{
done();
}, 500);
}
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.actsfeatureabilitytest",
abilityName: "com.example.actsfeatureabilitytest.MainAbility"
}
],
operationType: 2,
requestCode: 0,
wantAgentFlags: [3]
};
await wantAgent.getWantAgent(wantAgentInfo).then((data) => {
particleAbility.startBackgroundRunning(data);
setTimeout(()=>{
}, 500);
});
particleAbility.cancelBackgroundRunning(conTaskCallback);
})
/**
* @tc.number: ACTS_wantConstant_0100
* @tc.name: wantConstant : Check specific enum
......@@ -469,8 +106,10 @@ describe('ActsFeatureAbilityTest', function () {
expect(wantconstant.Action.ACTION_DIAL).assertEqual("ohos.want.action.dial");
expect(wantconstant.Action.ACTION_SEARCH).assertEqual("ohos.want.action.search");
expect(wantconstant.Action.ACTION_WIRELESS_SETTINGS).assertEqual("ohos.settings.wireless");
expect(wantconstant.Action.ACTION_MANAGE_APPLICATIONS_SETTINGS).assertEqual("ohos.settings.manage.applications");
expect(wantconstant.Action.ACTION_APPLICATION_DETAILS_SETTINGS).assertEqual("ohos.settings.application.details");
expect(wantconstant.Action.ACTION_MANAGE_APPLICATIONS_SETTINGS)
.assertEqual("ohos.settings.manage.applications");
expect(wantconstant.Action.ACTION_APPLICATION_DETAILS_SETTINGS)
.assertEqual("ohos.settings.application.details");
expect(wantconstant.Action.ACTION_SET_ALARM).assertEqual("ohos.want.action.setAlarm");
expect(wantconstant.Action.ACTION_SHOW_ALARMS).assertEqual("ohos.want.action.showAlarms");
expect(wantconstant.Action.ACTION_SNOOZE_ALARM).assertEqual("ohos.want.action.snoozeAlarm");
......@@ -503,7 +142,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by Promise)
*/
it('ACTS_GetContext_0100', 0, async function (done) {
var promise = await featureAbility.getContext()
let promise = await featureAbility.getContext()
expect(typeof (promise)).assertEqual("object");
done();
})
......@@ -514,14 +153,10 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by Promise)
*/
it('ACTS_HasWindowFocus_0100', 0, async function (done) {
var promise = featureAbility.hasWindowFocus();
expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.hasWindowFocus();
let info = await featureAbility.hasWindowFocus();
expect(info).assertEqual(true);
console.info('====> ACTS_HasWindowFocus_0100 end=====>')
done();
setTimeout(function () {
console.info('====> ACTS_HasWindowFocus_0100 =====>')
}, TIMEOUT)
})
/**
......@@ -530,18 +165,15 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_HasWindowFocus_0300', 0, async function (done) {
var result = featureAbility.hasWindowFocus(
let result = featureAbility.hasWindowFocus(
(err, data) => {
console.log("hasWindowFocus asyncCallback code: " + err.code + " data: " + data);
console.info("hasWindowFocus asyncCallback code: " + err.code + " data: " + data);
expect(err.code).assertEqual(0);
expect(data).assertTrue();
done()
}
);
console.info('AceApplication : hasWindowFocus : ' + result);
setTimeout(function () {
console.info('====> ACTS_HasWindowFocus_0300 =====>')
}, TIMEOUT)
})
/*
......@@ -553,7 +185,7 @@ describe('ActsFeatureAbilityTest', function () {
it("ACTS_StartAbility_1000",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1000-------------------");
try{
var Subscriber;
let Subscriber;
let id;
function SubscribeCallBack(err, data) {
......@@ -588,17 +220,17 @@ describe('ActsFeatureAbilityTest', function () {
abilityName: "com.example.startability.MainAbility",
uri: "xxxxx",
}
var StartAbilityParameter = {
let StartAbilityParameter = {
want:Want
}
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_1000 asyncCallback errCode : ' + JSON.stringify(err)
console.info('ACTS_StartAbility_1000 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code == 0).assertTrue();
});
}catch(error){
console.log("ACTS_StartAbility_1000 : error = " + error);
console.info("ACTS_StartAbility_1000 : error = " + error);
}
})
......@@ -608,7 +240,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by Promise)
*/
it('ACTS_StartAbility_0100', 0, async function (done) {
var Subscriber;
let Subscriber;
let id;
function SubscribeCallBack(err, data) {
......@@ -619,7 +251,7 @@ describe('ActsFeatureAbilityTest', function () {
done();
}
commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0100).then(async (data) => {
commonEvent.createSubscriber(subscriberInfoActsStartAbility0100).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
......@@ -638,7 +270,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = await featureAbility.startAbility(
let promise = await featureAbility.startAbility(
{
want:
{
......@@ -690,7 +322,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Pass the parameters, Check the return value of the interface (by Promise)
*/
it('ACTS_StartAbility_0200', 0, async function (done) {
var Subscriber;
let Subscriber;
let id;
function SubscribeCallBack(err, data) {
......@@ -701,7 +333,7 @@ describe('ActsFeatureAbilityTest', function () {
done();
}
commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0200).then(async (data) => {
commonEvent.createSubscriber(subscriberInfoActsStartAbility0200).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
......@@ -721,7 +353,7 @@ describe('ActsFeatureAbilityTest', function () {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug('=======wait id======');
var promise = await featureAbility.startAbility(
let promise = await featureAbility.startAbility(
{
want:
{
......@@ -784,7 +416,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Passing null, Check the return value of the interface (by Promise)
*/
it('ACTS_StartAbility_0300', 0, async function (done) {
var Subscriber;
let Subscriber;
let id;
function SubscribeCallBack(err, data) {
......@@ -795,7 +427,7 @@ describe('ActsFeatureAbilityTest', function () {
done();
}
commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0300).then(async (data) => {
commonEvent.createSubscriber(subscriberInfoActsStartAbility0300).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
......@@ -814,7 +446,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = await featureAbility.startAbility(
let promise = await featureAbility.startAbility(
{
want:
{
......@@ -866,7 +498,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_StartAbility_0400', 0, async function (done) {
var Subscriber;
let Subscriber;
let id;
function SubscribeCallBack(err, data) {
......@@ -877,7 +509,7 @@ describe('ActsFeatureAbilityTest', function () {
done();
}
commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0400).then(async (data) => {
commonEvent.createSubscriber(subscriberInfoActsStartAbility0400).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
......@@ -896,7 +528,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var result = featureAbility.startAbility(
let result = featureAbility.startAbility(
{
want:
{
......@@ -939,7 +571,7 @@ describe('ActsFeatureAbilityTest', function () {
},
},
(error, data) => {
console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data)
console.info('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data)
},
);
......@@ -951,7 +583,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Pass the parameters, Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_StartAbility_0500', 0, async function (done) {
var Subscriber;
let Subscriber;
let id;
function SubscribeCallBack(err, data) {
......@@ -962,7 +594,7 @@ describe('ActsFeatureAbilityTest', function () {
done();
}
commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0500).then(async (data) => {
commonEvent.createSubscriber(subscriberInfoActsStartAbility0500).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
......@@ -981,7 +613,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var result = featureAbility.startAbility(
let result = featureAbility.startAbility(
{
want:
{
......@@ -1035,7 +667,7 @@ describe('ActsFeatureAbilityTest', function () {
},
},
(error, data) => {
console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data)
console.info('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data)
},
);
......@@ -1047,7 +679,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Passing null, Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_StartAbility_0600', 0, async function (done) {
var Subscriber;
let Subscriber;
let id;
function SubscribeCallBack(err, data) {
......@@ -1058,7 +690,7 @@ describe('ActsFeatureAbilityTest', function () {
done();
}
commonEvent.createSubscriber(subscriberInfo_ACTS_StartAbility_0600).then(async (data) => {
commonEvent.createSubscriber(subscriberInfoActsStartAbility0600).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
......@@ -1077,7 +709,7 @@ describe('ActsFeatureAbilityTest', function () {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var result = featureAbility.startAbility(
let result = featureAbility.startAbility(
{
want:
{
......@@ -1120,7 +752,7 @@ describe('ActsFeatureAbilityTest', function () {
},
},
(error, data) => {
console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data)
console.info('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data)
},
);
......@@ -1132,7 +764,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it('ACTS_TerminateAbility_0200', 0, async function (done) {
var Subscriber;
let Subscriber;
let id;
let events = new Map();
......@@ -1168,9 +800,9 @@ describe('ActsFeatureAbilityTest', function () {
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
}
console.log('=====start ability=====');
console.info('=====start ability=====');
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = featureAbility.startAbility(
let promise = featureAbility.startAbility(
{
want:
{
......@@ -1188,76 +820,9 @@ describe('ActsFeatureAbilityTest', function () {
expect(typeof (promise)).assertEqual("object");
})
// checkAbilityName
function checkAbilityName(info) {
console.log("AbilityName name : " + info);
expect(typeof (info)).assertEqual("string");
expect(info).assertEqual("com.example.actsfeatureabilitytest.MainAbility");
}
/**
* @tc.number: ACTS_GetAbilityName_0100
* @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name.
* @tc.desc: Check the return type of the interface (by Promise)
*/
it('ACTS_GetAbilityName_0100', 0, async function (done) {
var promise = featureAbility.getAbilityName();
expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.getAbilityName();
checkAbilityName(info);
done();
setTimeout(function () {
console.info('====> ACTS_GetAbilityName_0100 =====>')
}, TIMEOUT)
})
/**
* @tc.number: ACTS_GetAbilityName_0200
* @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name.
* @tc.desc: Check the return type of the interface (by AsyncCallback)
*/
it('ACTS_GetAbilityName_0200', 0, async function (done) {
var result = featureAbility.getAbilityName(
(err, data) => {
checkAbilityName(data);
done()
}
);
setTimeout(function () {
console.info('====> ACTS_GetAbilityName_0200 =====>')
}, TIMEOUT)
})
// checkApplicationInfo
function checkApplicationInfo(info) {
console.log("getApplicationInfo : " + info)
console.log("name : " + info.name);
console.log("description : " + info.description);
console.log("descriptionId : " + info.descriptionId);
console.log("systemApp : " + info.systemApp);
console.log("enabled : " + info.enabled);
console.log("label : " + info.label);
console.log("labelId : " + info.labelId);
console.log("icon : " + info.icon);
console.log("iconId : " + info.iconId);
console.log("process : " + info.process);
console.log("supportedModes : " + info.supportedModes);
console.log("moduleSourceDirs length : " + info.moduleSourceDirs.length);
for (var j = 0; j < info.moduleSourceDirs.length; j++) {
console.log("info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
}
console.log("permissions length : " + info.permissions.length);
for (var j = 0; j < info.permissions.length; j++) {
console.log("info.permissions[" + j + "] : " + info.permissions[j]);
}
console.log("moduleInfos length : " + info.moduleInfos.length);
for (var j = 0; j < info.moduleInfos.length; j++) {
console.log("info.moduleInfos[" + j + "].moduleName : " + info.moduleInfos[j].moduleName);
console.log("info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir);
}
console.log("entryDir : " + info.entryDir);
console.info("getApplicationInfo : " + info)
expect(typeof (info)).assertEqual("object");
expect(typeof (info.name)).assertEqual("string");
expect(typeof (info.description)).assertEqual("string");
......@@ -1293,6 +858,7 @@ describe('ActsFeatureAbilityTest', function () {
"com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest");
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
"com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest");
console.info("getApplicationInfo : end")
}
/**
......@@ -1301,15 +867,17 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by Promise)
*/
it('ACTS_GetApplicationInfo_0100', 0, async function (done) {
var context = featureAbility.getContext();
var promise = context.getApplicationInfo();
expect(typeof (promise)).assertEqual("object");
var info = await context.getApplicationInfo();
checkApplicationInfo(info);
done();
setTimeout(function () {
console.info('====> ACTS_GetApplicationInfo_0100 =====>')
}, TIMEOUT)
let context = featureAbility.getContext();
await context.getApplicationInfo().then((data)=>{
checkApplicationInfo(data);
console.info("ACTS_GetApplicationInfo_0100 info :" + JSON.stringify(data))
console.info('====> ACTS_GetApplicationInfo_0100 end=====>')
done();
}).catch((err)=>{
console.info('====> ACTS_GetApplicationInfo_0100 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
});
})
/**
......@@ -1318,24 +886,26 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_GetApplicationInfo_0200', 0, async function (done) {
var context = featureAbility.getContext()
var result = context.getApplicationInfo(
let context = featureAbility.getContext()
context.getApplicationInfo(
(err, data) => {
checkApplicationInfo(data);
done()
if(err.code != 0){
console.info('====> ACTS_GetApplicationInfo_0200 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
}else{
console.info('====> ACTS_GetApplicationInfo_0200 data=====>' + JSON.stringify(data))
checkApplicationInfo(data);
done()
}
}
);
setTimeout(function () {
console.info('====> ACTS_GetApplicationInfo_0200 =====>')
}, TIMEOUT)
await sleep(1000)
})
// checkProcessInfo
function checkProcessInfo(info) {
console.log("checkProcessInfo ProcessInfo: " + info);
console.log("checkProcessInfo processName : " + info.processName);
console.log("checkProcessInfo pid : " + info.pid);
console.info("checkProcessInfo ProcessInfo: " + info);
expect(typeof (info)).assertEqual("object");
expect(typeof (info.processName)).assertEqual("string");
expect(typeof (info.pid)).assertEqual("number");
......@@ -1348,15 +918,17 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by promise)
*/
it('ACTS_GetProcessInfo_0100', 0, async function (done) {
var context = featureAbility.getContext()
var promise = context.getProcessInfo();
expect(typeof (promise)).assertEqual("object");
var info = await context.getProcessInfo();
checkProcessInfo(info);
done();
setTimeout(function () {
console.info('====> ACTS_GetProcessInfo_0100 =====>')
}, TIMEOUT)
let context = featureAbility.getContext()
await context.getProcessInfo().then((data)=>{
checkProcessInfo(data);
console.info("ACTS_GetProcessInfo_0100 info :" + JSON.stringify(data))
console.info('====> ACTS_GetProcessInfo_0100 end=====>')
done();
}).catch((err)=>{
console.info('====> ACTS_GetProcessInfo_0100 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
});
})
/**
......@@ -1365,27 +937,26 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by AsyncCallback)
*/
it('ACTS_GetProcessInfo_0200', 0, async function (done) {
var context = featureAbility.getContext()
var result = context.getProcessInfo(
let context = featureAbility.getContext()
context.getProcessInfo(
(err, data) => {
checkProcessInfo(data);
done()
if(err.code != 0){
console.info('====> ACTS_GetProcessInfo_0200 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
}else{
console.info('====> ACTS_GetProcessInfo_0200 data=====>' + JSON.stringify(data))
checkProcessInfo(data);
done()
}
}
);
setTimeout(function () {
console.info('====> ACTS_GetProcessInfo_0200 =====>')
}, TIMEOUT)
await sleep(1000)
})
// checkElementName
function checkElementName(info) {
console.log("getElementName : " + info);
console.log("deviceId : " + info.deviceId);
console.log("bundleName : " + info.bundleName);
console.log("abilityName : " + info.abilityName);
console.log("uri : " + info.uri);
console.log("shortName : " + info.shortName);
console.info("getElementName : " + info);
expect(typeof (info)).assertEqual("object");
expect(typeof (info.deviceId)).assertEqual("string");
expect(typeof (info.bundleName)).assertEqual("string");
......@@ -1398,6 +969,7 @@ describe('ActsFeatureAbilityTest', function () {
expect(info.abilityName).assertEqual("com.example.actsfeatureabilitytest.MainAbility");
expect(info.uri).assertEqual("");
expect(info.shortName).assertEqual("");
console.info("getElementName : end");
}
/**
......@@ -1406,15 +978,17 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it('ACTS_GetElementName_0100', 0, async function (done) {
var context = featureAbility.getContext()
var promise = context.getElementName();
expect(typeof (promise)).assertEqual("object");
var info = await context.getElementName();
checkElementName(info);
done();
setTimeout(function () {
console.info('====> ACTS_GetElementName_0100 =====>')
}, TIMEOUT)
let context = featureAbility.getContext()
await context.getElementName().then((data)=>{
checkElementName(data);
console.info("ACTS_GetElementName_0100 info :" + JSON.stringify(data))
console.info('====> ACTS_GetElementName_0100 end=====>')
done()
}).catch((err)=>{
console.info('====> ACTS_GetElementName_0100 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
});
})
/**
......@@ -1423,21 +997,25 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_GetElementName_0200', 0, async function (done) {
var context = featureAbility.getContext()
var result = context.getElementName(
let context = featureAbility.getContext()
context.getElementName(
(err, data) => {
checkElementName(data);
done()
if(err.code != 0){
console.info('====> ACTS_GetProcessInfo_0200 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
}else{
console.info('====> ACTS_GetProcessInfo_0200 data=====>' + JSON.stringify(data))
checkElementName(data);
done()
}
}
);
setTimeout(function () {
console.info('====> ACTS_GetElementName_0200 =====>')
}, TIMEOUT)
await sleep(1000)
})
// checkAppType
function checkAppType(info) {
console.log("AppType : " + info);
console.info("AppType : " + info);
expect(typeof (info)).assertEqual("string");
expect(info).assertEqual("system");
}
......@@ -1448,14 +1026,16 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it('ACTS_GetAppType_0100', 0, async function (done) {
var promise = featureAbility.getAppType();
expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.getAppType();
checkAppType(info);
done();
setTimeout(function () {
console.info('====> ACTS_GetAppType_0100 =====>')
}, TIMEOUT)
await featureAbility.getContext().getAppType().then((data)=>{
console.info("ACTS_GetAppType_0100 getAppType info :" + JSON.stringify(data))
checkAppType(data);
console.info('====> ACTS_GetAppType_0100 end=====>')
done()
}).catch((err)=>{
console.info('====> ACTS_GetAppType_0100 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
});
})
/**
......@@ -1464,59 +1044,23 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_GetAppType_0200', 0, async function (done) {
var result = featureAbility.getAppType(
(err, data) => {
checkAppType(data);
featureAbility.getContext().getAppType((err, data) => {
if(err.code != 0){
console.info("ACTS_GetAppType_0200 getAppType callback err :" + JSON.stringify(err))
expect().assertFail()
done()
}
);
setTimeout(function () {
console.info('====> ACTS_GetAppType_0200 =====>')
}, TIMEOUT)
}else{
console.info("ACTS_GetAppType_0200 getAppType callback data :" + JSON.stringify(data))
checkAppType(data)
done()
}
});
await sleep(1000)
})
// checkAbilityInfo
function checkAbilityInfo(data) {
console.log("checkAbilityInfo start " + data);
console.log("checkAbilityInfo bundleName : " + data.bundleName);
console.log("checkAbilityInfo name : " + data.name);
console.log("checkAbilityInfo label : " + data.label);
console.log("checkAbilityInfo description : " + data.description);
console.log("checkAbilityInfo icon : " + data.icon);
console.log("checkAbilityInfo labelId : " + data.labelId);
console.log("checkAbilityInfo descriptionId : " + data.descriptionId);
console.log("checkAbilityInfo iconId : " + data.iconId);
console.log("checkAbilityInfo moduleName : " + data.moduleName);
console.log("checkAbilityInfo process : " + data.process);
console.log("checkAbilityInfo isVisible : " + data.isVisible);
console.log("checkAbilityInfo type : " + data.type)
console.log("checkAbilityInfo orientation : " + data.orientation);
console.log("checkAbilityInfo launchMode : " + data.launchMode);
console.log("checkAbilityInfo uri : " + data.uri);
console.log("checkAbilityInfo promise readPermission : " + data.readPermission);
console.log("checkAbilityInfo writePermission : " + data.writePermission);
console.log("checkAbilityInfo formEntity : " + data.formEntity);
console.log("checkAbilityInfo minFormHeight : " + data.minFormHeight);
console.log("checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight);
console.log("checkAbilityInfo minFormWidth : " + data.minFormWidth);
console.log("checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
console.log("checkAbilityInfo targetAbility : " + data.targetAbility);
console.log("checkAbilityInfo backgroundModes : " + data.backgroundModes);
console.log("checkAbilityInfo subType : " + data.subType);
console.log("checkAbilityInfo formEnabled : " + data.formEnabled);
console.log("checkAbilityInfo permissions length : " + data.permissions.length);
for (var j = 0; j < data.permissions.length; j++) {
console.log("getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]);
}
console.log("checkAbilityInfo deviceTypes length : " + data.deviceTypes.length);
for (var j = 0; j < data.deviceTypes.length; j++) {
console.log("getAbilityInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]);
}
console.log("checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length);
for (var j = 0; j < data.deviceCapabilities.length; j++) {
console.log("getAbilityInfo data.deviceCapabilities[" + j + "] : " + data.deviceCapabilities[j]);
}
console.info("checkAbilityInfo start " + data);
expect(typeof (data)).assertEqual("object");
expect(typeof (data.bundleName)).assertEqual("string");
......@@ -1582,7 +1126,7 @@ describe('ActsFeatureAbilityTest', function () {
expect(data.defaultFormWidth).assertEqual(0);
expect(data.uri).assertEqual("uriTest");
console.log("checkAbilityInfo end " + data);
console.info("checkAbilityInfo end " + data);
}
/**
......@@ -1591,15 +1135,15 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it('ACTS_GetAbilityInfo_0100', 0, async function (done) {
var promise = featureAbility.getAbilityInfo();
expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.getAbilityInfo();
checkAbilityInfo(info);
done();
setTimeout(function () {
console.info('====> ACTS_GetAbilityInfo_0100 =====>')
}, TIMEOUT)
await featureAbility.getContext().getAbilityInfo().then((data)=>{
checkAbilityInfo(data);
console.info('====> ACTS_GetAbilityInfo_0100 data=====>' + JSON.stringify(data))
done()
}).catch((err)=>{
console.info('====> ACTS_GetAbilityInfo_0100 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
});
})
/**
......@@ -1608,42 +1152,24 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_GetAbilityInfo_0200', 0, async function (done) {
var result = featureAbility.getAbilityInfo(
featureAbility.getContext().getAbilityInfo(
(err, data) => {
checkAbilityInfo(data);
done()
if(err.code != 0){
expect().assertFail()
done()
}else{
console.info('====> ACTS_GetAbilityInfo_0200 =====>' + JSON.stringify(data))
checkAbilityInfo(data);
done()
}
}
);
setTimeout(function () {
console.info('====> ACTS_GetAbilityInfo_0200 =====>')
}, TIMEOUT)
await sleep(1000)
})
// checkHapModuleInfo
function checkHapModuleInfo(data) {
console.log("checkHapModuleInfo start " + data);
console.log("checkHapModuleInfo name : " + data.name);
console.log("checkHapModuleInfo description : " + data.description);
console.log("checkHapModuleInfo descriptionId : " + data.descriptionId);
console.log("checkHapModuleInfo icon : " + data.icon);
console.log("checkHapModuleInfo label : " + data.label);
console.log("checkHapModuleInfo labelId : " + data.labelId);
console.log("checkHapModuleInfo iconId : " + data.iconId);
console.log("checkHapModuleInfo backgroundImg : " + data.backgroundImg);
console.log("checkHapModuleInfo supportedModes : " + data.supportedModes);
console.log("checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length);
for (var j = 0; j < data.reqCapabilities.length; j++) {
console.log("getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]);
}
console.log("checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length);
for (var j = 0; j < data.deviceTypes.length; j++) {
console.log("getHapModuleInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]);
}
console.log("checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length);
console.log("checkHapModuleInfo moduleName : " + data.moduleName);
console.log("checkHapModuleInfo mainAbilityName : " + data.mainAbilityName);
console.log("checkHapModuleInfo installationFree : " + data.installationFree);
console.info("checkHapModuleInfo start " + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
expect(typeof (data.name)).assertEqual("string");
expect(typeof (data.description)).assertEqual("string");
......@@ -1656,11 +1182,10 @@ describe('ActsFeatureAbilityTest', function () {
expect(typeof (data.supportedModes)).assertEqual("number");
expect(Array.isArray(data.reqCapabilities)).assertEqual(true);
expect(Array.isArray(data.deviceTypes)).assertEqual(true);
expect(Array.isArray(data.abilityInfos)).assertEqual(true);
expect(Array.isArray(data.abilityInfo)).assertEqual(true);
expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.mainAbilityName)).assertEqual("string");
expect(typeof (data.installationFree)).assertEqual("boolean");
expect(data.name).assertEqual("com.example.actsfeatureabilitytest");
expect(data.description).assertEqual("descriptionTest");
expect(data.descriptionId).assertEqual(0);
......@@ -1670,15 +1195,13 @@ describe('ActsFeatureAbilityTest', function () {
expect(data.iconId).assertEqual(0);
expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0);
expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1");
expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2");
expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.moduleName).assertEqual("entry")
expect(data.mainAbilityName).assertEqual("");
expect(data.installationFree).assertEqual(false);
console.log("checkHapModuleInfo end " + data);
console.info("checkHapModuleInfo end " + data);
}
/**
......@@ -1687,14 +1210,16 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it('ACTS_GetHapModuleInfo_0100', 0, async function (done) {
var promise = featureAbility.getHapModuleInfo();
expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.getHapModuleInfo();
checkHapModuleInfo(info);
done();
setTimeout(function () {
console.info('====> ACTS_GetHapModuleInfo_0100 =====>')
}, TIMEOUT)
await featureAbility.getContext().getHapModuleInfo().then((data)=>{
checkHapModuleInfo(data);
console.info('====> ACTS_GetHapModuleInfo_0100 data=====>' + JSON.stringify(data))
done();
}).catch((err)=>{
console.info('====> ACTS_GetHapModuleInfo_0100 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
});
})
/**
......@@ -1703,20 +1228,26 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_GetHapModuleInfo_0200', 0, async function (done) {
var result = featureAbility.getHapModuleInfo(
let tempInfo
featureAbility.getContext().getHapModuleInfo(
(err, data) => {
checkHapModuleInfo(data);
done()
if(err.code != 0){
expect().assertFail()
done()
}else{
console.info('====> ACTS_GetHapModuleInfo_0200 =====>' + JSON.stringify(tempInfo))
tempInfo = data
checkHapModuleInfo(tempInfo);
done()
}
}
);
setTimeout(function () {
console.info('====> ACTS_GetHapModuleInfo_0200 =====>')
}, TIMEOUT)
await sleep(1000)
})
// checkProcessName
function checkProcessName(info) {
console.log("checkProcessName processName : " + info);
console.info("checkProcessName processName : " + info);
expect(typeof (info)).assertEqual("string");
expect(info).assertEqual("processTestAbility");
}
......@@ -1727,15 +1258,16 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise)
*/
it('ACTS_GetProcessName_0100', 0, async function (done) {
var context = featureAbility.getContext();
var promise = context.getProcessName();
expect(typeof (promise)).assertEqual("object");
var info = await context.getProcessName();
checkProcessName(info);
done();
setTimeout(function () {
console.info('====> ACTS_GetProcessName_0100 =====>')
}, TIMEOUT)
let context = featureAbility.getContext();
await context.getProcessName().then((data)=>{
console.info('====> ACTS_GetProcessName_0100 data=====>' + JSON.stringify(data))
checkProcessName(data);
done()
}).catch((err)=>{
console.info('====> ACTS_GetProcessName_0100 err=====>' + JSON.stringify(err))
expect().assertFail()
done();
});
})
/**
......@@ -1744,16 +1276,22 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_GetProcessName_0200', 0, async function (done) {
var context = featureAbility.getContext();
var result = context.getProcessName(
let tempInfo
let context = featureAbility.getContext();
context.getProcessName(
(err, data) => {
checkProcessName(data);
done()
if(err.code!= 0){
expect().assertFail()
done()
}else{
tempInfo = data
checkProcessName(tempInfo);
console.info('====> ACTS_GetProcessName_0200 =====>' + JSON.stringify(tempInfo))
done()
}
}
);
setTimeout(function () {
console.info('====> ACTS_GetProcessName_0200 =====>')
}, TIMEOUT)
await sleep(1000)
})
/**
......@@ -1761,8 +1299,8 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.name: GetCallingBundle : Obtains the bundle name of the ability that called the current ability.
* @tc.desc: Check the return type of the interface (by AsyncCallback)
*/
it('ACTS_GetCallingBundle_0100', 0, async function (done) {
var Subscriber;
it('ACTS_GetCallingBundle_0100', 0, async function (done) {
let Subscriber;
let id;
let events = new Map();
......@@ -1786,7 +1324,7 @@ describe('ActsFeatureAbilityTest', function () {
}
}
commonEvent.createSubscriber(subscriberInfo_ACTS_GetCallingBundle_0100).then(async (data) => {
commonEvent.createSubscriber(subscriberInfoActsGetCallingBundle0100).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
......@@ -1804,7 +1342,7 @@ describe('ActsFeatureAbilityTest', function () {
done();
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var result = await featureAbility.startAbility(
await featureAbility.startAbility(
{
want:
{
......@@ -1817,39 +1355,44 @@ describe('ActsFeatureAbilityTest', function () {
// checkGetOrCreateLocalDir
function checkGetOrCreateLocalDir(info) {
console.log("checkGetOrCreateLocalDir root dir : " + info);
expect(typeof (info)).assertEqual("string");
console.info("checkGetOrCreateLocalDir root dir : " + info);
expect(info).assertEqual("/data/storage/el2/base/haps/entry");
}
// @tc.number: ACTS_GetOrCreateLocalDir_0100
// @tc.name: GetProcessName : Obtains the name of the current process.
// @tc.desc: Check the return value of the interface (by promise)
it('ACTS_GetOrCreateLocalDir_0100', 0, async function (done) {
var context = featureAbility.getContext();
var promise = context.getOrCreateLocalDir();
expect(typeof (promise)).assertEqual("object");
var info = await context.getOrCreateLocalDir();
checkGetOrCreateLocalDir(info);
done();
setTimeout(function () {
console.info('====> ACTS_GetOrCreateLocalDir_0100 =====>')
}, TIMEOUT)
let context = featureAbility.getContext();
await context.getOrCreateLocalDir().then((data)=>{
checkGetOrCreateLocalDir(data);
console.info('====> ACTS_GetOrCreateLocalDir_0100 data=====>' + JSON.stringify(data))
done();
}).catch((err)=>{
console.info('====> ACTS_GetOrCreateLocalDir_0100 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
})
})
// @tc.number: ACTS_GetOrCreateLocalDir_0200
// @tc.name: GetProcessName : Obtains the name of the current process.
// @tc.desc: Check the return value of the interface (by AsyncCallback)
it('ACTS_GetOrCreateLocalDir_0200', 0, async function (done) {
var context = featureAbility.getContext();
var result = context.getOrCreateLocalDir(
let context = featureAbility.getContext();
context.getOrCreateLocalDir(
(err, data) => {
checkGetOrCreateLocalDir(data);
done()
}
);
setTimeout(function () {
console.info('====> ACTS_GetOrCreateLocalDir_0200 =====>')
}, TIMEOUT)
if(err.code != 0){
console.info('====> ACTS_GetOrCreateLocalDir_0200 err=====>' + JSON.stringify(err))
expect().assertFail()
done()
}else{
console.info('====> ACTS_GetOrCreateLocalDir_0200 data=====>' + JSON.stringify(data))
checkGetOrCreateLocalDir(data);
done()
}
});
await sleep(1000)
})
/*
......@@ -1866,18 +1409,23 @@ describe('ActsFeatureAbilityTest', function () {
bundleName: "com.example.startability",
abilityName: "com.example.startability.MainAbilityXXXXX",
}
var StartAbilityParameter = {
let StartAbilityParameter = {
want:Want
}
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_0700 asyncCallback errCode : ' + JSON.stringify(err)
console.info('ACTS_StartAbility_0700 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code == 2097152).assertTrue();
done();
if(err.code != 0){
expect(err.code).assertEqual(1);
done();
}else{
expect().assertFail()
done()
}
});
}catch(error){
console.log("ACTS_StartAbility_0700 : error = " + error);
console.info("ACTS_StartAbility_0700 : error = " + error);
}
});
......@@ -1895,18 +1443,23 @@ describe('ActsFeatureAbilityTest', function () {
bundleName: "com.example.startabilityxxxxx",
abilityName: "com.example.startability.MainAbility",
}
var StartAbilityParameter = {
let StartAbilityParameter = {
want:Want
}
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_0800 asyncCallback errCode : ' + JSON.stringify(err)
console.info('ACTS_StartAbility_0800 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
if(err.code != 0){
expect(err.code).assertEqual(1);
done();
}else{
expect().assertFail()
done()
}
});
}catch(error){
console.log("ACTS_StartAbility_0800 : error = " + error);
console.info("ACTS_StartAbility_0800 : error = " + error);
}
});
......@@ -1924,18 +1477,23 @@ describe('ActsFeatureAbilityTest', function () {
bundleName: "com.example.startability",
abilityName: "com.example.startability.MainAbility",
}
var StartAbilityParameter = {
let StartAbilityParameter = {
want:Want
}
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_0900 asyncCallback errCode : ' + JSON.stringify(err)
console.info('ACTS_StartAbility_0900 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data) + "err.code: " + err.code);
expect(err.code != 0).assertTrue();
done();
if(err.code != 0){
expect(err.code != 0).assertTrue();
done();
}else{
expect().assertFail()
done()
}
});
}catch(error){
console.log("ACTS_StartAbility_0900 : error = " + error);
console.info("ACTS_StartAbility_0900 : error = " + error);
}
});
......@@ -1951,18 +1509,23 @@ describe('ActsFeatureAbilityTest', function () {
let Want = {
action: "action.sysxxxtem.homexxxx"
}
var StartAbilityParameter = {
let StartAbilityParameter = {
want:Want
}
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_1100 asyncCallback errCode : ' + JSON.stringify(err)
console.info('ACTS_StartAbility_1100 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
if(err.code != 0){
expect(err.code).assertEqual(1);
done();
}else{
expect().assertFail()
done()
}
});
}catch(error){
console.log("ACTS_StartAbility_1100 : error = " + error);
console.info("ACTS_StartAbility_1100 : error = " + error);
}
});
......@@ -1979,18 +1542,23 @@ describe('ActsFeatureAbilityTest', function () {
action: "action.system.home",
entities: ["entity.system.homexxxxxxxxx"]
}
var StartAbilityParameter = {
let StartAbilityParameter = {
want:Want
}
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_1200 asyncCallback errCode : ' + JSON.stringify(err)
console.info('ACTS_StartAbility_1200 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue();
done();
if(err.code != 0){
expect(err.code).assertEqual(1);
done();
}else{
expect().assertFail()
done()
}
});
}catch(error){
console.log("ACTS_StartAbility_1200 : error = " + error);
console.info("ACTS_StartAbility_1200 : error = " + error);
}
});
......@@ -2003,7 +1571,7 @@ describe('ActsFeatureAbilityTest', function () {
it("ACTS_StartAbility_1300",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1300-------------------");
try{
var Subscriber;
let Subscriber;
let id;
function SubscribeCallBack(err, data) {
......@@ -2037,17 +1605,20 @@ describe('ActsFeatureAbilityTest', function () {
action: "action.system.homeability",
entities: []
}
var StartAbilityParameter = {
let StartAbilityParameter = {
want:Want
}
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_1300 asyncCallback errCode : ' + JSON.stringify(err)
console.info('ACTS_StartAbility_1300 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
expect(err.code == 0).assertTrue();
if(err.code != 0){
expect().assertFail()
done()
}
});
}catch(error){
console.log("ACTS_StartAbility_1300 : error = " + error);
console.info("ACTS_StartAbility_1300 : error = " + error);
}
});
......@@ -2064,17 +1635,25 @@ describe('ActsFeatureAbilityTest', function () {
action: "action.system.home",
entities: 'asdfghj'
}
var StartAbilityParameter = {
let StartAbilityParameter = {
want:Want
}
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{
console.log('ACTS_StartAbility_1400 asyncCallback errCode : ' + JSON.stringify(err)
console.info('ACTS_StartAbility_1400 asyncCallback errCode : ' + JSON.stringify(err)
+ " data: " + JSON.stringify(data));
done();
if(err.code != 0){
expect().assertFail()
done()
}else{
expect(err.code).assertEqual(0)
done()
}
});
}catch(error){
console.log("ACTS_StartAbility_1400 : error = " + error);
console.info("ACTS_StartAbility_1400 : error = " + error);
expect().assertFail()
done()
}
});
......@@ -2087,22 +1666,22 @@ describe('ActsFeatureAbilityTest', function () {
it("ACTS_StartAbility_1600",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1600-------------------");
let Want = {}
var StartAbilityParameter = {
let StartAbilityParameter = {
want:Want
}
var promise = featureAbility.startAbility(StartAbilityParameter);
let promise = featureAbility.startAbility(StartAbilityParameter);
if (promise) {
promise.then((data) => {
console.log('ACTS_StartAbility_1600 errCode : ' + " data: " + JSON.stringify(data));
console.info('ACTS_StartAbility_1600 errCode : ' + " data: " + JSON.stringify(data));
expect().assertFail();
done();
}).catch((err)=>{
expect(err.code != 0).assertTrue();
expect(err.code).assertEqual(1);
done();
});
} else {
expect(promise == undefined).assertTrue();
expect().assertFail()
done();
}
});
......@@ -2115,19 +1694,19 @@ describe('ActsFeatureAbilityTest', function () {
*/
it("ACTS_StartAbility_1700",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1700-------------------");
var StartAbilityParameter = {}
var promise = featureAbility.startAbility(StartAbilityParameter)
let StartAbilityParameter = {}
let promise = featureAbility.startAbility(StartAbilityParameter)
if (promise) {
promise.then((data) => {
console.log('ACTS_StartAbility_1700 data: ' + JSON.stringify(data));
console.info('ACTS_StartAbility_1700 data: ' + JSON.stringify(data));
expect().assertFail();
done();
}).catch((err)=>{
expect(err.code != 0).assertTrue();
expect(err.code).assertEqual(202);
done();
});
} else {
expect(promise == undefined).assertTrue();
expect().assertFail()
done();
}
});
......@@ -2140,18 +1719,18 @@ describe('ActsFeatureAbilityTest', function () {
*/
it("ACTS_StartAbility_1800",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1800-------------------");
var promise = featureAbility.startAbility(undefined);
let promise = featureAbility.startAbility(undefined);
if (promise) {
promise.then((data) => {
console.log('ACTS_StartAbility_1800 asyncCallback data: ' + JSON.stringify(data));
console.info('ACTS_StartAbility_1800 asyncCallback data: ' + JSON.stringify(data));
expect().assertFail();
done();
}).catch((err)=>{
expect(err.code != 0).assertTrue();
expect(err.code).assertEqual(202);
done();
});
} else {
expect(promise == undefined).assertTrue();
expect().assertFail()
done();
}
});
......
......@@ -47,21 +47,6 @@
"launchType": "standard"
}
],
"defPermissions": [
{
"name": "com.permission.CAMERA",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "$string:testFormA",
"description": "CAMERA permission in detail"
},
{
"name": "ohos.permission.REQUIRE_FORM",
"grantMode": "system_grant",
"label": "$string:testForm",
"description": "REQUIRE_FORM permission in detail"
}
],
"reqPermissions": [
{
"name": "ohos.permission.REQUIRE_FORM",
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
import {stringTest, numberTest, booleanTest, nullTest, undefinedTest,
objectTest, arrayTest, functionTest, REPEAT_COUNT} from './getParam.js'
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
import {stringTest, numberTest, booleanTest, nullTest, undefinedTest,
objectTest, arrayTest, functionTest, REPEAT_COUNT} from './getParam.js'
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
import {stringTest, numberTest, booleanTest, nullTest, undefinedTest,
objectTest, arrayTest, functionTest, REPEAT_COUNT} from './getParam.js'
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
import {stringTest, numberTest, booleanTest, nullTest, undefinedTest,
objectTest, arrayTest, functionTest, REPEAT_COUNT} from './getParam.js'
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
import {stringTest, numberTest, booleanTest, nullTest, undefinedTest,
objectTest, arrayTest, functionTest, REPEAT_COUNT} from './getParam.js'
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
import {stringTest, numberTest, booleanTest, nullTest, undefinedTest,
objectTest, arrayTest, functionTest, REPEAT_COUNT} from './getParam.js'
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
import {stringTest, numberTest, booleanTest, nullTest, undefinedTest,
objectTest, arrayTest, functionTest, REPEAT_COUNT} from './getParam.js'
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
const TIMEOUT = 3000;
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
const TIMEOUT = 5000;
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
const TIMEOUT = 3000;
......
......@@ -14,7 +14,7 @@
*/
import formBindingData from "@ohos.application.formBindingData"
import formManager from '@ohos.ability.formManager'
import formManager from '@ohos.ability.formHost'
import {describe, it, expect} from 'deccjsunit/index'
const TIMEOUT = 3000;
......@@ -107,5 +107,4 @@ describe('ActsFormsZeroTest', function () {
done();
console.log("FMS_CreateFormBindingData_0100 end");
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册