diff --git a/appexecfwk/ams_standard/BUILD.gn b/appexecfwk/ams_standard/BUILD.gn index db5a1e7479f610c7a9e0021665408d0cf93da95f..4a252155e6edf1c9becc31da0ad30b5e0da1cf8b 100644 --- a/appexecfwk/ams_standard/BUILD.gn +++ b/appexecfwk/ams_standard/BUILD.gn @@ -17,6 +17,9 @@ group("ams_standard") { testonly = true if (is_standard_system) { deps = [ + "amsabilitymanager/amsMissionSnapshotTest:amsMissionSnapshotTest", + "amsabilitymanager/amsMissionSnapshotTestSingleton:amsMissionSnapshotTestSingleton", + "amsabilitymanager/amsMissionSnapshotTestSingletonS:amsMissionSnapshotTestSingletonS", "amsdatauriutils:amsDataUriUtils", "amszipfileunzipfilest:amsZipfileUnzipfileST", "fwkdataaccessor:FWKDataAccessor", diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/BUILD.gn b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..da37010edcad31a0b29b83b9a4a7f21bf15a6f24 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("amsMissionSnapshotTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "amsMissionSnapshotTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/Test.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..3ec911dfc7b3a17504cd4577be5bbabaf7f97e63 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/config.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d738e6874b89f8eb2a8f8f86d08635792e6e1218 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/config.json @@ -0,0 +1,51 @@ +{ + "app": { + "bundleName": "com.amsst.amsMissionSnapshotTest", + "vendor": "amsst", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.amsst.amsMissionSnapshotTest", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "name": "com.amsst.amsMissionSnapshotTest.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/app.js b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/pages/index/index.css b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6724ec055a554cf3f9c7be83780c30df2274875b --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,12 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} +.titleST { + font-size: 32px; +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f114df963b0ed3bd70b40cf47e396f9c5e9ed759 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,8 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + + + STAbilityManagerMissionSnapshot + +
diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/pages/index/index.js b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4bfa4f7e4a4085d7336a97befffb8d52882d281d --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file' +import app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('====onShow finish====<') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/List.test.js b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2a0e2e7c28b34893374a3c3451fb200fc1ff368f --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./amsMissionSnapshotTest.test.js') \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/amsMissionSnapshotTest.test.js b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/amsMissionSnapshotTest.test.js new file mode 100644 index 0000000000000000000000000000000000000000..19a0e45b641660f3b489a633e2bcf9f55a6f2ef8 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTest/entry/src/main/js/test/amsMissionSnapshotTest.test.js @@ -0,0 +1,449 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityManager from '@ohos.app.abilityManager' +import featureAbility from '@ohos.ability.featureability' +import commonEvent from '@ohos.commonevent' +import image from '@ohos.multimedia.image' + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ActsMissionSnapshotTest', function () { + beforeAll(async (done) => { + console.debug('= ACTS_beforeAll ====:' + err); + } + console.debug('= ACTS_beforeAll ==== { + console.debug('= ACTS_afterAll ====:' + err); + } + console.debug('= ACTS_afterAll ==== { + expect(err.code).assertEqual(0); + console.debug("=ACTS_MissionSnapshot_0100 err,data=======>" + + ("json data【") + JSON.stringify(data) + (" 】") + " , " + data); + expect(data.topAbility.bundleName).assertEqual(""); + expect(data.topAbility.abilityName).assertEqual(""); + console.debug('ACTS_MissionSnapshot_0100==== { + console.debug("=ACTS_MissionSnapshot_0200 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + console.debug('ACTS_MissionSnapshot_0200 AbilityMissionInfo data.length ====>: ' + data.length); + if (!data.length) { + m_missionId = -99; + m_topAbility_bundleName = ""; + m_topAbility_abilityName = ""; + expect("if (!data.length) ").assertEqual("0"); + console.debug('ACTS_MissionSnapshot_0200====" + m_missionId); + await abilityManager.getAbilityMissionSnapshot(m_missionId, (err, data) => { + expect(err.code).assertEqual(0); + console.debug("=ACTS_MissionSnapshot_0200 err,data=======>" + + ("json data【") + JSON.stringify(data) + (" 】") + " , " + data); + expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName); + expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName); + console.debug("=ACTS_MissionSnapshot_0200 ====> JSON.stringify(data.snapshot)=" + + JSON.stringify(data.snapshot) + " , " + data.snapshot); + try { + data.snapshot.getPixelBytesNumber().then(function (data){ + console.debug("=ACTS_MissionSnapshot_0200 ====>" + +"(data.snapshot.getPixelBytesNumber()=)" + data) + expect(data != 0).assertEqual(true); + console.debug('ACTS_MissionSnapshot_0200==== { + console.debug("=ACTS_MissionSnapshot_0300 createSubscriber .then(data)=======>" + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,data=" + data); + subscriber = data; + await commonEvent.subscribe(subscriber, async (err, data) => { + clearTimeout(currentAlertTimeout); + console.debug("=ACTS_MissionSnapshot_0300 subscribe (err,data)=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + unsubscribe("subscribe", subscriber); + + var m_missionId = -1; + var m_topAbility_bundleName = ""; + var m_topAbility_abilityName = ""; + var upperLimit = 10; + await abilityManager.getActiveAbilityMissionInfos(upperLimit, async (err, data) => { + console.debug("=ACTS_MissionSnapshot_0300 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + console.debug('ACTS_MissionSnapshot_0300 AbilityMissionInfo data.length ====>' + + data.length); + if (!data.length) { + m_missionId = -99; + m_topAbility_bundleName = ""; + m_topAbility_abilityName = ""; + expect("if (!data.length) ").assertEqual(0); + unsubscribe("if (!data.length) ", subscriber); + console.debug('ACTS_MissionSnapshot_0300====" + m_missionId); + await abilityManager.getAbilityMissionSnapshot(m_missionId, (err, data) => { + expect(err.code).assertEqual(0); + console.debug("=ACTS_MissionSnapshot_0300 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); + try { + expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName); + expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName); + data.snapshot.getPixelBytesNumber().then(function (data){ + console.debug("=ACTS_MissionSnapshot_0300 ====> " + +("data.snapshot.getPixelBytesNumber()=" + data)) + expect(data != 0).assertEqual(true); + unsubscribe(".then() ", subscriber); + console.debug('ACTS_MissionSnapshot_0300==== { + console.debug('ACTS_MissionSnapshot_0300====" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); + expect(data.topAbility.bundleName).assertEqual(""); + expect(data.topAbility.abilityName).assertEqual(""); + console.debug('ACTS_MissionSnapshot_0400====" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(err).assertEqual("false"); + console.debug('ACTS_MissionSnapshot_0400==== { + console.debug("=ACTS_MissionSnapshot_0500 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + console.debug('ACTS_MissionSnapshot_0500 AbilityMissionInfo data.length ====>: ' + data.length); + if (!data.length) { + m_missionId = -99; + m_topAbility_bundleName = ""; + m_topAbility_abilityName = ""; + expect("if (!data.length) ").assertEqual(0); + console.debug('ACTS_MissionSnapshot_0500====" + m_missionId); + abilityManager.getAbilityMissionSnapshot(m_missionId) + .then(function (data) { + console.debug("=ACTS_MissionSnapshot_0500 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); + expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName); + expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName); + console.debug("=ACTS_MissionSnapshot_0500 err,data=======> JSON.stringify(data.snapshot)=" + + JSON.stringify(data.snapshot) + " , " + data.snapshot); + try { + data.snapshot.getPixelBytesNumber().then(function (data){ + console.debug("=ACTS_MissionSnapshot_0500 ====> " + +("data.snapshot.getPixelBytesNumber()=" + data)) + expect(data != 0).assertEqual(true); + console.debug('ACTS_MissionSnapshot_0500====" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(err).assertEqual("false"); + console.debug('ACTS_MissionSnapshot_0500==== { + console.debug("=ACTS_MissionSnapshot_unsubscribe (err,data)=======>" + + (caller) + + (" , json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + }); + } + /* + * @tc.number: ACTS_MissionSnapshot_0600 + * @tc.name: getAbilityMissionSnapshot + * @tc.desc: Recent task stack provides current screenshot.(Promise) + */ + it('ACTS_MissionSnapshot_0600', 0, async function (done) { + console.debug('ACTS_MissionSnapshot_0600==== { + console.debug("=ACTS_MissionSnapshot_0600 createSubscriber .then(data)=======>" + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,data=" + data); + subscriber = data; + await commonEvent.subscribe(subscriber, async (err, data) => { + clearTimeout(currentAlertTimeout); + console.debug("=ACTS_MissionSnapshot_0600 subscribe (err,data)=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + unsubscribe("subscribe", subscriber); + + var m_missionId = -1; + var m_topAbility_bundleName = ""; + var m_topAbility_abilityName = ""; + var upperLimit = 10; + await abilityManager.getActiveAbilityMissionInfos(upperLimit, (err, data) => { + console.debug("=ACTS_MissionSnapshot_0600 err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + console.debug('ACTS_MissionSnapshot_0600 AbilityMissionInfo data.length ====>' + + data.length); + if (!data.length) { + m_missionId = -99; + m_topAbility_bundleName = ""; + m_topAbility_abilityName = ""; + expect("if (!data.length) ").assertEqual(0); + unsubscribe("if (!data.length) ", subscriber); + console.debug('ACTS_MissionSnapshot_0600====" + m_missionId); + abilityManager.getAbilityMissionSnapshot(m_missionId).then(function (data) { + console.debug("=ACTS_MissionSnapshot_0600 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); + try { + expect(data.topAbility.bundleName).assertEqual(m_topAbility_bundleName); + expect(data.topAbility.abilityName).assertEqual(m_topAbility_abilityName); + console.debug("=ACTS_MissionSnapshot_0600=====> JSON.stringify(data.snapshot)=" + + JSON.stringify(data.snapshot) + " , " + data.snapshot); + data.snapshot.getPixelBytesNumber().then(function (data){ + console.debug("=ACTS_MissionSnapshot_0600 ====> " + +("data.snapshot.getPixelBytesNumber()=" + data)) + expect(data != 0).assertEqual(true); + unsubscribe(".then() ", subscriber); + console.debug('ACTS_MissionSnapshot_0600====" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(err).assertEqual("false"); + console.debug('ACTS_MissionSnapshot_0600==== { + console.debug('ACTS_MissionSnapshot_0600==== + + {{ $t('strings.hello') }} {{ title }} + + + STAbilityManagerMissionSnapshotSingleton + + diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/default/pages/index/index.js b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/default/pages/index/index.js new file mode 100755 index 0000000000000000000000000000000000000000..02bb00896bb750e6be2fc88cb6826f580f1f5a81 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import commonEvent from '@ohos.commonevent' +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + OnActive(){ + console.debug('ACTS_MissionSnapshot_OnActive'); + commonEvent.publish("ACTS_MissionSnapshot_OnActive", (err,data) =>{ + console.debug("=ACTS_MissionSnapshot_OnActive err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + }); + }, + onShow() { + console.debug('ACTS_MissionSnapshot_onShow'); + commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{ + console.debug("=ACTS_MissionSnapshot_onShow err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + }); + }, +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/resources/base/element/string.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..3ef6a8608a2a13717d01a77d1f27a0c9f7ab84fb --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StServiceAbilityServer" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/resources/base/media/icon.png b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/entry/src/main/js/resources/base/media/icon.png differ diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/signature/openharmony_sx.p7b b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingleton/signature/openharmony_sx.p7b differ diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/BUILD.gn b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..27ecf4d3d63b6a29c83fd0bd8e096d99ecfdb392 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("amsMissionSnapshotTestSingletonS") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "amsMissionSnapshotTestSingletonS" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/Test.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..7a88763ed8d2ac31dd30211b9574f47273e84549 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/config.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..4d90366fb5729ef972f0067fc341173478dfa432 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/config.json @@ -0,0 +1,51 @@ +{ + "app": { + "bundleName": "com.amsst.amsMissionSnapshotTestSingletonS", + "vendor": "amsst", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.amsst.amsMissionSnapshotTestSingletonS", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "name": "com.amsst.amsMissionSnapshotTestSingletonS.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "singleton", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/app.js b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/app.js new file mode 100755 index 0000000000000000000000000000000000000000..743ddb4640d5204342f4a538f730162334613c49 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/i18n/en-US.json new file mode 100755 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/i18n/zh-CN.json new file mode 100755 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.css b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.css new file mode 100755 index 0000000000000000000000000000000000000000..ac39915c295d19be6b0c23ae374d30b8f13bc066 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,12 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} +.titleST { + font-size: 32px; +} diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.hml new file mode 100755 index 0000000000000000000000000000000000000000..26ad1262d71cd021622773948e92726dc7e13f42 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,8 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + + + STAbilityManagerMissionSnapshotSingletonS + +
diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.js b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.js new file mode 100755 index 0000000000000000000000000000000000000000..02bb00896bb750e6be2fc88cb6826f580f1f5a81 --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import commonEvent from '@ohos.commonevent' +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + OnActive(){ + console.debug('ACTS_MissionSnapshot_OnActive'); + commonEvent.publish("ACTS_MissionSnapshot_OnActive", (err,data) =>{ + console.debug("=ACTS_MissionSnapshot_OnActive err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + }); + }, + onShow() { + console.debug('ACTS_MissionSnapshot_onShow'); + commonEvent.publish("ACTS_MissionSnapshot_onShow", (err,data) =>{ + console.debug("=ACTS_MissionSnapshot_onShow err,data=======>" + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); + }); + }, +} \ No newline at end of file diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/resources/base/element/string.json b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..3ef6a8608a2a13717d01a77d1f27a0c9f7ab84fb --- /dev/null +++ b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StServiceAbilityServer" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/resources/base/media/icon.png b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/entry/src/main/js/resources/base/media/icon.png differ diff --git a/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/signature/openharmony_sx.p7b b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/appexecfwk/ams_standard/amsabilitymanager/amsMissionSnapshotTestSingletonS/signature/openharmony_sx.p7b differ diff --git a/notification/ans_standard/publish_test/BUILD.gn b/notification/ans_standard/publish_test/BUILD.gn index 6675d46fa5cf37e9994720feccada44c00eca8ee..f0f114393275bd307e98a8e54fef2f749bde90f1 100644 --- a/notification/ans_standard/publish_test/BUILD.gn +++ b/notification/ans_standard/publish_test/BUILD.gn @@ -24,6 +24,7 @@ group("publish_test") { #"publishcontentype:publishcontentype", #"subscribe:subscribe", + "activebtn:activebtn", "ansactscancelgroup:ActsAnsCancelGroup", "ansactsremovegroup:ActsAnsRemoveGroup", "donotdisturbmode:ActsAnsDoNotDisturbTest", diff --git a/notification/ans_standard/publish_test/activebtn/BUILD.gn b/notification/ans_standard/publish_test/activebtn/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0dece9fcf201b31ed1d8392fabd5f36898a43156 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/BUILD.gn @@ -0,0 +1,26 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +group("activebtn") { + testonly = true + if (is_standard_system) { + deps = [ + "activebutton:ActsAnsActionButtonTest", + "testa:testA", + "testb:testB", + "testc:testC", + ] + } +} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/BUILD.gn b/notification/ans_standard/publish_test/activebtn/activebutton/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..12c75c870f91ab20ade1cd0d44264dd9330543c7 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAnsActionButtonTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAnsActionButtonTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/Test.json b/notification/ans_standard/publish_test/activebtn/activebutton/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a9b377759ad36df116c2160d0369f94b9df596be --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/Test.json @@ -0,0 +1,21 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "60000", + "package": "com.example.actsansactionbuttontest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAnsActionButtonTest.hap", + "testA.hap", + "testB.hap", + "testC.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/config.json b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..947e90b4ed016b2593f66ce7438ee66a5167ea49 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/config.json @@ -0,0 +1,62 @@ +{ + "app": { + "bundleName": "com.example.actsansactionbuttontest", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsansactionbuttontest", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.actsansactionbuttontest.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..2a68c1992145a976957d7dcdd69a7e9c2e8e9877 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..485c1ea4f2631a1045e84574a6e492429c6152db --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + activeButton + +
diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..eb3bb563e41888ba752c3a4da28e4d09cefec8b8 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActiveBtn" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/resources/base/media/icon.png differ diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActiveButton.js b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActiveButton.js new file mode 100644 index 0000000000000000000000000000000000000000..c54d0d2a920273c2950f584c8fe21d88c001fcbe --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActiveButton.js @@ -0,0 +1,975 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import notify from '@ohos.notification' +import WantAgent from '@ohos.wantAgent' +import { OperationType, WantAgentFlags } from '@ohos.wantagent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsAnsActionButtonTest', function () { + console.info("===ActsDoNotSubscriberTest start===>"); + function publishCallbacka(err){ + console.debug("===>publishCallbacka===>"+err.code); + expect(err.code).assertEqual(0) + } + function publishCallbackb(err){ + console.debug("===>publishCallbackb===>"+err.code); + expect(err.code).assertEqual(0) + } + function publishCallbackc(err){ + console.debug("===>publishCallbackc===>"+err.code); + expect(err.code).assertEqual(0) + } + + function consumeCallbackA(data) { + console.debug("===>consumeCallbackA data : ===>" +JSON.stringify(data)); + var triggerInfo = { + code:0 + } + expect(data.request.actionButtons[0].title).assertEqual("buttonA") + var wantAgenta = data.request.actionButtons[0].wantAgent + console.debug("===>titleA: ===>" + JSON.stringify(data.request.actionButtons[0].title)) + console.debug("===>wantAgentA: ===>" + JSON.stringify(wantAgenta)) + WantAgent.trigger(wantAgenta, triggerInfo, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerA success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerA failed!----'+err.code); + } + } + ); + } + + /* + * @tc.number: ActsActiveButton_test_0100 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsActiveButton_test_0100', 0, async function (done) { + console.debug("===ActsActiveButton_test_0100===begin===>"); + var subInfo ={ + onConsume:consumeCallbackA + } + notify.subscribe(subInfo); + + var agentInfoA = { + wants: [ + { + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var wantAgentData = await WantAgent.getWantAgent(agentInfoA); + + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText : { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText: "long_text", + briefText: "long_briefText", + expandedTitle: "long_expandedTitle" + }, + }, + id: 1, + slotType : notify.SlotType.SERVICE_INFORMATION, + actionButtons: [{title:"buttonA", wantAgent:wantAgentData}] + } + await notify.publish(notificationRequest, publishCallbacka); + console.info("===ActsActiveButton_test_0100===end===>"); + setTimeout((async function(){ + notify.unsubscribe(subInfo); + console.info("======ActsActiveButton_test_0100 setTimeout unsubscribe===>"); + done(); + }),300); + }) + + //consume + function consumeCallbackB(data) { + console.debug("===>consumeCallbackB data : ===>" +JSON.stringify(data)); + var triggerInfo = { + code:1 + } + expect(data.request.actionButtons[0].title).assertEqual("buttonB") + var wantAgentB = data.request.actionButtons[0].wantAgent + console.debug("===>titleB: ===>" + JSON.stringify(data.request.actionButtons[0].title)) + console.debug("===>wantAgentB: ===>" + JSON.stringify(wantAgentB)) + WantAgent.trigger(wantAgentB, triggerInfo, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerB success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerB failed!----'+err.code); + } + } + ); + } + + /* + * @tc.number: ActsActiveButton_test_0200 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsActiveButton_test_0200', 0, async function (done) { + console.debug("===ActsActiveButton_test_0200===begin===>"); + var subInfo ={ + onConsume:consumeCallbackB + } + notify.subscribe(subInfo); + + var agentInfoB = { + wants: [ + { + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var wantAgentDataB = await WantAgent.getWantAgent(agentInfoB); + + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText : { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText: "long_text", + briefText: "long_briefText", + expandedTitle: "long_expandedTitle" + }, + }, + id: 2, + slotType : notify.SlotType.SERVICE_INFORMATION, + actionButtons: [{title:"buttonB", wantAgent:wantAgentDataB}] + } + await notify.publish(notificationRequest).then(()=>{ + console.info("===ActsActiveButton_test_0200===promise===>"); + }); + setTimeout((async function(){ + notify.unsubscribe(subInfo); + console.info("======ActsActiveButton_test_0200 setTimeout unsubscribe===>"); + done(); + }),300); + }) + + + function consumeCallbackC(data) { + console.debug("===>consumeCallbackC data : ===>" +JSON.stringify(data)); + var triggerInfoC = { + code:2 + } + var triggerInfoD = { + code:3 + } + expect(data.request.actionButtons[0].title).assertEqual("buttonC") + expect(data.request.actionButtons[1].title).assertEqual("buttonD") + var wantAgentC = data.request.actionButtons[0].wantAgent + var wantAgentD = data.request.actionButtons[1].wantAgent + console.debug("===>wantAgentC: ===>" + JSON.stringify(wantAgentC)) + console.debug("===>wantAgentD: ===>" + JSON.stringify(wantAgentD)) + WantAgent.trigger(wantAgentC, triggerInfoC, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerC success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerC failed!----'+err.code); + } + }); + WantAgent.trigger(wantAgentD, triggerInfoD, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerD success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerD failed!----'+err.code); + } + }); + } + + /* + * @tc.number: ActsActiveButton_test_0300 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsActiveButton_test_0300', 0, async function (done) { + console.debug("===ActsActiveButton_test_0300===begin===>"); + + var subInfo ={ + onConsume:consumeCallbackC + } + await notify.subscribe(subInfo); + + var agentInfoC = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var agentInfoD = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var wantAgentDataC = await WantAgent.getWantAgent(agentInfoC); + var wantAgentDataD = await WantAgent.getWantAgent(agentInfoD); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText : { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText: "long_text", + briefText: "long_briefText", + expandedTitle: "long_expandedTitle" + }, + }, + id: 3, + slotType : notify.SlotType.SERVICE_INFORMATION, + actionButtons: [{title:"buttonC", wantAgent:wantAgentDataC},{title:"buttonD", wantAgent:wantAgentDataD}] + } + notify.publish(notificationRequest, publishCallbackb); + setTimeout((async function(){ + notify.unsubscribe(subInfo); + console.info("======ActsActiveButton_test_0300 setTimeout unsubscribe===>"); + done(); + }),300); + }) + + function consumeCallbackD(data) { + console.debug("===>consumeCallbackD data : ===>" +JSON.stringify(data)); + var triggerInfoE = { + code:4 + } + var triggerInfoF = { + code:5 + } + expect(data.request.actionButtons[0].title).assertEqual("buttonE") + expect(data.request.actionButtons[1].title).assertEqual("buttonF") + var wantAgentE = data.request.actionButtons[0].wantAgent + var wantAgentF = data.request.actionButtons[1].wantAgent + console.debug("===>wantAgentC: ===>" + JSON.stringify(wantAgentE)) + console.debug("===>wantAgentD: ===>" + JSON.stringify(wantAgentF)) + WantAgent.trigger(wantAgentE, triggerInfoE, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerInfoE success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerInfoE failed!----'+err.code); + } + }); + WantAgent.trigger(wantAgentF, triggerInfoF, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerInfoF success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerInfoF failed!----'+err.code); + } + }); + } + + /* + * @tc.number: ActsActiveButton_test_0400 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsActiveButton_test_0400', 0, async function (done) { + console.debug("===ActsActiveButton_test_0400===begin===>"); + + var subInfo ={ + onConsume:consumeCallbackD + } + await notify.subscribe(subInfo); + + var agentInfoE = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var agentInfoF = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var wantAgentDataE = await WantAgent.getWantAgent(agentInfoE); + var wantAgentDataF = await WantAgent.getWantAgent(agentInfoF); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText : { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText: "long_text", + briefText: "long_briefText", + expandedTitle: "long_expandedTitle" + }, + }, + id: 3, + slotType : notify.SlotType.SERVICE_INFORMATION, + actionButtons: [{title:"buttonE", wantAgent:wantAgentDataE},{title:"buttonF", wantAgent:wantAgentDataF}] + } + notify.publish(notificationRequest).then(()=>{ + console.info("======ActsActiveButton_test_0400 promise===>"); + }); + setTimeout((async function(){ + notify.unsubscribe(subInfo); + console.info("======ActsActiveButton_test_0400 setTimeout unsubscribe===>"); + done(); + }),300); + }) + + function consumeCallbackE(data) { + console.debug("===>consumeCallbackE data : ===>" +JSON.stringify(data)); + var triggerInfoG = { + code:1 + } + var triggerInfoH = { + code:2 + } + var triggerInfoI = { + code:3 + } + expect(data.request.actionButtons[0].title).assertEqual("buttonG") + expect(data.request.actionButtons[1].title).assertEqual("buttonH") + expect(data.request.actionButtons[2].title).assertEqual("buttonI") + var wantAgentG = data.request.actionButtons[0].wantAgent + var wantAgentH = data.request.actionButtons[1].wantAgent + var wantAgentI = data.request.actionButtons[2].wantAgent + console.debug("===>wantAgentG: ===>" + JSON.stringify(wantAgentG)) + console.debug("===>wantAgentH: ===>" + JSON.stringify(wantAgentH)) + console.debug("===>wantAgentI: ===>" + JSON.stringify(wantAgentI)) + WantAgent.trigger(wantAgentG, triggerInfoG, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerG success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerG failed!----'+err.code); + } + }); + WantAgent.trigger(wantAgentH, triggerInfoH, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerH success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerH failed!----'+err.code); + } + }); + WantAgent.trigger(wantAgentI, triggerInfoI, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerI success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerI failed!----'+err.code); + } + }); + } + + /* + * @tc.number: ActsActiveButton_test_0500 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsActiveButton_test_0500', 0, async function (done) { + console.debug("===ActsActiveButton_test_0500===begin===>"); + + var subInfo ={ + onConsume:consumeCallbackE + } + await notify.subscribe(subInfo); + + var agentInfoG = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var agentInfoH = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var agentInfoI = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var wantAgentDataG = await WantAgent.getWantAgent(agentInfoG); + var wantAgentDataH = await WantAgent.getWantAgent(agentInfoH); + var wantAgentDataI = await WantAgent.getWantAgent(agentInfoI); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText : { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText: "long_text", + briefText: "long_briefText", + expandedTitle: "long_expandedTitle" + }, + }, + id: 1, + slotType : notify.SlotType.SERVICE_INFORMATION, + actionButtons: [{title:"buttonG", wantAgent:wantAgentDataG},{title:"buttonH", wantAgent:wantAgentDataH},{title:"buttonI", wantAgent:wantAgentDataI}] + } + notify.publish(notificationRequest, publishCallbackc); + setTimeout((async function(){ + notify.unsubscribe(subInfo); + console.info("======ActsActiveButton_test_0500 setTimeout unsubscribe===>"); + done(); + }),300); + }) + + function consumeCallbackF(data) { + console.debug("===>consumeCallbackF data : ===>" +JSON.stringify(data)); + var triggerInfoJ = { + code:4 + } + var triggerInfoK = { + code:5 + } + var triggerInfoL = { + code:6 + } + expect(data.request.actionButtons[0].title).assertEqual("buttonJ") + expect(data.request.actionButtons[1].title).assertEqual("buttonK") + expect(data.request.actionButtons[2].title).assertEqual("buttonL") + var wantAgentJ = data.request.actionButtons[0].wantAgent + var wantAgentK = data.request.actionButtons[1].wantAgent + var wantAgentL = data.request.actionButtons[2].wantAgent + console.debug("===>wantAgentJ: ===>" + JSON.stringify(wantAgentJ)) + console.debug("===>wantAgentK: ===>" + JSON.stringify(wantAgentK)) + console.debug("===>wantAgentL: ===>" + JSON.stringify(wantAgentL)) + WantAgent.trigger(wantAgentJ, triggerInfoJ, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerJ success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerJ failed!----'+err.code); + } + }); + WantAgent.trigger(wantAgentK, triggerInfoK, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerK success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerK failed!----'+err.code); + } + }); + WantAgent.trigger(wantAgentL, triggerInfoL, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerI success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerI failed!----'+err.code); + } + }); + } + + /* + * @tc.number: ActsActiveButton_test_0600 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsActiveButton_test_0600', 0, async function (done) { + console.debug("===ActsActiveButton_test_0600===begin===>"); + + var subInfo ={ + onConsume:consumeCallbackF + } + await notify.subscribe(subInfo); + + var agentInfoJ = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var agentInfoK = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var agentInfoL = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.wantAgentTest", + abilityName: "com.example.wantAgentTest.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var wantAgentDataJ = await WantAgent.getWantAgent(agentInfoJ); + var wantAgentDataK = await WantAgent.getWantAgent(agentInfoK); + var wantAgentDataL = await WantAgent.getWantAgent(agentInfoL); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText : { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText: "long_text", + briefText: "long_briefText", + expandedTitle: "long_expandedTitle" + }, + }, + id: 1, + slotType : notify.SlotType.SERVICE_INFORMATION, + actionButtons: [{title:"buttonJ", wantAgent:wantAgentDataJ},{title:"buttonK", wantAgent:wantAgentDataK},{title:"buttonL", wantAgent:wantAgentDataL}] + } + notify.publish(notificationRequest).then(()=>{ + console.info("======ActsActiveButton_test_0600 promise===>"); + }); + setTimeout((async function(){ + notify.unsubscribe(subInfo); + console.info("======ActsActiveButton_test_0600 setTimeout unsubscribe===>"); + done(); + }),300); + }) + function consumeCallbackG(data) { + console.debug("===>consumeCallbackG data : ===>" +JSON.stringify(data)); + var triggerInfoM = { + code:7 + } + var triggerInfoN = { + code:8 + } + var triggerInfoO = { + code:9 + } + // expect(data.request.actionButtons.length).assertEqual(3) + expect(data.request.actionButtons[0].title).assertEqual("buttonM") + expect(data.request.actionButtons[1].title).assertEqual("buttonN") + expect(data.request.actionButtons[2].title).assertEqual("buttonO") + var wantAgentM = data.request.actionButtons[0].wantAgent + var wantAgentN = data.request.actionButtons[1].wantAgent + var wantAgentO = data.request.actionButtons[2].wantAgent + console.debug("===>wantAgentM: ===>" + JSON.stringify(wantAgentM)) + console.debug("===>wantAgentN: ===>" + JSON.stringify(wantAgentN)) + console.debug("===>wantAgentO: ===>" + JSON.stringify(wantAgentO)) + WantAgent.trigger(wantAgentM, triggerInfoM, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerM success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerM failed!----'+err.code); + } + }); + WantAgent.trigger(wantAgentN, triggerInfoN, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerN success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerN failed!----'+err.code); + } + }); + setTimeout((function(){ + WantAgent.trigger(wantAgentO, triggerInfoO, + (err, data) => { + if (err.code == 0) { + console.info('==== triggerO success' + err.code+JSON.stringify(data) ); + } else { + console.info('----triggerO failed!----'+err.code); + } + }); + }),300); + } + + /* + * @tc.number: ActsActiveButton_test_0700 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsActiveButton_test_0700', 0, async function (done) { + console.debug("===ActsActiveButton_test_0700===begin===>"); + + var subInfo ={ + onConsume:consumeCallbackG + } + await notify.subscribe(subInfo); + + var agentInfoM = { + wants: [ + { + bundleName: "com.example.wantAgentTestA", + abilityName: "com.example.wantAgentTestA.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var agentInfoN = { + wants: [ + { + bundleName: "com.example.wantAgentTestB", + abilityName: "com.example.wantAgentTestB.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var agentInfoO = { + wants: [ + { + bundleName: "com.example.wantAgentTestC", + abilityName: "com.example.wantAgentTestC.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var agentInfoP = { + wants: [ + { + bundleName: "com.example.wantAgentTestA", + abilityName: "com.example.wantAgentTestA.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var wantAgentDataM = await WantAgent.getWantAgent(agentInfoM); + var wantAgentDataN = await WantAgent.getWantAgent(agentInfoN); + var wantAgentDataO = await WantAgent.getWantAgent(agentInfoO); + var wantAgentDataP = await WantAgent.getWantAgent(agentInfoP); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText : { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText: "long_text", + briefText: "long_briefText", + expandedTitle: "long_expandedTitle" + }, + }, + id: 1, + slotType : notify.SlotType.SERVICE_INFORMATION, + actionButtons: [{title:"buttonM", wantAgent:wantAgentDataM},{title:"buttonN", wantAgent:wantAgentDataN},{title:"buttonO", wantAgent:wantAgentDataO},{title:"buttonP", wantAgent:wantAgentDataP}] + } + notify.publish(notificationRequest).then(()=>{ + console.info("======ActsActiveButton_test_0700 promise===>"); + }); + setTimeout((async function(){ + notify.unsubscribe(subInfo); + console.info("======ActsActiveButton_test_0700 setTimeout unsubscribe===>"); + done(); + }),300); + }) +}) + diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActsAnsPublishInput.js b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActsAnsPublishInput.js new file mode 100644 index 0000000000000000000000000000000000000000..6624a6aa1867ea05ee70b56a9801e2738ae9811a --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/ActsAnsPublishInput.js @@ -0,0 +1,189 @@ +/* +* Copyright (c) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import notify from '@ohos.notification'; +import { OperationType, WantAgentFlags} from '@ohos.wantagent'; +import wantagent from '@ohos.wantAgent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +var timeout = 300; +describe('ActsAnsPublishInput', function () { + console.info("===========ActsAnsPublishInput start====================>"); + + function onConsumeOne(data) { + console.info("=========Ans_PublishInput_0100 onConsume start==============>"); + console.info("=========Ans_PublishInput_0100 onConsume data:==============>" + JSON.stringify(data)); + var inputKey = data.request.actionButtons[0].userInput.inputKey + console.info("=========Ans_PublishInput_0100 onConsume inputKey================>"+inputKey); + expect(inputKey).assertEqual("inputKey_0100"); + console.info("=========Ans_PublishInput_0100 onConsume end================>"); + } + + /* + * @tc.number: Ans_PublishInput_0100 + * @tc.name: publish(request: NotificationRequest): Promise; + * @tc.desc: Verify that the inputKey information can be received in the received notification. + */ + it('Ans_PublishInput_0100', 0, async function (done) { + console.info("==================Ans_PublishInput_0100 start==================>"); + var subscriber = { + onConsume:onConsumeOne, + } + var agentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.actsanspublishinput", + abilityName: "com.example.actsanspublishinput.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var wantAgentData = await wantagent.getWantAgent(agentInfo); + console.info("===========Ans_PublishInput_0100 getWantAgent promise======>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText : { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText: "long_text", + briefText: "long_briefText", + expandedTitle: "long_expandedTitle" + }, + }, + id: 1, + slotType : notify.SlotType.SERVICE_INFORMATION, + wantAgent: wantAgentData, + actionButtons: [ + { + title:"button1", + wantAgent:wantAgentData, + userInput : { + inputKey: "inputKey_0100", + } + }] + } + await notify.subscribe(subscriber); + console.info("===========Ans_PublishInput_0100 subscribe promise======>"); + await notify.publish(notificationRequest); + console.info("===========Ans_PublishInput_0100 publish promise========>"); + setTimeout((async function(){ + console.info("======Ans_PublishInput_0100 setTimeout==============>"); + notify.unsubscribe(subscriber); + console.info("======Ans_PublishInput_0100 setTimeout unsubscribe==>"); + done(); + }),timeout); + }) + + function onConsumeTwo(data) { + console.info("=========Ans_PublishInput_0200 onConsume start==============>"); + console.info("=========Ans_PublishInput_0200 onConsume data:==============>" + JSON.stringify(data)); + var inputKey = data.request.actionButtons[0].userInput.inputKey + console.info("=========Ans_PublishInput_0200 onConsume inputKey================>"+inputKey); + expect(inputKey).assertEqual(" "); + console.info("=========Ans_PublishInput_0200 onConsume end================>"); + } + + /* + * @tc.number: Ans_PublishInput_0200 + * @tc.name: publish(request: NotificationRequest): Promise; + * @tc.desc: Verify that the inputKey information can be received in the received notification.(inputKey = " ") + */ + it('Ans_PublishInput_0200', 0, async function (done) { + console.info("==================Ans_PublishInput_0200 start==================>"); + var subscriber = { + onConsume:onConsumeTwo, + } + var agentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.actsanspublishinput", + abilityName: "com.example.actsanspublishinput.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITY, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + var wantAgentData = await wantagent.getWantAgent(agentInfo); + console.info("===========Ans_PublishInput_0200 getWantAgent promise======>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText : { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText: "long_text", + briefText: "long_briefText", + expandedTitle: "long_expandedTitle" + }, + }, + id: 2, + slotType : notify.SlotType.SERVICE_INFORMATION, + wantAgent: wantAgentData, + actionButtons: [ + { + title:"button2", + wantAgent:wantAgentData, + userInput : { + inputKey: " ", + } + }] + } + await notify.subscribe(subscriber); + console.info("===========Ans_PublishInput_0200 subscribe promise======>"); + await notify.publish(notificationRequest); + console.info("===========Ans_PublishInput_0200 publish promise========>"); + setTimeout((async function(){ + console.info("======Ans_PublishInput_0200 setTimeout==============>"); + notify.unsubscribe(subscriber); + console.info("======Ans_PublishInput_0200 setTimeout unsubscribe==>"); + done(); + }),timeout); + }) +}) \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..408fe4ba7dddae00d1e65c0ac1aadbf1d437e453 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/List.test.js @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +require('./publishIcon.js') +require('./publishImage.js') +require('./ActsAnsPublishInput.js') +require('./ActiveButton.js') diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishIcon.js b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishIcon.js new file mode 100644 index 0000000000000000000000000000000000000000..fbfa1485276ce38b4333a08e0a8f1c1cbbdcc1e0 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishIcon.js @@ -0,0 +1,319 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import notification from '@ohos.notification' +import image from '@ohos.multimedia.image' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +var ERR_ANS_ICON_OVER_SIZE = 67108882 +var largeIconA +var smallIconA +var largeBufferA +var smallBufferA +var largeOptsA +var smallOptsA + +var largeIconB +var smallIconB +var largeBufferB +var smallBufferB +var largeOptsB +var smallOptsB + +var largeIconC +var smallIconC +var largeBufferC +var smallBufferC +var largeOptsC +var smallOptsC + +var largeIconD +var smallIconD +var largeBufferD +var smallBufferD +var largeOptsD +var smallOptsD + +describe('ActsAnsPublishIconTest', function () { + function publishCallbackA(err){ + console.log('ActsAnsPublishIconTest publishCallbackA asyncCallback'+err.code) + expect(err.code).assertEqual(0) + } + function publishCallbackB(err){ + console.log('ActsAnsPublishIconTest publishCallbackB asyncCallback'+err.code) + expect(err.code).assertEqual(ERR_ANS_ICON_OVER_SIZE) + } + function consumeCallbackA(data) { + console.debug("===consumeCallbackA data : ===>" + JSON.stringify(data)); + expect(data.request.id).assertEqual(1) + } + function consumeCallbackB(data) { + console.debug("===consumeCallbackB data : ===>" + JSON.stringify(data)); + expect(data.request.id).assertEqual(2) + } + + function subscribeCallbackA(err) { + console.info("===subscribeCallbackA err : ===>" + JSON.stringify(err)); + expect(err.code).assertEqual(0) + } + function subscribeCallbackB(err) { + console.info("===subscribeCallbackB err : ===>" + JSON.stringify(err)); + expect(err.code).assertEqual(0) + } + + /* + * @tc.number: ACTS_PublishIconTest_0100 + * @tc.name: publish() + * @tc.desc: verify the function of publish + */ + it('ACTS_PublishIconTest_0100', 0,async function (done) { + var subInfo ={ + onConsume:consumeCallbackA, + } + await notification.subscribe(subInfo,subscribeCallbackA); + largeBufferA = new ArrayBuffer(4*100*100); + smallBufferA = new ArrayBuffer(4*2*25); + largeOptsA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 100, width: 100}} + smallOptsA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}} + const promise_Large = image.createPixelMap(largeBufferA, largeOptsA); + promise_Large.then((data) => { + largeIconA = data; + console.debug("===createPixelMapA largeIcon===>"+JSON.stringify(largeIconA)); + const promise_Small = image.createPixelMap(smallBufferA, smallOptsA); + promise_Small.then((data) => { + smallIconA = data; + console.debug("===createPixelMapA smallIcon===>"+JSON.stringify(smallIconA)); + + notification.publish({ + content:{ + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_titleA", + text: "test_textA", + additionalText: "test_additionalTextA" + }, + }, + id: 1, + slotType : notification.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0100_1", + badgeIconStyle: 1, + showDeliveryTime: true, + smallIcon:smallIconA, + largeIcon:largeIconA, + },publishCallbackA); + setTimeout((async function(){ + notification.unsubscribe(subInfo); + console.info("======ActsPublishImage_test_0100 setTimeout unsubscribe===>"); + done(); + }),300); + }) + }); + }); + + /* + * @tc.number: ACTS_PublishTest_0200 + * @tc.name: publish() + * @tc.desc: verify the function of publish + */ + it('ACTS_PublishIconTest_0200', 0,async function (done) { + var subInfo ={ + onConsume:consumeCallbackB, + } + await notification.subscribe(subInfo,subscribeCallbackB); + largeBufferB = new ArrayBuffer(4*200*50); + smallBufferB = new ArrayBuffer(4*2*25); + largeOptsB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 200}} + smallOptsB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}} + const promise_Large = image.createPixelMap(largeBufferB, largeOptsB); + promise_Large.then((data) => { + largeIconB = data; + console.debug("===createPixelMapB largeIcon===>"+JSON.stringify(largeIconB)); + const promise_Small = image.createPixelMap(smallBufferB, smallOptsB); + promise_Small.then((data) => { + smallIconB = data; + console.debug("===createPixelMapB smallIcon===>"+JSON.stringify(smallIconB)); + + notification.publish({ + content:{ + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_titleB", + text: "test_textB", + additionalText: "test_additionalTextB" + }, + }, + id: 2, + slotType : notification.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0100_1", + badgeIconStyle: 1, + showDeliveryTime: true, + smallIcon:smallIconB, + largeIcon:largeIconB, + }).then(()=>{ + console.debug("===ACTS_PublishIconTest_0200 promise===>"); + }); + setTimeout((async function(){ + notification.unsubscribe(subInfo); + console.info("======ActsPublishImage_test_0200 setTimeout unsubscribe===>"); + done(); + }),300); + }) + }); + }); + + /* + * @tc.number: ACTS_PublishIconTest_0300 + * @tc.name: publish() + * @tc.desc: verify the function of publish + */ + it('ACTS_PublishIconTest_0300', 0,async function (done) { + largeBufferC = new ArrayBuffer(4*1024*50); + smallBufferC = new ArrayBuffer(4*2*25); + largeOptsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 1024}} + smallOptsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}} + const promise_Large = image.createPixelMap(largeBufferC, largeOptsC); + promise_Large.then((data) => { + largeIconC = data; + console.debug("===createPixelMapC largeIcon===>"+JSON.stringify(largeIconC)); + const promise_Small = image.createPixelMap(smallBufferC, smallOptsC); + promise_Small.then((data) => { + smallIconC = data; + console.debug("===createPixelMapC smallIcon===>"+JSON.stringify(smallIconC)); + + notification.publish({ + content:{ + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_titleC", + text: "test_textC", + additionalText: "test_additionalTextC" + }, + }, + id: 3, + slotType : notification.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0100_1", + badgeIconStyle: 1, + showDeliveryTime: true, + smallIcon:smallIconC, + largeIcon:largeIconC, + },publishCallbackB); + done(); + }) + }); + }); + + /* + * @tc.number: ACTS_PublishTest_0400 + * @tc.name: publish() + * @tc.desc: verify the function of publish + */ + it('ACTS_PublishIconTest_0400', 0,async function (done) { + largeBufferD = new ArrayBuffer(4*1024*50); + smallBufferD = new ArrayBuffer(4*2*25); + largeOptsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 1024}} + smallOptsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}} + const promise_Large = image.createPixelMap(largeBufferD, largeOptsD); + promise_Large.then((data) => { + largeIconD = data; + console.debug("===createPixelMapD largeIcon===>"+JSON.stringify(largeIconD)); + const promise_Small = image.createPixelMap(smallBufferD, smallOptsD); + promise_Small.then((data) => { + smallIconD = data; + console.debug("===createPixelMapD smallIcon===>"+JSON.stringify(smallIconD)); + + notification.publish({ + content:{ + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test1_title", + text: "test1_text", + additionalText: "test1_additionalText" + }, + }, + id: 4, + slotType : notification.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0100_1", + badgeIconStyle: 1, + showDeliveryTime: true, + smallIcon:smallIconD, + largeIcon:largeIconD, + }).then().catch((err)=>{ + console.debug("===ACTS_PublishIconTest_0400 promise===>"+err.code); + expect(err.code).assertEqual(ERR_ANS_ICON_OVER_SIZE) + done() + }); + }) + }); + }); +}) \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishImage.js b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishImage.js new file mode 100644 index 0000000000000000000000000000000000000000..26358f3e8e3ed70eb0365b928b02d9ca46d7dc4d --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/activebutton/entry/src/main/js/test/publishImage.js @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import notify from '@ohos.notification' +import image from '@ohos.multimedia.image' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +var BufferA +var BufferB +var BufferC +var BufferD +var optsA +var optsB +var optsC +var optsD +var pubimageA +var pubimageB +var pubimageC +var pubimageD +var ERR_ANS_PICTURE_OVER_SIZE = 67108883 +describe('ActsAnsPublishImageTest', function () { + console.info("===ActsAnsPublishImageTest start===>"); + + //consume + function consumeCallbackA(data) { + console.debug("===>consumeDoNotCallback1 data : ===>" + JSON.stringify(data)); + expect(data.request.id).assertEqual(1) + } + function consumeCallbackB(data) { + console.debug("===>consumeDoNotCallback2 data : ===>" +JSON.stringify(data)); + expect(data.request.id).assertEqual(2) + } + //subscribe + function subscribeCallbackA(err) { + console.debug("===>subscribeCallbackA===>"+err.code); + expect(err.code).assertEqual(0) + } + function subscribeCallbackB(err) { + console.debug("===>subscribeCallbackB===>"+err.code); + expect(err.code).assertEqual(0) + } + function publishCallbackA(err){ + console.log('ActsAnsPublishImageTest publishCallbackA asyncCallback'+err.code) + expect(err.code).assertEqual(0) + } + function publishCallbackB(err){ + console.log('ActsAnsPublishImageTest publishCallbackB asyncCallback'+err.code) + expect(err.code).assertEqual(ERR_ANS_PICTURE_OVER_SIZE) + } + + /* + * @tc.number: ActsPublishImage_test_0100 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsPublishImage_test_0100', 0, async function (done) { + console.debug("===ActsDoNotSubscriber_test_0100===begin===>"); + + var subInfo ={ + onConsume:consumeCallbackA, + } + await notify.subscribe(subInfo, subscribeCallbackA); + + BufferA = new ArrayBuffer(32); + optsA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}} + + const promise_Large = image.createPixelMap(BufferA, optsA); + promise_Large.then((data) => { + pubimageA = data; + console.debug("===createPixelMapA image===>"+pubimageA); + + notify.publish({ + id: 1, + content: { + contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE, + picture: { + title: "image_titleA", + text: "image_textA", + additionalText: "image_additionalTextA", + briefText:"image_briefA", + expandedTitle:"expandedTitleA", + picture:pubimageA + }, + }, + slotType:notify.SlotType.SOCIAL_COMMUNICATION, + classification:"classificationA", + sortingKey:"sortingKeyA", + },publishCallbackA); + setTimeout((async function(){ + notify.unsubscribe(subInfo); + console.info("======ActsPublishImage_test_0100 setTimeout unsubscribe===>"); + done(); + }),300); + }) + }) + + /* + * @tc.number: ActsPublishImage_test_0200 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsPublishImage_test_0200', 0, async function (done) { + console.debug("===ActsPublishImage_test_0200===begin===>"); + + var subInfo ={ + onConsume:consumeCallbackB, + } + await notify.subscribe(subInfo, subscribeCallbackB); + + BufferB = new ArrayBuffer(32); + optsB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}} + + const promise_Large = image.createPixelMap(BufferB, optsB); + promise_Large.then((data) => { + pubimageB = data; + console.debug("===createPixelMapB image===>"+pubimageB); + + notify.publish({ + id: 2, + content: { + contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE, + picture: { + title: "image_titleB", + text: "image_textB", + additionalText: "image_additionalTextB", + briefText:"image_briefB", + expandedTitle:"expandedTitleB", + picture:pubimageB + }, + }, + slotType:notify.SlotType.SOCIAL_COMMUNICATION, + classification:"classificationB", + sortingKey:"sortingKeyB", + }).then(()=> { + console.debug("===ActsPublishImage_test_0200 promise===>") + }) + setTimeout((async function(){ + notify.unsubscribe(subInfo); + console.info("===ActsPublishImage_test_0200 setTimeout unsubscribe===>"); + done(); + }),300); + }) + }) + + /* + * @tc.number: ActsPublishImage_test_0300 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsPublishImage_test_0300', 0, async function (done) { + console.debug("===ActsPublishImage_test_0300===begin===>"); + BufferC = new ArrayBuffer( 4*1024* 2048); + optsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 1024, width: 2048}} + + const promise_Large = image.createPixelMap(BufferC, optsC); + promise_Large.then((data) => { + pubimageC = data; + console.debug("====createPixelMapC image===>"+pubimageC); + + notify.publish({ + id: 3, + content: { + contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE, + picture: { + title: "image_titleC", + text: "image_textC", + additionalText: "image_additionalTextC", + briefText:"image_briefC", + expandedTitle:"expandedTitleC", + picture:pubimageC + }, + }, + slotType:notify.SlotType.SOCIAL_COMMUNICATION, + classification:"classificationC", + sortingKey:"sortingKeyC", + },publishCallbackB); + done(); + }) + }) + + /* + * @tc.number: ActsPublishImage_test_0400 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsPublishImage_test_0400', 0, async function (done) { + console.debug("===ActsPublishImage_test_0400===begin===>"); + BufferD = new ArrayBuffer( 4*1024* 2048); + optsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 1024, width: 2048}} + + const promise_Large = image.createPixelMap(BufferD, optsD); + promise_Large.then((data) => { + pubimageD = data; + console.debug("===createPixelMapD image===>"+pubimageD); + + notify.publish({ + id: 4, + content: { + contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE, + picture: { + title: "image_titleD", + text: "image_textD", + additionalText: "image_additionalTextD", + briefText:"image_briefD", + expandedTitle:"expandedTitleD", + picture:pubimageD + }, + }, + slotType:notify.SlotType.SOCIAL_COMMUNICATION, + classification:"classificationD", + sortingKey:"sortingKeyD", + }).then().catch((err)=>{ + console.debug("===ActsPublishImage_test_0400 err===>"+err.code); + expect(err.code).assertEqual(ERR_ANS_PICTURE_OVER_SIZE) + done(); + }); + }) + }) + }) + + diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/activebtn/activebutton/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/notification/ans_standard/publish_test/activebtn/activebutton/signature/openharmony_sx.p7b differ diff --git a/notification/ans_standard/publish_test/activebtn/testa/BUILD.gn b/notification/ans_standard/publish_test/activebtn/testa/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c42394c1682bc5376933d2912d956d2ea97296c1 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("testA") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "testA" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/notification/ans_standard/publish_test/activebtn/testa/Test.json b/notification/ans_standard/publish_test/activebtn/testa/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fd2b84059ded89eccdaa96c479873e0c1bc5d090 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/config.json b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..e085db83fa4bc384a5d67ef171b04377a7550a3a --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/config.json @@ -0,0 +1,62 @@ +{ + "app": { + "bundleName": "com.example.wantAgentTestA", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.wantAgentTestA", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.wantAgentTestA.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..2a68c1992145a976957d7dcdd69a7e9c2e8e9877 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..847c4e55edc6537e2b0450e5fd35de9c5444c399 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + 页面1 + +
diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..564fb917e86558511fcd08d438b143c939f8ef70 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f65b394eb7a98a4058d726bacda53fe1221d909d --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "test1" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/media/icon.png differ diff --git a/notification/ans_standard/publish_test/activebtn/testa/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/activebtn/testa/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/notification/ans_standard/publish_test/activebtn/testa/signature/openharmony_sx.p7b differ diff --git a/notification/ans_standard/publish_test/activebtn/testb/BUILD.gn b/notification/ans_standard/publish_test/activebtn/testb/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cc2bd6dd43d5e691a243612e4dd493e90443b715 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("testB") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "testB" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/notification/ans_standard/publish_test/activebtn/testb/Test.json b/notification/ans_standard/publish_test/activebtn/testb/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fd2b84059ded89eccdaa96c479873e0c1bc5d090 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/config.json b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..ecf73a802f24aa1f32d9c6df49cdad39d3ea16d6 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/config.json @@ -0,0 +1,62 @@ +{ + "app": { + "bundleName": "com.example.wantAgentTestB", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.wantAgentTestB", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.wantAgentTestB.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..2a68c1992145a976957d7dcdd69a7e9c2e8e9877 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..34797615b4d19479ee6a4e8e4255bf2d4fab5172 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + 页面2 + +
diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..564fb917e86558511fcd08d438b143c939f8ef70 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ef239e584f5a0fbfa932d1ec4897291ba92b9765 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "test2" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/media/icon.png differ diff --git a/notification/ans_standard/publish_test/activebtn/testb/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/activebtn/testb/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/notification/ans_standard/publish_test/activebtn/testb/signature/openharmony_sx.p7b differ diff --git a/notification/ans_standard/publish_test/activebtn/testc/BUILD.gn b/notification/ans_standard/publish_test/activebtn/testc/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..1d4243ec909866168221b70f4f987e6d4ccdf84b --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("testC") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "testC" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/notification/ans_standard/publish_test/activebtn/testc/Test.json b/notification/ans_standard/publish_test/activebtn/testc/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fd2b84059ded89eccdaa96c479873e0c1bc5d090 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/config.json b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b7c6812d9aa226b8738d5273be5c2c03bee76ea8 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/config.json @@ -0,0 +1,62 @@ +{ + "app": { + "bundleName": "com.example.wantAgentTestC", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.wantAgentTestC", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.wantAgentTestC.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..2a68c1992145a976957d7dcdd69a7e9c2e8e9877 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..9cedb686ab3ea2e35688bb63ac4e1fc49f433a20 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + 页面3 + +
diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..564fb917e86558511fcd08d438b143c939f8ef70 --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import file from '@system.file' +import {Core, ExpectExtend} from 'deccjsunit/index' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b3bd2eb154f549353d38d9d76af8d80bfccc14cb --- /dev/null +++ b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "test3" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/media/icon.png differ diff --git a/notification/ans_standard/publish_test/activebtn/testc/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/activebtn/testc/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/notification/ans_standard/publish_test/activebtn/testc/signature/openharmony_sx.p7b differ diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/entry/.gitignore b/notification/ans_standard/publish_test/ansactscancelgroup/entry/.gitignore deleted file mode 100644 index 3543521e9fef8e7322940a87c2b45dd0061b0f45..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/entry/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/Test.json b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/Test.json index 917c8457fa0150add1cc775595d0a0b15869fd05..1756887fc05d4a6a80b94caa48f9c2fda69d2a82 100644 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/Test.json +++ b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/Test.json @@ -9,7 +9,8 @@ "kits": [ { "test-file-name": [ - "ActsAnsBadgeDisplayTest.hap" + "ActsAnsBadgeDisplayTest.hap", + "localcandisplay.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/test/WantAgent.test.js index f9498c45fc2e80f46bd647aa2ef184e15219bcb2..f4fcb02c5e07b7942faa1f2063839eba8d2d6189 100644 --- a/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/getwantagentinfo/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var WantAgenta; @@ -55,7 +55,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } wantAgent.getWantAgent(agentInfoa, (err, data) => { @@ -135,7 +135,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } wantAgent.getWantAgent(agentInfod).then( (data) => { @@ -198,7 +198,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } wantAgent.getWantAgent(agentInfob,(err,data)=>{ WantAgentb = data @@ -227,7 +227,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } wantAgent.getWantAgent(agentInfoc, (err, data) => { @@ -302,7 +302,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } wantAgent.getWantAgent(agentInfoe,(err,data)=>{ console.log("=======agentInfoe======="+err.code+JSON.stringify(data)) @@ -332,7 +332,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } wantAgent.getWantAgent(agentInfof, (err, data) => { @@ -394,7 +394,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } wantAgent.getWantAgent(agentInfoe,(err,data)=>{ WantAgentd = data @@ -423,7 +423,7 @@ describe('ActsAnsGetWantAgentInfoTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } wantAgent.getWantAgent(agentInfof, (err, data) => { diff --git a/notification/ans_standard/publish_test/publishsound/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/publishsound/entry/src/main/js/test/ExampleJsunit.test.js index fe31588189eadfb4ef3f00a2c16a93fc77b2a411..b2d7eba9755990a733bff257c03f87c3d4761016 100644 --- a/notification/ans_standard/publish_test/publishsound/entry/src/main/js/test/ExampleJsunit.test.js +++ b/notification/ans_standard/publish_test/publishsound/entry/src/main/js/test/ExampleJsunit.test.js @@ -17,7 +17,7 @@ import notify from '@ohos.notification' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('ActsAnsPublishSoundTest', function () { console.info("===========ActsAnsPublishSoundTest start====================>"); - var timeout = 300 + var timeout = 1000 var bundleoption = { bundle: "com.example.actsanspublishsoundtest" } @@ -1021,4 +1021,4 @@ describe('ActsAnsPublishSoundTest', function () { done(); }),timeout); }); -}) \ No newline at end of file +}) diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent1/entry/src/main/js/test/WantAgent.test.js index 0b6586602a3e2e407d82681c1e31254a441f09e3..bf3d49d39a97eb99cbce710f90295d4f9d0bb4cd 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent1/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -32,8 +32,8 @@ describe('ActsAnsWantAgentOneTest', function () { wants: [ { deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -52,7 +52,7 @@ describe('ActsAnsWantAgentOneTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); await wantAgent.getWantAgent(agentInfo, @@ -73,8 +73,8 @@ describe('ActsAnsWantAgentOneTest', function () { expect(data.finalCode).assertEqual(0); expect(data.finalData).assertEqual(""); expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.neu.WantAgentTest1"); - expect(data.want.abilityName).assertEqual("com.example.test.MainAbility"); + expect(data.want.bundleName).assertEqual("com.example.WantAgentTest1"); + expect(data.want.abilityName).assertEqual("com.example.WantAgentTest1.MainAbility"); expect(data.want.uri).assertEqual("key={true,true,false}"); expect(JSON.stringify(data.want.entities)).assertEqual(JSON.stringify(["entity1"])); expect(data.want.action).assertEqual("action1"); @@ -112,7 +112,7 @@ describe('ActsAnsWantAgentOneTest', function () { wants: [ { deviceId: "", - bundleName: "com.neu.WantAgentTest1", + bundleName: "com.example.WantAgentTest1", abilityName: "com.example.test.MainAbility", action: "action1", entities: ["entity1"], @@ -132,7 +132,7 @@ describe('ActsAnsWantAgentOneTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.ONE_TIME_FLAG] + wantAgentFlags:[WantAgentFlags.ONE_TIME_FLAG] } console.info('----getWantAgent before----'); await wantAgent.getWantAgent(agentInfo, @@ -165,7 +165,7 @@ describe('ActsAnsWantAgentOneTest', function () { wants: [ { deviceId: "", - bundleName: "com.neu.WantAgentTest1", + bundleName: "com.example.WantAgentTest1", abilityName: "com.example.test.MainAbility", action: "action1", entities: ["entity1"], @@ -185,7 +185,7 @@ describe('ActsAnsWantAgentOneTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.NO_BUILD_FLAG] + wantAgentFlags:[WantAgentFlags.NO_BUILD_FLAG] } console.info('----getWantAgent before----'); await wantAgent.getWantAgent(agentInfo, @@ -218,7 +218,7 @@ describe('ActsAnsWantAgentOneTest', function () { wants: [ { deviceId: "", - bundleName: "com.neu.WantAgentTest1", + bundleName: "com.example.WantAgentTest1", abilityName: "com.example.test.MainAbility", action: "action1", entities: ["entity1"], @@ -238,7 +238,7 @@ describe('ActsAnsWantAgentOneTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.CANCEL_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.CANCEL_PRESENT_FLAG] } console.info('----getWantAgent before----'); await wantAgent.getWantAgent(agentInfo, @@ -271,7 +271,7 @@ describe('ActsAnsWantAgentOneTest', function () { wants: [ { deviceId: "", - bundleName: "com.neu.WantAgentTest1", + bundleName: "com.example.WantAgentTest1", abilityName: "com.example.test.MainAbility", action: "action1", entities: ["entity1"], @@ -291,7 +291,7 @@ describe('ActsAnsWantAgentOneTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.CONSTANT_FLAG] + wantAgentFlags:[WantAgentFlags.CONSTANT_FLAG] } console.info('----getWantAgent before----'); await wantAgent.getWantAgent(agentInfo, diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent1promise/entry/src/main/js/test/WantAgent.test.js index 1fca21ac017a2e1f6eadde6884c1bf43bd5aa9b7..e29ac3c2f3cbd896dfd4046809ab0673b4b161f0 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent1promise/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -22,7 +22,7 @@ describe('ActsAnsWantAgentOneProTest', function () { console.info('----ActsWantAgentTest----'); /* - * @tc.number: ACTS_SetWant_0100 + * @tc.number: ACTS_SetWant_0200 * @tc.name: getWantAgent(OperationType.START_ABILITY) * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY) */ @@ -30,9 +30,8 @@ describe('ActsAnsWantAgentOneProTest', function () { var agentInfo = { wants: [ { - deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -51,7 +50,7 @@ describe('ActsAnsWantAgentOneProTest', function () { ], operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); wantAgent.getWantAgent(agentInfo).then( diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent2/entry/src/main/js/test/WantAgent.test.js index e94112b9a27f447a00aa2162b4b24cc4a69cdd6b..8018d2dff7bee99fecfdeddfc79c64e5fdcf385c 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent2/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -29,9 +29,8 @@ describe('ActsAnsWantAgentTwoTest', function () { var agentInfo = { wants: [ { - deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -48,9 +47,8 @@ describe('ActsAnsWantAgentTwoTest', function () { } }, { - deviceId: "", - bundleName: "com.neu.WantAgenTest2", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgenTest2", + abilityName: "com.example.WantAgenTest2.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -69,7 +67,7 @@ describe('ActsAnsWantAgentTwoTest', function () { ], operationType: OperationType.START_ABILITIES, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); wantAgent.getWantAgent(agentInfo, diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent2promise/entry/src/main/js/test/WantAgent.test.js index 2bf5e10da8fb2cf754756a4f27fcc871f7a77b4f..187ae8454dc1f13cf94b85ca3a3c26293ca717fa 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent2promise/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -29,9 +29,8 @@ describe('ActsAnsWantAgentTwoProTest', function () { var agentInfo = { wants: [ { - deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -48,9 +47,8 @@ describe('ActsAnsWantAgentTwoProTest', function () { } }, { - deviceId: "", - bundleName: "com.neu.WantAgenTest2", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgenTest2", + abilityName: "com.example.WantAgenTest2.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -69,7 +67,7 @@ describe('ActsAnsWantAgentTwoProTest', function () { ], operationType: OperationType.START_ABILITIES, requestCode: 0, -// wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); wantAgent.getWantAgent(agentInfo).then( diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent3/entry/src/main/js/test/WantAgent.test.js index b79054bfa22a41f6edbcbc367e874b2094175752..379f7386c4b061fcd61947ecbae516aff493e65f 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent3/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -29,9 +29,8 @@ describe('ActsAnsWantAgentTreeTest', function () { var agentInfo = { wants: [ { - deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -50,7 +49,7 @@ describe('ActsAnsWantAgentTreeTest', function () { ], operationType: OperationType.SEND_COMMON_EVENT, requestCode: 0, -// wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); wantAgent.getWantAgent(agentInfo, diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent3promise/entry/src/main/js/test/WantAgent.test.js index 8e1dfbcc649bcf8b214383de5259d073a4330288..6f5ac1ad1ce1d38a3cfac2aca114aad99c321489 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent3promise/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -29,9 +29,8 @@ describe('ActsAnsWantAgentTreeProTest', function () { var agentInfo = { wants: [ { - deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -50,7 +49,7 @@ describe('ActsAnsWantAgentTreeProTest', function () { ], operationType: OperationType.SEND_COMMON_EVENT, requestCode: 0, -// wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); wantAgent.getWantAgent(agentInfo).then( diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent4/entry/src/main/js/test/WantAgent.test.js index 78cd0caf35263b0be34fea0013b7ed376f07ade5..70592d3026b4802d3bf682d33269f442bfa15bf8 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent4/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -30,8 +30,8 @@ describe('ActsAnsWantAgentFourTest', function () { wants: [ { deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -50,7 +50,7 @@ describe('ActsAnsWantAgentFourTest', function () { ], operationType: OperationType.UNKNOWN_TYPE, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); wantAgent.getWantAgent(agentInfo, diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent4promise/entry/src/main/js/test/WantAgent.test.js index a7ce02d0af1e117a40ad301e253f78a39428a4d1..28241ea30f97342d332b8320f8c6df2bf7180625 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent4promise/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -29,9 +29,8 @@ describe('ActsAnsWantAgentFourProTest', function () { var agentInfo = { wants: [ { - deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -50,7 +49,7 @@ describe('ActsAnsWantAgentFourProTest', function () { ], operationType: OperationType.UNKNOWN_TYPE, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); wantAgent.getWantAgent(agentInfo).then( diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5/entry/src/main/js/test/WantAgent.test.js index eb801bc7b9e048e8cd46fff09820c77530758554..34c0d715208263032d5a2998b60009e62c446514 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent5/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -29,9 +29,8 @@ describe('ActsAnsWantAgentFiveTest', function () { var agentInfo = { wants: [ { - deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -50,7 +49,7 @@ describe('ActsAnsWantAgentFiveTest', function () { ], // operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); wantAgent.getWantAgent(agentInfo, diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/entry/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/entry/src/main/js/test/WantAgent.test.js index c976e862b2f2bf8ec33e9cf6110dc7c49984af6e..2e86203324b3aeb1aa5480fe88e5384d0d438d9b 100644 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/entry/src/main/js/test/WantAgent.test.js +++ b/notification/ans_standard/publish_test/wantagent/wantagent5promise/entry/src/main/js/test/WantAgent.test.js @@ -14,7 +14,7 @@ */ import wantAgent from '@ohos.wantAgent'; -import { OperationType, Flags } from '@ohos.wantagent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; var time = 1000 var WantAgent; @@ -29,9 +29,8 @@ describe('ActsAnsWantAgentFiveProTest', function () { var agentInfo = { wants: [ { - deviceId: "", - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", + bundleName: "com.example.WantAgentTest1", + abilityName: "com.example.WantAgentTest1.MainAbility", action: "action1", entities: ["entity1"], type: "MIMETYPE", @@ -50,7 +49,7 @@ describe('ActsAnsWantAgentFiveProTest', function () { ], // operationType: OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG] + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] } console.info('----getWantAgent before----'); wantAgent.getWantAgent(agentInfo).then(