提交 138132bf 编写于 作者: Y yangzk

fixed fd169766 from https://gitee.com/yzkp/xts_acts/pulls/6143

IssueNo: #I5XSF5
Description: 元能力补充导出类接口覆盖
Sig: SIG_ApplicationFramework
Feature or Bugfix: Feature
Binary Source: No
Signed-off-by: Nyangzk <yangzhongkai@huawei.com>
Change-Id: Ibf02da033204f6fe97234cd55448db69be307b1c
上级 285742c8
......@@ -26,6 +26,7 @@ import applicationContext from '@ohos.application.context'
import commonEvent from '@ohos.commonEvent';
import ability from '@ohos.ability.ability';
import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import common from '@ohos.app.ability.common';
var EXTENSION_INFO_ERR = 16000001
var INNER_ERROR = 16000050
......@@ -312,8 +313,21 @@ export default function ApiCoverTest() {
*/
it('SUB_AA_ABILITY_Extension_API_012', 0, async function (done) {
try {
globalThis.abilityContext.getApplicationContext().killProcessesBySelf();
globalThis.abilityContext.getApplicationContext().killProcessesBySelf((err, data) => {
let info: appManager.ProcessRunningInfo;
let stageContext: common.AbilityStageContext = globalThis.stageContext;
let abilityContext: common.AbilityContext = globalThis.abilityContext;
let appContext: common.ApplicationContext = abilityContext.getApplicationContext();
let baseContext: common.BaseContext = stageContext;
let context: common.Context = stageContext;
let el1 = common.AreaMode.EL1;
let el2 = common.AreaMode.EL2;
let eventHub: common.EventHub = context.eventHub;
let permissionRequestResult: common.PermissionRequestResult;
let abilityResult: common.AbilityResult;
let connectOptions: common.ConnectOptions;
appContext.killProcessesBySelf();
appContext.killProcessesBySelf((err, data) => {
console.log(`killProcessesBySelf, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`);
})
let abilityDelegator: abilityDelegatorRegistry.AbilityDelegator;
......
import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.app.form.formBindingData';
import formInfo from '@ohos.app.form.formInfo';
import common from '@ohos.app.ability.common';
export default class FormModuleAbility extends FormExtensionAbility {
onAddForm(want) {
// Called to return a FormBindingData object.
console.info("FormAbility onAddForm")
globalThis.abilityContext = this.context;
let formExtensionAbilities: common.FormExtensionContext = this.context;
let extensionAbilities: common.ExtensionContext = this.context;
let formData = {
};
return formBindingData.createFormBindingData(formData);
......
......@@ -918,6 +918,68 @@ export default function ActsNotificationWantAgentNewTest() {
})
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3100 END`)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3200
* @tc.name : function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback<CompleteData>): void
* @tc.desc : Triggers a WantAgent
*/
it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3200', 0, async function (done) {
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3200 START`)
WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY
WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG
wantAgent.getWantAgent(WantAgentInfo, (err, data) => {
if (err.code) {
console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`)
expect(false).assertTrue()
done()
} else {
WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
let triggerInfo = {
code: 0,
want: {
deviceId: "deviceId",
bundleName: "com.example.actsnotificationwantagent",
abilityName: "com.example.actsnotificationwantagent.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
myKey0: 2222,
myKey1: [1, 2, 3],
myKey2: "[1, 2, 3]",
myKey3: "notification",
myKey4: [false, true, false],
myKey5: ["ANS", "WANT", "AGENT"],
myKey6: true,
}
},
permission: '',
extraInfo: {
test: 'this is a test value'
}
}
wantAgent.trigger(WantAgent, triggerInfo, (err, data) => {
console.info(`${TAG} trigger Callback success: ${JSON.stringify(data)}`)
expect(err.code).assertEqual(0)
expect(typeof(data.wantAgent)).assertEqual('object')
expect(data.finalCode).assertEqual(0)
expect(data.finalData).assertEqual('')
expect(typeof(data.extraInfo)).assertEqual('object')
expect(data.want.deviceId).assertEqual('deviceId')
expect(data.want.bundleName).assertEqual('com.example.actsnotificationwantagent')
expect(data.want.abilityName).assertEqual('com.example.actsnotificationwantagent.MainAbility')
done()
})
}
})
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3200 END`)
})
console.info(TAG + 'SUB_NOTIFICATION_ANS_WANT_AGENT_NEW_TEST END')
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册