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

!6426 Adaption code getwant and ActsAbilityDelegatorCaseTest

Merge pull request !6426 from xinking129/master
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "MainAbility",
"deviceTypes": [ "deviceTypes": [
"default" "default",
"tablet"
], ],
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "MainAbility",
"deviceTypes": [ "deviceTypes": [
"default" "default",
"tablet"
], ],
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "MainAbility",
"deviceTypes": [ "deviceTypes": [
"default" "default",
"tablet"
], ],
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "MainAbility",
"deviceTypes": [ "deviceTypes": [
"default" "default",
"tablet"
], ],
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
......
...@@ -37,14 +37,6 @@ export default function actsStServiceAbilityTest() { ...@@ -37,14 +37,6 @@ export default function actsStServiceAbilityTest() {
done(); done();
}, gSetTimeout); }, gSetTimeout);
}) })
afterAll((done) => {
console.debug('= ACTS_AAAfterAll ====<begin');
setTimeout(function () {
console.debug('= ACTS_AAAfterAll ====<end');
featureAbility.terminateSelf();
done();
}, gSetTimeout);
})
/** /**
* @tc.number: ACTS_AExecuteShellCommand_0100 * @tc.number: ACTS_AExecuteShellCommand_0100
......
...@@ -63,14 +63,6 @@ describe('ActsStServiceAbilityTest', function () { ...@@ -63,14 +63,6 @@ describe('ActsStServiceAbilityTest', function () {
done(); done();
}, gSetTimeout); }, gSetTimeout);
}) })
afterAll((done) => {
console.debug('= ACTS_AafterAll ====<begin');
setTimeout(function () {
console.debug('= ACTS_AafterAll ====<end');
featureAbility.terminateSelf();
done();
}, gSetTimeout);
})
/* /*
* @tc.number ACTS_AAbilityStartSetting_0100 * @tc.number ACTS_AAbilityStartSetting_0100
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"description": "$string:hap4_desc", "description": "$string:hap4_desc",
"mainElement": "Hap4MainAbility1", "mainElement": "Hap4MainAbility1",
"deviceTypes": [ "deviceTypes": [
"default" "default",
"tablet"
], ],
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
......
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import featureAbility from '@ohos.ability.featureAbility' 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 '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function ActsGetWantTest() { export default function ActsGetWantTest() {
describe('ActsGetWantTest', function () { describe('ActsGetWantTest', function () {
beforeAll(async (done) => { var TIMEOUT_NUMBER = 3000;
console.info('ActsGetWantTest begin') afterEach(async (done) => {
done(); setTimeout(function () {
}) done();
}, 1500);
var TIMEOUT_NUMBER = 2500; })
// @tc.number: ACTS_GetWant_0100 // @tc.number: ACTS_GetWant_0100
// @tc.name: getWant : get want in current ability // @tc.name: getWant : get want in current ability
// @tc.desc:Start the ability through startabilityforresult, // @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data (by promise) // and then use terminateselfwithresult to return the data (by promise)
it('ACTS_GetWant_0100', 0, async function (done) { it('ACTS_GetWant_0100', 0, async function (done) {
featureAbility.startAbilityForResult({ featureAbility.startAbilityForResult({
want: { want: {
deviceId: "", deviceId: "",
bundleName: "com.example.actsgetwantalltesthap", bundleName: "com.example.actsgetwantalltesthap",
abilityName: "com.example.actsgetwantalltesthap.MainAbility", abilityName: "com.example.actsgetwantalltesthap.MainAbility",
action: "action1", action: "action1",
parameters: parameters:
{ {
mykey0: 1, mykey0: 1,
mykey1: [1, 2, 3], mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]", mykey2: "[1, 2, 3]",
mykey3: "str", mykey3: "str",
mykey4: [false, true, false], mykey4: [false, true, false],
mykey5: ["str", "STR", "helloopenharmony"], mykey5: ["str", "STR", "helloopenharmony"],
mykey6: {"subKey1":"STRING", "subKey2":10, "subKey3":true}, mykey6: {"subKey1":"STRING", "subKey2":10, "subKey3":true},
}, },
} }
}).then((data) => { }).then((data) => {
console.info('====> ACTS_GetWant_0100 start ability=====>' + JSON.stringify(data)) setTimeout(()=>{
expect(data.want.deviceId).assertEqual(""); console.info('====> ACTS_GetWant_0100 start ability=====>' + JSON.stringify(data))
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.deviceId).assertEqual("");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.action).assertEqual("action1"); expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.parameters.mykey0).assertEqual(1); expect(data.want.action).assertEqual("action1");
expect(data.want.parameters.mykey1[0]).assertEqual(1); expect(data.want.parameters.mykey0).assertEqual(1);
expect(data.want.parameters.mykey1[1]).assertEqual(2); expect(data.want.parameters.mykey1[0]).assertEqual(1);
expect(data.want.parameters.mykey1[2]).assertEqual(3); expect(data.want.parameters.mykey1[1]).assertEqual(2);
expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); expect(data.want.parameters.mykey1[2]).assertEqual(3);
expect(data.want.parameters.mykey3).assertEqual("str"); expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]");
expect(data.want.parameters.mykey4[0]).assertEqual(false); expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.parameters.mykey4[1]).assertEqual(true); expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey4[2]).assertEqual(false); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey5[0]).assertEqual("str"); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey6["subKey1"]).assertEqual("STRING"); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
expect(data.want.parameters.mykey6["subKey2"]).assertEqual(10); expect(data.want.parameters.mykey6["subKey1"]).assertEqual("STRING");
expect(data.want.parameters.mykey6["subKey3"]).assertEqual(true); expect(data.want.parameters.mykey6["subKey2"]).assertEqual(10);
setTimeout(()=>{ expect(data.want.parameters.mykey6["subKey3"]).assertEqual(true);
done(); done();
}, TIMEOUT_NUMBER); }, TIMEOUT_NUMBER);
}).catch((error) => { }).catch((error) => {
console.log('ACTS_GetWant_0100 error: ' + JSON.stringify(error)) console.log('ACTS_GetWant_0100 error: ' + JSON.stringify(error))
expect.assertFail() expect.assertFail()
done(); done();
}) })
}) })
// @tc.number: ACTS_GetWant_0200 // @tc.number: ACTS_GetWant_0200
// @tc.name: getWant : get want in current ability // @tc.name: getWant : get want in current ability
// @tc.desc:Start the ability through startabilityforresult, // @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data (by callback) // and then use terminateselfwithresult to return the data (by callback)
it('ACTS_GetWant_0200', 0, async function (done) { it('ACTS_GetWant_0200', 0, async function (done) {
featureAbility.startAbilityForResult({ featureAbility.startAbilityForResult({
want: { want: {
deviceId: "", deviceId: "",
bundleName: "com.example.actsgetwantalltesthap", bundleName: "com.example.actsgetwantalltesthap",
abilityName: "com.example.actsgetwantalltesthap.MainAbility", abilityName: "com.example.actsgetwantalltesthap.MainAbility",
action: "action1", action: "action1",
parameters: parameters:
{ {
mykey0: 1, mykey0: 1,
mykey1: [1, 2, 3], mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]", mykey2: "[1, 2, 3]",
mykey3: "str", mykey3: "str",
mykey4: [false, true, false], mykey4: [false, true, false],
mykey5: ["str", "STR", "helloopenharmony"], mykey5: ["str", "STR", "helloopenharmony"],
}, },
} }
}, },
(err, data) => { (err, data) => {
console.info('====> ACTS_GetWant_0200 start ability=====>' + JSON.stringify(data)) setTimeout(()=>{
expect(data.want.deviceId).assertEqual(""); console.info('====> ACTS_GetWant_0200 start ability=====>' + JSON.stringify(data))
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.deviceId).assertEqual("");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.action).assertEqual("action1"); expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.parameters.mykey0).assertEqual(1); expect(data.want.action).assertEqual("action1");
expect(data.want.parameters.mykey1[0]).assertEqual(1); expect(data.want.parameters.mykey0).assertEqual(1);
expect(data.want.parameters.mykey1[1]).assertEqual(2); expect(data.want.parameters.mykey1[0]).assertEqual(1);
expect(data.want.parameters.mykey1[2]).assertEqual(3); expect(data.want.parameters.mykey1[1]).assertEqual(2);
expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); expect(data.want.parameters.mykey1[2]).assertEqual(3);
expect(data.want.parameters.mykey3).assertEqual("str"); expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]");
expect(data.want.parameters.mykey4[0]).assertEqual(false); expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.parameters.mykey4[1]).assertEqual(true); expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey4[2]).assertEqual(false); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey5[0]).assertEqual("str"); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
setTimeout(()=>{ expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
done(); done();
}, TIMEOUT_NUMBER); }, TIMEOUT_NUMBER);
}) })
}) })
// @tc.number: ACTS_GetWant_0300 // @tc.number: ACTS_GetWant_0300
// @tc.name: getWant : get want in current ability // @tc.name: getWant : get want in current ability
// @tc.desc:Start the ability through startabilityforresult, // @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data (by promise) // and then use terminateselfwithresult to return the data (by promise)
it('ACTS_GetWant_0300', 0, async function (done) { it('ACTS_GetWant_0300', 0, async function (done) {
featureAbility.startAbilityForResult({ featureAbility.startAbilityForResult({
want: want:
{ {
deviceId: "", deviceId: "",
bundleName: "com.example.actsgetwantalltesthap", bundleName: "com.example.actsgetwantalltesthap",
abilityName: "com.example.actsgetwantalltesthap.MainAbility", abilityName: "com.example.actsgetwantalltesthap.MainAbility",
action: "action2", action: "action2",
entities: ["entity1", "entity2"], entities: ["entity1", "entity2"],
type: "MIMETYPE", type: "MIMETYPE",
uri: "key={true,true,false}", uri: "key={true,true,false}",
flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT,
parameters: parameters:
{ {
mykey0: 0.1, mykey0: 0.1,
mykey1: [0.1, 0.2, 0.3], mykey1: [0.1, 0.2, 0.3],
mykey2: "[1, 2, 3]", mykey2: "[1, 2, 3]",
mykey3: "str", mykey3: "str",
mykey4: [false, true, false], mykey4: [false, true, false],
mykey5: ["str", "!@#$%", "helloopenharmony"], mykey5: ["str", "!@#$%", "helloopenharmony"],
}, },
}, },
}).then((data) => { }).then((data) => {
checkOnAbilityResult0300(data); setTimeout(()=>{
setTimeout(()=>{ console.info('====> ACTS_GetWant_0300 start ability=====>' + JSON.stringify(data))
done(); expect(data.want.deviceId).assertEqual("");
}, TIMEOUT_NUMBER); expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
}).catch((error) => { expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
console.log('ACTS_GetWant_0300 error: ' + JSON.stringify(error)) expect(data.want.action).assertEqual("action2");
expect.assertFail() expect(data.want.entities[0]).assertEqual("entity1");
done(); expect(data.want.entities[1]).assertEqual("entity2");
}) expect(data.want.type).assertEqual("MIMETYPE");
}) expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT);
function checkOnAbilityResult0300(data) { expect(data.want.parameters.mykey0).assertEqual(0.1);
console.info('====> ACTS_GetWant_0300 start ability=====>' + JSON.stringify(data)) expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
expect(data.want.deviceId).assertEqual(""); expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.parameters.mykey1[2]).assertEqual(0.3);
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]");
expect(data.want.action).assertEqual("action2"); expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.entities[0]).assertEqual("entity1"); expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.entities[1]).assertEqual("entity2"); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.type).assertEqual("MIMETYPE"); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.uri).assertEqual("key={true,true,false}"); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT); expect(data.want.parameters.mykey5[1]).assertEqual("!@#$%");
expect(data.want.parameters.mykey0).assertEqual(0.1); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); console.info('====> ACTS_GetWant_0300 before done=====>')
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); done();
expect(data.want.parameters.mykey1[2]).assertEqual(0.3); }, TIMEOUT_NUMBER);
expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); }).catch((error) => {
expect(data.want.parameters.mykey3).assertEqual("str"); console.log('ACTS_GetWant_0300 error: ' + JSON.stringify(error))
expect(data.want.parameters.mykey4[0]).assertEqual(false); expect.assertFail()
expect(data.want.parameters.mykey4[1]).assertEqual(true); done();
expect(data.want.parameters.mykey4[2]).assertEqual(false); })
expect(data.want.parameters.mykey5[0]).assertEqual("str"); })
expect(data.want.parameters.mykey5[1]).assertEqual("!@#$%");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); // @tc.number: ACTS_GetWant_0500
console.info('====> ACTS_GetWant_0300 before done=====>') // @tc.name: getWant : get want in current ability
} // @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data (by promise)
// @tc.number: ACTS_GetWant_0500 it('ACTS_GetWant_0500', 0, async function (done) {
// @tc.name: getWant : get want in current ability featureAbility.startAbilityForResult({
// @tc.desc:Start the ability through startabilityforresult, want:
// and then use terminateselfwithresult to return the data (by promise) {
it('ACTS_GetWant_0500', 0, async function (done) { deviceId: "",
featureAbility.startAbilityForResult({ bundleName: "com.example.actsgetwantalltesthap",
want: abilityName: "com.example.actsgetwantalltesthap.MainAbility",
{ action: "action1",
deviceId: "", entities: ["entity1"],
bundleName: "com.example.actsgetwantalltesthap", type: "MIMETYPE",
abilityName: "com.example.actsgetwantalltesthap.MainAbility", uri: "key={true,true,false}",
action: "action1", flags: wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED,
entities: ["entity1"], parameters:
type: "MIMETYPE", {
uri: "key={true,true,false}", mykey0: 0.1,
flags: wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED, mykey1: [0.1, 0.2, 0.0000000003],
parameters: mykey2: "[a, b, c]",
{ mykey3: "str",
mykey0: 0.1, mykey4: [false, true, false],
mykey1: [0.1, 0.2, 0.0000000003], mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
mykey2: "[a, b, c]", },
mykey3: "str", },
mykey4: [false, true, false], }).then((data) => {
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], setTimeout(()=>{
}, console.info('====> ACTS_GetWant_0500 start ability=====>' + JSON.stringify(data))
}, expect(data.want.deviceId).assertEqual("");
}).then((data) => { expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
console.info('====> ACTS_GetWant_0500 start ability=====>' + JSON.stringify(data)) expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.deviceId).assertEqual(""); expect(data.want.action).assertEqual("action1");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.entities[0]).assertEqual("entity1");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.action).assertEqual("action1"); expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.entities[0]).assertEqual("entity1"); expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED);
expect(data.want.type).assertEqual("MIMETYPE"); expect(data.want.parameters.mykey0).assertEqual(0.1);
expect(data.want.uri).assertEqual("key={true,true,false}"); expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED); expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.parameters.mykey0).assertEqual(0.1); expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey3).assertEqual("str"); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey4[0]).assertEqual(false); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey4[1]).assertEqual(true); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey4[2]).assertEqual(false); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
expect(data.want.parameters.mykey5[0]).assertEqual("str"); console.info('====> ACTS_GetWant_0500 before done=====>')
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); done();
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); }, TIMEOUT_NUMBER);
console.info('====> ACTS_GetWant_0500 before done=====>') }).catch((error) => {
setTimeout(()=>{ console.log('ACTS_GetWant_0500 error: ' + JSON.stringify(error))
done(); expect.assertFail()
}, TIMEOUT_NUMBER); done();
}).catch((error) => { })
console.log('ACTS_GetWant_0500 error: ' + JSON.stringify(error)) })
expect.assertFail()
done(); // @tc.number: ACTS_GetWant_0600
}) // @tc.name: getWant : get want in current ability
}) // @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data (by callback)
// @tc.number: ACTS_GetWant_0600 it('ACTS_GetWant_0600', 0, async function (done) {
// @tc.name: getWant : get want in current ability featureAbility.startAbilityForResult({
// @tc.desc:Start the ability through startabilityforresult, want:
// and then use terminateselfwithresult to return the data (by callback) {
it('ACTS_GetWant_0600', 0, async function (done) { deviceId: "",
featureAbility.startAbilityForResult({ bundleName: "com.example.actsgetwantalltesthap",
want: abilityName: "com.example.actsgetwantalltesthap.MainAbility",
{ action: "action1",
deviceId: "", entities: ["entity1"],
bundleName: "com.example.actsgetwantalltesthap", type: "MIMETYPE",
abilityName: "com.example.actsgetwantalltesthap.MainAbility", uri: "key={true,true,false}",
action: "action1", flags: wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED,
entities: ["entity1"], parameters:
type: "MIMETYPE", {
uri: "key={true,true,false}", mykey0: 0.1,
flags: wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED, mykey1: [0.1, 0.2, 0.0000000003],
parameters: mykey2: "[a, b, c]",
{ mykey3: "str",
mykey0: 0.1, mykey4: [false, true, false],
mykey1: [0.1, 0.2, 0.0000000003], mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
mykey2: "[a, b, c]", },
mykey3: "str", },
mykey4: [false, true, false], },
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], (err, data) => {
}, setTimeout(()=>{
}, console.info('====> ACTS_GetWant_0600 start ability=====>' + JSON.stringify(data))
}, expect(data.want.deviceId).assertEqual("");
(err, data) => { expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
console.info('====> ACTS_GetWant_0600 start ability=====>' + JSON.stringify(data)) expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.deviceId).assertEqual(""); expect(data.want.action).assertEqual("action1");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.entities[0]).assertEqual("entity1");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.action).assertEqual("action1"); expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.entities[0]).assertEqual("entity1"); expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED);
expect(data.want.type).assertEqual("MIMETYPE"); expect(data.want.parameters.mykey0).assertEqual(0.1);
expect(data.want.uri).assertEqual("key={true,true,false}"); expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORM_ENABLED); expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.parameters.mykey0).assertEqual(0.1); expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey3).assertEqual("str"); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey4[0]).assertEqual(false); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey4[1]).assertEqual(true); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey4[2]).assertEqual(false); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
expect(data.want.parameters.mykey5[0]).assertEqual("str"); console.info('====> ACTS_GetWant_0600 before done=====>')
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); done();
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); }, TIMEOUT_NUMBER);
console.info('====> ACTS_GetWant_0600 before done=====>') })
setTimeout(()=>{ })
done();
}, TIMEOUT_NUMBER); // @tc.number: ACTS_GetWant_0700
}) // @tc.name: getWant : get want in current ability
}) // @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data (by promise)
// @tc.number: ACTS_GetWant_0700 it('ACTS_GetWant_0700', 0, async function (done) {
// @tc.name: getWant : get want in current ability featureAbility.startAbilityForResult({
// @tc.desc:Start the ability through startabilityforresult, want:
// and then use terminateselfwithresult to return the data (by promise) {
it('ACTS_GetWant_0700', 0, async function (done) { deviceId: "",
featureAbility.startAbilityForResult({ bundleName: "com.example.actsgetwantalltesthap",
want: abilityName: "com.example.actsgetwantalltesthap.MainAbility",
{ action: "action1",
deviceId: "", entities: ["entity1"],
bundleName: "com.example.actsgetwantalltesthap", type: "MIMETYPE",
abilityName: "com.example.actsgetwantalltesthap.MainAbility", uri: "key={true,true,false}",
action: "action1", flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
entities: ["entity1"], parameters:
type: "MIMETYPE", {
uri: "key={true,true,false}", mykey0: 0.1,
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, mykey1: [0.1, 0.2, 0.0000000003],
parameters: mykey2: "[a, b, c]",
{ mykey3: "str",
mykey0: 0.1, mykey4: [false, true, false],
mykey1: [0.1, 0.2, 0.0000000003], mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
mykey2: "[a, b, c]", },
mykey3: "str", },
mykey4: [false, true, false], }).then((data) => {
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], setTimeout(()=>{
}, console.info('====> ACTS_GetWant_0700 start ability=====>' + JSON.stringify(data))
}, expect(data.want.deviceId).assertEqual("");
}).then((data) => { expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
console.info('====> ACTS_GetWant_0700 start ability=====>' + JSON.stringify(data)) expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.deviceId).assertEqual(""); expect(data.want.action).assertEqual("action1");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.entities[0]).assertEqual("entity1");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.action).assertEqual("action1"); expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.entities[0]).assertEqual("entity1"); expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION);
expect(data.want.type).assertEqual("MIMETYPE"); expect(data.want.parameters.mykey0).assertEqual(0.1);
expect(data.want.uri).assertEqual("key={true,true,false}"); expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION); expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.parameters.mykey0).assertEqual(0.1); expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey3).assertEqual("str"); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey4[0]).assertEqual(false); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey4[1]).assertEqual(true); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey4[2]).assertEqual(false); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
expect(data.want.parameters.mykey5[0]).assertEqual("str"); console.info('====> ACTS_GetWant_0700 before done=====>')
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); done();
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); }, TIMEOUT_NUMBER);
console.info('====> ACTS_GetWant_0700 before done=====>') }).catch((error) => {
setTimeout(()=>{ console.log('ACTS_GetWant_0700 error: ' + JSON.stringify(error))
done(); expect.assertFail()
}, TIMEOUT_NUMBER); done();
}).catch((error) => { })
console.log('ACTS_GetWant_0700 error: ' + JSON.stringify(error)) })
expect.assertFail()
done(); // @tc.number: ACTS_GetWant_0800
}) // @tc.name: getWant : get want in current ability
}) // @tc.desc:Start the ability through startabilityforresult,
// and then use terminateselfwithresult to return the data (by callback)
// @tc.number: ACTS_GetWant_0800 it('ACTS_GetWant_0800', 0, async function (done) {
// @tc.name: getWant : get want in current ability featureAbility.startAbilityForResult({
// @tc.desc:Start the ability through startabilityforresult, want:
// and then use terminateselfwithresult to return the data (by callback) {
it('ACTS_GetWant_0800', 0, async function (done) { deviceId: "",
featureAbility.startAbilityForResult({ bundleName: "com.example.actsgetwantalltesthap",
want: abilityName: "com.example.actsgetwantalltesthap.MainAbility",
{ action: "action1",
deviceId: "", entities: ["entity1"],
bundleName: "com.example.actsgetwantalltesthap", type: "MIMETYPE",
abilityName: "com.example.actsgetwantalltesthap.MainAbility", uri: "key={true,true,false}",
action: "action1", flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
entities: ["entity1"], parameters:
type: "MIMETYPE", {
uri: "key={true,true,false}", mykey0: 0.1,
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, mykey1: [0.1, 0.2, 0.0000000003],
parameters: mykey2: "[a, b, c]",
{ mykey3: "str",
mykey0: 0.1, mykey4: [false, true, false],
mykey1: [0.1, 0.2, 0.0000000003], mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
mykey2: "[a, b, c]", },
mykey3: "str", },
mykey4: [false, true, false], },
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], (err, data) => {
}, setTimeout(()=>{
}, console.info('====> ACTS_GetWant_0800 start ability=====>' + JSON.stringify(data))
}, expect(data.want.deviceId).assertEqual("");
(err, data) => { expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
checkOnAbilityResult0800(data); expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
setTimeout(()=>{ expect(data.want.action).assertEqual("action1");
done(); expect(data.want.entities[0]).assertEqual("entity1");
}, TIMEOUT_NUMBER); expect(data.want.type).assertEqual("MIMETYPE");
}) expect(data.want.uri).assertEqual("key={true,true,false}");
}) expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION);
expect(data.want.parameters.mykey0).assertEqual(0.1);
function checkOnAbilityResult0800(data) { expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
console.info('====> ACTS_GetWant_0800 start ability=====>' + JSON.stringify(data)) expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.deviceId).assertEqual(""); expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.action).assertEqual("action1"); expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.entities[0]).assertEqual("entity1"); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.type).assertEqual("MIMETYPE"); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.uri).assertEqual("key={true,true,false}"); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey0).assertEqual(0.1); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); console.info('====> ACTS_GetWant_0800 before done=====>')
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); done();
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); }, 3500);
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); })
expect(data.want.parameters.mykey3).assertEqual("str"); })
expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey4[1]).assertEqual(true); // @tc.number: ACTS_GetWant_0900
expect(data.want.parameters.mykey4[2]).assertEqual(false); // @tc.name: getWant : get want in current ability
expect(data.want.parameters.mykey5[0]).assertEqual("str"); // @tc.desc:Start the ability through startabilityforresult,
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); // and then use terminateselfwithresult to return the data (by promise)
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); it('ACTS_GetWant_0900', 0, async function (done) {
console.info('====> ACTS_GetWant_0800 before done=====>') featureAbility.startAbilityForResult({
} want:
{
// @tc.number: ACTS_GetWant_0900 deviceId: "",
// @tc.name: getWant : get want in current ability bundleName: "com.example.actsgetwantalltesthap",
// @tc.desc:Start the ability through startabilityforresult, abilityName: "com.example.actsgetwantalltesthap.MainAbility",
// and then use terminateselfwithresult to return the data (by promise) action: "action1",
it('ACTS_GetWant_0900', 0, async function (done) { entities: ["entity1"],
featureAbility.startAbilityForResult({ type: "MIMETYPE",
want: uri: "key={true,true,false}",
{ flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION,
deviceId: "", parameters:
bundleName: "com.example.actsgetwantalltesthap", {
abilityName: "com.example.actsgetwantalltesthap.MainAbility", mykey0: 0.1,
action: "action1", mykey1: [0.1, 0.2, 0.0000000003],
entities: ["entity1"], mykey2: "[a, b, c]",
type: "MIMETYPE", mykey3: "str",
uri: "key={true,true,false}", mykey4: [false, true, false],
flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
parameters: },
{ },
mykey0: 0.1, }).then((data) => {
mykey1: [0.1, 0.2, 0.0000000003], setTimeout(()=>{
mykey2: "[a, b, c]", console.info('====> ACTS_GetWant_0900 start ability=====>' + JSON.stringify(data))
mykey3: "str", expect(data.want.deviceId).assertEqual("");
mykey4: [false, true, false], expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
}, expect(data.want.action).assertEqual("action1");
}, expect(data.want.entities[0]).assertEqual("entity1");
}).then((data) => { expect(data.want.type).assertEqual("MIMETYPE");
console.info('====> ACTS_GetWant_0900 start ability=====>' + JSON.stringify(data)) expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.deviceId).assertEqual(""); expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION);
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.parameters.mykey0).assertEqual(0.1);
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
expect(data.want.action).assertEqual("action1"); expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.entities[0]).assertEqual("entity1"); expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
expect(data.want.type).assertEqual("MIMETYPE"); expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
expect(data.want.uri).assertEqual("key={true,true,false}"); expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION); expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey0).assertEqual(0.1); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
expect(data.want.parameters.mykey3).assertEqual("str"); console.info('====> ACTS_GetWant_0900 before done=====>')
expect(data.want.parameters.mykey4[0]).assertEqual(false); done();
expect(data.want.parameters.mykey4[1]).assertEqual(true); }, TIMEOUT_NUMBER);
expect(data.want.parameters.mykey4[2]).assertEqual(false); }).catch((error) => {
expect(data.want.parameters.mykey5[0]).assertEqual("str"); console.log('ACTS_GetWant_0900 error: ' + JSON.stringify(error))
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); expect.assertFail()
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); done();
console.info('====> ACTS_GetWant_0900 before done=====>') })
setTimeout(()=>{ })
done();
}, TIMEOUT_NUMBER); // @tc.number: ACTS_GetWant_1000
}).catch((error) => { // @tc.name: getWant : get want in current ability
console.log('ACTS_GetWant_0900 error: ' + JSON.stringify(error)) // @tc.desc:Start the ability through startabilityforresult,
expect.assertFail() // and then use terminateselfwithresult to return the data (by callback)
done(); it('ACTS_GetWant_1000', 0, async function (done) {
}) featureAbility.startAbilityForResult({
}) want:
{
// @tc.number: ACTS_GetWant_1000 deviceId: "",
// @tc.name: getWant : get want in current ability bundleName: "com.example.actsgetwantalltesthap",
// @tc.desc:Start the ability through startabilityforresult, abilityName: "com.example.actsgetwantalltesthap.MainAbility",
// and then use terminateselfwithresult to return the data (by callback) action: "action1",
it('ACTS_GetWant_1000', 0, async function (done) { entities: ["entity1"],
featureAbility.startAbilityForResult({ type: "MIMETYPE",
want: uri: "key={true,true,false}",
{ flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION,
deviceId: "", parameters:
bundleName: "com.example.actsgetwantalltesthap", {
abilityName: "com.example.actsgetwantalltesthap.MainAbility", mykey0: 0.1,
action: "action1", mykey1: [0.1, 0.2, 0.0000000003],
entities: ["entity1"], mykey2: "[a, b, c]",
type: "MIMETYPE", mykey3: "str",
uri: "key={true,true,false}", mykey4: [false, true, false],
flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
parameters: },
{ },
mykey0: 0.1, },
mykey1: [0.1, 0.2, 0.0000000003], (err, data) => {
mykey2: "[a, b, c]", setTimeout(()=>{
mykey3: "str", console.info('====> ACTS_GetWant_1000 start ability=====>' + JSON.stringify(data))
mykey4: [false, true, false], expect(data.want.deviceId).assertEqual("");
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
}, expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
}, expect(data.want.action).assertEqual("action1");
}, expect(data.want.entities[0]).assertEqual("entity1");
(err, data) => { expect(data.want.type).assertEqual("MIMETYPE");
checkOnAbilityResult1000(data); expect(data.want.uri).assertEqual("key={true,true,false}");
setTimeout(()=>{ expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION);
done(); expect(data.want.parameters.mykey0).assertEqual(0.1);
}, TIMEOUT_NUMBER); expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
}) expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
}) expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
function checkOnAbilityResult1000(data) { expect(data.want.parameters.mykey3).assertEqual("str");
console.info('====> ACTS_GetWant_1000 start ability=====>' + JSON.stringify(data)) expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.deviceId).assertEqual(""); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.action).assertEqual("action1"); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.entities[0]).assertEqual("entity1"); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
expect(data.want.type).assertEqual("MIMETYPE"); console.info('====> ACTS_GetWant_1000 before done=====>')
expect(data.want.uri).assertEqual("key={true,true,false}"); done();
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION); }, TIMEOUT_NUMBER);
expect(data.want.parameters.mykey0).assertEqual(0.1); })
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); })
expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); // @tc.number: ACTS_GetWant_1100
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); // @tc.name: getWant : get want in current ability
expect(data.want.parameters.mykey3).assertEqual("str"); // @tc.desc:Start the ability through startabilityforresult,
expect(data.want.parameters.mykey4[0]).assertEqual(false); // and then use terminateselfwithresult to return the data (by promise)
expect(data.want.parameters.mykey4[1]).assertEqual(true); it('ACTS_GetWant_1100', 0, async function (done) {
expect(data.want.parameters.mykey4[2]).assertEqual(false); featureAbility.startAbilityForResult({
expect(data.want.parameters.mykey5[0]).assertEqual("str"); want:
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); {
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); deviceId: "",
console.info('====> ACTS_GetWant_1000 before done=====>') bundleName: "com.example.actsgetwantalltesthap",
} abilityName: "com.example.actsgetwantalltesthap.MainAbility",
action: "action1",
// @tc.number: ACTS_GetWant_1100 entities: ["entity1"],
// @tc.name: getWant : get want in current ability type: "MIMETYPE",
// @tc.desc:Start the ability through startabilityforresult, uri: "key={true,true,false}",
// and then use terminateselfwithresult to return the data (by promise) parameters:
it('ACTS_GetWant_1100', 0, async function (done) { {
featureAbility.startAbilityForResult({ mykey0: 0.1,
want: mykey1: [0.1, 0.2, 0.0000000003],
{ mykey2: "[a, b, c]",
deviceId: "", mykey3: "str",
bundleName: "com.example.actsgetwantalltesthap", mykey4: [false, true, false],
abilityName: "com.example.actsgetwantalltesthap.MainAbility", mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
action: "action1", },
entities: ["entity1"], },
type: "MIMETYPE", }).then((data) => {
uri: "key={true,true,false}", setTimeout(()=>{
parameters: console.info('====> ACTS_GetWant_1100 start ability=====>' + JSON.stringify(data))
{ expect(data.want.deviceId).assertEqual("");
mykey0: 0.1, expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
mykey1: [0.1, 0.2, 0.0000000003], expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
mykey2: "[a, b, c]", expect(data.want.action).assertEqual("action1");
mykey3: "str", expect(data.want.entities[0]).assertEqual("entity1");
mykey4: [false, true, false], expect(data.want.type).assertEqual("MIMETYPE");
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.uri).assertEqual("key={true,true,false}");
}, expect(data.want.parameters.mykey0).assertEqual(0.1);
}, expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
}).then((data) => { expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
checkOnAbilityResult1100(data); expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
setTimeout(()=>{ expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
done(); expect(data.want.parameters.mykey3).assertEqual("str");
}, TIMEOUT_NUMBER); expect(data.want.parameters.mykey4[0]).assertEqual(false);
}).catch((error) => { expect(data.want.parameters.mykey4[1]).assertEqual(true);
console.log('ACTS_GetWant_1100 error: ' + JSON.stringify(error)) expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect.assertFail() expect(data.want.parameters.mykey5[0]).assertEqual("str");
done(); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
}) expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
}) console.info('====> ACTS_GetWant_1100 before done=====>')
done();
function checkOnAbilityResult1100(data) { }, TIMEOUT_NUMBER);
console.info('====> ACTS_GetWant_1100 start ability=====>' + JSON.stringify(data)) }).catch((error) => {
expect(data.want.deviceId).assertEqual(""); console.log('ACTS_GetWant_1100 error: ' + JSON.stringify(error))
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect.assertFail()
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); done();
expect(data.want.action).assertEqual("action1"); })
expect(data.want.entities[0]).assertEqual("entity1"); })
expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.uri).assertEqual("key={true,true,false}"); // @tc.number: ACTS_GetWant_1200
expect(data.want.parameters.mykey0).assertEqual(0.1); // @tc.name: getWant : get want in current ability
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); // @tc.desc:Start the ability through startabilityforresult,
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); // and then use terminateselfwithresult to return the data (by callback)
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); it('ACTS_GetWant_1200', 0, async function (done) {
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); featureAbility.startAbilityForResult({
expect(data.want.parameters.mykey3).assertEqual("str"); want:
expect(data.want.parameters.mykey4[0]).assertEqual(false); {
expect(data.want.parameters.mykey4[1]).assertEqual(true); deviceId: "",
expect(data.want.parameters.mykey4[2]).assertEqual(false); bundleName: "com.example.actsgetwantalltesthap",
expect(data.want.parameters.mykey5[0]).assertEqual("str"); abilityName: "com.example.actsgetwantalltesthap.MainAbility",
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); action: "action1",
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); entities: ["entity1"],
console.info('====> ACTS_GetWant_1100 before done=====>') type: "MIMETYPE",
} uri: "key={true,true,false}",
parameters:
// @tc.number: ACTS_GetWant_1200 {
// @tc.name: getWant : get want in current ability mykey0: 0.1,
// @tc.desc:Start the ability through startabilityforresult, mykey1: [0.1, 0.2, 0.0000000003],
// and then use terminateselfwithresult to return the data (by callback) mykey2: "[a, b, c]",
it('ACTS_GetWant_1200', 0, async function (done) { mykey3: "str",
featureAbility.startAbilityForResult({ mykey4: [false, true, false],
want: mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
{ },
deviceId: "", },
bundleName: "com.example.actsgetwantalltesthap", },
abilityName: "com.example.actsgetwantalltesthap.MainAbility", (err, data) => {
action: "action1", setTimeout(()=>{
entities: ["entity1"], console.info('====> ACTS_GetWant_1200 start ability=====>' + JSON.stringify(data))
type: "MIMETYPE", expect(data.want.deviceId).assertEqual("");
uri: "key={true,true,false}", expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
parameters: expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
{ expect(data.want.action).assertEqual("action1");
mykey0: 0.1, expect(data.want.entities[0]).assertEqual("entity1");
mykey1: [0.1, 0.2, 0.0000000003], expect(data.want.type).assertEqual("MIMETYPE");
mykey2: "[a, b, c]", expect(data.want.uri).assertEqual("key={true,true,false}");
mykey3: "str", expect(data.want.parameters.mykey0).assertEqual(0.1);
mykey4: [false, true, false], expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
}, expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
}, expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
}, expect(data.want.parameters.mykey3).assertEqual("str");
(err, data) => { expect(data.want.parameters.mykey4[0]).assertEqual(false);
console.info('====> ACTS_GetWant_1200 start ability=====>' + JSON.stringify(data)) expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.deviceId).assertEqual(""); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.action).assertEqual("action1"); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
expect(data.want.entities[0]).assertEqual("entity1"); console.info('====> ACTS_GetWant_1200 before done=====>')
expect(data.want.type).assertEqual("MIMETYPE"); done();
expect(data.want.uri).assertEqual("key={true,true,false}"); }, TIMEOUT_NUMBER);
expect(data.want.parameters.mykey0).assertEqual(0.1); })
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); })
expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); // @tc.number: ACTS_GetWant_1300
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); // @tc.name: getWant : get want in current ability
expect(data.want.parameters.mykey3).assertEqual("str"); // @tc.desc:Start the ability through startabilityforresult,
expect(data.want.parameters.mykey4[0]).assertEqual(false); // and then use terminateselfwithresult to return the data (by promise)
expect(data.want.parameters.mykey4[1]).assertEqual(true); it('ACTS_GetWant_1300', 0, async function (done) {
expect(data.want.parameters.mykey4[2]).assertEqual(false); featureAbility.startAbilityForResult({
expect(data.want.parameters.mykey5[0]).assertEqual("str"); want:
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); {
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); deviceId: "",
console.info('====> ACTS_GetWant_1200 before done=====>') bundleName: "com.example.actsgetwantalltesthap",
setTimeout(()=>{ abilityName: "com.example.actsgetwantalltesthap.MainAbility",
done(); action: "action1",
}, TIMEOUT_NUMBER); entities: ["entity1"],
}) type: "MIMETYPE",
}) uri: "key={true,true,false}",
flags: wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT,
// @tc.number: ACTS_GetWant_1300 parameters:
// @tc.name: getWant : get want in current ability {
// @tc.desc:Start the ability through startabilityforresult, mykey0: 0.1,
// and then use terminateselfwithresult to return the data (by promise) mykey1: [0.1, 0.2, 0.0000000003],
it('ACTS_GetWant_1300', 0, async function (done) { mykey2: "[a, b, c]",
featureAbility.startAbilityForResult({ mykey3: "str",
want: mykey4: [false, true, false],
{ mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
deviceId: "", },
bundleName: "com.example.actsgetwantalltesthap", },
abilityName: "com.example.actsgetwantalltesthap.MainAbility", }).then((data) => {
action: "action1", setTimeout(()=>{
entities: ["entity1"], console.info('====> ACTS_GetWant_1300 start ability=====>' + JSON.stringify(data))
type: "MIMETYPE", expect(data.want.deviceId).assertEqual("");
uri: "key={true,true,false}", expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
flags: wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT, expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
parameters: expect(data.want.action).assertEqual("action1");
{ expect(data.want.entities[0]).assertEqual("entity1");
mykey0: 0.1, expect(data.want.type).assertEqual("MIMETYPE");
mykey1: [0.1, 0.2, 0.0000000003], expect(data.want.uri).assertEqual("key={true,true,false}");
mykey2: "[a, b, c]", expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT);
mykey3: "str", expect(data.want.parameters.mykey0).assertEqual(0.1);
mykey4: [false, true, false], expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
}, expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
}, expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
}).then((data) => { expect(data.want.parameters.mykey3).assertEqual("str");
console.info('====> ACTS_GetWant_1300 start ability=====>' + JSON.stringify(data)) expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.deviceId).assertEqual(""); expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.action).assertEqual("action1"); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
expect(data.want.entities[0]).assertEqual("entity1"); expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
expect(data.want.type).assertEqual("MIMETYPE"); console.info('====> ACTS_GetWant_1300 before done=====>')
expect(data.want.uri).assertEqual("key={true,true,false}"); done();
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT); }, 3500);
expect(data.want.parameters.mykey0).assertEqual(0.1); }).catch((error) => {
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); console.log('ACTS_GetWant_1300 error: ' + JSON.stringify(error))
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); expect.assertFail()
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); done();
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); })
expect(data.want.parameters.mykey3).assertEqual("str"); })
expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey4[1]).assertEqual(true); // @tc.number: ACTS_GetWant_1400
expect(data.want.parameters.mykey4[2]).assertEqual(false); // @tc.name: getWant : get want in current ability
expect(data.want.parameters.mykey5[0]).assertEqual("str"); // @tc.desc:Start the ability through startabilityforresult,
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); // and then use terminateselfwithresult to return the data (by callback)
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); it('ACTS_GetWant_1400', 0, async function (done) {
console.info('====> ACTS_GetWant_1300 before done=====>') featureAbility.startAbilityForResult({
setTimeout(()=>{ want:
done(); {
}, TIMEOUT_NUMBER); deviceId: "",
}).catch((error) => { bundleName: "com.example.actsgetwantalltesthap",
console.log('ACTS_GetWant_1300 error: ' + JSON.stringify(error)) abilityName: "com.example.actsgetwantalltesthap.MainAbility",
expect.assertFail() action: "action1",
done(); entities: ["entity1"],
}) type: "MIMETYPE",
}) uri: "key={true,true,false}",
flags: wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT,
// @tc.number: ACTS_GetWant_1400 parameters:
// @tc.name: getWant : get want in current ability {
// @tc.desc:Start the ability through startabilityforresult, mykey0: 0.1,
// and then use terminateselfwithresult to return the data (by callback) mykey1: [0.1, 0.2, 0.0000000003],
it('ACTS_GetWant_1400', 0, async function (done) { mykey2: "[a, b, c]",
featureAbility.startAbilityForResult({ mykey3: "str",
want: mykey4: [false, true, false],
{ mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
deviceId: "", },
bundleName: "com.example.actsgetwantalltesthap", },
abilityName: "com.example.actsgetwantalltesthap.MainAbility", },
action: "action1", (err, data) => {
entities: ["entity1"], setTimeout(()=>{
type: "MIMETYPE", console.info('====> ACTS_GetWant_1400 start ability=====>' + JSON.stringify(data))
uri: "key={true,true,false}", expect(data.want.deviceId).assertEqual("");
flags: wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT, expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
parameters: expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
{ expect(data.want.action).assertEqual("action1");
mykey0: 0.1, expect(data.want.entities[0]).assertEqual("entity1");
mykey1: [0.1, 0.2, 0.0000000003], expect(data.want.type).assertEqual("MIMETYPE");
mykey2: "[a, b, c]", expect(data.want.uri).assertEqual("key={true,true,false}");
mykey3: "str", expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT);
mykey4: [false, true, false], expect(data.want.parameters.mykey0).assertEqual(0.1);
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
}, expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
}, expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
}, expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
(err, data) => { expect(data.want.parameters.mykey3).assertEqual("str");
checkOnAbilityResult1400(data); expect(data.want.parameters.mykey4[0]).assertEqual(false);
setTimeout(()=>{ expect(data.want.parameters.mykey4[1]).assertEqual(true);
done(); expect(data.want.parameters.mykey4[2]).assertEqual(false);
}, TIMEOUT_NUMBER); expect(data.want.parameters.mykey5[0]).assertEqual("str");
}) expect(data.want.parameters.mykey5[1]).assertEqual("STR");
}) expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
console.info('====> ACTS_GetWant_1400 before done=====>')
function checkOnAbilityResult1400(data) { done();
console.info('====> ACTS_GetWant_1400 start ability=====>' + JSON.stringify(data)) }, 3500);
expect(data.want.deviceId).assertEqual(""); })
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); })
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.action).assertEqual("action1"); // @tc.number: ACTS_GetWant_1500
expect(data.want.entities[0]).assertEqual("entity1"); // @tc.name: getWant : get want in current ability
expect(data.want.type).assertEqual("MIMETYPE"); // @tc.desc:Start the ability through startabilityforresult,
expect(data.want.uri).assertEqual("key={true,true,false}"); // and then use terminateselfwithresult to return the data (by promise)
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_NOT_OHOS_COMPONENT); it('ACTS_GetWant_1500', 0, async function (done) {
expect(data.want.parameters.mykey0).assertEqual(0.1); featureAbility.startAbilityForResult({
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); want:
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); {
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); deviceId: "",
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); bundleName: "com.example.actsgetwantalltesthap",
expect(data.want.parameters.mykey3).assertEqual("str"); abilityName: "com.example.actsgetwantalltesthap.MainAbility",
expect(data.want.parameters.mykey4[0]).assertEqual(false); action: "action1",
expect(data.want.parameters.mykey4[1]).assertEqual(true); entities: ["entity1"],
expect(data.want.parameters.mykey4[2]).assertEqual(false); type: "MIMETYPE",
expect(data.want.parameters.mykey5[0]).assertEqual("str"); uri: "key={true,true,false}",
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); flags: wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE,
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); parameters:
console.info('====> ACTS_GetWant_1400 before done=====>') {
} mykey0: 0.1,
mykey1: [0.1, 0.2, 0.0000000003],
// @tc.number: ACTS_GetWant_1500 mykey2: "[a, b, c]",
// @tc.name: getWant : get want in current ability mykey3: "str",
// @tc.desc:Start the ability through startabilityforresult, mykey4: [false, true, false],
// and then use terminateselfwithresult to return the data (by promise) mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
it('ACTS_GetWant_1500', 0, async function (done) { },
featureAbility.startAbilityForResult({ },
want: }).then((data) => {
{ setTimeout(()=>{
deviceId: "", console.info('====> ACTS_GetWant_1500 start ability=====>' + JSON.stringify(data))
bundleName: "com.example.actsgetwantalltesthap", expect(data.want.deviceId).assertEqual("");
abilityName: "com.example.actsgetwantalltesthap.MainAbility", expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
action: "action1", expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
entities: ["entity1"], expect(data.want.action).assertEqual("action1");
type: "MIMETYPE", expect(data.want.entities[0]).assertEqual("entity1");
uri: "key={true,true,false}", expect(data.want.type).assertEqual("MIMETYPE");
flags: wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE, expect(data.want.uri).assertEqual("key={true,true,false}");
parameters: expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE );
{ expect(data.want.parameters.mykey0).assertEqual(0.1);
mykey0: 0.1, expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
mykey1: [0.1, 0.2, 0.0000000003], expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
mykey2: "[a, b, c]", expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
mykey3: "str", expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
mykey4: [false, true, false], expect(data.want.parameters.mykey3).assertEqual("str");
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.parameters.mykey4[0]).assertEqual(false);
}, expect(data.want.parameters.mykey4[1]).assertEqual(true);
}, expect(data.want.parameters.mykey4[2]).assertEqual(false);
}).then((data) => { expect(data.want.parameters.mykey5[0]).assertEqual("str");
checkOnAbilityResult1500(data); expect(data.want.parameters.mykey5[1]).assertEqual("STR");
setTimeout(()=>{ expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
done(); console.info('====> ACTS_GetWant_1500 setTimeout before done.=====>')
}, TIMEOUT_NUMBER); done();
}).catch((error) => { }, TIMEOUT_NUMBER);
console.log('ACTS_GetWant_1500 error: ' + JSON.stringify(error)) }).catch((error) => {
expect.assertFail() console.log('ACTS_GetWant_1500 error: ' + JSON.stringify(error))
done(); expect.assertFail()
}) done();
}) })
})
function checkOnAbilityResult1500(data) {
console.info('====> ACTS_GetWant_1500 start ability=====>' + JSON.stringify(data)) // @tc.number: ACTS_GetWant_1600
expect(data.want.deviceId).assertEqual(""); // @tc.name: getWant : get want in current ability
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); // @tc.desc:Start the ability through startabilityforresult,
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); // and then use terminateselfwithresult to return the data (by callback)
expect(data.want.action).assertEqual("action1"); it('ACTS_GetWant_1600', 0, async function (done) {
expect(data.want.entities[0]).assertEqual("entity1"); featureAbility.startAbilityForResult({
expect(data.want.type).assertEqual("MIMETYPE"); want:
expect(data.want.uri).assertEqual("key={true,true,false}"); {
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE ); deviceId: "",
expect(data.want.parameters.mykey0).assertEqual(0.1); bundleName: "com.example.actsgetwantalltesthap",
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); abilityName: "com.example.actsgetwantalltesthap.MainAbility",
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); action: "action1",
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); entities: ["entity1"],
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); type: "MIMETYPE",
expect(data.want.parameters.mykey3).assertEqual("str"); uri: "key={true,true,false}",
expect(data.want.parameters.mykey4[0]).assertEqual(false); flags: wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE,
expect(data.want.parameters.mykey4[1]).assertEqual(true); parameters:
expect(data.want.parameters.mykey4[2]).assertEqual(false); {
expect(data.want.parameters.mykey5[0]).assertEqual("str"); mykey0: 0.1,
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); mykey1: [0.1, 0.2, 0.0000000003],
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); mykey2: "[a, b, c]",
console.info('====> ACTS_GetWant_1500 setTimeout before done.=====>') mykey3: "str",
} mykey4: [false, true, false],
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
// @tc.number: ACTS_GetWant_1600 },
// @tc.name: getWant : get want in current ability },
// @tc.desc:Start the ability through startabilityforresult, },
// and then use terminateselfwithresult to return the data (by callback) (err, data) => {
it('ACTS_GetWant_1600', 0, async function (done) { setTimeout(()=>{
featureAbility.startAbilityForResult({ console.info('====> ACTS_GetWant_1600 start ability=====>' + JSON.stringify(data))
want: expect(data.want.deviceId).assertEqual("");
{ expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
deviceId: "", expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
bundleName: "com.example.actsgetwantalltesthap", expect(data.want.action).assertEqual("action1");
abilityName: "com.example.actsgetwantalltesthap.MainAbility", expect(data.want.entities[0]).assertEqual("entity1");
action: "action1", expect(data.want.type).assertEqual("MIMETYPE");
entities: ["entity1"], expect(data.want.uri).assertEqual("key={true,true,false}");
type: "MIMETYPE", expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE );
uri: "key={true,true,false}", expect(data.want.parameters.mykey0).assertEqual(0.1);
flags: wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE, expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
parameters: expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
{ expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
mykey0: 0.1, expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
mykey1: [0.1, 0.2, 0.0000000003], expect(data.want.parameters.mykey3).assertEqual("str");
mykey2: "[a, b, c]", expect(data.want.parameters.mykey4[0]).assertEqual(false);
mykey3: "str", expect(data.want.parameters.mykey4[1]).assertEqual(true);
mykey4: [false, true, false], expect(data.want.parameters.mykey4[2]).assertEqual(false);
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.parameters.mykey5[0]).assertEqual("str");
}, expect(data.want.parameters.mykey5[1]).assertEqual("STR");
}, expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
}, console.info('====> ACTS_GetWant_1600 setTimeout before done.=====>')
(err, data) => { done();
console.info('====> ACTS_GetWant_1600 start ability=====>' + JSON.stringify(data)) }, 3500);
expect(data.want.deviceId).assertEqual(""); })
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); })
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.action).assertEqual("action1"); // @tc.number: ACTS_GetWant_1700
expect(data.want.entities[0]).assertEqual("entity1"); // @tc.name: getWant : get want in current ability
expect(data.want.type).assertEqual("MIMETYPE"); // @tc.desc:Start the ability through startabilityforresult,
expect(data.want.uri).assertEqual("key={true,true,false}"); // and then use terminateselfwithresult to return the data (by promise)
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITYSLICE_MULTI_DEVICE ); it('ACTS_GetWant_1700', 0, async function (done) {
expect(data.want.parameters.mykey0).assertEqual(0.1); featureAbility.startAbilityForResult({
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); want:
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); {
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); deviceId: "",
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); bundleName: "com.example.actsgetwantalltesthap",
expect(data.want.parameters.mykey3).assertEqual("str"); abilityName: "com.example.actsgetwantalltesthap.MainAbility",
expect(data.want.parameters.mykey4[0]).assertEqual(false); action: "action1",
expect(data.want.parameters.mykey4[1]).assertEqual(true); entities: ["entity1"],
expect(data.want.parameters.mykey4[2]).assertEqual(false); type: "MIMETYPE",
expect(data.want.parameters.mykey5[0]).assertEqual("str"); uri: "key={true,true,false}",
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); flags: wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY,
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); parameters:
console.info('====> ACTS_GetWant_1600 setTimeout before done.=====>') {
setTimeout(()=>{ mykey0: 0.1,
done(); mykey1: [0.1, 0.2, 0.0000000003],
}, TIMEOUT_NUMBER); mykey2: "[a, b, c]",
}) mykey3: "str",
}) mykey4: [false, true, false],
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
// @tc.number: ACTS_GetWant_1700 },
// @tc.name: getWant : get want in current ability },
// @tc.desc:Start the ability through startabilityforresult, }).then((data) => {
// and then use terminateselfwithresult to return the data (by promise) setTimeout(()=>{
it('ACTS_GetWant_1700', 0, async function (done) { console.info('====> ACTS_GetWant_1700 start ability=====>' + JSON.stringify(data))
featureAbility.startAbilityForResult({ expect(data.want.deviceId).assertEqual("");
want: expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
{ expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
deviceId: "", expect(data.want.action).assertEqual("action1");
bundleName: "com.example.actsgetwantalltesthap", expect(data.want.entities[0]).assertEqual("entity1");
abilityName: "com.example.actsgetwantalltesthap.MainAbility", expect(data.want.type).assertEqual("MIMETYPE");
action: "action1", expect(data.want.uri).assertEqual("key={true,true,false}");
entities: ["entity1"], expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY );
type: "MIMETYPE", expect(data.want.parameters.mykey0).assertEqual(0.1);
uri: "key={true,true,false}", expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
flags: wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY, expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
parameters: expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
{ expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
mykey0: 0.1, expect(data.want.parameters.mykey3).assertEqual("str");
mykey1: [0.1, 0.2, 0.0000000003], expect(data.want.parameters.mykey4[0]).assertEqual(false);
mykey2: "[a, b, c]", expect(data.want.parameters.mykey4[1]).assertEqual(true);
mykey3: "str", expect(data.want.parameters.mykey4[2]).assertEqual(false);
mykey4: [false, true, false], expect(data.want.parameters.mykey5[0]).assertEqual("str");
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.parameters.mykey5[1]).assertEqual("STR");
}, expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
}, console.info('====> ACTS_GetWant_1700 setTimeout before done.=====>')
}).then((data) => { done();
console.info('====> ACTS_GetWant_1700 start ability=====>' + JSON.stringify(data)) }, TIMEOUT_NUMBER);
expect(data.want.deviceId).assertEqual(""); }).catch((error) => {
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); console.log('ACTS_GetWant_1700 error: ' + JSON.stringify(error))
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); expect.assertFail()
expect(data.want.action).assertEqual("action1"); done();
expect(data.want.entities[0]).assertEqual("entity1"); })
expect(data.want.type).assertEqual("MIMETYPE"); })
expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_START_FOREGROUND_ABILITY ); // @tc.number: ACTS_GetWant_1900
expect(data.want.parameters.mykey0).assertEqual(0.1); // @tc.name: getWant : get want in current ability
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); // @tc.desc:Start the ability through startabilityforresult,
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); // and then use terminateselfwithresult to return the data (by promise)
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); it('ACTS_GetWant_1900', 0, async function (done) {
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); featureAbility.startAbilityForResult({
expect(data.want.parameters.mykey3).assertEqual("str"); want:
expect(data.want.parameters.mykey4[0]).assertEqual(false); {
expect(data.want.parameters.mykey4[1]).assertEqual(true); deviceId: "",
expect(data.want.parameters.mykey4[2]).assertEqual(false); bundleName: "com.example.actsgetwantalltesthap",
expect(data.want.parameters.mykey5[0]).assertEqual("str"); abilityName: "com.example.actsgetwantalltesthap.MainAbility",
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); action: "action1",
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); entities: ["entity1"],
console.info('====> ACTS_GetWant_1700 setTimeout before done.=====>') type: "MIMETYPE",
setTimeout(()=>{ uri: "key={true,true,false}",
done(); flags: wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE,
}, TIMEOUT_NUMBER); parameters:
}).catch((error) => { {
console.log('ACTS_GetWant_1700 error: ' + JSON.stringify(error)) mykey0: 0.1,
expect.assertFail() mykey1: [0.1, 0.2, 0.0000000003],
done(); mykey2: "[a, b, c]",
}) mykey3: "str",
}) mykey4: [false, true, false],
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
// @tc.number: ACTS_GetWant_1900 },
// @tc.name: getWant : get want in current ability },
// @tc.desc:Start the ability through startabilityforresult, }).then((data) => {
// and then use terminateselfwithresult to return the data (by promise) setTimeout(()=>{
it('ACTS_GetWant_1900', 0, async function (done) { console.info('====> ACTS_GetWant_1900 start ability=====>' + JSON.stringify(data))
featureAbility.startAbilityForResult({ expect(data.want.deviceId).assertEqual("");
want: expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
{ expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
deviceId: "", expect(data.want.action).assertEqual("action1");
bundleName: "com.example.actsgetwantalltesthap", expect(data.want.entities[0]).assertEqual("entity1");
abilityName: "com.example.actsgetwantalltesthap.MainAbility", expect(data.want.type).assertEqual("MIMETYPE");
action: "action1", expect(data.want.uri).assertEqual("key={true,true,false}");
entities: ["entity1"], expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE);
type: "MIMETYPE", expect(data.want.parameters.mykey0).assertEqual(0.1);
uri: "key={true,true,false}", expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
flags: wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE, expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
parameters: expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
{ expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
mykey0: 0.1, expect(data.want.parameters.mykey3).assertEqual("str");
mykey1: [0.1, 0.2, 0.0000000003], expect(data.want.parameters.mykey4[0]).assertEqual(false);
mykey2: "[a, b, c]", expect(data.want.parameters.mykey4[1]).assertEqual(true);
mykey3: "str", expect(data.want.parameters.mykey4[2]).assertEqual(false);
mykey4: [false, true, false], expect(data.want.parameters.mykey5[0]).assertEqual("str");
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], expect(data.want.parameters.mykey5[1]).assertEqual("STR");
}, expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
}, console.info('====> ACTS_GetWant_1900 setTimeout before done.=====>')
}).then((data) => { done();
checkOnAbilityResult1900(data); }, TIMEOUT_NUMBER);
setTimeout(()=>{ }).catch((error) => {
done(); console.log('ACTS_GetWant_1900 error: ' + JSON.stringify(error))
}, TIMEOUT_NUMBER); expect.assertFail()
}).catch((error) => { done();
console.log('ACTS_GetWant_1900 error: ' + JSON.stringify(error)) })
expect.assertFail() })
done();
}) // @tc.number: ACTS_GetWant_2100
}) // @tc.name: getWant : get want in current ability
// @tc.desc:Start the ability through startabilityforresult,
function checkOnAbilityResult1900(data) { // and then use terminateselfwithresult to return the data (by promise)
console.info('====> ACTS_GetWant_1900 start ability=====>' + JSON.stringify(data)) it('ACTS_GetWant_2100', 0, async function (done) {
expect(data.want.deviceId).assertEqual(""); featureAbility.startAbilityForResult({
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); want:
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); {
expect(data.want.action).assertEqual("action1"); deviceId: "",
expect(data.want.entities[0]).assertEqual("entity1"); bundleName: "com.example.actsgetwantalltesthap",
expect(data.want.type).assertEqual("MIMETYPE"); abilityName: "com.example.actsgetwantalltesthap.MainAbility",
expect(data.want.uri).assertEqual("key={true,true,false}"); action: "action1",
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE); entities: ["entity1"],
expect(data.want.parameters.mykey0).assertEqual(0.1); type: "MIMETYPE",
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); uri: "key={true,true,false}",
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); flags: wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION,
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); parameters:
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); {
expect(data.want.parameters.mykey3).assertEqual("str"); mykey0: 0.1,
expect(data.want.parameters.mykey4[0]).assertEqual(false); mykey1: [0.1, 0.2, 0.0000000003],
expect(data.want.parameters.mykey4[1]).assertEqual(true); mykey2: "[a, b, c]",
expect(data.want.parameters.mykey4[2]).assertEqual(false); mykey3: "str",
expect(data.want.parameters.mykey5[0]).assertEqual("str"); mykey4: [false, true, false],
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); },
console.info('====> ACTS_GetWant_1900 setTimeout before done.=====>') },
} }).then((data) => {
setTimeout(()=>{
// @tc.number: ACTS_GetWant_2100 console.info('====> ACTS_GetWant_2100 start ability=====>' + JSON.stringify(data))
// @tc.name: getWant : get want in current ability expect(data.want.deviceId).assertEqual("");
// @tc.desc:Start the ability through startabilityforresult, expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
// and then use terminateselfwithresult to return the data (by promise) expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
it('ACTS_GetWant_2100', 0, async function (done) { expect(data.want.action).assertEqual("action1");
featureAbility.startAbilityForResult({ expect(data.want.entities[0]).assertEqual("entity1");
want: expect(data.want.type).assertEqual("MIMETYPE");
{ expect(data.want.uri).assertEqual("key={true,true,false}");
deviceId: "", expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION);
bundleName: "com.example.actsgetwantalltesthap", expect(data.want.parameters.mykey0).assertEqual(0.1);
abilityName: "com.example.actsgetwantalltesthap.MainAbility", expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
action: "action1", expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
entities: ["entity1"], expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
type: "MIMETYPE", expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
uri: "key={true,true,false}", expect(data.want.parameters.mykey3).assertEqual("str");
flags: wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION, expect(data.want.parameters.mykey4[0]).assertEqual(false);
parameters: expect(data.want.parameters.mykey4[1]).assertEqual(true);
{ expect(data.want.parameters.mykey4[2]).assertEqual(false);
mykey0: 0.1, expect(data.want.parameters.mykey5[0]).assertEqual("str");
mykey1: [0.1, 0.2, 0.0000000003], expect(data.want.parameters.mykey5[1]).assertEqual("STR");
mykey2: "[a, b, c]", expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
mykey3: "str", console.info('====> ACTS_GetWant_2100 setTimeout before done.=====>')
mykey4: [false, true, false], done();
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], }, TIMEOUT_NUMBER);
}, }).catch((error) => {
}, console.log('ACTS_GetWant_2100 error: ' + JSON.stringify(error))
}).then((data) => { expect.assertFail()
checkOnAbilityResult2100(data); done();
setTimeout(()=>{ })
done(); })
}, TIMEOUT_NUMBER);
}).catch((error) => { // @tc.number: ACTS_GetWant_2200
console.log('ACTS_GetWant_2100 error: ' + JSON.stringify(error)) // @tc.name: getWant : get want in current ability
expect.assertFail() // @tc.desc:Start the ability through startabilityforresult,
done(); // and then use terminateselfwithresult to return the data (by callback)
}) it('ACTS_GetWant_2200', 0, async function (done) {
}) featureAbility.startAbilityForResult({
want:
function checkOnAbilityResult2100(data) { {
console.info('====> ACTS_GetWant_2100 start ability=====>' + JSON.stringify(data)) deviceId: "",
expect(data.want.deviceId).assertEqual(""); bundleName: "com.example.actsgetwantalltesthap",
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); abilityName: "com.example.actsgetwantalltesthap.MainAbility",
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); action: "action1",
expect(data.want.action).assertEqual("action1"); entities: ["entity1"],
expect(data.want.entities[0]).assertEqual("entity1"); type: "MIMETYPE",
expect(data.want.type).assertEqual("MIMETYPE"); uri: "key={true,true,false}",
expect(data.want.uri).assertEqual("key={true,true,false}"); flags: wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION,
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION); parameters:
expect(data.want.parameters.mykey0).assertEqual(0.1); {
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); mykey0: 0.1,
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); mykey1: [0.1, 0.2, 0.0000000003],
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); mykey2: "[a, b, c]",
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); mykey3: "str",
expect(data.want.parameters.mykey3).assertEqual("str"); mykey4: [false, true, false],
expect(data.want.parameters.mykey4[0]).assertEqual(false); mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
expect(data.want.parameters.mykey4[1]).assertEqual(true); },
expect(data.want.parameters.mykey4[2]).assertEqual(false); },
expect(data.want.parameters.mykey5[0]).assertEqual("str"); },
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); (err, data) => {
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); setTimeout(()=>{
console.info('====> ACTS_GetWant_2100 setTimeout before done.=====>') console.info('====> ACTS_GetWant_2200 start ability=====>' + JSON.stringify(data))
} expect(data.want.deviceId).assertEqual("");
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
// @tc.number: ACTS_GetWant_2200 expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
// @tc.name: getWant : get want in current ability expect(data.want.action).assertEqual("action1");
// @tc.desc:Start the ability through startabilityforresult, expect(data.want.entities[0]).assertEqual("entity1");
// and then use terminateselfwithresult to return the data (by callback) expect(data.want.type).assertEqual("MIMETYPE");
it('ACTS_GetWant_2200', 0, async function (done) { expect(data.want.uri).assertEqual("key={true,true,false}");
featureAbility.startAbilityForResult({ expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION);
want: expect(data.want.parameters.mykey0).assertEqual(0.1);
{ expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
deviceId: "", expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
bundleName: "com.example.actsgetwantalltesthap", expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
abilityName: "com.example.actsgetwantalltesthap.MainAbility", expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
action: "action1", expect(data.want.parameters.mykey3).assertEqual("str");
entities: ["entity1"], expect(data.want.parameters.mykey4[0]).assertEqual(false);
type: "MIMETYPE", expect(data.want.parameters.mykey4[1]).assertEqual(true);
uri: "key={true,true,false}", expect(data.want.parameters.mykey4[2]).assertEqual(false);
flags: wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION, expect(data.want.parameters.mykey5[0]).assertEqual("str");
parameters: expect(data.want.parameters.mykey5[1]).assertEqual("STR");
{ expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
mykey0: 0.1, console.info('====> ACTS_GetWant_2200 setTimeout before done.=====>')
mykey1: [0.1, 0.2, 0.0000000003], done();
mykey2: "[a, b, c]", }, TIMEOUT_NUMBER);
mykey3: "str", })
mykey4: [false, true, false], })
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
}, // @tc.number: ACTS_GetWant_2300
}, // @tc.name: getWant : get want in current ability
}, // @tc.desc:Start the ability through startabilityforresult,
(err, data) => { // and then use terminateselfwithresult to return the data (by promise)
checkOnAbilityResult2200(data); it('ACTS_GetWant_2300', 0, async function (done) {
setTimeout(()=>{ featureAbility.startAbilityForResult({
done(); want:
}, TIMEOUT_NUMBER); {
}) deviceId: "",
}) bundleName: "com.example.actsgetwantalltesthap",
abilityName: "com.example.actsgetwantalltesthap.MainAbility",
function checkOnAbilityResult2200(data) { action: "action1",
console.info('====> ACTS_GetWant_2200 start ability=====>' + JSON.stringify(data)) entities: ["entity1"],
expect(data.want.deviceId).assertEqual(""); type: "MIMETYPE",
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); uri: "key={true,true,false}",
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); flags: wantConstant.Flags.FLAG_ABILITY_NEW_MISSION,
expect(data.want.action).assertEqual("action1"); parameters:
expect(data.want.entities[0]).assertEqual("entity1"); {
expect(data.want.type).assertEqual("MIMETYPE"); mykey0: 0.1,
expect(data.want.uri).assertEqual("key={true,true,false}"); mykey1: [0.1, 0.2, 0.0000000003],
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_CLEAR_MISSION); mykey2: "[a, b, c]",
expect(data.want.parameters.mykey0).assertEqual(0.1); mykey3: "str",
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); mykey4: [false, true, false],
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); },
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); },
expect(data.want.parameters.mykey3).assertEqual("str"); }).then((data) => {
expect(data.want.parameters.mykey4[0]).assertEqual(false); setTimeout(()=>{
expect(data.want.parameters.mykey4[1]).assertEqual(true); console.info('====> ACTS_GetWant_2300 start ability=====>' + JSON.stringify(data))
expect(data.want.parameters.mykey4[2]).assertEqual(false); expect(data.want.deviceId).assertEqual("");
expect(data.want.parameters.mykey5[0]).assertEqual("str"); expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); expect(data.want.action).assertEqual("action1");
console.info('====> ACTS_GetWant_2200 setTimeout before done.=====>') expect(data.want.entities[0]).assertEqual("entity1");
} expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.uri).assertEqual("key={true,true,false}");
// @tc.number: ACTS_GetWant_2300 expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_NEW_MISSION);
// @tc.name: getWant : get want in current ability expect(data.want.parameters.mykey0).assertEqual(0.1);
// @tc.desc:Start the ability through startabilityforresult, expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
// and then use terminateselfwithresult to return the data (by promise) expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
it('ACTS_GetWant_2300', 0, async function (done) { expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
featureAbility.startAbilityForResult({ expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
want: expect(data.want.parameters.mykey3).assertEqual("str");
{ expect(data.want.parameters.mykey4[0]).assertEqual(false);
deviceId: "", expect(data.want.parameters.mykey4[1]).assertEqual(true);
bundleName: "com.example.actsgetwantalltesthap", expect(data.want.parameters.mykey4[2]).assertEqual(false);
abilityName: "com.example.actsgetwantalltesthap.MainAbility", expect(data.want.parameters.mykey5[0]).assertEqual("str");
action: "action1", expect(data.want.parameters.mykey5[1]).assertEqual("STR");
entities: ["entity1"], expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
type: "MIMETYPE", console.info('====> ACTS_GetWant_2300 setTimeout before done.=====>')
uri: "key={true,true,false}", done();
flags: wantConstant.Flags.FLAG_ABILITY_NEW_MISSION, }, TIMEOUT_NUMBER);
parameters: }).catch((error) => {
{ console.log('ACTS_GetWant_2300 error: ' + JSON.stringify(error))
mykey0: 0.1, expect.assertFail()
mykey1: [0.1, 0.2, 0.0000000003], done();
mykey2: "[a, b, c]", })
mykey3: "str", })
mykey4: [false, true, false],
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], // @tc.number: ACTS_GetWant_2400
}, // @tc.name: getWant : get want in current ability
}, // @tc.desc:Start the ability through startabilityforresult,
}).then((data) => { // and then use terminateselfwithresult to return the data (by callback)
checkOnAbilityResult2300(data); it('ACTS_GetWant_2400', 0, async function (done) {
setTimeout(()=>{ featureAbility.startAbilityForResult({
done(); want:
}, TIMEOUT_NUMBER); {
}).catch((error) => { deviceId: "",
console.log('ACTS_GetWant_2300 error: ' + JSON.stringify(error)) bundleName: "com.example.actsgetwantalltesthap",
expect.assertFail() abilityName: "com.example.actsgetwantalltesthap.MainAbility",
done(); action: "action1",
}) entities: ["entity1"],
}) type: "MIMETYPE",
uri: "key={true,true,false}",
function checkOnAbilityResult2300(data) { flags: wantConstant.Flags.FLAG_ABILITY_NEW_MISSION,
console.info('====> ACTS_GetWant_2300 start ability=====>' + JSON.stringify(data)) parameters:
expect(data.want.deviceId).assertEqual(""); {
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); mykey0: 0.1,
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); mykey1: [0.1, 0.2, 0.0000000003],
expect(data.want.action).assertEqual("action1"); mykey2: "[a, b, c]",
expect(data.want.entities[0]).assertEqual("entity1"); mykey3: "str",
expect(data.want.type).assertEqual("MIMETYPE"); mykey4: [false, true, false],
expect(data.want.uri).assertEqual("key={true,true,false}"); mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"],
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_NEW_MISSION); },
expect(data.want.parameters.mykey0).assertEqual(0.1); },
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); },
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); (err, data) => {
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); setTimeout(()=>{
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); console.info('====> ACTS_GetWant_2400 start ability=====>' + JSON.stringify(data))
expect(data.want.parameters.mykey3).assertEqual("str"); expect(data.want.deviceId).assertEqual("");
expect(data.want.parameters.mykey4[0]).assertEqual(false); expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.parameters.mykey4[1]).assertEqual(true); expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.parameters.mykey4[2]).assertEqual(false); expect(data.want.action).assertEqual("action1");
expect(data.want.parameters.mykey5[0]).assertEqual("str"); expect(data.want.entities[0]).assertEqual("entity1");
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); expect(data.want.uri).assertEqual("key={true,true,false}");
console.info('====> ACTS_GetWant_2300 setTimeout before done.=====>') expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_NEW_MISSION);
} expect(data.want.parameters.mykey0).assertEqual(0.1);
expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
// @tc.number: ACTS_GetWant_2400 expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
// @tc.name: getWant : get want in current ability expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003);
// @tc.desc:Start the ability through startabilityforresult, expect(data.want.parameters.mykey2).assertEqual("[a, b, c]");
// and then use terminateselfwithresult to return the data (by callback) expect(data.want.parameters.mykey3).assertEqual("str");
it('ACTS_GetWant_2400', 0, async function (done) { expect(data.want.parameters.mykey4[0]).assertEqual(false);
featureAbility.startAbilityForResult({ expect(data.want.parameters.mykey4[1]).assertEqual(true);
want: expect(data.want.parameters.mykey4[2]).assertEqual(false);
{ expect(data.want.parameters.mykey5[0]).assertEqual("str");
deviceId: "", expect(data.want.parameters.mykey5[1]).assertEqual("STR");
bundleName: "com.example.actsgetwantalltesthap", expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony");
abilityName: "com.example.actsgetwantalltesthap.MainAbility", console.info('====> ACTS_GetWant_2400 setTimeout before done.=====>')
action: "action1", done();
entities: ["entity1"], }, TIMEOUT_NUMBER);
type: "MIMETYPE", })
uri: "key={true,true,false}", })
flags: wantConstant.Flags.FLAG_ABILITY_NEW_MISSION,
parameters: /*
{ * @tc.number ACTS_GetWant_2500
mykey0: 0.1, * @tc.name Misconfigured bundlename validation
mykey1: [0.1, 0.2, 0.0000000003], * @tc.desc Function test (by promise)
mykey2: "[a, b, c]", * @tc.level 0
mykey3: "str", */
mykey4: [false, true, false], it("ACTS_GetWant_2500",0, async function(done){
mykey5: ["str", "STR", "helloopenharmonyhelloopenharmonyhelloopenharmony"], featureAbility.startAbilityForResult({
}, want:
}, {
}, deviceId: "",
(err, data) => { bundleName: "com.example.actsgetwantalltesthap",
checkOnAbilityResult2400(data); abilityName: "com.example.actsgetwantalltesthap.MainAbility",
setTimeout(()=>{ action: "action2",
done(); entities: ["entity1", "entity2"],
}, TIMEOUT_NUMBER); type: "MIMETYPE",
}) uri: "key={true,true,false}",
}) flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT,
parameters:
function checkOnAbilityResult2400(data) { {
console.info('====> ACTS_GetWant_2400 start ability=====>' + JSON.stringify(data)) mykey0: 0.1,
expect(data.want.deviceId).assertEqual(""); mykey1: [0.1, 0.2, 0.3],
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); mykey2: "[1, 2, 3]",
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); mykey3: "str",
expect(data.want.action).assertEqual("action1"); mykey4: [false, true, false],
expect(data.want.entities[0]).assertEqual("entity1"); mykey5: ["str", "test123", "helloopenharmony"],
expect(data.want.type).assertEqual("MIMETYPE"); },
expect(data.want.uri).assertEqual("key={true,true,false}"); },
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_NEW_MISSION); }).then((data) => {
expect(data.want.parameters.mykey0).assertEqual(0.1); setTimeout(()=>{
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); console.info('====> ACTS_GetWant_2500 start ability=====>' + JSON.stringify(data))
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); expect(data.want.deviceId).assertEqual("");
expect(data.want.parameters.mykey1[2]).assertEqual(0.0000000003); expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.parameters.mykey2).assertEqual("[a, b, c]"); expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.parameters.mykey3).assertEqual("str"); expect(data.want.action).assertEqual("action2");
expect(data.want.parameters.mykey4[0]).assertEqual(false); expect(data.want.entities[0]).assertEqual("entity1");
expect(data.want.parameters.mykey4[1]).assertEqual(true); expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.parameters.mykey4[2]).assertEqual(false); expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.parameters.mykey5[0]).assertEqual("str"); expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT );
expect(data.want.parameters.mykey5[1]).assertEqual("STR"); expect(data.want.parameters.mykey0).assertEqual(0.1);
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmonyhelloopenharmonyhelloopenharmony"); expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
console.info('====> ACTS_GetWant_2400 setTimeout before done.=====>') expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
} expect(data.want.parameters.mykey1[2]).assertEqual(0.3);
expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]");
/* expect(data.want.parameters.mykey3).assertEqual("str");
* @tc.number ACTS_GetWant_2500 expect(data.want.parameters.mykey4[0]).assertEqual(false);
* @tc.name Misconfigured bundlename validation expect(data.want.parameters.mykey4[1]).assertEqual(true);
* @tc.desc Function test (by promise) expect(data.want.parameters.mykey4[2]).assertEqual(false);
* @tc.level 0 expect(data.want.parameters.mykey5[0]).assertEqual("str");
*/ expect(data.want.parameters.mykey5[1]).assertEqual("test123");
it("ACTS_GetWant_2500",0, async function(done){ expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
featureAbility.startAbilityForResult({ console.info('====> ACTS_GetWant_2500 before done=====>')
want: done();
{ }, TIMEOUT_NUMBER);
deviceId: "", }).catch((error) => {
bundleName: "com.example.actsgetwantalltesthap", console.log('ACTS_GetWant_2500 error: ' + JSON.stringify(error))
abilityName: "com.example.actsgetwantalltesthap.MainAbility", expect.assertFail()
action: "action2", done();
entities: ["entity1", "entity2"], })
type: "MIMETYPE", });
uri: "key={true,true,false}",
flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, /*
parameters: * @tc.number ACTS_GetWant_2600
{ * @tc.name Misconfigured bundlename validation
mykey0: 0.1, * @tc.desc Function test (by callback)
mykey1: [0.1, 0.2, 0.3], * @tc.level 0
mykey2: "[1, 2, 3]", */
mykey3: "str", it("ACTS_GetWant_2600",0, async function(done){
mykey4: [false, true, false], featureAbility.startAbilityForResult({
mykey5: ["str", "test123", "helloopenharmony"], want:
}, {
}, deviceId: "",
}).then((data) => { bundleName: "com.example.actsgetwantalltesthap",
checkOnAbilityResult2500(data); abilityName: "com.example.actsgetwantalltesthap.MainAbility",
setTimeout(()=>{ action: "action2",
done(); entities: ["entity1", "entity2"],
}, TIMEOUT_NUMBER); type: "MIMETYPE",
}).catch((error) => { uri: "key={true,true,false}",
console.log('ACTS_GetWant_2500 error: ' + JSON.stringify(error)) flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT,
expect.assertFail() parameters:
done(); {
}) mykey0: 0.1,
}); mykey1: [0.1, 0.2, 0.3],
mykey2: "[1, 2, 3]",
function checkOnAbilityResult2500(data) { mykey3: "str",
console.info('====> ACTS_GetWant_2500 start ability=====>' + JSON.stringify(data)) mykey4: [false, true, false],
expect(data.want.deviceId).assertEqual(""); mykey5: ["str", "test123", "helloopenharmony"],
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); },
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); },
expect(data.want.action).assertEqual("action2"); },
expect(data.want.entities[0]).assertEqual("entity1"); (err, data) => {
expect(data.want.type).assertEqual("MIMETYPE"); setTimeout(()=>{
expect(data.want.uri).assertEqual("key={true,true,false}"); console.info('====> ACTS_GetWant_2600 start ability=====>' + JSON.stringify(data))
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT ); expect(data.want.deviceId).assertEqual("");
expect(data.want.parameters.mykey0).assertEqual(0.1); expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap");
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility");
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); expect(data.want.action).assertEqual("action2");
expect(data.want.parameters.mykey1[2]).assertEqual(0.3); expect(data.want.entities[0]).assertEqual("entity1");
expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]"); expect(data.want.type).assertEqual("MIMETYPE");
expect(data.want.parameters.mykey3).assertEqual("str"); expect(data.want.uri).assertEqual("key={true,true,false}");
expect(data.want.parameters.mykey4[0]).assertEqual(false); expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT );
expect(data.want.parameters.mykey4[1]).assertEqual(true); expect(data.want.parameters.mykey0).assertEqual(0.1);
expect(data.want.parameters.mykey4[2]).assertEqual(false); expect(data.want.parameters.mykey1[0]).assertEqual(0.1);
expect(data.want.parameters.mykey5[0]).assertEqual("str"); expect(data.want.parameters.mykey1[1]).assertEqual(0.2);
expect(data.want.parameters.mykey5[1]).assertEqual("test123"); expect(data.want.parameters.mykey1[2]).assertEqual(0.3);
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony"); expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]");
console.info('====> ACTS_GetWant_2500 before done=====>') expect(data.want.parameters.mykey3).assertEqual("str");
} expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey4[1]).assertEqual(true);
/* expect(data.want.parameters.mykey4[2]).assertEqual(false);
* @tc.number ACTS_GetWant_2600 expect(data.want.parameters.mykey5[0]).assertEqual("str");
* @tc.name Misconfigured bundlename validation expect(data.want.parameters.mykey5[1]).assertEqual("test123");
* @tc.desc Function test (by callback) expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
* @tc.level 0 console.info('====> ACTS_GetWant_2600 before done=====>')
*/ done();
it("ACTS_GetWant_2600",0, async function(done){ }, TIMEOUT_NUMBER);
featureAbility.startAbilityForResult({ })
want: });
{
deviceId: "", /**
bundleName: "com.example.actsgetwantalltesthap", * @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0100
abilityName: "com.example.actsgetwantalltesthap.MainAbility", * @tc.name: Check the enumerated value ACTION_IMAGE_CAPTURE of wantConstant.
action: "action2", * @tc.desc: Check the enumerated value ACTION_IMAGE_CAPTURE of wantConstant.
entities: ["entity1", "entity2"], */
type: "MIMETYPE", it('SUB_AA_OpenHarmony_wantConstantEnumeration_0100',0, async function (done) {
uri: "key={true,true,false}", console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0100 --- start")
flags: wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT, let image = wantConstant.Action.ACTION_IMAGE_CAPTURE
parameters: expect(image).assertEqual("ohos.want.action.imageCapture")
{ console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0100 --- end")
mykey0: 0.1, done()
mykey1: [0.1, 0.2, 0.3], })
mykey2: "[1, 2, 3]",
mykey3: "str", /**
mykey4: [false, true, false], * @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0200
mykey5: ["str", "test123", "helloopenharmony"], * @tc.name: Check the enumerated value ACTION_VIDEO_CAPTURE of wantConstant.
}, * @tc.desc: Check the enumerated value ACTION_VIDEO_CAPTURE of wantCconstant.
}, */
}, it('SUB_AA_OpenHarmony_wantConstantEnumeration_0200',0, async function (done) {
(err, data) => { console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0200 --- start")
checkOnAbilityResult2600(data); let video = wantConstant.Action.ACTION_VIDEO_CAPTURE
setTimeout(()=>{ expect(video).assertEqual("ohos.want.action.videoCapture")
done(); console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0200 --- end")
}, TIMEOUT_NUMBER); done()
}) })
});
/**
function checkOnAbilityResult2600(data) { * @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0300
console.info('====> ACTS_GetWant_2600 start ability=====>' + JSON.stringify(data)) * @tc.name: Check the enumerated value ACTION_APP_ACCOUNT_OAUTH of wantConstant.
expect(data.want.deviceId).assertEqual(""); * @tc.desc: Check the enumerated value ACTION_APP_ACCOUNT_OAUTH of wantConstant.
expect(data.want.bundleName).assertEqual("com.example.actsgetwantalltesthap"); */
expect(data.want.abilityName).assertEqual("com.example.actsgetwantalltesthap.MainAbility"); it('SUB_AA_OpenHarmony_wantConstantEnumeration_0300',0, async function (done) {
expect(data.want.action).assertEqual("action2"); console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0300 --- start")
expect(data.want.entities[0]).assertEqual("entity1"); let app = wantConstant.Action.ACTION_APP_ACCOUNT_OAUTH
expect(data.want.type).assertEqual("MIMETYPE"); expect(app).assertEqual("ohos.account.appAccount.action.oauth")
expect(data.want.uri).assertEqual("key={true,true,false}"); console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0300 --- end")
expect(data.want.flags).assertEqual(wantConstant.Flags.FLAG_ABILITY_FORWARD_RESULT ); done()
expect(data.want.parameters.mykey0).assertEqual(0.1); })
expect(data.want.parameters.mykey1[0]).assertEqual(0.1); })
expect(data.want.parameters.mykey1[1]).assertEqual(0.2); }
expect(data.want.parameters.mykey1[2]).assertEqual(0.3);
expect(data.want.parameters.mykey2).assertEqual("[1, 2, 3]");
expect(data.want.parameters.mykey3).assertEqual("str");
expect(data.want.parameters.mykey4[0]).assertEqual(false);
expect(data.want.parameters.mykey4[1]).assertEqual(true);
expect(data.want.parameters.mykey4[2]).assertEqual(false);
expect(data.want.parameters.mykey5[0]).assertEqual("str");
expect(data.want.parameters.mykey5[1]).assertEqual("test123");
expect(data.want.parameters.mykey5[2]).assertEqual("helloopenharmony");
console.info('====> ACTS_GetWant_2600 before done=====>')
}
/**
* @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0100
* @tc.name: Check the enumerated value ACTION_IMAGE_CAPTURE of wantConstant.
* @tc.desc: Check the enumerated value ACTION_IMAGE_CAPTURE of wantConstant.
*/
it('SUB_AA_OpenHarmony_wantConstantEnumeration_0100',0, async function (done) {
console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0100 --- start")
let image = wantConstant.Action.ACTION_IMAGE_CAPTURE
expect(image).assertEqual("ohos.want.action.imageCapture")
console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0100 --- end")
done()
})
/**
* @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0200
* @tc.name: Check the enumerated value ACTION_VIDEO_CAPTURE of wantConstant.
* @tc.desc: Check the enumerated value ACTION_VIDEO_CAPTURE of wantCconstant.
*/
it('SUB_AA_OpenHarmony_wantConstantEnumeration_0200',0, async function (done) {
console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0200 --- start")
let video = wantConstant.Action.ACTION_VIDEO_CAPTURE
expect(video).assertEqual("ohos.want.action.videoCapture")
console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0200 --- end")
done()
})
/**
* @tc.number: SUB_AA_OpenHarmony_wantConstantEnumeration_0300
* @tc.name: Check the enumerated value ACTION_APP_ACCOUNT_OAUTH of wantConstant.
* @tc.desc: Check the enumerated value ACTION_APP_ACCOUNT_OAUTH of wantConstant.
*/
it('SUB_AA_OpenHarmony_wantConstantEnumeration_0300',0, async function (done) {
console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0300 --- start")
let app = wantConstant.Action.ACTION_APP_ACCOUNT_OAUTH
expect(app).assertEqual("ohos.account.appAccount.action.oauth")
console.log("SUB_AA_OpenHarmony_wantConstantEnumeration_0300 --- end")
done()
})
})
}
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
export default { export default {
data: { data: {
title: '' title: ''
}, },
onInit() { onInit() {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
}, },
onShow() { onShow() {
console.info('============Start Ability onShow finish'); console.info('============Start Ability onShow finish');
featureAbility.getWant( featureAbility.getWant(
(err, data) => { (err, data) => {
data = data; data = data;
console.debug("==========data=" + JSON.stringify(data)); console.debug("==========data=" + JSON.stringify(data));
if (data.parameters.mykey5[1] == 'test123'){ if (data.parameters.mykey5[1] == 'test123'){
featureAbility.getWant().then((data) =>{ featureAbility.getWant().then((data) =>{
data = data data = data
setTimeout(function(){ setTimeout(function(){
console.debug("==========data2 bundleName is===========" console.debug("==========data2 bundleName is==========="
+ JSON.stringify(data.bundleName)); + JSON.stringify(data.bundleName));
featureAbility.terminateSelfWithResult( featureAbility.terminateSelfWithResult(
{ {
resultCode: 1, resultCode: 1,
want: data want: data
} }
); );
},1000); },1000);
}) })
}else{ }else{
setTimeout(function(){ setTimeout(function(){
console.debug("==========data1 bundleName is===========" featureAbility.terminateSelfWithResult(
+ JSON.stringify(data.bundleName)); {
featureAbility.terminateSelfWithResult( resultCode: 1,
{ want: data
resultCode: 1, }
want: data );
} },800);
); }
},1000); }
} )
} },
) onReady() {
}, console.info('onReady');
onReady() { },
console.info('onReady'); }
},
}
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "MainAbility",
"deviceTypes": [ "deviceTypes": [
"default" "default",
"tablet"
], ],
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
"mainElement": "MainAbility", "mainElement": "MainAbility",
"deviceTypes": [ "deviceTypes": [
"default" "default",
"tablet"
], ],
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册