未验证 提交 3e0a7bff 编写于 作者: O openharmony_ci 提交者: Gitee

!4292 XTS元能力失败用例适配

Merge pull request !4292 from chengxingzhen/master
...@@ -132,7 +132,7 @@ export default function ActsAmsCallBackFifthScene() { ...@@ -132,7 +132,7 @@ export default function ActsAmsCallBackFifthScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -76,7 +76,7 @@ export default function ActsAmsCallBackFirstScene() { ...@@ -76,7 +76,7 @@ export default function ActsAmsCallBackFirstScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -127,7 +127,7 @@ export default function ActsAmsCallBackFourthScene() { ...@@ -127,7 +127,7 @@ export default function ActsAmsCallBackFourthScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -93,7 +93,7 @@ export default function ActsAmsCallBackSecondScene() { ...@@ -93,7 +93,7 @@ export default function ActsAmsCallBackSecondScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -87,7 +87,7 @@ export default function ActsAmsCallBackThirdScene() { ...@@ -87,7 +87,7 @@ export default function ActsAmsCallBackThirdScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -144,7 +144,7 @@ export default function ActsAmsTestFifthScene() { ...@@ -144,7 +144,7 @@ export default function ActsAmsTestFifthScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -78,7 +78,7 @@ export default function ActsAmsTestFirstScene() { ...@@ -78,7 +78,7 @@ export default function ActsAmsTestFirstScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -144,7 +144,7 @@ export default function ActsAmsTestFourthScene() { ...@@ -144,7 +144,7 @@ export default function ActsAmsTestFourthScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -100,7 +100,7 @@ export default function ActsAmsTestSecondScene() { ...@@ -100,7 +100,7 @@ export default function ActsAmsTestSecondScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -102,7 +102,7 @@ export default function ActsAmsTestThirdScene() { ...@@ -102,7 +102,7 @@ export default function ActsAmsTestThirdScene() {
expect(typeof (info[i].processName)).assertEqual("string"); expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0); expect(info[i].processName.length).assertLarger(0);
expect(Array.isArray(info[i].bundleNames)).assertEqual(true); 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(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0); expect(info[i].uid).assertLarger(0);
......
...@@ -35,6 +35,7 @@ describe('ActsDataAbilityHelperTest', function () { ...@@ -35,6 +35,7 @@ describe('ActsDataAbilityHelperTest', function () {
console.debug('ACTS_beforeAll DAHelper ====>: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper)); console.debug('ACTS_beforeAll DAHelper ====>: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper));
if(DAHelper == null){ if(DAHelper == null){
console.debug('ACTS_beforeAll DAHelper ====>: DAHelper == null'); console.debug('ACTS_beforeAll DAHelper ====>: DAHelper == null');
return;
} }
} catch (err) { } catch (err) {
console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err); console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err);
......
...@@ -212,7 +212,7 @@ export default function abilityTest(abilityContext) { ...@@ -212,7 +212,7 @@ export default function abilityTest(abilityContext) {
expect(data.formEnabled).assertEqual(false); expect(data.formEnabled).assertEqual(false);
expect(data.type).assertEqual(1); expect(data.type).assertEqual(1);
expect(data.subType).assertEqual(0); expect(data.subType).assertEqual(0);
expect(data.orientation).assertEqual(0); expect(data.orientation).assertEqual(2);
expect(data.launchMode).assertEqual(0); expect(data.launchMode).assertEqual(0);
expect(data.permissions.length).assertEqual(0); expect(data.permissions.length).assertEqual(0);
expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.deviceTypes[0]).assertEqual("phone");
......
...@@ -16,50 +16,48 @@ import featureAbility from '@ohos.ability.featureAbility' ...@@ -16,50 +16,48 @@ import featureAbility from '@ohos.ability.featureAbility'
import wantconstant from '@ohos.ability.wantConstant' import wantconstant from '@ohos.ability.wantConstant'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
import notification from '@ohos.notification';
import wantAgent from '@ohos.wantAgent';
import particleAbility from '@ohos.ability.particleAbility' import particleAbility from '@ohos.ability.particleAbility'
import backgroundTaskManager from '@ohos.backgroundTaskManager' import backgroundTaskManager from '@ohos.backgroundTaskManager'
const CREATELOCALDIR = "/data/storage/el2/base/haps/entry";
const START_ABILITY_TIMEOUT = 4000; const START_ABILITY_TIMEOUT = 4000;
const TERMINATE_ABILITY_TIMEOUT = 1000; let subscriberInfoActsStartAbility0100 = {
const TIMEOUT = 1000;
const errCode = 1;
var subscriberInfoActsStartAbility0100 = {
events: ["ACTS_StartAbility_0100_CommonEvent"], events: ["ACTS_StartAbility_0100_CommonEvent"],
}; };
var subscriberInfoActsStartAbility0200 = { let subscriberInfoActsStartAbility0200 = {
events: ["ACTS_StartAbility_0200_CommonEvent"], events: ["ACTS_StartAbility_0200_CommonEvent"],
}; };
var subscriberInfoActsStartAbility0300 = { let subscriberInfoActsStartAbility0300 = {
events: ["ACTS_StartAbility_0300_CommonEvent"], events: ["ACTS_StartAbility_0300_CommonEvent"],
}; };
var subscriberInfoActsStartAbility0400 = { let subscriberInfoActsStartAbility0400 = {
events: ["ACTS_StartAbility_0400_CommonEvent"], events: ["ACTS_StartAbility_0400_CommonEvent"],
}; };
var subscriberInfoActsStartAbility0500 = { let subscriberInfoActsStartAbility0500 = {
events: ["ACTS_StartAbility_0500_CommonEvent"], events: ["ACTS_StartAbility_0500_CommonEvent"],
}; };
var subscriberInfoActsStartAbility0600 = { let subscriberInfoActsStartAbility0600 = {
events: ["ACTS_StartAbility_0600_CommonEvent"], events: ["ACTS_StartAbility_0600_CommonEvent"],
}; };
var subscriberInfoStartAbilityTen = { let subscriberInfoStartAbilityTen = {
events: ["ACTS_StartAbility_1000_CommonEvent"], events: ["ACTS_StartAbility_1000_CommonEvent"],
}; };
var subscriberInfoStartAbilityThirteen = { let subscriberInfoStartAbilityThirteen = {
events: ["ACTS_StartAbility_1300_CommonEvent"], events: ["ACTS_StartAbility_1300_CommonEvent"],
}; };
var subscriberInfoTerminateAbilityTwo = { let subscriberInfoTerminateAbilityTwo = {
events: ["ACTS_TerminateAbility_0200_CommonEvent", events: ["ACTS_TerminateAbility_0200_CommonEvent",
"ACTS_TerminateAbility_0200_Return"], "ACTS_TerminateAbility_0200_Return"],
}; };
var subscriberInfoActsGetCallingBundle0100 = { let subscriberInfoActsGetCallingBundle0100 = {
events: ["ACTS_GetCallingBundle_0100_CommonEvent", events: ["ACTS_GetCallingBundle_0100_CommonEvent",
"com.example.actsfeatureabilitytest.promise", "com.example.actsfeatureabilitytest.promise",
"com.example.actsfeatureabilitytest.callback"], "com.example.actsfeatureabilitytest.callback"],
}; };
function sleep(time) {
return new Promise((resolve)=>setTimeout(resolve,time));
}
describe('ActsFeatureAbilityTest', function () { describe('ActsFeatureAbilityTest', function () {
beforeAll(function() { beforeAll(function() {
...@@ -98,344 +96,6 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -98,344 +96,6 @@ describe('ActsFeatureAbilityTest', function () {
setTimeout(() => {}, 500); 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.number: ACTS_wantConstant_0100
* @tc.name: wantConstant : Check specific enum * @tc.name: wantConstant : Check specific enum
...@@ -482,7 +142,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -482,7 +142,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by Promise) * @tc.desc: Check the return value of the interface (by Promise)
*/ */
it('ACTS_GetContext_0100', 0, async function (done) { it('ACTS_GetContext_0100', 0, async function (done) {
var promise = await featureAbility.getContext() let promise = await featureAbility.getContext()
expect(typeof (promise)).assertEqual("object"); expect(typeof (promise)).assertEqual("object");
done(); done();
}) })
...@@ -493,14 +153,10 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -493,14 +153,10 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by Promise) * @tc.desc: Check the return value of the interface (by Promise)
*/ */
it('ACTS_HasWindowFocus_0100', 0, async function (done) { it('ACTS_HasWindowFocus_0100', 0, async function (done) {
var promise = featureAbility.hasWindowFocus(); let info = await featureAbility.hasWindowFocus();
expect(typeof (promise)).assertEqual("object");
var info = await featureAbility.hasWindowFocus();
expect(info).assertEqual(true); expect(info).assertEqual(true);
console.info('====> ACTS_HasWindowFocus_0100 end=====>')
done(); done();
setTimeout(function () {
console.info('====> ACTS_HasWindowFocus_0100 =====>')
}, TIMEOUT)
}) })
/** /**
...@@ -509,18 +165,15 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -509,18 +165,15 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_HasWindowFocus_0300', 0, async function (done) { it('ACTS_HasWindowFocus_0300', 0, async function (done) {
var result = featureAbility.hasWindowFocus( let result = featureAbility.hasWindowFocus(
(err, data) => { (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(err.code).assertEqual(0);
expect(data).assertTrue(); expect(data).assertTrue();
done() done()
} }
); );
console.info('AceApplication : hasWindowFocus : ' + result); console.info('AceApplication : hasWindowFocus : ' + result);
setTimeout(function () {
console.info('====> ACTS_HasWindowFocus_0300 =====>')
}, TIMEOUT)
}) })
/* /*
...@@ -532,7 +185,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -532,7 +185,7 @@ describe('ActsFeatureAbilityTest', function () {
it("ACTS_StartAbility_1000",0, async function(done){ it("ACTS_StartAbility_1000",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1000-------------------"); console.info("------------------logMessage ACTS_StartAbility_1000-------------------");
try{ try{
var Subscriber; let Subscriber;
let id; let id;
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
...@@ -567,17 +220,17 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -567,17 +220,17 @@ describe('ActsFeatureAbilityTest', function () {
abilityName: "com.example.startability.MainAbility", abilityName: "com.example.startability.MainAbility",
uri: "xxxxx", uri: "xxxxx",
} }
var StartAbilityParameter = { let StartAbilityParameter = {
want:Want want:Want
} }
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ 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)); + " data: " + JSON.stringify(data));
expect(err.code == 0).assertTrue(); expect(err.code == 0).assertTrue();
}); });
}catch(error){ }catch(error){
console.log("ACTS_StartAbility_1000 : error = " + error); console.info("ACTS_StartAbility_1000 : error = " + error);
} }
}) })
...@@ -587,7 +240,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -587,7 +240,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by Promise) * @tc.desc: Check the return value of the interface (by Promise)
*/ */
it('ACTS_StartAbility_0100', 0, async function (done) { it('ACTS_StartAbility_0100', 0, async function (done) {
var Subscriber; let Subscriber;
let id; let id;
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
...@@ -617,7 +270,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -617,7 +270,7 @@ describe('ActsFeatureAbilityTest', function () {
} }
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = await featureAbility.startAbility( let promise = await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -669,7 +322,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -669,7 +322,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Pass the parameters, Check the return value of the interface (by Promise) * @tc.desc: Pass the parameters, Check the return value of the interface (by Promise)
*/ */
it('ACTS_StartAbility_0200', 0, async function (done) { it('ACTS_StartAbility_0200', 0, async function (done) {
var Subscriber; let Subscriber;
let id; let id;
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
...@@ -700,7 +353,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -700,7 +353,7 @@ describe('ActsFeatureAbilityTest', function () {
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug('=======wait id======'); console.debug('=======wait id======');
var promise = await featureAbility.startAbility( let promise = await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -763,7 +416,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -763,7 +416,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Passing null, Check the return value of the interface (by Promise) * @tc.desc: Passing null, Check the return value of the interface (by Promise)
*/ */
it('ACTS_StartAbility_0300', 0, async function (done) { it('ACTS_StartAbility_0300', 0, async function (done) {
var Subscriber; let Subscriber;
let id; let id;
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
...@@ -793,7 +446,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -793,7 +446,7 @@ describe('ActsFeatureAbilityTest', function () {
} }
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = await featureAbility.startAbility( let promise = await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -845,7 +498,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -845,7 +498,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_StartAbility_0400', 0, async function (done) { it('ACTS_StartAbility_0400', 0, async function (done) {
var Subscriber; let Subscriber;
let id; let id;
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
...@@ -875,7 +528,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -875,7 +528,7 @@ describe('ActsFeatureAbilityTest', function () {
} }
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var result = featureAbility.startAbility( let result = featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -918,7 +571,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -918,7 +571,7 @@ describe('ActsFeatureAbilityTest', function () {
}, },
}, },
(error, data) => { (error, data) => {
console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data) console.info('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data)
}, },
); );
...@@ -930,7 +583,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -930,7 +583,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Pass the parameters, Check the return value of the interface (by AsyncCallback) * @tc.desc: Pass the parameters, Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_StartAbility_0500', 0, async function (done) { it('ACTS_StartAbility_0500', 0, async function (done) {
var Subscriber; let Subscriber;
let id; let id;
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
...@@ -960,7 +613,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -960,7 +613,7 @@ describe('ActsFeatureAbilityTest', function () {
} }
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var result = featureAbility.startAbility( let result = featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -1014,7 +667,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1014,7 +667,7 @@ describe('ActsFeatureAbilityTest', function () {
}, },
}, },
(error, data) => { (error, data) => {
console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data) console.info('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data)
}, },
); );
...@@ -1026,7 +679,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1026,7 +679,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Passing null, Check the return value of the interface (by AsyncCallback) * @tc.desc: Passing null, Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_StartAbility_0600', 0, async function (done) { it('ACTS_StartAbility_0600', 0, async function (done) {
var Subscriber; let Subscriber;
let id; let id;
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
...@@ -1056,7 +709,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1056,7 +709,7 @@ describe('ActsFeatureAbilityTest', function () {
} }
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var result = featureAbility.startAbility( let result = featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -1099,7 +752,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1099,7 +752,7 @@ describe('ActsFeatureAbilityTest', function () {
}, },
}, },
(error, data) => { (error, data) => {
console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data) console.info('featureAbilityTest startAbility asyncCallback errCode : ' + error + " data: " + data)
}, },
); );
...@@ -1111,7 +764,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1111,7 +764,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_TerminateAbility_0200', 0, async function (done) { it('ACTS_TerminateAbility_0200', 0, async function (done) {
var Subscriber; let Subscriber;
let id; let id;
let events = new Map(); let events = new Map();
...@@ -1147,9 +800,9 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1147,9 +800,9 @@ describe('ActsFeatureAbilityTest', function () {
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done(); done();
} }
console.log('=====start ability====='); console.info('=====start ability=====');
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = featureAbility.startAbility( let promise = featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -1167,76 +820,9 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1167,76 +820,9 @@ describe('ActsFeatureAbilityTest', function () {
expect(typeof (promise)).assertEqual("object"); 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 // checkApplicationInfo
function checkApplicationInfo(info) { function checkApplicationInfo(info) {
console.log("getApplicationInfo : " + info) console.info("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);
expect(typeof (info)).assertEqual("object"); expect(typeof (info)).assertEqual("object");
expect(typeof (info.name)).assertEqual("string"); expect(typeof (info.name)).assertEqual("string");
expect(typeof (info.description)).assertEqual("string"); expect(typeof (info.description)).assertEqual("string");
...@@ -1272,6 +858,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1272,6 +858,7 @@ describe('ActsFeatureAbilityTest', function () {
"com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest");
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" + expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
"com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest"); "com.example.actsfeatureabilitytest/com.example.actsfeatureabilitytest");
console.info("getApplicationInfo : end")
} }
/** /**
...@@ -1280,15 +867,17 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1280,15 +867,17 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by Promise) * @tc.desc: Check the return type of the interface (by Promise)
*/ */
it('ACTS_GetApplicationInfo_0100', 0, async function (done) { it('ACTS_GetApplicationInfo_0100', 0, async function (done) {
var context = featureAbility.getContext(); let context = featureAbility.getContext();
var promise = context.getApplicationInfo(); await context.getApplicationInfo().then((data)=>{
expect(typeof (promise)).assertEqual("object"); checkApplicationInfo(data);
var info = await context.getApplicationInfo(); console.info("ACTS_GetApplicationInfo_0100 info :" + JSON.stringify(data))
checkApplicationInfo(info); console.info('====> ACTS_GetApplicationInfo_0100 end=====>')
done(); done();
setTimeout(function () { }).catch((err)=>{
console.info('====> ACTS_GetApplicationInfo_0100 =====>') console.info('====> ACTS_GetApplicationInfo_0100 err=====>' + JSON.stringify(err))
}, TIMEOUT) expect().assertFail()
done()
});
}) })
/** /**
...@@ -1297,24 +886,26 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1297,24 +886,26 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_GetApplicationInfo_0200', 0, async function (done) { it('ACTS_GetApplicationInfo_0200', 0, async function (done) {
var context = featureAbility.getContext() let context = featureAbility.getContext()
var result = context.getApplicationInfo( context.getApplicationInfo(
(err, data) => { (err, data) => {
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); checkApplicationInfo(data);
done() done()
} }
}
); );
setTimeout(function () { await sleep(1000)
console.info('====> ACTS_GetApplicationInfo_0200 =====>')
}, TIMEOUT)
}) })
// checkProcessInfo // checkProcessInfo
function checkProcessInfo(info) { function checkProcessInfo(info) {
console.log("checkProcessInfo ProcessInfo: " + info); console.info("checkProcessInfo ProcessInfo: " + info);
console.log("checkProcessInfo processName : " + info.processName);
console.log("checkProcessInfo pid : " + info.pid);
expect(typeof (info)).assertEqual("object"); expect(typeof (info)).assertEqual("object");
expect(typeof (info.processName)).assertEqual("string"); expect(typeof (info.processName)).assertEqual("string");
expect(typeof (info.pid)).assertEqual("number"); expect(typeof (info.pid)).assertEqual("number");
...@@ -1327,15 +918,17 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1327,15 +918,17 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by promise) * @tc.desc: Check the return type of the interface (by promise)
*/ */
it('ACTS_GetProcessInfo_0100', 0, async function (done) { it('ACTS_GetProcessInfo_0100', 0, async function (done) {
var context = featureAbility.getContext() let context = featureAbility.getContext()
var promise = context.getProcessInfo(); await context.getProcessInfo().then((data)=>{
expect(typeof (promise)).assertEqual("object"); checkProcessInfo(data);
var info = await context.getProcessInfo(); console.info("ACTS_GetProcessInfo_0100 info :" + JSON.stringify(data))
checkProcessInfo(info); console.info('====> ACTS_GetProcessInfo_0100 end=====>')
done(); done();
setTimeout(function () { }).catch((err)=>{
console.info('====> ACTS_GetProcessInfo_0100 =====>') console.info('====> ACTS_GetProcessInfo_0100 err=====>' + JSON.stringify(err))
}, TIMEOUT) expect().assertFail()
done()
});
}) })
/** /**
...@@ -1344,27 +937,26 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1344,27 +937,26 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by AsyncCallback) * @tc.desc: Check the return type of the interface (by AsyncCallback)
*/ */
it('ACTS_GetProcessInfo_0200', 0, async function (done) { it('ACTS_GetProcessInfo_0200', 0, async function (done) {
var context = featureAbility.getContext() let context = featureAbility.getContext()
var result = context.getProcessInfo( context.getProcessInfo(
(err, data) => { (err, data) => {
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); checkProcessInfo(data);
done() done()
} }
}
); );
setTimeout(function () { await sleep(1000)
console.info('====> ACTS_GetProcessInfo_0200 =====>')
}, TIMEOUT)
}) })
// checkElementName // checkElementName
function checkElementName(info) { function checkElementName(info) {
console.log("getElementName : " + info); console.info("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);
expect(typeof (info)).assertEqual("object"); expect(typeof (info)).assertEqual("object");
expect(typeof (info.deviceId)).assertEqual("string"); expect(typeof (info.deviceId)).assertEqual("string");
expect(typeof (info.bundleName)).assertEqual("string"); expect(typeof (info.bundleName)).assertEqual("string");
...@@ -1377,6 +969,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1377,6 +969,7 @@ describe('ActsFeatureAbilityTest', function () {
expect(info.abilityName).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); expect(info.abilityName).assertEqual("com.example.actsfeatureabilitytest.MainAbility");
expect(info.uri).assertEqual(""); expect(info.uri).assertEqual("");
expect(info.shortName).assertEqual(""); expect(info.shortName).assertEqual("");
console.info("getElementName : end");
} }
/** /**
...@@ -1385,15 +978,17 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1385,15 +978,17 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_GetElementName_0100', 0, async function (done) { it('ACTS_GetElementName_0100', 0, async function (done) {
var context = featureAbility.getContext() let context = featureAbility.getContext()
var promise = context.getElementName(); await context.getElementName().then((data)=>{
expect(typeof (promise)).assertEqual("object"); checkElementName(data);
var info = await context.getElementName(); console.info("ACTS_GetElementName_0100 info :" + JSON.stringify(data))
checkElementName(info); console.info('====> ACTS_GetElementName_0100 end=====>')
done(); done()
setTimeout(function () { }).catch((err)=>{
console.info('====> ACTS_GetElementName_0100 =====>') console.info('====> ACTS_GetElementName_0100 err=====>' + JSON.stringify(err))
}, TIMEOUT) expect().assertFail()
done()
});
}) })
/** /**
...@@ -1402,21 +997,25 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1402,21 +997,25 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_GetElementName_0200', 0, async function (done) { it('ACTS_GetElementName_0200', 0, async function (done) {
var context = featureAbility.getContext() let context = featureAbility.getContext()
var result = context.getElementName( context.getElementName(
(err, data) => { (err, data) => {
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); checkElementName(data);
done() done()
} }
}
); );
setTimeout(function () { await sleep(1000)
console.info('====> ACTS_GetElementName_0200 =====>')
}, TIMEOUT)
}) })
// checkAppType
function checkAppType(info) { function checkAppType(info) {
console.log("AppType : " + info); console.info("AppType : " + info);
expect(typeof (info)).assertEqual("string"); expect(typeof (info)).assertEqual("string");
expect(info).assertEqual("system"); expect(info).assertEqual("system");
} }
...@@ -1427,14 +1026,16 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1427,14 +1026,16 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_GetAppType_0100', 0, async function (done) { it('ACTS_GetAppType_0100', 0, async function (done) {
var promise = featureAbility.getAppType(); await featureAbility.getContext().getAppType().then((data)=>{
expect(typeof (promise)).assertEqual("object"); console.info("ACTS_GetAppType_0100 getAppType info :" + JSON.stringify(data))
var info = await featureAbility.getAppType(); checkAppType(data);
checkAppType(info); console.info('====> ACTS_GetAppType_0100 end=====>')
done(); done()
setTimeout(function () { }).catch((err)=>{
console.info('====> ACTS_GetAppType_0100 =====>') console.info('====> ACTS_GetAppType_0100 err=====>' + JSON.stringify(err))
}, TIMEOUT) expect().assertFail()
done()
});
}) })
/** /**
...@@ -1443,59 +1044,23 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1443,59 +1044,23 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_GetAppType_0200', 0, async function (done) { it('ACTS_GetAppType_0200', 0, async function (done) {
var result = featureAbility.getAppType( featureAbility.getContext().getAppType((err, data) => {
(err, data) => { if(err.code != 0){
checkAppType(data); console.info("ACTS_GetAppType_0200 getAppType callback err :" + JSON.stringify(err))
expect().assertFail()
done()
}else{
console.info("ACTS_GetAppType_0200 getAppType callback data :" + JSON.stringify(data))
checkAppType(data)
done() done()
} }
); });
setTimeout(function () { await sleep(1000)
console.info('====> ACTS_GetAppType_0200 =====>')
}, TIMEOUT)
}) })
// checkAbilityInfo // checkAbilityInfo
function checkAbilityInfo(data) { function checkAbilityInfo(data) {
console.log("checkAbilityInfo start " + data); console.info("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]);
}
expect(typeof (data)).assertEqual("object"); expect(typeof (data)).assertEqual("object");
expect(typeof (data.bundleName)).assertEqual("string"); expect(typeof (data.bundleName)).assertEqual("string");
...@@ -1561,7 +1126,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1561,7 +1126,7 @@ describe('ActsFeatureAbilityTest', function () {
expect(data.defaultFormWidth).assertEqual(0); expect(data.defaultFormWidth).assertEqual(0);
expect(data.uri).assertEqual("uriTest"); expect(data.uri).assertEqual("uriTest");
console.log("checkAbilityInfo end " + data); console.info("checkAbilityInfo end " + data);
} }
/** /**
...@@ -1570,15 +1135,15 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1570,15 +1135,15 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_GetAbilityInfo_0100', 0, async function (done) { it('ACTS_GetAbilityInfo_0100', 0, async function (done) {
var promise = featureAbility.getAbilityInfo(); await featureAbility.getContext().getAbilityInfo().then((data)=>{
expect(typeof (promise)).assertEqual("object"); checkAbilityInfo(data);
console.info('====> ACTS_GetAbilityInfo_0100 data=====>' + JSON.stringify(data))
var info = await featureAbility.getAbilityInfo(); done()
checkAbilityInfo(info); }).catch((err)=>{
done(); console.info('====> ACTS_GetAbilityInfo_0100 err=====>' + JSON.stringify(err))
setTimeout(function () { expect().assertFail()
console.info('====> ACTS_GetAbilityInfo_0100 =====>') done()
}, TIMEOUT) });
}) })
/** /**
...@@ -1587,42 +1152,24 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1587,42 +1152,24 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_GetAbilityInfo_0200', 0, async function (done) { it('ACTS_GetAbilityInfo_0200', 0, async function (done) {
var result = featureAbility.getAbilityInfo( featureAbility.getContext().getAbilityInfo(
(err, data) => { (err, data) => {
if(err.code != 0){
expect().assertFail()
done()
}else{
console.info('====> ACTS_GetAbilityInfo_0200 =====>' + JSON.stringify(data))
checkAbilityInfo(data); checkAbilityInfo(data);
done() done()
} }
}
); );
setTimeout(function () { await sleep(1000)
console.info('====> ACTS_GetAbilityInfo_0200 =====>')
}, TIMEOUT)
}) })
// checkHapModuleInfo // checkHapModuleInfo
function checkHapModuleInfo(data) { function checkHapModuleInfo(data) {
console.log("checkHapModuleInfo start " + data); console.info("checkHapModuleInfo start " + JSON.stringify(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);
expect(typeof (data)).assertEqual("object"); expect(typeof (data)).assertEqual("object");
expect(typeof (data.name)).assertEqual("string"); expect(typeof (data.name)).assertEqual("string");
expect(typeof (data.description)).assertEqual("string"); expect(typeof (data.description)).assertEqual("string");
...@@ -1635,11 +1182,10 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1635,11 +1182,10 @@ describe('ActsFeatureAbilityTest', function () {
expect(typeof (data.supportedModes)).assertEqual("number"); expect(typeof (data.supportedModes)).assertEqual("number");
expect(Array.isArray(data.reqCapabilities)).assertEqual(true); expect(Array.isArray(data.reqCapabilities)).assertEqual(true);
expect(Array.isArray(data.deviceTypes)).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.moduleName)).assertEqual("string");
expect(typeof (data.mainAbilityName)).assertEqual("string"); expect(typeof (data.mainAbilityName)).assertEqual("string");
expect(typeof (data.installationFree)).assertEqual("boolean"); expect(typeof (data.installationFree)).assertEqual("boolean");
expect(data.name).assertEqual("com.example.actsfeatureabilitytest"); expect(data.name).assertEqual("com.example.actsfeatureabilitytest");
expect(data.description).assertEqual("descriptionTest"); expect(data.description).assertEqual("descriptionTest");
expect(data.descriptionId).assertEqual(0); expect(data.descriptionId).assertEqual(0);
...@@ -1649,15 +1195,13 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1649,15 +1195,13 @@ describe('ActsFeatureAbilityTest', function () {
expect(data.iconId).assertEqual(0); expect(data.iconId).assertEqual(0);
expect(data.backgroundImg).assertEqual(""); expect(data.backgroundImg).assertEqual("");
expect(data.supportedModes).assertEqual(0); expect(data.supportedModes).assertEqual(0);
expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1"); expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1");
expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2"); expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2");
expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.deviceTypes[0]).assertEqual("phone");
expect(data.moduleName).assertEqual("entry") expect(data.moduleName).assertEqual("entry")
expect(data.mainAbilityName).assertEqual(""); expect(data.mainAbilityName).assertEqual("");
expect(data.installationFree).assertEqual(false); expect(data.installationFree).assertEqual(false);
console.info("checkHapModuleInfo end " + data);
console.log("checkHapModuleInfo end " + data);
} }
/** /**
...@@ -1666,14 +1210,16 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1666,14 +1210,16 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_GetHapModuleInfo_0100', 0, async function (done) { it('ACTS_GetHapModuleInfo_0100', 0, async function (done) {
var promise = featureAbility.getHapModuleInfo(); await featureAbility.getContext().getHapModuleInfo().then((data)=>{
expect(typeof (promise)).assertEqual("object"); checkHapModuleInfo(data);
var info = await featureAbility.getHapModuleInfo(); console.info('====> ACTS_GetHapModuleInfo_0100 data=====>' + JSON.stringify(data))
checkHapModuleInfo(info);
done(); done();
setTimeout(function () { }).catch((err)=>{
console.info('====> ACTS_GetHapModuleInfo_0100 =====>') console.info('====> ACTS_GetHapModuleInfo_0100 err=====>' + JSON.stringify(err))
}, TIMEOUT) expect().assertFail()
done()
});
}) })
/** /**
...@@ -1682,20 +1228,26 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1682,20 +1228,26 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_GetHapModuleInfo_0200', 0, async function (done) { it('ACTS_GetHapModuleInfo_0200', 0, async function (done) {
var result = featureAbility.getHapModuleInfo( let tempInfo
featureAbility.getContext().getHapModuleInfo(
(err, data) => { (err, data) => {
checkHapModuleInfo(data); if(err.code != 0){
expect().assertFail()
done()
}else{
console.info('====> ACTS_GetHapModuleInfo_0200 =====>' + JSON.stringify(tempInfo))
tempInfo = data
checkHapModuleInfo(tempInfo);
done() done()
} }
}
); );
setTimeout(function () { await sleep(1000)
console.info('====> ACTS_GetHapModuleInfo_0200 =====>')
}, TIMEOUT)
}) })
// checkProcessName // checkProcessName
function checkProcessName(info) { function checkProcessName(info) {
console.log("checkProcessName processName : " + info); console.info("checkProcessName processName : " + info);
expect(typeof (info)).assertEqual("string"); expect(typeof (info)).assertEqual("string");
expect(info).assertEqual("processTestAbility"); expect(info).assertEqual("processTestAbility");
} }
...@@ -1706,15 +1258,16 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1706,15 +1258,16 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by promise) * @tc.desc: Check the return value of the interface (by promise)
*/ */
it('ACTS_GetProcessName_0100', 0, async function (done) { it('ACTS_GetProcessName_0100', 0, async function (done) {
var context = featureAbility.getContext(); let context = featureAbility.getContext();
var promise = context.getProcessName(); await context.getProcessName().then((data)=>{
expect(typeof (promise)).assertEqual("object"); console.info('====> ACTS_GetProcessName_0100 data=====>' + JSON.stringify(data))
var info = await context.getProcessName(); checkProcessName(data);
checkProcessName(info); done()
}).catch((err)=>{
console.info('====> ACTS_GetProcessName_0100 err=====>' + JSON.stringify(err))
expect().assertFail()
done(); done();
setTimeout(function () { });
console.info('====> ACTS_GetProcessName_0100 =====>')
}, TIMEOUT)
}) })
/** /**
...@@ -1723,16 +1276,22 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1723,16 +1276,22 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return value of the interface (by AsyncCallback) * @tc.desc: Check the return value of the interface (by AsyncCallback)
*/ */
it('ACTS_GetProcessName_0200', 0, async function (done) { it('ACTS_GetProcessName_0200', 0, async function (done) {
var context = featureAbility.getContext(); let tempInfo
var result = context.getProcessName( let context = featureAbility.getContext();
context.getProcessName(
(err, data) => { (err, data) => {
checkProcessName(data); if(err.code!= 0){
expect().assertFail()
done() done()
}else{
tempInfo = data
checkProcessName(tempInfo);
console.info('====> ACTS_GetProcessName_0200 =====>' + JSON.stringify(tempInfo))
done()
}
} }
); );
setTimeout(function () { await sleep(1000)
console.info('====> ACTS_GetProcessName_0200 =====>')
}, TIMEOUT)
}) })
/** /**
...@@ -1741,7 +1300,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1741,7 +1300,7 @@ describe('ActsFeatureAbilityTest', function () {
* @tc.desc: Check the return type of the interface (by AsyncCallback) * @tc.desc: Check the return type of the interface (by AsyncCallback)
*/ */
it('ACTS_GetCallingBundle_0100', 0, async function (done) { it('ACTS_GetCallingBundle_0100', 0, async function (done) {
var Subscriber; let Subscriber;
let id; let id;
let events = new Map(); let events = new Map();
...@@ -1783,7 +1342,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1783,7 +1342,7 @@ describe('ActsFeatureAbilityTest', function () {
done(); done();
} }
id = setTimeout(timeout, START_ABILITY_TIMEOUT); id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var result = await featureAbility.startAbility( await featureAbility.startAbility(
{ {
want: want:
{ {
...@@ -1794,35 +1353,46 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1794,35 +1353,46 @@ describe('ActsFeatureAbilityTest', function () {
); );
}) })
// checkGetOrCreateLocalDir
function checkGetOrCreateLocalDir(info) {
console.info("checkGetOrCreateLocalDir root dir : " + info);
expect(info).assertEqual("/data/storage/el2/base/haps/entry");
}
// @tc.number: ACTS_GetOrCreateLocalDir_0100 // @tc.number: ACTS_GetOrCreateLocalDir_0100
// @tc.name: GetProcessName : Obtains the name of the current process. // @tc.name: GetProcessName : Obtains the name of the current process.
// @tc.desc: Check the return value of the interface (by promise) // @tc.desc: Check the return value of the interface (by promise)
it('ACTS_GetOrCreateLocalDir_0100', 0, async function (done) { it('ACTS_GetOrCreateLocalDir_0100', 0, async function (done) {
var context = featureAbility.getContext(); let context = featureAbility.getContext();
var promise = context.getOrCreateLocalDir(); await context.getOrCreateLocalDir().then((data)=>{
expect(typeof (promise)).assertEqual("object"); checkGetOrCreateLocalDir(data);
var info = await context.getOrCreateLocalDir(); console.info('====> ACTS_GetOrCreateLocalDir_0100 data=====>' + JSON.stringify(data))
expect(info).assertEqual(CREATELOCALDIR);
done(); done();
setTimeout(function () { }).catch((err)=>{
console.info('====> ACTS_GetOrCreateLocalDir_0100 =====>') console.info('====> ACTS_GetOrCreateLocalDir_0100 err=====>' + JSON.stringify(err))
}, TIMEOUT) expect().assertFail()
done()
})
}) })
// @tc.number: ACTS_GetOrCreateLocalDir_0200 // @tc.number: ACTS_GetOrCreateLocalDir_0200
// @tc.name: GetProcessName : Obtains the name of the current process. // @tc.name: GetProcessName : Obtains the name of the current process.
// @tc.desc: Check the return value of the interface (by AsyncCallback) // @tc.desc: Check the return value of the interface (by AsyncCallback)
it('ACTS_GetOrCreateLocalDir_0200', 0, async function (done) { it('ACTS_GetOrCreateLocalDir_0200', 0, async function (done) {
var context = featureAbility.getContext(); let context = featureAbility.getContext();
var result = context.getOrCreateLocalDir( context.getOrCreateLocalDir(
(err, data) => { (err, data) => {
expect(data).assertEqual(CREATELOCALDIR); 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() done()
} }
); });
setTimeout(function () { await sleep(1000)
console.info('====> ACTS_GetOrCreateLocalDir_0200 =====>')
}, TIMEOUT)
}) })
/* /*
...@@ -1839,18 +1409,23 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1839,18 +1409,23 @@ describe('ActsFeatureAbilityTest', function () {
bundleName: "com.example.startability", bundleName: "com.example.startability",
abilityName: "com.example.startability.MainAbilityXXXXX", abilityName: "com.example.startability.MainAbilityXXXXX",
} }
var StartAbilityParameter = { let StartAbilityParameter = {
want:Want want:Want
} }
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ 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)); + " data: " + JSON.stringify(data));
expect(errCode).assertEqual(error.code); if(err.code != 0){
expect(err.code).assertEqual(1);
done(); done();
}else{
expect().assertFail()
done()
}
}); });
}catch(error){ }catch(error){
console.log("ACTS_StartAbility_0700 : error = " + error); console.info("ACTS_StartAbility_0700 : error = " + error);
} }
}); });
...@@ -1868,18 +1443,23 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1868,18 +1443,23 @@ describe('ActsFeatureAbilityTest', function () {
bundleName: "com.example.startabilityxxxxx", bundleName: "com.example.startabilityxxxxx",
abilityName: "com.example.startability.MainAbility", abilityName: "com.example.startability.MainAbility",
} }
var StartAbilityParameter = { let StartAbilityParameter = {
want:Want want:Want
} }
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ 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)); + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue(); if(err.code != 0){
expect(err.code).assertEqual(1);
done(); done();
}else{
expect().assertFail()
done()
}
}); });
}catch(error){ }catch(error){
console.log("ACTS_StartAbility_0800 : error = " + error); console.info("ACTS_StartAbility_0800 : error = " + error);
} }
}); });
...@@ -1897,18 +1477,23 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1897,18 +1477,23 @@ describe('ActsFeatureAbilityTest', function () {
bundleName: "com.example.startability", bundleName: "com.example.startability",
abilityName: "com.example.startability.MainAbility", abilityName: "com.example.startability.MainAbility",
} }
var StartAbilityParameter = { let StartAbilityParameter = {
want:Want want:Want
} }
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ 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); + " data: " + JSON.stringify(data) + "err.code: " + err.code);
if(err.code != 0){
expect(err.code != 0).assertTrue(); expect(err.code != 0).assertTrue();
done(); done();
}else{
expect().assertFail()
done()
}
}); });
}catch(error){ }catch(error){
console.log("ACTS_StartAbility_0900 : error = " + error); console.info("ACTS_StartAbility_0900 : error = " + error);
} }
}); });
...@@ -1924,18 +1509,23 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1924,18 +1509,23 @@ describe('ActsFeatureAbilityTest', function () {
let Want = { let Want = {
action: "action.sysxxxtem.homexxxx" action: "action.sysxxxtem.homexxxx"
} }
var StartAbilityParameter = { let StartAbilityParameter = {
want:Want want:Want
} }
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ 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)); + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue(); if(err.code != 0){
expect(err.code).assertEqual(1);
done(); done();
}else{
expect().assertFail()
done()
}
}); });
}catch(error){ }catch(error){
console.log("ACTS_StartAbility_1100 : error = " + error); console.info("ACTS_StartAbility_1100 : error = " + error);
} }
}); });
...@@ -1952,18 +1542,23 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1952,18 +1542,23 @@ describe('ActsFeatureAbilityTest', function () {
action: "action.system.home", action: "action.system.home",
entities: ["entity.system.homexxxxxxxxx"] entities: ["entity.system.homexxxxxxxxx"]
} }
var StartAbilityParameter = { let StartAbilityParameter = {
want:Want want:Want
} }
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ 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)); + " data: " + JSON.stringify(data));
expect(err.code != 0).assertTrue(); if(err.code != 0){
expect(err.code).assertEqual(1);
done(); done();
}else{
expect().assertFail()
done()
}
}); });
}catch(error){ }catch(error){
console.log("ACTS_StartAbility_1200 : error = " + error); console.info("ACTS_StartAbility_1200 : error = " + error);
} }
}); });
...@@ -1976,7 +1571,7 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -1976,7 +1571,7 @@ describe('ActsFeatureAbilityTest', function () {
it("ACTS_StartAbility_1300",0, async function(done){ it("ACTS_StartAbility_1300",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1300-------------------"); console.info("------------------logMessage ACTS_StartAbility_1300-------------------");
try{ try{
var Subscriber; let Subscriber;
let id; let id;
function SubscribeCallBack(err, data) { function SubscribeCallBack(err, data) {
...@@ -2010,17 +1605,20 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2010,17 +1605,20 @@ describe('ActsFeatureAbilityTest', function () {
action: "action.system.homeability", action: "action.system.homeability",
entities: [] entities: []
} }
var StartAbilityParameter = { let StartAbilityParameter = {
want:Want want:Want
} }
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ 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)); + " data: " + JSON.stringify(data));
expect(err.code == 0).assertTrue(); if(err.code != 0){
expect().assertFail()
done()
}
}); });
}catch(error){ }catch(error){
console.log("ACTS_StartAbility_1300 : error = " + error); console.info("ACTS_StartAbility_1300 : error = " + error);
} }
}); });
...@@ -2037,17 +1635,25 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2037,17 +1635,25 @@ describe('ActsFeatureAbilityTest', function () {
action: "action.system.home", action: "action.system.home",
entities: 'asdfghj' entities: 'asdfghj'
} }
var StartAbilityParameter = { let StartAbilityParameter = {
want:Want want:Want
} }
featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ 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)); + " data: " + JSON.stringify(data));
done(); if(err.code != 0){
expect().assertFail()
done()
}else{
expect(err.code).assertEqual(0)
done()
}
}); });
}catch(error){ }catch(error){
console.log("ACTS_StartAbility_1400 : error = " + error); console.info("ACTS_StartAbility_1400 : error = " + error);
expect().assertFail()
done()
} }
}); });
...@@ -2060,22 +1666,22 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2060,22 +1666,22 @@ describe('ActsFeatureAbilityTest', function () {
it("ACTS_StartAbility_1600",0, async function(done){ it("ACTS_StartAbility_1600",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1600-------------------"); console.info("------------------logMessage ACTS_StartAbility_1600-------------------");
let Want = {} let Want = {}
var StartAbilityParameter = { let StartAbilityParameter = {
want:Want want:Want
} }
var promise = featureAbility.startAbility(StartAbilityParameter); let promise = featureAbility.startAbility(StartAbilityParameter);
if (promise) { if (promise) {
promise.then((data) => { 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(); expect().assertFail();
done(); done();
}).catch((err)=>{ }).catch((err)=>{
expect(err.code != 0).assertTrue(); expect(err.code).assertEqual(1);
done(); done();
}); });
} else { } else {
expect(promise == undefined).assertTrue(); expect().assertFail()
done(); done();
} }
}); });
...@@ -2088,19 +1694,19 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2088,19 +1694,19 @@ describe('ActsFeatureAbilityTest', function () {
*/ */
it("ACTS_StartAbility_1700",0, async function(done){ it("ACTS_StartAbility_1700",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1700-------------------"); console.info("------------------logMessage ACTS_StartAbility_1700-------------------");
var StartAbilityParameter = {} let StartAbilityParameter = {}
var promise = featureAbility.startAbility(StartAbilityParameter) let promise = featureAbility.startAbility(StartAbilityParameter)
if (promise) { if (promise) {
promise.then((data) => { promise.then((data) => {
console.log('ACTS_StartAbility_1700 data: ' + JSON.stringify(data)); console.info('ACTS_StartAbility_1700 data: ' + JSON.stringify(data));
expect().assertFail(); expect().assertFail();
done(); done();
}).catch((err)=>{ }).catch((err)=>{
expect(err.code != 0).assertTrue(); expect(err.code).assertEqual(202);
done(); done();
}); });
} else { } else {
expect(promise == undefined).assertTrue(); expect().assertFail()
done(); done();
} }
}); });
...@@ -2113,18 +1719,18 @@ describe('ActsFeatureAbilityTest', function () { ...@@ -2113,18 +1719,18 @@ describe('ActsFeatureAbilityTest', function () {
*/ */
it("ACTS_StartAbility_1800",0, async function(done){ it("ACTS_StartAbility_1800",0, async function(done){
console.info("------------------logMessage ACTS_StartAbility_1800-------------------"); console.info("------------------logMessage ACTS_StartAbility_1800-------------------");
var promise = featureAbility.startAbility(undefined); let promise = featureAbility.startAbility(undefined);
if (promise) { if (promise) {
promise.then((data) => { 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(); expect().assertFail();
done(); done();
}).catch((err)=>{ }).catch((err)=>{
expect(err.code != 0).assertTrue(); expect(err.code).assertEqual(202);
done(); done();
}); });
} else { } else {
expect(promise == undefined).assertTrue(); expect().assertFail()
done(); done();
} }
}); });
......
...@@ -62,16 +62,17 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -62,16 +62,17 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
tempDataC = dataC[0]; tempDataC = dataC[0];
expect(error.code).assertEqual(ERR_OK_CODE); expect(error.code).assertEqual(ERR_OK_CODE);
expect(error.message).assertEqual(ERR_OK); expect(error.message).assertEqual(ERR_OK);
done();
console.log(`==========${callbackName} ${describeName} end==========`); console.log(`==========${callbackName} ${describeName} end==========`);
}); });
await sleep(2000) await sleep(2000)
checkDataB(tempDataB) checkDataB(tempDataB)
checkDataC(tempDataC) checkDataC(tempDataC)
done();
} catch (error) { } catch (error) {
console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName} should not reach here`); console.log(`${callbackName} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -110,6 +111,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -110,6 +111,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`);
console.log(`${promiseName} should not reach here`); console.log(`${promiseName} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
function checkDataB(formInfo){ function checkDataB(formInfo){
...@@ -121,9 +123,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -121,9 +123,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type) expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_b').assertEqual(formInfo.jsComponentName) expect('card_b').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode) expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode)
expect(1).assertEqual(formInfo.isDefault) expect(formInfo.isDefault).assertTrue()
expect(1).assertEqual(formInfo.updateEnabled) expect(formInfo.updateEnabled).assertTrue()
expect(1).assertEqual(formInfo.formVisibleNotify) expect(formInfo.formVisibleNotify).assertTrue()
expect(undefined).assertEqual(formInfo.relatedBundleName) expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityb").assertEqual(formInfo.formConfigAbility) expect("abilityb").assertEqual(formInfo.formConfigAbility)
expect(3).assertEqual(formInfo.updateDuration) expect(3).assertEqual(formInfo.updateDuration)
...@@ -131,8 +133,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -131,8 +133,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect('10:30').assertEqual(formInfo.scheduledUpdateTime) expect('10:30').assertEqual(formInfo.scheduledUpdateTime)
expect(1).assertEqual(formInfo.supportDimensions[0]) expect(1).assertEqual(formInfo.supportDimensions[0])
expect(2).assertEqual(formInfo.supportDimensions[1]) expect(2).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameB').assertEqual(formInfo.metaData.customizeData[0].name) expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name)
expect('valueB').assertEqual(formInfo.metaData.customizeData[0].value) expect('valueB').assertEqual(formInfo.customizeData[0].value)
} }
function checkDataC(formInfo){ function checkDataC(formInfo){
expect("com.ohos.st.formsystemproviderc").assertEqual(formInfo.bundleName) expect("com.ohos.st.formsystemproviderc").assertEqual(formInfo.bundleName)
...@@ -143,9 +145,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -143,9 +145,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type) expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_c').assertEqual(formInfo.jsComponentName) expect('card_c').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_LIGHT).assertEqual(formInfo.colorMode) expect(FormInfo.ColorMode.MODE_LIGHT).assertEqual(formInfo.colorMode)
expect(1).assertEqual(formInfo.isDefault) expect(formInfo.isDefault).assertTrue()
expect(1).assertEqual(formInfo.updateEnabled) expect(formInfo.updateEnabled).assertTrue()
expect(1).assertEqual(formInfo.formVisibleNotify) expect(formInfo.formVisibleNotify).assertTrue()
expect(undefined).assertEqual(formInfo.relatedBundleName) expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityc").assertEqual(formInfo.formConfigAbility) expect("abilityc").assertEqual(formInfo.formConfigAbility)
expect(4).assertEqual(formInfo.updateDuration) expect(4).assertEqual(formInfo.updateDuration)
...@@ -153,8 +155,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -153,8 +155,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(3).assertEqual(formInfo.defaultDimension) expect(3).assertEqual(formInfo.defaultDimension)
expect(3).assertEqual(formInfo.supportDimensions[0]) expect(3).assertEqual(formInfo.supportDimensions[0])
expect(4).assertEqual(formInfo.supportDimensions[1]) expect(4).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameC').assertEqual(formInfo.metaData.customizeData[0].name) expect('originWidgetNameC').assertEqual(formInfo.customizeData[0].name)
expect('valueC').assertEqual(formInfo.metaData.customizeData[0].value) expect('valueC').assertEqual(formInfo.customizeData[0].value)
} }
}); });
}; };
...@@ -74,6 +74,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -74,6 +74,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName} should not reach here`); console.log(`${callbackName} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -115,6 +116,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -115,6 +116,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`); console.log(`${promiseName} exception caught: ${JSON.stringify(error)})`);
console.log(`${promiseName} should not reach here`); console.log(`${promiseName} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -127,9 +129,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -127,9 +129,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type) expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_b').assertEqual(formInfo.jsComponentName) expect('card_b').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode) expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode)
expect(1).assertEqual(formInfo.isDefault) expect(formInfo.isDefault).assertTrue()
expect(1).assertEqual(formInfo.updateEnabled) expect(formInfo.updateEnabled).assertTrue()
expect(1).assertEqual(formInfo.formVisibleNotify) expect(formInfo.formVisibleNotify).assertTrue()
expect(undefined).assertEqual(formInfo.relatedBundleName) expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityb").assertEqual(formInfo.formConfigAbility) expect("abilityb").assertEqual(formInfo.formConfigAbility)
expect(3).assertEqual(formInfo.updateDuration) expect(3).assertEqual(formInfo.updateDuration)
...@@ -137,8 +139,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -137,8 +139,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect('10:30').assertEqual(formInfo.scheduledUpdateTime) expect('10:30').assertEqual(formInfo.scheduledUpdateTime)
expect(1).assertEqual(formInfo.supportDimensions[0]) expect(1).assertEqual(formInfo.supportDimensions[0])
expect(2).assertEqual(formInfo.supportDimensions[1]) expect(2).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameB').assertEqual(formInfo.metaData.customizeData[0].name) expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name)
expect('valueB').assertEqual(formInfo.metaData.customizeData[0].value) expect('valueB').assertEqual(formInfo.customizeData[0].value)
} }
function checkDataA1(formInfo){ function checkDataA1(formInfo){
...@@ -150,9 +152,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -150,9 +152,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type) expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_a01').assertEqual(formInfo.jsComponentName) expect('card_a01').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_DARK).assertEqual(formInfo.colorMode) expect(FormInfo.ColorMode.MODE_DARK).assertEqual(formInfo.colorMode)
expect(1).assertEqual(formInfo.isDefault) expect(formInfo.isDefault).assertTrue()
expect(1).assertEqual(formInfo.updateEnabled) expect(formInfo.updateEnabled).assertTrue()
expect(1).assertEqual(formInfo.formVisibleNotify) expect(formInfo.formVisibleNotify).assertTrue()
expect(undefined).assertEqual(formInfo.relatedBundleName) expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilitya01").assertEqual(formInfo.formConfigAbility) expect("abilitya01").assertEqual(formInfo.formConfigAbility)
expect(1).assertEqual(formInfo.updateDuration) expect(1).assertEqual(formInfo.updateDuration)
...@@ -160,8 +162,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -160,8 +162,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect('5:30').assertEqual(formInfo.scheduledUpdateTime) expect('5:30').assertEqual(formInfo.scheduledUpdateTime)
expect(1).assertEqual(formInfo.supportDimensions[0]) expect(1).assertEqual(formInfo.supportDimensions[0])
expect(3).assertEqual(formInfo.supportDimensions[1]) expect(3).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameA01').assertEqual(formInfo.metaData.customizeData[0].name) expect('originWidgetNameA01').assertEqual(formInfo.customizeData[0].name)
expect('valueA01').assertEqual(formInfo.metaData.customizeData[0].value) expect('valueA01').assertEqual(formInfo.customizeData[0].value)
} }
function checkDataA2(formInfo){ function checkDataA2(formInfo){
...@@ -173,9 +175,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -173,9 +175,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type) expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_a02').assertEqual(formInfo.jsComponentName) expect('card_a02').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_LIGHT).assertEqual(formInfo.colorMode) expect(FormInfo.ColorMode.MODE_LIGHT).assertEqual(formInfo.colorMode)
expect(0).assertEqual(formInfo.isDefault) expect(formInfo.isDefault).assertFalse()
expect(0).assertEqual(formInfo.updateEnabled) expect(formInfo.updateEnabled).assertFalse()
expect(0).assertEqual(formInfo.formVisibleNotify) expect(formInfo.formVisibleNotify).assertFalse()
expect(undefined).assertEqual(formInfo.relatedBundleName) expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilitya02").assertEqual(formInfo.formConfigAbility) expect("abilitya02").assertEqual(formInfo.formConfigAbility)
expect(2).assertEqual(formInfo.updateDuration) expect(2).assertEqual(formInfo.updateDuration)
...@@ -185,8 +187,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -185,8 +187,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(2).assertEqual(formInfo.supportDimensions[1]) expect(2).assertEqual(formInfo.supportDimensions[1])
expect(3).assertEqual(formInfo.supportDimensions[2]) expect(3).assertEqual(formInfo.supportDimensions[2])
expect(4).assertEqual(formInfo.supportDimensions[3]) expect(4).assertEqual(formInfo.supportDimensions[3])
expect('originWidgetNameA02').assertEqual(formInfo.metaData.customizeData[0].name) expect('originWidgetNameA02').assertEqual(formInfo.customizeData[0].name)
expect('valueA02').assertEqual(formInfo.metaData.customizeData[0].value) expect('valueA02').assertEqual(formInfo.customizeData[0].value)
} }
}); });
}; };
...@@ -68,6 +68,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -68,6 +68,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`);
console.log(`${callbackName} should not reach here`); console.log(`${callbackName} should not reach here`);
expect().assertFail(); expect().assertFail();
done();
} }
}); });
...@@ -118,9 +119,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -118,9 +119,9 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect(FormInfo.FormType.JS).assertEqual(formInfo.type) expect(FormInfo.FormType.JS).assertEqual(formInfo.type)
expect('card_b').assertEqual(formInfo.jsComponentName) expect('card_b').assertEqual(formInfo.jsComponentName)
expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode) expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode)
expect(1).assertEqual(formInfo.isDefault) expect(formInfo.isDefault).assertTrue()
expect(1).assertEqual(formInfo.updateEnabled) expect(formInfo.updateEnabled).assertTrue()
expect(1).assertEqual(formInfo.formVisibleNotify) expect(formInfo.formVisibleNotify).assertTrue()
expect(undefined).assertEqual(formInfo.relatedBundleName) expect(undefined).assertEqual(formInfo.relatedBundleName)
expect("abilityb").assertEqual(formInfo.formConfigAbility) expect("abilityb").assertEqual(formInfo.formConfigAbility)
expect(3).assertEqual(formInfo.updateDuration) expect(3).assertEqual(formInfo.updateDuration)
...@@ -128,8 +129,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { ...@@ -128,8 +129,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => {
expect('10:30').assertEqual(formInfo.scheduledUpdateTime) expect('10:30').assertEqual(formInfo.scheduledUpdateTime)
expect(1).assertEqual(formInfo.supportDimensions[0]) expect(1).assertEqual(formInfo.supportDimensions[0])
expect(2).assertEqual(formInfo.supportDimensions[1]) expect(2).assertEqual(formInfo.supportDimensions[1])
expect('originWidgetNameB').assertEqual(formInfo.metaData.customizeData[0].name) expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name)
expect('valueB').assertEqual(formInfo.metaData.customizeData[0].value) expect('valueB').assertEqual(formInfo.customizeData[0].value)
} }
}); });
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册