提交 e2072b76 编写于 作者: Z zhuhan

wantagent xts 适配错误码

Signed-off-by: Nzhuhan <zhuhan10@huawei.com>
Change-Id: Idf1474a3fd940a227fd891a26774784e007eec0e
上级 7449506e
...@@ -72,13 +72,13 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -72,13 +72,13 @@ export default function ActsNotificationWantAgentNewTest() {
WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.ONE_TIME_FLAG] WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.ONE_TIME_FLAG]
wantAgent.getWantAgent(WantAgentInfo, (err, data) => { wantAgent.getWantAgent(WantAgentInfo, (err, data) => {
if (err != null) { if (err != null) {
console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
} else { } else {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
} }
}) })
...@@ -192,13 +192,13 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -192,13 +192,13 @@ export default function ActsNotificationWantAgentNewTest() {
WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ELEMENT] WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ELEMENT]
wantAgent.getWantAgent(WantAgentInfo, (err, data) => { wantAgent.getWantAgent(WantAgentInfo, (err, data) => {
if (err != null) { if (err != null) {
console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
} else { } else {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
} }
}) })
...@@ -216,13 +216,13 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -216,13 +216,13 @@ export default function ActsNotificationWantAgentNewTest() {
WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ACTION] WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ACTION]
wantAgent.getWantAgent(WantAgentInfo, (err, data) => { wantAgent.getWantAgent(WantAgentInfo, (err, data) => {
if (err != null) { if (err != null) {
console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
} else { } else {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
} }
}) })
...@@ -240,13 +240,13 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -240,13 +240,13 @@ export default function ActsNotificationWantAgentNewTest() {
WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_URI] WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_URI]
wantAgent.getWantAgent(WantAgentInfo, (err, data) => { wantAgent.getWantAgent(WantAgentInfo, (err, data) => {
if (err != null) { if (err != null) {
console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
} else { } else {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
} }
}) })
...@@ -264,13 +264,13 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -264,13 +264,13 @@ export default function ActsNotificationWantAgentNewTest() {
WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ENTITIES] WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_ENTITIES]
wantAgent.getWantAgent(WantAgentInfo, (err, data) => { wantAgent.getWantAgent(WantAgentInfo, (err, data) => {
if (err != null) { if (err != null) {
console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
} else { } else {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
} }
}) })
...@@ -288,13 +288,13 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -288,13 +288,13 @@ export default function ActsNotificationWantAgentNewTest() {
WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_BUNDLE] WantAgentInfo.wantAgentFlags = [wantAgent.WantAgentFlags.REPLACE_BUNDLE]
wantAgent.getWantAgent(WantAgentInfo, (err, data) => { wantAgent.getWantAgent(WantAgentInfo, (err, data) => {
if (err != null) { if (err != null) {
console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
} else { } else {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
} }
}) })
...@@ -313,11 +313,11 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -313,11 +313,11 @@ export default function ActsNotificationWantAgentNewTest() {
wantAgent.getWantAgent(WantAgentInfo).then((data) => { wantAgent.getWantAgent(WantAgentInfo).then((data) => {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
}).catch((err) => { }).catch((err) => {
console.info(`${TAG} getWantAgent Promise err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
}) })
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1100 END`) console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1100 END`)
...@@ -345,6 +345,7 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -345,6 +345,7 @@ export default function ActsNotificationWantAgentNewTest() {
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1200 END`) console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1200 END`)
}) })
//TODO
/* /*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1300 * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1300
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent> * @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
...@@ -423,11 +424,11 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -423,11 +424,11 @@ export default function ActsNotificationWantAgentNewTest() {
wantAgent.getWantAgent(WantAgentInfo).then((data) => { wantAgent.getWantAgent(WantAgentInfo).then((data) => {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
}).catch((err) => { }).catch((err) => {
console.info(`${TAG} getWantAgent Promise err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
}) })
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1600 END`) console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1600 END`)
...@@ -445,11 +446,11 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -445,11 +446,11 @@ export default function ActsNotificationWantAgentNewTest() {
wantAgent.getWantAgent(WantAgentInfo).then((data) => { wantAgent.getWantAgent(WantAgentInfo).then((data) => {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
}).catch((err) => { }).catch((err) => {
console.info(`${TAG} getWantAgent Promise err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
}) })
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1700 END`) console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1700 END`)
...@@ -467,11 +468,11 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -467,11 +468,11 @@ export default function ActsNotificationWantAgentNewTest() {
wantAgent.getWantAgent(WantAgentInfo).then((data) => { wantAgent.getWantAgent(WantAgentInfo).then((data) => {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
}).catch((err) => { }).catch((err) => {
console.info(`${TAG} getWantAgent Promise err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
}) })
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1800 END`) console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1800 END`)
...@@ -489,11 +490,11 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -489,11 +490,11 @@ export default function ActsNotificationWantAgentNewTest() {
wantAgent.getWantAgent(WantAgentInfo).then((data) => { wantAgent.getWantAgent(WantAgentInfo).then((data) => {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
}).catch((err) => { }).catch((err) => {
console.info(`${TAG} getWantAgent Promise err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
}) })
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1900 END`) console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1900 END`)
...@@ -511,11 +512,11 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -511,11 +512,11 @@ export default function ActsNotificationWantAgentNewTest() {
wantAgent.getWantAgent(WantAgentInfo).then((data) => { wantAgent.getWantAgent(WantAgentInfo).then((data) => {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`)
expect(true).assertTrue() expect(false).assertTrue()
done() done()
}).catch((err) => { }).catch((err) => {
console.info(`${TAG} getWantAgent Promise err: ${err.code}`) console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code} ,message: ${err.message}`)
expect(false).assertTrue() expect(true).assertTrue()
done() done()
}) })
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2000 END`) console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2000 END`)
...@@ -538,8 +539,8 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -538,8 +539,8 @@ export default function ActsNotificationWantAgentNewTest() {
} else { } else {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
wantAgent.cancel(WantAgent, (err) => { wantAgent.cancel(WantAgent, (err, data) => {
if (err.code) { if (err) {
console.info(`${TAG} cancel AsyncCallback err: ${err.code}`) console.info(`${TAG} cancel AsyncCallback err: ${err.code}`)
expect(false).assertTrue() expect(false).assertTrue()
done() done()
...@@ -601,7 +602,7 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -601,7 +602,7 @@ export default function ActsNotificationWantAgentNewTest() {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
wantAgent.getBundleName(WantAgent, (err, data) => { wantAgent.getBundleName(WantAgent, (err, data) => {
if (err.code) { if (err) {
console.info(`${TAG} getBundleName AsyncCallback err: ${err.code}`) console.info(`${TAG} getBundleName AsyncCallback err: ${err.code}`)
expect(false).assertTrue() expect(false).assertTrue()
done() done()
...@@ -665,7 +666,7 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -665,7 +666,7 @@ export default function ActsNotificationWantAgentNewTest() {
WantAgent = data WantAgent = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
wantAgent.getUid(WantAgent, (err, data) => { wantAgent.getUid(WantAgent, (err, data) => {
if (err.code) { if (err) {
console.info(`${TAG} getUid AsyncCallback err: ${err.code}`) console.info(`${TAG} getUid AsyncCallback err: ${err.code}`)
expect(false).assertTrue() expect(false).assertTrue()
done() done()
...@@ -728,7 +729,7 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -728,7 +729,7 @@ export default function ActsNotificationWantAgentNewTest() {
wantAgentData2 = data wantAgentData2 = data
console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`)
wantAgent.equal(wantAgentData1, wantAgentData2, (err, data) => { wantAgent.equal(wantAgentData1, wantAgentData2, (err, data) => {
if (err.code) { if (err) {
console.info(`${TAG} equal AsyncCallback err: ${err.code}`) console.info(`${TAG} equal AsyncCallback err: ${err.code}`)
expect(false).assertTrue() expect(false).assertTrue()
done() done()
...@@ -884,7 +885,7 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -884,7 +885,7 @@ export default function ActsNotificationWantAgentNewTest() {
} }
} }
wantAgent.trigger(WantAgent, triggerInfo, (err, data) => { wantAgent.trigger(WantAgent, triggerInfo, (err, data) => {
if (err.code) { if (err) {
console.info(`${TAG} trigger AsyncCallback err: ${JSON.stringify(err)}`) console.info(`${TAG} trigger AsyncCallback err: ${JSON.stringify(err)}`)
expect(false).assertTrue() expect(false).assertTrue()
done() done()
...@@ -905,68 +906,6 @@ export default function ActsNotificationWantAgentNewTest() { ...@@ -905,68 +906,6 @@ export default function ActsNotificationWantAgentNewTest() {
}) })
console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3100 END`) 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 != null) {
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') 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.
先完成此消息的编辑!
想要评论请 注册