diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js index 454144df4dd28976dc1b8705d17bb8e1839af0df..e7dd915a383d1e6656721d98b1efe61c627140b3 100644 --- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -381,6 +381,7 @@ describe('ActsAmsTestFourthScene', function () { * @tc.desc : Get All Active Processes Info(by Promise) */ it('Acts_Ams_test_8400', 0, async function (done) { + sleep(5000); var info = await abilitymanager.getActiveProcessInfos(); console.info('Acts_Ams_test_8400 getActiveProcessInfos JSON String: ' + JSON.stringify(info)); expect(Array.isArray(info)).assertEqual(true); diff --git a/appexecfwk/bundle_standard/bundlemanager/BUILD.gn b/appexecfwk/bundle_standard/bundlemanager/BUILD.gn index 150b040c3488b397ef62b26c3304973714a84304..15d3decd300e1a7222b62f465d3379af1c228b3f 100755 --- a/appexecfwk/bundle_standard/bundlemanager/BUILD.gn +++ b/appexecfwk/bundle_standard/bundlemanager/BUILD.gn @@ -21,13 +21,16 @@ group("bundlemanager") { "actsbmscheckpermissiontest:ActsBmsCheckPermissionTest", "actsbmshapmoduletest:ActsBmsHapModuleTest", "actsbmsjstest:ActsBmsJsTest", + "actsbmskittest:ActsBmsKitTest", "actsbmsmetadatatest:ActsBmsMetaDataTest", "actsbmsmoduleusagerecordtest:ActsBmsModuleUsageRecordTest", "actsbundlemanagertest:ActsBundleManagerTest", "actsbundlemanageruninstall:ActsBundleManagerUninstall", + "bmscheckpermissiontest:BmsCheckPermissionTest", "sceneProject/bmsgetinfosfifthscene:bmsThirdBundleTest5", "sceneProject/bmsgetinfosfirstscene:bmsThirdBundleTest1", "sceneProject/bmsgetinfosfirstsceneupdate:bmsThirdBundleTestA1", + "sceneProject/bmsgetinfoshapc:bmsThirdBundleC", "sceneProject/bmsgetinfosfourthscene:bmsThirdBundleTest4", "sceneProject/bmsgetinfosjsscene:bmsThirdBundleJs", "sceneProject/bmsgetinfosscenesystem:bmsSystemBundleTest1", diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsallshortcutinfotest/entry/src/main/js/test/ActsBmsAllShortcutInfoTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsallshortcutinfotest/entry/src/main/js/test/ActsBmsAllShortcutInfoTest.test.js index 2648fb69d9c391892269401c2f220367bb34b482..362daa6493c12a1b9ac83320ea2f42fa9f061712 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsallshortcutinfotest/entry/src/main/js/test/ActsBmsAllShortcutInfoTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsallshortcutinfotest/entry/src/main/js/test/ActsBmsAllShortcutInfoTest.test.js @@ -31,11 +31,39 @@ describe('ActsBmsAllShortcutInfoTest', function () { var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']; await install(bundlePath); var bundleName = 'com.example.third1'; - bundle.getAllShortcutInfo(bundleName).then((data) => { + bundle.getAllShortcutInfo(bundleName).then(async(data) => { + for (var i = 0; i < data.length; i++) { + expect(data[i].id).assertEqual('id.third1'); + console.info('==========data[i].id==========' + data[i].id) + expect(data[i].bundleName).assertEqual('com.example.third1'); + console.info('==========data[i].bundleName==========' + data[i].bundleName) + expect(data[i].hostAbility).assertEqual(""); + console.info('==========data[i].hostAbility==========' + data[i].hostAbility) + expect(data[i].icon).assertEqual('$media:icon'); + console.info('==========data[i].icon==========' + data[i].icon) + expect(data[i].label).assertEqual('$string:app_name'); + console.info('==========data[i].label==========' + data[i].label) + expect(data[i].disableMessage).assertEqual(""); + console.info('==========data[i].disableMessage==========' + data[i].disableMessage) + expect(data[i].isStatic).assertEqual(false); + console.info('==========data[i].isStatic==========' + data[i].isStatic) + expect(data[i].isHomeShortcut).assertEqual(false); + console.info('==========data[i].isHomeShortcut==========' + data[i].isHomeShortcut) + expect(data[i].isEnabled).assertEqual(false); + console.info('==========data[i].isEnabled==========' + data[i].isEnabled) + for (var j = 0; j < data[i].wants.length; j++) { + console.info('==========data[i].wants[j].targetClass==========' + data[i].wants[j].targetClass) + expect(data[i].wants[j].targetClass).assertEqual('com.example.third1.MainAbility'); + console.info('==========data[i].wants[j].targetBundle==========' + data[i].wants[j].targetBundle) + expect(data[i].wants[j].targetBundle).assertEqual('com.example.third1'); + } + } expect(typeof data).assertEqual('object'); expect(data.length).assertEqual(1); checkShortcutIsExist(data, 'id.third1', 'third1'); + await uninstall('com.example.third1'); done(); + }); setTimeout(function () { console.info('=====================bms_getAllShortcutInfo_0100==================end'); @@ -49,11 +77,14 @@ describe('ActsBmsAllShortcutInfoTest', function () { */ it('bms_getAllShortcutInfo_0200', 0, async function (done) { console.info('=====================bms_getAllShortcutInfo_0200=================='); + var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']; + await install(bundlePath); var bundleName = 'com.example.third1'; - bundle.getAllShortcutInfo(bundleName, (result, data) => { + bundle.getAllShortcutInfo(bundleName, async(result, data) => { expect(result.code).assertEqual(0); expect(data.length).assertEqual(1); checkShortcutIsExist(data, 'id.third1', 'third1'); + await uninstall('com.example.third1'); done(); }); setTimeout(function () { @@ -70,13 +101,14 @@ describe('ActsBmsAllShortcutInfoTest', function () { it('bms_getAllShortcutInfo_0300', 0, async function (done) { console.info('=====================bms_getAllShortcutInfo_0300=================='); var bundleName = 'com.example.third1'; - var bundlePath = ['/data/test/bmsThirdBundleTest3.hap']; + var bundlePath = ['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap']; await install(bundlePath); var data = await bundle.getAllShortcutInfo(bundleName); expect(typeof data).assertEqual('object'); expect(data.length).assertEqual(2); checkShortcutIsExist(data, 'id.third1', 'third1'); checkShortcutIsExist(data, 'id.third3', 'third3'); + await uninstall('com.example.third1'); done(); setTimeout(function () { console.info('=====================bms_getAllShortcutInfo_0300==================end'); @@ -90,13 +122,15 @@ describe('ActsBmsAllShortcutInfoTest', function () { */ it('bms_getAllShortcutInfo_0400', 0, async function (done) { console.info('=====================bms_getAllShortcutInfo_0400=================='); + var bundlePath = ['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap']; + await install(bundlePath); var bundleName = 'com.example.third1'; bundle.getAllShortcutInfo(bundleName, async (result, data) => { expect(result.code).assertEqual(0); expect(data.length).assertEqual(2); checkShortcutIsExist(data, 'id.third1', 'third1'); checkShortcutIsExist(data, 'id.third3', 'third3'); - await uninstall(bundleName); + await uninstall('com.example.third1'); done(); }); setTimeout(function () { @@ -172,6 +206,7 @@ describe('ActsBmsAllShortcutInfoTest', function () { } } } + await uninstall('com.example.third1') done(); setTimeout(function () { console.info('=====================bms_getAllShortcutInfo_0700==================end'); @@ -186,6 +221,10 @@ describe('ActsBmsAllShortcutInfoTest', function () { it('bms_getAllShortcutInfo_0800', 0, async function (done) { console.info('=====================bms_getAllShortcutInfo_0800=================='); var bundleName = 'com.example.third1'; + var bundlePath1 = ['/data/test/bmsThirdBundleTest1.hap']; + await install(bundlePath1); + var bundlePath2 = ['/data/test/bmsThirdBundleTestA1.hap']; + await install(bundlePath2); bundle.getAllShortcutInfo(bundleName, async (result, data) => { expect(result.code).assertEqual(0); expect(data.length).assertEqual(1); @@ -206,7 +245,7 @@ describe('ActsBmsAllShortcutInfoTest', function () { } } } - await uninstall(bundleName); + await uninstall('com.example.third1'); done(); }); setTimeout(function () { @@ -227,6 +266,7 @@ describe('ActsBmsAllShortcutInfoTest', function () { var data = await bundle.getAllShortcutInfo(bundleName); expect(typeof data).assertEqual('object'); expect(data.length).assertEqual(0); + await uninstall('com.example.third2') done(); setTimeout(function () { console.info('=====================bms_getAllShortcutInfo_0900==================end'); @@ -241,10 +281,12 @@ describe('ActsBmsAllShortcutInfoTest', function () { it('bms_getAllShortcutInfo_1000', 0, async function (done) { console.info('=====================bms_getAllShortcutInfo_1000=================='); var bundleName = 'com.example.third2'; + var bundlePath = ['/data/test/bmsThirdBundleTest2.hap']; + await install(bundlePath); bundle.getAllShortcutInfo(bundleName, async (result, data) => { expect(result.code).assertEqual(0); expect(data.length).assertEqual(0); - await uninstall(bundleName); + await uninstall('com.example.third2'); done(); }); setTimeout(function () { @@ -342,7 +384,7 @@ describe('ActsBmsAllShortcutInfoTest', function () { expect(typeof data).assertEqual('object'); expect(data.length).assertEqual(1); checkShortcutIsExist(data, 'id.third1', 'third1'); - await uninstall(bundleName); + await uninstall('com.example.third1'); var info = await bundle.getAllShortcutInfo(bundleName); expect(info.length).assertEqual(0); done(); @@ -357,9 +399,16 @@ describe('ActsBmsAllShortcutInfoTest', function () { * @tc.desc: get the shortcut information of this hap after uninstalling the hap */ it('bms_getAllShortcutInfo_1600', 0, async function (done) { - console.info('=====================bms_getAllShortcutInfo_1600==================');; + console.info('=====================bms_getAllShortcutInfo_1600=================='); + var bundlePath = ['/data/test/bmsThirdBundleTest1.hap']; + await install(bundlePath); var bundleName = 'com.example.third1'; - bundle.getAllShortcutInfo(bundleName, (result, data) => { + var data = await bundle.getAllShortcutInfo(bundleName); + expect(typeof data).assertEqual('object'); + expect(data.length).assertEqual(1); + checkShortcutIsExist(data, 'id.third1', 'third1'); + await uninstall('com.example.third1'); + bundle.getAllShortcutInfo(bundleName, async(result, data) => { expect(result.code).assertEqual(-1); expect(data.length).assertEqual(0); done(); @@ -384,6 +433,7 @@ describe('ActsBmsAllShortcutInfoTest', function () { expect(data.length).assertEqual(2); checkShortcutIsExist(data, 'id.third4A', 'third4A'); checkShortcutIsExist(data, 'id.third4B', 'third4B'); + await uninstall('com.example.third4') done(); setTimeout(function () { console.info('=====================bms_getAllShortcutInfo_1700==================end'); @@ -398,12 +448,14 @@ describe('ActsBmsAllShortcutInfoTest', function () { it('bms_getAllShortcutInfo_1800', 0, async function (done) { console.info('=====================bms_getAllShortcutInfo_1800=================='); var bundleName = 'com.example.third4'; + var bundlePath = ['/data/test/bmsThirdBundleTest4.hap']; + await install(bundlePath); bundle.getAllShortcutInfo(bundleName, async (result, data) => { expect(result.code).assertEqual(0); expect(data.length).assertEqual(2); checkShortcutIsExist(data, 'id.third4A', 'third4A'); checkShortcutIsExist(data, 'id.third4B', 'third4B'); - await uninstall(bundleName); + await uninstall('com.example.third4'); done(); }); setTimeout(function () { diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/Test.json b/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/Test.json index eddc706a3745bb94c92216fa04df2d61a4b02e71..3923774e0c05dc7a5514f0ca6bfc2a6549432ac0 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/Test.json +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/Test.json @@ -9,6 +9,7 @@ "kits": [ { "test-file-name": [ + "bmsThirdBundleTest1", "ActsBmsCheckPermissionTest.hap" ], "type": "AppInstallKit", diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/entry/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/entry/src/main/config.json index 98d7fe050fa56acfd528e3458aae37d9687cf8ca..df446b08dbba104af195be12e1880b3ad1c112bd 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/entry/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/entry/src/main/config.json @@ -57,7 +57,6 @@ } } ], - "defPermissions": [ { "name": "com.permission.CAMERA", @@ -90,6 +89,16 @@ ], "when": "always" } + }, + { + "name": "com.permission.PERMISSION_B", + "reason": "Need PERMISSION_B", + "usedScene": { + "ability": [ + "com.example.actsbmscheckpermissiontest.MainAbility" + ], + "when": "always" + } } ] } diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/entry/src/main/js/test/ActsBmsCheckPermissionTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/entry/src/main/js/test/ActsBmsCheckPermissionTest.test.js index a6107f3e07fbc500a50fe788c6469e070470ffb7..84d28abd669322c47c64213e0a32144a99c84c35 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/entry/src/main/js/test/ActsBmsCheckPermissionTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmscheckpermissiontest/entry/src/main/js/test/ActsBmsCheckPermissionTest.test.js @@ -17,8 +17,8 @@ import bundle from '@ohos.bundle' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' const BUNDLE_NAME = 'com.example.actsbmscheckpermissiontest'; -const PERMISSION_ONE = 'com.permission.CAMERA'; -const PERMISSION_TWO = 'com.permission.PERMISSION_A'; +const PERMISSION_ONE = 'com.permission.PERMISSION_A'; +const PERMISSION_TWO = 'com.permission.PERMISSION_B'; const TIMEOUT = 1000; const NAMECOUNT = 10000; @@ -31,7 +31,7 @@ describe('ActsBmsCheckPermissionTest', function () { */ it('bms_checkPermission_0100', 0, async function (done) { console.info('=====================bms_checkPermission_0100=================='); - var data = await bundle.checkPermission(BUNDLE_NAME, PERMISSION_TWO) + var data = await bundle.checkPermission(BUNDLE_NAME, PERMISSION_ONE) expect(data).assertEqual(0); done(); setTimeout(function () { @@ -46,7 +46,7 @@ describe('ActsBmsCheckPermissionTest', function () { */ it('bms_checkPermission_0200', 0, async function (done) { console.info('=====================bms_checkPermission_0200=================='); - await bundle.checkPermission(BUNDLE_NAME, PERMISSION_TWO, (err, data) => { + await bundle.checkPermission(BUNDLE_NAME, PERMISSION_ONE, (err, data) => { expect(err.code).assertEqual(0); expect(data).assertEqual(0); done(); @@ -275,4 +275,38 @@ describe('ActsBmsCheckPermissionTest', function () { console.info('=====================bms_checkPermission_1400==================end'); }, TIMEOUT) }) + + /* + * @tc.number: bms_checkPermission_1500 + * @tc.name: check whether the permission is granted + * @tc.desc: Verify that permissions which availableScope is system_grant requested + * from other apps are granted. (by promise) + */ + it('bms_checkPermission_1500', 0, async function (done) { + console.info('=====================bms_checkPermission_1500=================='); + var data = await bundle.checkPermission(BUNDLE_NAME, PERMISSION_TWO) + expect(data).assertEqual(0); + done(); + setTimeout(function () { + console.info('=====================bms_checkPermission_1500==================end'); + }, TIMEOUT) + }) + + /* + * @tc.number: bms_checkPermission_1600 + * @tc.name: check whether the permission is granted + * @tc.desc: Verify that permissions which availableScope is system_grant requested + * from other apps are granted. (by callback) + */ + it('bms_checkPermission_1600', 0, async function (done) { + console.info('=====================bms_checkPermission_1600=================='); + await bundle.checkPermission(BUNDLE_NAME, PERMISSION_TWO, (err, data) => { + expect(err.code).assertEqual(0); + expect(data).assertEqual(0); + done(); + }) + setTimeout(function () { + console.info('=====================bms_checkPermission_1600==================end'); + }, TIMEOUT) + }) }) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/Test.json b/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/Test.json index a211f78331da28a43d03151a6ab5ec7eb6107ac4..488cf48669002b81e7a13ea6f9215f9f349fe15c 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/Test.json +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/Test.json @@ -26,7 +26,10 @@ "push": [ "bmsMainAbilityFirstScene.hap->/data/test/bmsMainAbilityFirstScene.hap", "bmsMainAbilitySecondScene.hap->/data/test/bmsMainAbilitySecondScene.hap", - "bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap" + "bmsThirdBundleTest1.hap->/data/test/bmsThirdBundleTest1.hap", + "bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap", + "bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap", + "bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap" ] }, { diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js index 6ad9fe60425ace51abe5f821bd27ae1cc0a55206..fffdce41af752c907d98a97ce154ec7af806da81 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js @@ -1,22 +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. - */ +* 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 bundle from '@ohos.bundle' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' -const TIMEOUT = 1000; +const TIMEOUT = 2000; describe('ActsBmsHapModuleTest', function () { @@ -31,15 +31,43 @@ describe('ActsBmsHapModuleTest', function () { let bundleName = 'com.example.bmsmainabilityfirstscene'; let ret = false bundle.getBundleInfo(bundleName, 1, callback); - function callback(err, data) { + async function callback(err, data) { console.debug('=======get bundle========' + JSON.stringify(data)); - let hapModuleInfo = data.hapModuleInfo[0]; - console.debug('=======get hapModule========' + JSON.stringify(hapModuleInfo)) - console.debug('=======get hapModule mainAbilityName========' + hapModuleInfo.mainAbilityName) - expect(hapModuleInfo.moduleName).assertEqual('entry'); - expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility'); - checkHapModuleInfo(hapModuleInfo); - ret = true; + expect(data.hapModuleInfo.length).assertEqual(1); + if (data.hapModuleInfo.length > 0) { + let hapModuleInfo = data.hapModuleInfo[0]; + console.debug('=======get hapModule========' + JSON.stringify(hapModuleInfo)) + console.debug('=======get hapModule mainAbilityName========' + hapModuleInfo.mainAbilityName) + expect(hapModuleInfo.moduleName).assertEqual('entry'); + expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility'); + expect(hapModuleInfo.name).assertEqual('com.example.bmsmainabilityfirstscene'); + expect(hapModuleInfo.description).assertEqual(''); + expect(hapModuleInfo.descriptionId).assertEqual(0); + expect(hapModuleInfo.icon).assertEqual(''); + expect(hapModuleInfo.label).assertEqual('$string:app_name'); + expect(hapModuleInfo.labelId).assertEqual(0); + expect(hapModuleInfo.iconId).assertEqual(0); + expect(hapModuleInfo.backgroundImg).assertEqual(''); + expect(hapModuleInfo.supportedModes).assertEqual(0); + console.info('===============hapModuleInfo.reqCapabilities==========' + JSON.stringify(hapModuleInfo.reqCapabilities)) + expect(typeof hapModuleInfo.reqCapabilities).assertEqual('object'); + expect(hapModuleInfo.deviceTypes).assertEqual('phone'); + console.info('===============hapModuleInfo.abilityInfo==========' + JSON.stringify(hapModuleInfo.abilityInfo)) + expect(typeof hapModuleInfo.abilityInfo).assertEqual('object'); + expect(hapModuleInfo.moduleName).assertEqual('entry'); + expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility'); + expect(hapModuleInfo.installationFree).assertEqual(false); + for (let i = 0, len = hapModuleInfo.reqCapabilities.length; i < len; i++) { + console.debug('=======get reqCapabilities========' + JSON.stringify(hapModuleInfo.reqCapabilities[i])); + expect(hapModuleInfo.reqCapabilities[i]).assertEqual(''); + } + for (let j = 0, len = hapModuleInfo.abilityInfo.length; j < len; j++) { + console.debug('=======get abilityInfo========' + JSON.stringify(hapModuleInfo.abilityInfo[j])) + expect(hapModuleInfo.abilityInfo[j].name).assertEqual('com.example.bmsmainabilityfirstscene.MainAbility'); + } + ret = true; + } + await uninstall(bundleName); done(); } setTimeout(function () { @@ -54,12 +82,12 @@ describe('ActsBmsHapModuleTest', function () { */ it('bms_getHapModuleInfo_0200', 0, async function (done) { console.debug('===========begin bms_getHapModuleInfo_0200===========') + await install(['/data/test/bmsMainAbilityFirstScene.hap']); await install(['/data/test/bmsMainAbilitySecondScene.hap']); let ret = false let bundleName = 'com.example.bmsmainabilityfirstscene'; let firstMainAbility = 'com.example.bmsmainabilityfirstscene.MainAbility'; let secondMainAbility = 'com.example.bmsmainabilitysecondscene.MainAbility'; - let result = new Map(); bundle.getBundleInfo(bundleName, 1, async (err, data) => { console.debug('=======hapModule length========' + data.hapModuleInfo.length); expect(data.hapModuleInfo.length).assertEqual(2); @@ -67,12 +95,13 @@ describe('ActsBmsHapModuleTest', function () { console.debug('=======get hapModule========' + JSON.stringify(data.hapModuleInfo[i])) console.debug('=======get hapModule mainAbilityName========' + data.hapModuleInfo[i].mainAbilityName); checkHapModuleInfo(data.hapModuleInfo[i]); - result.set(data.hapModuleInfo[i].mainAbilityName, data.hapModuleInfo[i]); } - expect(result.has(firstMainAbility)).assertTrue(); - expect(result.has(secondMainAbility)).assertTrue(); - expect(result.get(firstMainAbility).moduleName).assertEqual('entry'); - expect(result.get(secondMainAbility).moduleName).assertEqual('bmsmainabilitysecondscene'); + if (data.hapModuleInfo.length == 2) { + expect(data.hapModuleInfo[0].mainAbilityName).assertEqual(firstMainAbility); + expect(data.hapModuleInfo[0].moduleName).assertEqual('entry'); + expect(data.hapModuleInfo[1].mainAbilityName).assertEqual(secondMainAbility); + expect(data.hapModuleInfo[1].moduleName).assertEqual('bmsmainabilitysecondscene'); + } await uninstall(bundleName); ret = true; done(); @@ -92,15 +121,40 @@ describe('ActsBmsHapModuleTest', function () { await install(['/data/test/bmsThirdBundleTest2.hap']); let bundleName = 'com.example.third2'; let ret = false; - bundle.getBundleInfo(bundleName, 1).then(async (data) => { + bundle.getBundleInfo(bundleName, 1,).then(async (data) => { console.debug('=======get hapModule========' + JSON.stringify(data)) expect(data.hapModuleInfo.length).assertEqual(1); - console.debug('=======get hapModule mainAbilityName========' + data.hapModuleInfo[0].mainAbilityName) - expect(data.hapModuleInfo[0].mainAbilityName).assertEqual(''); - expect(data.hapModuleInfo[0].moduleName).assertEqual('entry'); - checkHapModuleInfo(data.hapModuleInfo[0]); + if (data.hapModuleInfo.length > 0) { + console.debug('=======get hapModule mainAbilityName========' + data.hapModuleInfo[0].mainAbilityName) + expect(data.hapModuleInfo[0].mainAbilityName).assertEqual(''); + expect(data.hapModuleInfo[0].moduleName).assertEqual('entry'); + checkHapModuleInfo(data.hapModuleInfo[0]); + ret = true; + } + await uninstall(bundleName); + done(); + }) + setTimeout(function () { + expect(ret).assertTrue(); + }, TIMEOUT); + }) + + it('bms_getHapModuleInfo_0400', 0, async function (done) { + console.debug('===========begin bms_getHapModuleInfo_0400===========') + await install(['/data/test/bmsThirdBundleTest5.hap']); + let bundleName = 'com.example.third5'; + let ret = true; + bundle.getBundleInfo(bundleName, 1, async (err, data) => { + console.debug('=======get hapModule========' + JSON.stringify(data)) + expect(data.hapModuleInfo.length).assertEqual(1); + if (data.hapModuleInfo.length == 1) { + console.debug('=======get hapModule mainAbilityName========' + data.hapModuleInfo[0].mainAbilityName) + expect(data.hapModuleInfo[0].mainAbilityName).assertEqual('com.example.third5.AMainAbility'); + expect(data.hapModuleInfo[0].moduleName).assertEqual('entry'); + checkHapModuleInfo(data.hapModuleInfo[0]); + ret = true; + } await uninstall(bundleName); - ret = true; done(); }) setTimeout(function () { @@ -108,6 +162,58 @@ describe('ActsBmsHapModuleTest', function () { }, TIMEOUT); }) + it('bms_getHapModuleInfo_0500', 0, async function (done) { + console.debug('===========begin bms_getHapModuleInfo_0500===========') + await install(['/data/test/bmsThirdBundleTest1.hap']); + await install(['/data/test/bmsThirdBundleTestA1.hap']); + let bundleName = 'com.example.third1'; + let ret = false + bundle.getBundleInfo(bundleName, 1, callback); + async function callback(err, data) { + console.debug('=======get bundle========' + JSON.stringify(data)); + expect(data.hapModuleInfo.length).assertEqual(1); + if (data.hapModuleInfo.length == 1) { + let hapModuleInfo = data.hapModuleInfo[0]; + console.debug('=======get hapModule========' + JSON.stringify(hapModuleInfo)) + console.debug('=======get hapModule mainAbilityName========' + hapModuleInfo.mainAbilityName) + expect(hapModuleInfo.moduleName).assertEqual('entry'); + expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.third1.AMainAbility'); + checkHapModuleInfo(hapModuleInfo); + } + await uninstall(bundleName); + ret = true; + done(); + } + setTimeout(function () { + expect(ret).assertTrue(); + }, TIMEOUT); + }); + + it('bms_getHapModuleInfo_0600', 0, async function (done) { + console.debug('===========begin bms_getHapModuleInfo_0600===========') + let bundleName = 'com.example.system1'; + let ret = false + bundle.getBundleInfo(bundleName, 1, callback); + function callback(err, data) { + console.debug('=======get bundle========' + JSON.stringify(data)); + console.debug('=======data.hapModuleInfo.length========' + data.hapModuleInfo.length); + expect(data.hapModuleInfo.length).assertEqual(1); + if (data.hapModuleInfo.length == 1) { + let hapModuleInfo = data.hapModuleInfo[0]; + console.debug('=======get hapModule========' + JSON.stringify(hapModuleInfo)) + console.debug('=======get hapModule mainAbilityName========' + hapModuleInfo.mainAbilityName) + expect(hapModuleInfo.moduleName).assertEqual('entry'); + expect(hapModuleInfo.mainAbilityName).assertEqual('com.example.system1.MainAbility'); + checkHapModuleInfo(hapModuleInfo); + ret = true; + } + done(); + } + setTimeout(function () { + expect(ret).assertTrue(); + }, TIMEOUT); + }); + function checkHapModuleInfo(dataInfo) { console.debug('========begin check hapModuleInfo========') expect(typeof dataInfo.name).assertEqual('string'); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/Test.json b/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/Test.json index a3f53e8870b5b6c7ddc0e87fd7de76a8739d7cec..64709c85c6a0be9454e275f12db585c785449b27 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/Test.json +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/Test.json @@ -26,7 +26,8 @@ "push": [ "bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap", "bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap", - "bmsThirdBundleJs.hap->/data/test/bmsThirdBundleJs.hap" + "bmsThirdBundleJs.hap->/data/test/bmsThirdBundleJs.hap", + "bmsThirdBundleC.hap->/data/test/bmsThirdBundleC.hap" ] }, { diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js index 6b815621d787533490119cec6b45138cd4496cfb..b864c838cf5282058bdd5e5868f5eb55e54f23dc 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js @@ -32,7 +32,12 @@ describe('ActsBmsJsTest', function () { await install(['/data/test/bmsThirdBundleTest2.hap']); let data = await bundle.getBundleInfo(bundleName, 1); expect(data.abilityInfo.length).assertEqual(1); - checkIsExist(abilityName, data); + if(data.abilityInfo.length == 1){ + console.debug('========check abilityName ========' + JSON.stringify(data.abilityInfo)); + expect(data.abilityInfo[0].name).assertEqual(abilityName); + expect(data.abilityInfo[0].srcLanguage).assertEqual('js'); + expect(data.abilityInfo[0].srcPath).assertEqual(''); + } await uninstall(bundleName); done(); setTimeout(function () { @@ -54,9 +59,16 @@ describe('ActsBmsJsTest', function () { await install(['/data/test/bmsThirdBundleTest5.hap']); let data = await bundle.getBundleInfo(bundleName, 1) console.debug('==========bundleInfo==========' + JSON.stringify(data)) - expect(data.abilityInfo.length).assertLarger(1); - checkIsExist(abilityName1, data); - checkIsExist(abilityName2, data); + expect(data.abilityInfo.length).assertEqual(2); + if(data.abilityInfo.length == 2){ + console.debug('========check abilityName ========' + JSON.stringify(data.abilityInfo)); + expect(data.abilityInfo[0].name).assertEqual(abilityName1); + expect(data.abilityInfo[0].srcLanguage).assertEqual('js'); + expect(data.abilityInfo[0].srcPath).assertEqual(''); + expect(data.abilityInfo[1].name).assertEqual(abilityName2); + expect(data.abilityInfo[1].srcLanguage).assertEqual('js'); + expect(data.abilityInfo[1].srcPath).assertEqual(''); + } await uninstall(bundleName); done(); setTimeout(function () { @@ -77,13 +89,45 @@ describe('ActsBmsJsTest', function () { await install(['/data/test/bmsThirdBundleJs.hap']); let data = await bundle.getBundleInfo(bundleName, 1); expect(data.abilityInfo.length).assertEqual(1); - checkIsExist(abilityName, data); + if(data.abilityInfo.length == 1){ + console.debug('========check abilityName ========' + JSON.stringify(data.abilityInfo)); + expect(data.abilityInfo[0].name).assertEqual(abilityName); + expect(data.abilityInfo[0].srcLanguage).assertEqual('js'); + expect(data.abilityInfo[0].srcPath).assertEqual('default'); + } + await uninstall(bundleName); + done(); + setTimeout(function () { + console.info('=====================bms_getJsAbility_0300==================end'); + }, TIMEOUT) + }) + + /* + * @tc.number: bms_getJsAbility_0400 + * @tc.name: test the multi js ability + * @tc.desc: 1.install a c++ hap which has an ability with short domain name + * 2.check the ability name by the interface of getBundleInfo + */ + it('bms_getJsAbility_0400', 0, async function (done) { + console.info('=====================bms_getJsAbility_0400=================='); + let bundleName = 'com.example.c'; + let abilityName = '.MainAbility'; + await install(['/data/test/bmsThirdBundleC.hap']); + let data = await bundle.getBundleInfo(bundleName, 1); + expect(data.abilityInfo.length).assertEqual(1); + if(data.abilityInfo.length == 1){ + console.debug('========check abilityName ========' + JSON.stringify(data.abilityInfo)); + expect(data.abilityInfo[0].name).assertEqual(abilityName); + expect(data.abilityInfo[0].srcLanguage).assertEqual('c++'); + expect(data.abilityInfo[0].srcPath).assertEqual('default/c++/'); + } await uninstall(bundleName); done(); setTimeout(function () { console.info('=====================bms_getJsAbility_0300==================end'); }, TIMEOUT) }) + async function install(bundlePath) { var installer = await bundle.getBundleInstaller(); installer.install(bundlePath, { @@ -123,15 +167,4 @@ describe('ActsBmsJsTest', function () { expect(data.statusMessage).assertEqual('SUCCESS'); } } - function checkIsExist(abilityName, data) - { - console.debug('==========bundleInfo==========' + JSON.stringify(data)) - console.debug('==========AbilityInfo===========' + JSON.stringify(data.abilityInfo)) - let abilityNames = new Map(); - for (var i = 0; i < data.abilityInfo.length; i++) { - console.debug('==========abilityName==========' + data.abilityInfo[i].name); - abilityNames.set(data.abilityInfo[i].name, data.abilityInfo[i]); - } - expect(abilityNames.has(abilityName)).assertEqual(true); - } }) \ No newline at end of file diff --git a/notification/ans_standard/publishicontest/BUILD.gn b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/BUILD.gn similarity index 93% rename from notification/ans_standard/publishicontest/BUILD.gn rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/BUILD.gn index f184f4e05abd7c08a46713fb1349ba3db60ea7c0..852c8e63dca178080ffff83c0d087971b638cc70 100644 --- a/notification/ans_standard/publishicontest/BUILD.gn +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/BUILD.gn @@ -9,18 +9,18 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ActsAnsIconTest") { +ohos_js_hap_suite("ActsBmsKitTest") { hap_profile = "./entry/src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsIconTest" + hap_name = "ActsBmsKitTest" } ohos_js_assets("hjs_demo_js_assets") { source_dir = "./entry/src/main/js/default" diff --git a/notification/ans_standard/publishicontest/Test.json b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/Test.json old mode 100755 new mode 100644 similarity index 65% rename from notification/ans_standard/publishicontest/Test.json rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/Test.json index ddba18c7521d6781850000ebd8b01b13bee9b2f4..7e569872c0cd4525fd4815e9fe88a7c9f8fb86d3 --- a/notification/ans_standard/publishicontest/Test.json +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/Test.json @@ -1,19 +1,19 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "120000", - "package": "com.example.actsansicontest", - "shell-timeout": "120000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsIconTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} - +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "120000", + "package": "com.example.actsbmskittest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsBmsKitTest.hap", + "bmsThirdBundleTest1.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a194211ca60aa3190285d12ea4e5ae30bbcf6b71 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/config.json @@ -0,0 +1,96 @@ +{ + "app": { + "bundleName": "com.example.actsbmskittest", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsbmskittest", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home", + "flag.home.intent.from.system" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.actsbmskittest.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 + } + } + ], + "defPermissions": [ + { + "name": "com.permission.CAMERA", + "grantMode": "user_grant", + "availableScope": ["signature"] + }, + { + "name": "com.permission.PERMISSION_A", + "grantMode": "system_grant", + "availableScope": ["signature"] + } + ], + "reqPermissions": [ + { + "name": "com.permission.CAMERA", + "reason": "Need open camera", + "usedScene": { + "ability": [ + "com.example.actsbmscheckpermissiontest.MainAbility" + ], + "when": "always" + } + }, + { + "name": "com.permission.PERMISSION_A", + "reason": "Need PERMISSION_A", + "usedScene": { + "ability": [ + "com.example.actsbmscheckpermissiontest.MainAbility" + ], + "when": "always" + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/app.js similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/app.js rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/app.js diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/i18n/en-US.json rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/i18n/en-US.json diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/i18n/zh-CN.json rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/i18n/zh-CN.json diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/pages/index/index.css rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/pages/index/index.css diff --git a/notification/ans_standard/publishicontest/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/pages/index/index.hml similarity index 74% rename from notification/ans_standard/publishicontest/entry/src/main/js/default/pages/index/index.hml rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/pages/index/index.hml index 60c117fb35d180619185b62bee24293514f4e896..13ae33e07e3a90032d5fb5589183072449422c77 100644 --- a/notification/ans_standard/publishicontest/entry/src/main/js/default/pages/index/index.hml +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/pages/index/index.hml @@ -1,5 +1,5 @@
- icon_pixcelMap + {{ title }}
diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/pages/index/index.js similarity index 87% rename from notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/pages/index/index.js rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/pages/index/index.js index c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c..839fa9d46be37fa9b80d3b40d0472985247bec90 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/pages/index/index.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/default/pages/index/index.js @@ -12,8 +12,6 @@ * 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 @@ -21,20 +19,19 @@ injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') export default { data: { - title: "" + title: 'Bms Stress Test' }, onInit() { - this.title = this.$t('strings.world'); + this.title = this.data.title; }, onShow() { - console.info('onShow finish') + console.info('onReady 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) @@ -42,6 +39,7 @@ export default { core.execute() }, onReady() { - console.info('onReady'); }, -} + onBackPress(){ + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/resources/base/element/string.json b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/resources/base/element/string.json similarity index 78% rename from notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/resources/base/element/string.json rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/resources/base/element/string.json index 6d530caefcdbe79f49db0b49fb864ed4daaeaac0..ee3f8eede26f5949fbaa4b4bb8a7db901536fffd 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/resources/base/element/string.json +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/resources/base/element/string.json @@ -2,7 +2,7 @@ "string": [ { "name": "app_name", - "value": "Sub1" + "value": "actsbmskittest" }, { "name": "mainability_description", diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/resources/base/media/icon.png b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/resources/base/media/icon.png rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/resources/base/media/icon.png diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/ActsBmsKitTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/ActsBmsKitTest.test.js new file mode 100644 index 0000000000000000000000000000000000000000..44ae79c5811a0e055d1891f9adc8010ad1384aa8 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/ActsBmsKitTest.test.js @@ -0,0 +1,306 @@ +/* + * 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 bundle from '@ohos.bundle' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import featureAbility from '@ohos.ability.featureability' +import commonEvent from '@ohos.commonevent' + +const TIMEOUT = 2000; +const STRESSLEVEL = 20; +const BUNDLE_NAME = 'com.example.actsbmskittest'; +const PERMISSION_NAME = 'com.permission.PERMISSION_A'; +const START_ABILITY_TIMEOUT = 3000; +const EVENTTIMEOUT = 5000; +var subscriberInfo_0100 = { + events: ['ACTS_Third1_Publish_CommonEvent'], +}; +describe('ActsBmsKitTest', function () { + + beforeAll(async (done) => { + var subscriber; + let id; + function subscribeCallBack(err, data) { + clearTimeout(id); + console.debug('=====subscribeCallBack=====' + data.event); + commonEvent.unsubscribe(subscriber, unSubscribeCallback); + console.debug('=====subscribeCallBack end====='); + done(); + } + commonEvent.createSubscriber(subscriberInfo_0100).then((data) => { + console.debug('====>Create Subscriber====>'); + subscriber = data; + commonEvent.subscribe(subscriber, subscribeCallBack); + }) + function unSubscribeCallback(err, data) { + console.debug('====>UnSubscribe CallBack====>'); + done(); + } + function timeout() { + console.debug('=====timeout======'); + commonEvent.unsubscribe(subscriber, unSubscribeCallback) + done(); + } + id = setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug('=======start ability========') + await featureAbility.startAbility( + { + want: + { + bundleName: 'com.example.third1', + abilityName: 'com.example.third1.MainAbility' + } + } + ) + setTimeout(function () { + console.info('==================beforeAll==================end'); + }, TIMEOUT) + }) + /* + * @tc.number: ActsBmsKit_getAllShortcutInfo_0100 + * @tc.name: Pressure test interface getAllShortcutInfo by promise + * @tc.desc: get the shortcut information of the hap + */ + it('ActsBmsKit_getAllShortcutInfo_0100', 0, async function (done) { + console.info('=====================ActsBmsKit_getAllShortcutInfo_0100=================='); + var bundleName = 'com.example.third1'; + let count; + for (count = 0; count < STRESSLEVEL; count++) { + let data = await bundle.getAllShortcutInfo(bundleName); + expect(typeof data).assertEqual('object'); + expect(data.length).assertEqual(1); + if (!checkShortcutIsExist(data, 'id.third1', 'third1')) + break; + } + done(); + setTimeout(function () { + console.info('==================ActsBmsKit_getAllShortcutInfo_0100==================end'); + }, TIMEOUT) + }); + + /* + * @tc.number: ActsBmsKit_getAllShortcutInfo_0200 + * @tc.name: Pressure test interface getAllShortcutInfo by callback + * @tc.desc: get the shortcut information of the hap + */ + it('ActsBmsKit_getAllShortcutInfo_0200', 0, async function (done) { + console.info('=====================ActsBmsKit_getAllShortcutInfo_0200=================='); + var bundleName = 'com.example.third1'; + for (let count = 0; count < STRESSLEVEL; count++) { + bundle.getAllShortcutInfo(bundleName, async (err, data) => { + expect(data.length).assertEqual(1); + expect(err.code).assertEqual(0); + checkShortcutIsExist(data, 'id.third1', 'third1'); + if (count == STRESSLEVEL - 1) { + done(); + } else if (err.code != 0) { + console.log('call function level is: ' + count); + expect().assertFail(); + done(); + } + }) + } + setTimeout(function () { + console.info('=====================ActsBmsKit_getAllShortcutInfo_0200==================end'); + }, TIMEOUT) + }) + + /* + * @tc.number: ActsBmsKit_checkPermission_0100 + * @tc.name: Pressure test interface checkPermission by promise; + * @tc.desc: + */ + it('ActsBmsKit_checkPermission_0100', 0, async function (done) { + console.info('=====================ActsBmsKit_checkPermission_0100=================='); + for (let count = 0; count < STRESSLEVEL; count++) { + var data = await bundle.checkPermission(BUNDLE_NAME, PERMISSION_NAME); + console.log('checkPermission is granted: ' + data); + expect(data).assertEqual(0); + if (data != 0) { + break; + } + } + done(); + setTimeout(function () { + console.info('=====================ActsBmsKit_checkPermission_0100==================end'); + }, TIMEOUT) + }) + + /* + * @tc.number: ActsBmsKit_checkPermission_0200 + * @tc.name: Pressure test interface checkPermission by callback; + * @tc.desc: + */ + it('ActsBmsKit_checkPermission_0200', 0, async function (done) { + console.info('=====================ActsBmsKit_checkPermission_0200=================='); + for (let count = 0; count < STRESSLEVEL; count++) { + await bundle.checkPermission(BUNDLE_NAME, PERMISSION_NAME, (err, data) => { + expect(err.code).assertEqual(0); + expect(data).assertEqual(0); + console.log('checkPermission is granted: ' + data); + if (count == STRESSLEVEL - 1) { + done(); + } else if (err.code != 0 || data != 0) { + console.log('call function level is: ' + count); + expect().assertFail(); + done(); + } + }) + } + setTimeout(function () { + console.info('=====================ActsBmsKit_checkPermission_0200==================end'); + }, TIMEOUT) + }) + + /* + * @tc.number: ActsBmsKit_getModuleUsageRecordTest_0100 + * @tc.name: Pressure test interface getModuleUsageRecord(int maxNum) by promise; + * @tc.desc: When the number of starts of ability is less than maxNum, call interface getModuleUsageRecord + */ + it('ActsBmsKit_getModuleUsageRecordTest_0100', 0, async function (done) { + console.debug('=====================ActsBmsKit_getModuleUsageRecordTest_0100=================='); + var bundleName = 'com.example.third1'; + for (let count = 0; count < STRESSLEVEL; count++) { + console.debug("===========STRESSLEVEL===============" + count) + let records = await bundle.getModuleUsageRecords(50); + checkModuleUsageRecord(records, 'ActsBmsKit_getModuleUsageRecordTest_0100'); + var result = checkIsExist(records, bundleName); + expect(result).assertEqual(true); + if (!result) { + break; + } + } + done(); + setTimeout(function () { + console.debug('===========ActsBmsKit_getModuleUsageRecordTest_0100===========end'); + }, EVENTTIMEOUT) + }) + + /* + * @tc.number: ActsBmsKit_getModuleUsageRecordTest_0200 + * @tc.name: Pressure test interface getModuleUsageRecord(int maxNum) by callback; + * @tc.desc: When the number of starts of ability is less than maxNum, call interface getModuleUsageRecord + */ + it('ActsBmsKit_getModuleUsageRecordTest_0200', 0, async function (done) { + console.debug('=====================ActsBmsKit_getModuleUsageRecordTest_0200=================='); + var bundleName = 'com.example.third1'; + let count = 0; + for (let i = 0; i < STRESSLEVEL; i++) { + bundle.getModuleUsageRecords(50, (err, data) => { + expect(err.code).assertEqual(0); + checkModuleUsageRecord(data, 'ActsBmsKit_getModuleUsageRecordTest_0200'); + var result = checkIsExist(data, bundleName); + expect(result).assertEqual(true); + if (count == STRESSLEVEL - 1) { + done(); + } else if (err.code != 0) { + console.log('call function level is: ' + count); + expect().assertFail(); + done(); + } + count++; + }); + } + setTimeout(function () { + console.debug('==========ActsBmsKit_getModuleUsageRecordTest_0200==================end'); + }, TIMEOUT) + }) + function checkModuleUsageRecord(data, caseName) { + console.debug('======================check ModuleUsageRecord begin=========================='); + console.debug(caseName + ' ==========record length is ========== ' + data.length); + expect(data.length).assertLarger(0); + for (let i = 0, length = data.length; i < length; i++) { + console.debug('=======All Info========' + JSON.stringify(data[i])); + console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName)); + expect(data[i].bundleName.length).assertLarger(0); + console.debug('=============appLabelId==============' + JSON.stringify(data[i].appLabelId)); + expect(data[i].appLabelId).assertLarger(0); + console.debug('=============name==============' + JSON.stringify(data[i].name)); + expect(data[i].name.length).assertLarger(0); + console.debug('=============labelId==============' + JSON.stringify(data[i].labelId)); + expect(data[i].labelId >=0 ).assertTrue(); + console.debug('=============descriptionId==============' + JSON.stringify(data[i].descriptionId)); + expect(data[i].descriptionId).assertEqual(0); + console.debug('=============abilityName==============' + JSON.stringify(data[i].abilityName)); + expect(data[i].abilityName.length).assertLarger(0); + console.debug('=============abilityLabelId==============' + JSON.stringify(data[i].abilityLabelId)); + expect(data[i].abilityLabelId).assertLarger(0); + console.debug('===========abilityDescriptionId===========' + JSON.stringify(data[i].abilityDescriptionId)); + expect(data[i].abilityDescriptionId).assertLarger(0); + console.debug('=============abilityIconId==============' + JSON.stringify(data[i].abilityIconId)); + expect(data[i].abilityIconId).assertLarger(0); + console.debug('=============launchedCount==============' + JSON.stringify(data[i].launchedCount)); + expect(data[i].launchedCount).assertLarger(0); + console.debug('=============lastLaunchTime==============' + JSON.stringify(data[i].lastLaunchTime)); + expect(data[i].lastLaunchTime).assertLarger(0); + console.debug('=============isRemoved==============' + JSON.stringify(data[i].isRemoved)); + expect(data[i].isRemoved).assertEqual(false); + expect(data[i].installationFreeSupported).assertEqual(false); + } + } + function checkIsExist(data, bundleName) { + let bundles = new Map(); + for (let i = 0, length = data.length; i < length; i++) { + console.debug('=============bundleName is=========' + JSON.stringify(data[i].bundleName)); + bundles.set(data[i].bundleName, data[i]); + } + if (bundles.has(bundleName)) { + console.debug(bundleName + ' is exist'); + return true; + } + else { + console.debug(bundleName + ' is not exist'); + return false; + } + } + function checkShortcutInfo(dataInfo, name) { + console.info('=======Shortcut Info========' + JSON.stringify(dataInfo)) + console.info('=============Shortcutid=========' + dataInfo.id); + expect(typeof dataInfo.id).assertEqual('string'); + expect(dataInfo.id).assertEqual('id.' + name); + console.info('=============icon==============' + JSON.stringify(dataInfo.icon)); + expect(typeof dataInfo.disableMessage).assertEqual('string'); + expect(typeof dataInfo.isStatic).assertEqual('boolean'); + expect(typeof dataInfo.isHomeShortcut).assertEqual('boolean'); + expect(typeof dataInfo.isEnabled).assertEqual('boolean'); + expect(typeof dataInfo.hostAbility).assertEqual('string'); + console.info('=============label==============' + JSON.stringify(dataInfo.label)); + expect(typeof dataInfo.wants).assertEqual('object'); + if (typeof dataInfo.wants != 'undefined' && Object.keys(dataInfo.wants).length != 0) { + expect(dataInfo.wants.length).assertLarger(0); + for (var j = 0; j < dataInfo.wants.length; j++) { + console.info('========targetClass=========' + JSON.stringify(dataInfo.wants[j].targetClass)); + expect(dataInfo.wants[j].targetClass).assertEqual('com.example.' + name + '.MainAbility'); + console.info('========targetBundle=========' + JSON.stringify(dataInfo.wants[j].targetBundle)); + expect(dataInfo.wants[j].targetBundle).assertEqual('com.example.' + name); + } + } + } + + function checkShortcutIsExist(dataInfo, shortcutId, testName) { + let info = new Map(); + for (var i = 0, len = dataInfo.length; i < len; i++) { + expect(typeof dataInfo[i]).assertEqual('object'); + info.set(dataInfo[i].id, dataInfo[i]); + } + expect(info.has(shortcutId)).assertTrue(); + if (!info.has(shortcutId)) { + return false; + } else { + checkShortcutInfo(info.get(shortcutId), testName); + return true; + } + } +}) \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/test/List.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/List.test.js similarity index 92% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/test/List.test.js rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/List.test.js index 36f3624a07c34f04eaac62fab64814215be2fd18..f3d7251ad1a585f06b30f5df553d51ac8cdaa09a 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/test/List.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/List.test.js @@ -12,4 +12,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./GetActiveInfo.test.js') \ No newline at end of file + +require('./ActsBmsKitTest.test.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/signature/openharmony_sx.p7b b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/signature/openharmony_sx.p7b similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/signature/openharmony_sx.p7b rename to appexecfwk/bundle_standard/bundlemanager/actsbmskittest/signature/openharmony_sx.p7b diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js index 48720f360ba9be1bd99c6e9a7524646e78f40c44..0da129041caa7045270921dc91f48b9e31b66fc9 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js @@ -73,6 +73,7 @@ describe('ActsBmsMetaDataTest', function () { checkMetaData(dataMap2.get(abilityName1), 'Data1'); checkMetaData(dataMap2.get(abilityName2), 'Data3'); } + await uninstall('com.example.third1'); done(); setTimeout(function () { console.debug('============bms_getMetaData_0100===========') @@ -86,6 +87,8 @@ describe('ActsBmsMetaDataTest', function () { */ it('bms_getMetaData_0200', 0, async function (done) { console.info('=====================bms_getMetaData_0200=================='); + await install(['/data/test/bmsThirdBundleTest1.hap']) + await install(['/data/test/bmsThirdBundleTest3.hap']) await install(['/data/test/bmsThirdBundleTestA1.hap']) let dataMap = new Map(); let abilityName1 = 'com.example.third1.AMainAbility'; @@ -110,6 +113,7 @@ describe('ActsBmsMetaDataTest', function () { checkMetaData(dataMap.get(abilityName1), 'DataA1'); checkMetaData(dataMap.get(abilityName2), 'Data3'); } + await uninstall('com.example.third1'); done(); setTimeout(function () { console.debug('============bms_getMetaData_0200===========') @@ -123,6 +127,7 @@ describe('ActsBmsMetaDataTest', function () { */ it('bms_getMetaData_0300', 0, async function (done) { console.info('=====================bms_getMetaData_0300=================='); + await install(['/data/test/bmsThirdBundleTest1.hap']) await uninstall('com.example.third1'); var dataInfos = await bundle.queryAbilityByWant({ want: { @@ -267,7 +272,29 @@ describe('ActsBmsMetaDataTest', function () { } expect(dataMap.has(abilityName1)).assertTrue(); if (dataMap.has(abilityName1)) { - checkMetaData(dataMap.get(abilityName1), 'Data1V'); + let data = dataMap.get(abilityName1); + var parameters = data.parameters; + var results = data.results; + var customizeDatas = data.customizeDatas; + expect(parameters.length).assertEqual(2); + expect(results.length).assertEqual(1); + expect(customizeDatas.length).assertEqual(1); + console.debug('=====customizeDatas length=====' + customizeDatas.length); + for (let i = 0; i < parameters.length; i++) { + expect(parameters[i].description).assertEqual('$string:mainability_description'); + expect(parameters[i].name).assertEqual("Data1V"+i); + expect(parameters[i].type).assertEqual('float'); + } + for (let i = 0; i < results.length; i++) { + expect(results[i].description).assertEqual('$string:mainability_description'); + expect(results[i].name).assertEqual('Data1V'); + expect(results[i].type).assertEqual('float'); + } + for (let i = 0; i < customizeDatas.length; i++) { + expect(customizeDatas[i].name).assertEqual(''); + expect(customizeDatas[i].value).assertEqual(''); + expect(customizeDatas[i].extra).assertEqual(''); + } } done(); setTimeout(function () { diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js index 6e6a6f39cc61444114fab7cb550531f8af414f3c..7c9776685111019f35a38640fe5286ce11490f62 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js @@ -15,22 +15,40 @@ import bundle from '@ohos.bundle' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import featureAbility from '@ohos.ability.featureability' -import commonEvent from '@ohos.commonevent' -const START_ABILITY_TIMEOUT = 5000; +const BUNDLE_NAME = 'com.example.third1'; const NUM_TWO = 2; const NUM_TEN = 10; const INVALID_NUM = -1; const TIMEOUT = 1000; const EVENTTIMEOUT = 2000; -var subscriberInfoGetModuleUsageRecordTest_0100 = { - events: ['ACTS_Third1_Publish_CommonEvent'], -}; +var START_COUNT = 1; +var RECORD_COUNT = 0; describe('ActsBmsModuleUsageRecordTest', function () { beforeAll(async (done) => { console.debug('=======before all install========'); await install(['/data/test/bmsThirdBundleTest1.hap']) + console.debug('=======start ability========') + sleep(TIMEOUT); + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.third1", + abilityName: "com.example.third1.MainAbility" + }, + }, + ); + sleep(TIMEOUT); + let records = await bundle.getModuleUsageRecords(1000); + RECORD_COUNT = records.length; + for (let i = 0, len = records.length; i < len; i++) { + if (records[i].bundleName == 'com.example.third1') { + START_COUNT = records[i].launchedCount; + } + } done(); setTimeout(function () { console.debug('=======before all install finish========'); @@ -45,47 +63,53 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_0100', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_0100=================='); - var bundleName = 'com.example.third1'; - var Subscriber; - let id; - async function SubscribeCallBack(err, data) { - clearTimeout(id); - expect(data.event).assertEqual('ACTS_Third1_Publish_CommonEvent'); - console.debug('====>Subscribe CallBack data:====>' + JSON.stringify(data)); - let records = await bundle.getModuleUsageRecords(NUM_TWO); - checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0100'); - var result = checkIsExist(records, bundleName); - expect(result).assertEqual(true); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - done(); - } - commonEvent.createSubscriber(subscriberInfoGetModuleUsageRecordTest_0100).then((data) => { - console.debug('====>Create Subscriber====>'); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - }) - function UnSubscribeCallback() { - console.debug('====>UnSubscribe CallBack====>'); - done(); + let records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO); + checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0100'); + let dataMap = new Map(); + for (let i = 0, length = records.length; i < length; i++) { + console.debug('=============bundleName is=========' + JSON.stringify(records[i].bundleName)); + dataMap.set(records[i].bundleName, records[i]); } - function timeout() { - expect().assertFail(); - console.debug('bms_getModuleUsageRecordTest_0100=====timeout======'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - done(); - } - id = setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug('=======start ability========') - let result = await featureAbility.startAbility( - { - want: - { - bundleName: 'com.example.third1', - abilityName: 'com.example.third1.MainAbility' - } + let data = dataMap.get(BUNDLE_NAME); + console.debug('=============data is=========' + JSON.stringify(data)); + console.debug('=============bundleName is=========' + JSON.stringify(data.bundleName)); + expect(data.bundleName).assertEqual('com.example.third1'); + console.debug('=============appLabelId==============' + JSON.stringify(data.appLabelId)); + expect(data.appLabelId).assertLarger(0); + console.debug('=============name==============' + JSON.stringify(data.name)); + expect(data.name).assertEqual('entry'); + console.debug('=============labelId==============' + JSON.stringify(data.labelId)); + expect(data.labelId >= 0).assertTrue(); + console.debug('=============descriptionId==============' + JSON.stringify(data.descriptionId)); + expect(data.descriptionId).assertEqual(0); + console.debug('=============abilityName==============' + JSON.stringify(data.abilityName)); + expect(data.abilityName).assertEqual('com.example.third1.MainAbility'); + console.debug('=============abilityLabelId==============' + JSON.stringify(data.abilityLabelId)); + expect(data.abilityLabelId).assertLarger(0); + console.debug('===========abilityDescriptionId===========' + JSON.stringify(data.abilityDescriptionId)); + expect(data.abilityDescriptionId).assertLarger(0); + console.debug('=============abilityIconId==============' + JSON.stringify(data.abilityIconId)); + expect(data.abilityIconId).assertLarger(0); + console.debug('=============launchedCount==============' + JSON.stringify(data.launchedCount)); + expect(data.launchedCount).assertLarger(0); + console.debug('=============lastLaunchTime==============' + JSON.stringify(data.lastLaunchTime)); + expect(data.lastLaunchTime).assertLarger(0); + console.debug('=============isRemoved==============' + JSON.stringify(data.isRemoved)); + expect(data.isRemoved).assertEqual(false); + expect(data.installationFreeSupported).assertEqual(false); + + var result = checkIsExist(records, BUNDLE_NAME); + expect(result).assertEqual(true); + if (result) { + let counts = new Map(); + console.debug('======LaunchedCount======' + START_COUNT); + for (let i = 0, length = records.length; i < length; i++) { + counts.set(records[i].bundleName, records[i].launchedCount); + console.debug('=============launchedCount is=========' + records[i].launchedCount); } - ) - expect(result).assertEqual(0); + expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); + } + done(); setTimeout(function () { console.debug('=====================bms_getModuleUsageRecordTest_0100==================end'); }, EVENTTIMEOUT) @@ -98,12 +122,20 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_0200', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_0200=================='); - var bundleName = 'com.example.third1'; - bundle.getModuleUsageRecords(NUM_TWO, (err, data) => { + bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, (err, data) => { expect(err.code).assertEqual(0); checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_0200'); - var result = checkIsExist(data, bundleName); + var result = checkIsExist(data, BUNDLE_NAME); expect(result).assertEqual(true); + if (result) { + let counts = new Map(); + console.debug('======LaunchedCount======' + START_COUNT); + for (let i = 0, length = data.length; i < length; i++) { + counts.set(data[i].bundleName, data[i].launchedCount); + console.debug('=============launchedCount is=========' + data[i].launchedCount); + } + expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); + } done(); }); setTimeout(function () { @@ -118,12 +150,20 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_0300', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_0300=================='); - var bundleName = 'com.example.third1'; - bundle.getModuleUsageRecords(NUM_TEN, (err, data) => { + bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, (err, data) => { expect(err.code).assertEqual(0); checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_0300'); - var result = checkIsExist(data, bundleName); + var result = checkIsExist(data, BUNDLE_NAME); expect(result).assertEqual(true); + if (result) { + let counts = new Map(); + console.debug('======LaunchedCount======' + START_COUNT); + for (let i = 0, length = data.length; i < length; i++) { + counts.set(data[i].bundleName, data[i].launchedCount); + console.debug('=============launchedCount is=========' + data[i].launchedCount); + } + expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); + } done(); }); setTimeout(function () { @@ -138,11 +178,20 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_0400', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_0400=================='); - var bundleName = 'com.example.third1'; - var records = await bundle.getModuleUsageRecords(NUM_TEN); + var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO); checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0400'); - var result = checkIsExist(records, bundleName); + var result = checkIsExist(records, BUNDLE_NAME); expect(result).assertEqual(true); + if (result) { + let counts = new Map(); + console.debug('======LaunchedCount======' + START_COUNT); + expect(records[0].launchedCount).assertEqual(START_COUNT); + for (let i = 0, length = records.length; i < length; i++) { + counts.set(records[i].bundleName, records[i].launchedCount); + console.debug('=============launchedCount is=========' + records[i].launchedCount); + } + expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); + } done(); setTimeout(function () { console.debug('=====================bms_getModuleUsageRecordTest_0400==================end'); @@ -157,13 +206,14 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_0500', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_0500=================='); - var bundleName = 'com.example.third1' - await uninstall(bundleName); + await uninstall(BUNDLE_NAME); + sleep(TIMEOUT); console.debug('===================uninstall third1===================='); - var records = await bundle.getModuleUsageRecords(NUM_TEN) + var records = await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO) checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_0500'); - var result = checkIsExist(records, bundleName); + var result = checkIsExist(records, BUNDLE_NAME); expect(result).assertEqual(false); + await install(['/data/test/bmsThirdBundleTest1.hap']); done(); setTimeout(function () { console.debug('=====================bms_getModuleUsageRecordTest_0500==================end'); @@ -178,12 +228,14 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_0600', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_0600=================='); - var bundleName = 'com.example.third1' - await bundle.getModuleUsageRecords(NUM_TEN, (err, data) => { + await uninstall(BUNDLE_NAME); + sleep(TIMEOUT); + await bundle.getModuleUsageRecords(RECORD_COUNT + NUM_TWO, async (err, data) => { expect(err.code).assertEqual(0); checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_0600'); - var result = checkIsExist(data, bundleName); + var result = checkIsExist(data, BUNDLE_NAME); expect(result).assertEqual(false); + await install(['/data/test/bmsThirdBundleTest1.hap']); done(); }); setTimeout(function () { @@ -265,14 +317,25 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_1100', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_1100=================='); - var bundleName = 'com.example.third1' + await uninstall(BUNDLE_NAME); + sleep(TIMEOUT); var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'] await install(bundlePath); + sleep(TIMEOUT); console.debug('===================install third1===================='); var records = await bundle.getModuleUsageRecords(NUM_TEN) checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_1100'); - var result = checkIsExist(records, bundleName); + var result = checkIsExist(records, BUNDLE_NAME); expect(result).assertEqual(true); + if (result) { + let counts = new Map(); + console.debug('======LaunchedCount======' + START_COUNT); + for (let i = 0, length = records.length; i < length; i++) { + counts.set(records[i].bundleName, records[i].launchedCount); + console.debug('=============launchedCount is=========' + records[i].launchedCount); + } + expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); + } done(); setTimeout(function () { console.debug('=====================bms_getModuleUsageRecordTest_1100==================end'); @@ -287,19 +350,120 @@ describe('ActsBmsModuleUsageRecordTest', function () { */ it('bms_getModuleUsageRecordTest_1200', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_1200=================='); - var bundleName = 'com.example.third1' + await uninstall(BUNDLE_NAME); + sleep(TIMEOUT); + var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'] + await install(bundlePath); + sleep(TIMEOUT); await bundle.getModuleUsageRecords(NUM_TEN, (err, data) => { expect(err.code).assertEqual(0); checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_1200'); - var result = checkIsExist(data, bundleName); + var result = checkIsExist(data, BUNDLE_NAME); expect(result).assertEqual(true); + if (result) { + let counts = new Map(); + console.debug('======LaunchedCount======' + START_COUNT); + for (let i = 0, length = data.length; i < length; i++) { + counts.set(data[i].bundleName, data[i].launchedCount); + console.debug('=============launchedCount is=========' + data[i].launchedCount); + } + expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); + } done(); }) setTimeout(function () { console.debug('=====================bms_getModuleUsageRecordTest_1200==================end'); }, TIMEOUT) }) - + /* + * @tc.number: bms_getModuleUsageRecordTest_1300 + * @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback>) + * @tc.desc: Install a third-party which is uninstalled, and then use the getModuleUsageRecord interface + * to query the activation times and last activation time of ability + */ + it('bms_getModuleUsageRecordTest_1300', 0, async function (done) { + console.debug('=====================bms_getModuleUsageRecordTest_1300=================='); + await uninstall(BUNDLE_NAME); + sleep(TIMEOUT); + var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'] + await install(bundlePath); + sleep(TIMEOUT); + console.debug('=======start ability========') + await featureAbility.startAbility( + { + want: + { + bundleName: 'com.example.third1', + abilityName: 'com.example.third1.MainAbility' + } + } + ) + sleep(TIMEOUT); + START_COUNT += 1; + await bundle.getModuleUsageRecords(NUM_TEN, (err, data) => { + expect(err.code).assertEqual(0); + checkModuleUsageRecord(data, 'bms_getModuleUsageRecordTest_1300'); + var result = checkIsExist(data, BUNDLE_NAME); + expect(result).assertEqual(true); + if (result) { + let counts = new Map(); + console.debug('======LaunchedCount======' + START_COUNT); + for (let i = 0, length = data.length; i < length; i++) { + counts.set(data[i].bundleName, data[i].launchedCount); + console.debug('=============launchedCount is=========' + data[i].launchedCount); + } + expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); + } + done(); + }) + setTimeout(function () { + console.debug('=====================bms_getModuleUsageRecordTest_1300==================end'); + }, TIMEOUT) + }) + /* + * @tc.number: bms_getModuleUsageRecordTest_1400 + * @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback>) + * @tc.desc: Install a third-party which is uninstalled, and then use the getModuleUsageRecord interface + * to query the activation times and last activation time of ability + */ + it('bms_getModuleUsageRecordTest_1400', 0, async function (done) { + console.debug('=====================bms_getModuleUsageRecordTest_1400=================='); + await uninstall(BUNDLE_NAME); + sleep(TIMEOUT); + var bundlePath = ['/data/test/bmsThirdBundleTest1.hap'] + await install(bundlePath); + sleep(TIMEOUT); + console.debug('=======start ability========') + await featureAbility.startAbility( + { + want: + { + bundleName: 'com.example.third1', + abilityName: 'com.example.third1.MainAbility' + } + } + ) + sleep(TIMEOUT); + START_COUNT += 1; + console.debug('=======start ability result========' + result); + var records = await bundle.getModuleUsageRecords(NUM_TEN) + checkModuleUsageRecord(records, 'bms_getModuleUsageRecordTest_1400'); + var result = checkIsExist(records, BUNDLE_NAME); + expect(result).assertEqual(true); + if (result) { + let counts = new Map(); + console.debug('======LaunchedCount======' + START_COUNT); + for (let i = 0, length = records.length; i < length; i++) { + counts.set(records[i].bundleName, records[i].launchedCount); + console.debug('=============launchedCount is=========' + records[i].launchedCount); + } + expect(counts.get(BUNDLE_NAME)).assertEqual(START_COUNT); + } + done(); + setTimeout(function () { + console.debug('=====================bms_getModuleUsageRecordTest_1400==================end'); + }, TIMEOUT) + }) function checkModuleUsageRecord(data, caseName) { console.debug('======================check ModuleUsageRecord begin=========================='); console.debug(caseName + ' ==========record length is ========== ' + data.length); @@ -392,4 +556,10 @@ describe('ActsBmsModuleUsageRecordTest', function () { uninstall(bundleName); done(); }) + function sleep(delay) { + var start = (new Date()).getTime(); + while ((new Date()).getTime() - start < delay) { + continue; + } + } }) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js index c445c296381fa49d190bbc1ded8abe6a4f1bc26c..5a41087d00b9b58295c45154eacb99202b5b8cf9 100755 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js @@ -2402,8 +2402,8 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test install interfaces. */ it('install_0600', 0, async function (done) { - let data = await demo.getBundleInstaller() - await data.install([PATH + BMSJSTEST1], { + let installer = await demo.getBundleInstaller() + await installer.install([PATH + BMSJSTEST1], { param: { userId: 0, installFlag: 1, @@ -2417,18 +2417,18 @@ describe('ActsBundleManagerTest', function () { var datainfo1 = await demo.getBundleInfo(NAME1, 1); expect(datainfo1.name).assertEqual(NAME1); expect(datainfo1.uid).assertLarger(UIDMINVALUE); + await installer.uninstall(NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: true + } + }, async (err, data) => { + expect(typeof data).assertEqual(OBJECT); + expect(data.statusMessage).assertEqual("SUCCESS"); + done(); + }); } - await data.uninstall(NAME1, { - param: { - userId: 0, - installFlag: 1, - isKeepData: true - } - }, async (err, data) => { - expect(typeof data).assertEqual(OBJECT); - expect(data.statusMessage).assertEqual("SUCCESS"); - done(); - }); setTimeout(function () { console.info('====> install_0600 =====>') }, TIMEOUT) @@ -2451,8 +2451,8 @@ describe('ActsBundleManagerTest', function () { function OnReceiveinstallEvent(err, data) { expect(typeof data).assertEqual(OBJECT); expect(data.statusMessage).assertEqual("STATUS_INSTALL_FAILURE_INVALID"); - } - done(); + done(); + } }); setTimeout(function () { console.info('====> install_0700 =====>') diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/BUILD.gn b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/BUILD.gn similarity index 88% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/BUILD.gn rename to appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/BUILD.gn index e244dcb6447df0f9e15d22c46aad00918c380582..06c69b3149db875afa2f06226fbc88edf8cd6123 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/active/BUILD.gn +++ b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/BUILD.gn @@ -13,19 +13,19 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ActsAnsGetActiveTest") { +ohos_js_hap_suite("BmsCheckPermissionTest") { hap_profile = "./entry/src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetActiveTest" + hap_name = "BmsCheckPermissionTest" } 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" ] + sources = [ "./entry/src/main/resources" ] hap_profile = "./entry/src/main/config.json" } diff --git a/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/Test.json b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..7a88763ed8d2ac31dd30211b9574f47273e84549 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} diff --git a/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b9e35c8ed56a0412636cf5cbb44d05708e52c8b0 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/config.json @@ -0,0 +1,110 @@ +{ + "app": { + "bundleName": "com.example.bmscheckpermissiontest", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.bmscheckpermissiontest", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home", + "flag.home.intent.from.system" + ] + } + ], + "name": "com.example.bmscheckpermissiontest.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 + } + } + ], + "defPermissions": [ + { + "name": "com.permission.LOCATION_IN_BACKGROUND", + "grantMode": "user_grant", + "availableScope": [ + "signature" + ] + }, + { + "name": "com.permission.MICROPHONE", + "grantMode": "user_grant", + "availableScope": [ + "signature" + ] + } + ], + "reqPermissions": [ + { + "name": "com.permission.LOCATION_IN_BACKGROUND", + "reason": "Need LOCATION_IN_BACKGROUND", + "usedScene": { + "ability": [ + "com.example.bmscheckpermissiontest.MainAbility" + ], + "when": "always" + } + }, + { + "name": "com.permission.MICROPHONE", + "reason": "Need MICROPHONE", + "usedScene": { + "ability": [ + "com.example.bmscheckpermissiontest.MainAbility" + ], + "when": "always" + } + }, + { + "name": "com.permission.PERMISSION_THIRD1", + "reason": "Need PERMISSION_THIRD1", + "usedScene": { + "ability": [ + "com.example.bmscheckpermissiontest.MainAbility" + ], + "when": "always" + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..2ba842eda9d2f61221fca73dfb53c2a2903fc3e4 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * 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/getactive/getactivenormal/publish/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/i18n/en-US.json rename to appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/i18n/en-US.json diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/i18n/zh-CN.json rename to appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/i18n/zh-CN.json diff --git a/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..2db157715d20fdcbfda84c27f484b1df39b97547 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,23 @@ +.container { + display: flex; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; + flex-direction: column; +} +.log { + font-size: 20px; + text-align: center; + width: 100%; + height: 500px; +} + +.btn { + margin-top:20px; + width: 300px; + height: 100px; + border-width:5px; +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..75d22eb54968026d63a6aa2872b5d2d33fad4145 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,17 @@ +
+ + {{ title }} + +
+ +
+ + + + + + +
+ diff --git a/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..0e0d25bd3e8566a3f855fbd0536989233b3a852f --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,125 @@ +/* + * 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 featureAbility from '@ohos.ability.featureability' +import bundle from '@ohos.bundle' +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index' + +export default { + data: { + title: "checkPermission Test", + logmessage: "check permission test: \n" + }, + onInit() { + this.title = this.data.title; + this.logmessage = this.data.logmessage; + }, + onReady() { + }, + async requestPermissons() { + this.data.logmessage += 'requestPermissons\n' + console.debug("==========begin request permissions==========") + var context = await featureAbility.getContext(); + await context.requestPermissionsFromUser(["com.permission.PERMISSION_THIRD1", + "com.permission.LOCATION_IN_BACKGROUND", "com.permission.MICROPHONE"], 1, + (err, data) => { + console.log("RequestPermissionForUser:requestCode=" + data.requestCode); + for (var j = 0; j < data.permissions.length; j++) { + console.log("RequestPermissionForUser permissions : " + data.permissions[j]); + } + + for (var j = 0; j < data.grantResults.length; j++) { + console.log("RequestPermissionForUser grantResults : " + data.grantResults[j]); + } + }); + }, + + /* + * @tc.number: bms_checkPermission_1700 + * @tc.name: check whether the permission is granted + * @tc.desc: verify the requested permission whose availableScope is user_grant whether is granted. (by promise) + */ + async bms_checkPermission_1700() { + console.info('=====================bms_checkPermission_1700=================='); + var data = await bundle.checkPermission("com.example.bmscheckpermissiontest", + 'com.permission.LOCATION_IN_BACKGROUND') + if (data == 0) { + this.data.logmessage += 'bms_checkPermission_1700 result: PERMISSION_GRANTED\n' + } else { + this.data.logmessage += 'bms_checkPermission_1700 result: PERMISSION_NOT_GRANTED\n' + } + + }, + + /* + * @tc.number: bms_checkPermission_1800 + * @tc.name: check whether the permission is granted + * @tc.desc: verify the requested permission whose availableScope is user_grant whether is granted. (by callback) + */ + bms_checkPermission_1800() { + console.info('=====================bms_checkPermission_1800=================='); + bundle.checkPermission("com.example.bmscheckpermissiontest", 'com.permission.MICROPHONE', (err, data) => { + console.debug("======err code======:" + err.code); + console.debug("======result======:" + data); + if (data == 0 && err.code == 0) { + this.data.logmessage += 'bms_checkPermission_1800 result: PERMISSION_GRANTED\n' + } else { + this.data.logmessage += 'bms_checkPermission_1800 result: PERMISSION_NOT_GRANTED\n' + } + + }) + }, + /* + * @tc.number: bms_checkPermission_1900 + * @tc.name: check whether the permission is granted + * @tc.desc: Verify that permissions which availableScope is user_grant requested + * from other apps are granted. (by promise) + */ + async bms_checkPermission_1900() { + console.info('=====================bms_checkPermission_1900=================='); + var data = await bundle.checkPermission("com.example.bmscheckpermissiontest", + 'com.permission.PERMISSION_THIRD1') + if (data == 0) { + this.data.logmessage += 'bms_checkPermission_1900 result: PERMISSION_GRANTED\n' + } else { + this.data.logmessage += 'bms_checkPermission_1900 result: PERMISSION_NOT_GRANTED\n' + } + + }, + + /* + * @tc.number: bms_checkPermission_2000 + * @tc.name: check whether the permission is granted + * @tc.desc: Verify that permissions which availableScope is user_grant requested + * from other apps are granted. (by callback) + */ + bms_checkPermission_2000() { + console.info('=====================bms_checkPermission_2000=================='); + bundle.checkPermission("com.example.bmscheckpermissiontest", 'com.permission.PERMISSION_THIRD1', + (err, data) => { + console.debug("======err code======:" + err.code); + console.debug("======result======:" + data); + if (data == 0 && err.code == 0) { + this.data.logmessage += 'bms_checkPermission_2000 result: PERMISSION_GRANTED\n' + } else { + this.data.logmessage += 'bms_checkPermission_2000 result: PERMISSION_NOT_GRANTED\n' + } + + }) + }, + clearLog() { + this.data.logmessage = ""; + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/resources/base/element/string.json b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..34903b169b1f2f7d146e77a700ee1fbb56f632a1 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "bmscheckpermissiontest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/resources/base/media/icon.png b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/resources/base/media/icon.png rename to appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/entry/src/main/resources/base/media/icon.png diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/signature/openharmony_sx.p7b b/appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/signature/openharmony_sx.p7b similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/signature/openharmony_sx.p7b rename to appexecfwk/bundle_standard/bundlemanager/bmscheckpermissiontest/signature/openharmony_sx.p7b diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfifthscene/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfifthscene/src/main/config.json index 0d803354d45730869423c90c41583d9a8253d325..0dd1dbba6b1087fd7a324deafea5134aa5172cc6 100644 --- a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfifthscene/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfifthscene/src/main/config.json @@ -16,6 +16,7 @@ "module": { "package": "com.example.third5", "name": ".BmsThirdBundle5", + "mainAbility": "com.example.third5.AMainAbility", "deviceType": [ "phone" ], diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstscene/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstscene/src/main/config.json index 59ca1fcd466e5e0562ab0fb6266d9e6c989e815f..ca3c3c852a3009652421486376832bfebb3944fe 100644 --- a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstscene/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstscene/src/main/config.json @@ -130,6 +130,18 @@ "autoDesignWidth": false } } + ], + "defPermissions": [ + { + "name": "com.permission.PERMISSION_THIRD1", + "grantMode": "user_grant", + "availableScope": ["signature"] + }, + { + "name": "com.permission.PERMISSION_B", + "grantMode": "system_grant", + "availableScope": ["signature"] + } ] } } \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstsceneupdate/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstsceneupdate/src/main/config.json index dd6bd5b2a24a54639cba1f6ba628cb59b5664f72..bb7a30835b49430d1ed21673efff0196c5628c8f 100644 --- a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstsceneupdate/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstsceneupdate/src/main/config.json @@ -16,6 +16,7 @@ "module": { "package": "com.example.third1.entry", "name": "com.example.third1.BmsThirdBundle1", + "mainAbility": "com.example.third1.AMainAbility", "deviceType": [ "phone" ], diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/BUILD.gn b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/BUILD.gn similarity index 79% rename from notification/ans_standard/publish_test/subscribe/publishfirst/BUILD.gn rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/BUILD.gn index ed28c5922930e1dbcd73689afea11af69203d35f..cddeb119c6ff912d5c90c6e5136b864a81e8348c 100644 --- a/notification/ans_standard/publish_test/subscribe/publishfirst/BUILD.gn +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/BUILD.gn @@ -12,9 +12,9 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_hap("ActsAnsPublishOneTest") { - hap_profile = "./entry/src/main/config.json" - hap_name = "ActsAnsPublishOneTest" +ohos_hap("bmsThirdBundleC") { + hap_profile = "./src/main/config.json" + hap_name = "bmsThirdBundleC" subsystem_name = XTS_SUITENAME final_hap_path = "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" @@ -26,9 +26,9 @@ ohos_hap("ActsAnsPublishOneTest") { certificate_profile = "./signature/openharmony_sx.p7b" } ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" + source_dir = "./src/main/js/default" } ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" + sources = [ "./src/main/js/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/Test.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..7a88763ed8d2ac31dd30211b9574f47273e84549 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/signature/openharmony_sx.p7b b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/signature/openharmony_sx.p7b old mode 100644 new mode 100755 similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/sub/signature/openharmony_sx.p7b rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/signature/openharmony_sx.p7b diff --git a/notification/ans_standard/publishicontest/entry/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/config.json similarity index 76% rename from notification/ans_standard/publishicontest/entry/src/main/config.json rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/config.json index 730f1958ad069e7eb57b45e126249a8fa0fa518e..204f3547e3896eac6e719f27c1bed90486454cb8 100644 --- a/notification/ans_standard/publishicontest/entry/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/config.json @@ -1,61 +1,63 @@ -{ - "app": { - "bundleName": "com.example.actsansicontest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansicontest", - "name": ".actsansicontest", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsansicontest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } +{ + "app": { + "bundleName": "com.example.c", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.c", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": ".MainAbility", + "srcLanguage": "c++", + "srcPath": "default/c++/", + "visible": true, + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "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/getactive/getactivenormal/publish/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/app.js similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/app.js rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/app.js diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/i18n/en-US.json similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/i18n/en-US.json rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/i18n/en-US.json diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/i18n/zh-CN.json rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/i18n/zh-CN.json diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/pages/index/index.css similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/pages/index/index.css rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/pages/index/index.css diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/pages/index/index.hml similarity index 59% rename from notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/pages/index/index.hml rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/pages/index/index.hml index 0ac24eaf6f6b6e2b1ff1f01dc0c724b2692299c5..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/pages/index/index.hml +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/pages/index/index.hml @@ -1,5 +1,5 @@
- 订阅程序1启动 + {{ $t('strings.hello') }} {{ title }}
diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..23ac44c8d392bb6b777ebae8c8a6f17bfff13f83 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/default/pages/index/index.js @@ -0,0 +1,25 @@ +/* + * 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. + */ +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/resources/base/element/string.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/resources/base/element/string.json similarity index 79% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/resources/base/element/string.json rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/resources/base/element/string.json index a83a041be69ed1ded7913caee6fa1906315c41a0..41f425000199f5ca867b893a36deda040f221f4b 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/resources/base/element/string.json +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/resources/base/element/string.json @@ -2,7 +2,7 @@ "string": [ { "name": "app_name", - "value": "publish1" + "value": "ThirdJsTest" }, { "name": "mainability_description", diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/resources/base/media/icon.png b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/resources/base/media/icon.png rename to appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/js/resources/base/media/icon.png diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosjsscene/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosjsscene/src/main/config.json index 10cfb165b6495c7e0356fef31a609d94c8fb0b7f..c809446189fac9bfc720be8648df657dd4bc15f6 100644 --- a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosjsscene/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosjsscene/src/main/config.json @@ -38,6 +38,7 @@ ], "name": ".MainAbility", "srcLanguage": "js", + "srcPath": "default", "visible": true, "icon": "$media:icon", "description": "$string:mainability_description", diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystem/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystem/src/main/config.json index 8b8f7212301588fa26bd9a3e90ded8bb65c34745..1a90440f69b5dabbea01f3f90c68276ecc94b4f0 100644 --- a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystem/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystem/src/main/config.json @@ -16,6 +16,7 @@ "module": { "package": "com.example.system1", "name": ".BmsSystemBundle1", + "mainAbility": "com.example.system1.MainAbility", "deviceType": [ "phone" ], diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenevendor/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenevendor/src/main/config.json index ad832022b1efc307921ac0f24ff1dd1cec2cc11c..78a39dd60b91b726f6ed07f7e7cb6fca91c41e5b 100644 --- a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenevendor/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenevendor/src/main/config.json @@ -90,19 +90,21 @@ "launchType": "standard", "metaData": { "parameters": [{ - "name": "Data1V", + "name": "Data1V0", "type": "float", "description": "$string:mainability_description" - }], + }, + { + "name": "Data1V1", + "type": "float", + "description": "$string:mainability_description" + }], "results": [{ "name": "Data1V", "type": "float", "description": "$string:mainability_description" }], - "customizeData": [{ - "name": "Data1V", - "value": "float", - "extra": "$string:mainability_description" + "customizeData": [{ }] } } diff --git a/notification/ans_standard/BUILD.gn b/notification/ans_standard/BUILD.gn index add0de8ff645f2d5250e7becb6f1caec2d95da27..9c176177fab3bf855c80998e8b44d3f5c9135d86 100644 --- a/notification/ans_standard/BUILD.gn +++ b/notification/ans_standard/BUILD.gn @@ -20,7 +20,6 @@ group("ans_standard") { #"actsansnotificationremove:ActsAnsNotificationRemove", "actsansslottest:ActsAnsSlotTest", "publish_test:publish_test", - "publishicontest:ActsAnsIconTest", ] } } diff --git a/notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js b/notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js index bacd6ad9ba1d6f650732f95868862578f5d3a75e..08ab9cf3c49723e87cec928154bc96141cfb9ae4 100644 --- a/notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js +++ b/notification/ans_standard/actsansnotificationcancel/entry/src/main/js/test/ActsAnsNotificationCancel.test.js @@ -251,12 +251,12 @@ describe('ActsAnsNotificationCancel', function () { function onConsumeCancelAllNoNotify(err, data) { console.info("================onConsume_cancelAll_noNotify_0300=======================>"); console.info("================onConsume_0300 data: =======================>" + JSON.stringify(data)); - expect(1).assertequal(0); + expect().assertFail(); console.info("================onConsume_cancelAll_noNotify_0300 end=======================>"); } function onCancelCancelAllNoNotify(err, data) { console.info("=================onCancel_cancelAll_0300=======================>"); - expect(1).assertequal(0); + expect().assertFail(); console.info("================onCancel_0300 data : =======================>" + JSON.stringify(data)); console.info("================onCancel_0300 err : =======================>" + JSON.stringify(err)); console.info("================onCancel_0300 end=======================>"); @@ -297,14 +297,14 @@ describe('ActsAnsNotificationCancel', function () { function onConsumeCancelAllNoNotifyPromise(err, data) { console.info("================onConsume_cancelAll_noNotify_promise_0400=======================>"); console.info("================onConsume_promise_0400 data: =======================>" + JSON.stringify(data)); - expect(1).assertequal(0); + expect().assertFail(); console.info("================onConsume_promise_0400 end=======================>"); } function onCancelCancelAllNoNotifyPromise(err, data) { console.info("===============onCancel_cancelAll_noNotify_promise_0400=======================>"); console.info("===============onCancel_promise_0400 data=================>" + JSON.stringify(data)); console.info("===============onCancel_promise_0400 err=====================>" + JSON.stringify(err)); - expect(1).assertequal(0); + expect().assertFail(); console.info("===============onCancel_cancelAll_noNotify_promise_0400 end=======================>"); } diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/entry/src/main/js/test/ExampleJsunit.test.js index 09fb5edb0c952e6ce4d3a24396c34bfb7c3d4d72..c1045df743476c43c6e52d6166c3f74fc7faf48d 100755 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/entry/src/main/js/test/ExampleJsunit.test.js +++ b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/entry/src/main/js/test/ExampleJsunit.test.js @@ -72,8 +72,12 @@ describe('ActsAnsGetSlotTestCallback', function () { expect(data.sound).assertEqual(""); expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); - console.debug("====>getSlotActsAnsGetSlotTestCallback_0100 finish====>"); - done(); + console.debug("====>getSlot ActsAnsGetSlotTestCallback_0100 finish====>"); + notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ + console.debug("====>removeSlot SOCIAL_COMMUNICATION enter====>"); + expect(err.code).assertEqual(0); + done(); + }) }); setTimeout(function(){ console.debug("====>time out ActsAnsGetSlotTestCallback_0100====>"); @@ -103,7 +107,11 @@ describe('ActsAnsGetSlotTestCallback', function () { expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); console.debug("====>getSlotActsAnsGetSlotTestCallback_0200 finish====>"); - done(); + notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ + console.debug("====>removeSlot SERVICE_INFORMATION enter====>"); + expect(err.code).assertEqual(0); + done(); + }) } console.debug("====>addSlot SlotType.SERVICE_INFORMATION: ====>"); await notification.addSlot(notification.SlotType.SERVICE_INFORMATION, addSlotActsAnsGetSlotTestCallbackSecond); @@ -137,7 +145,11 @@ describe('ActsAnsGetSlotTestCallback', function () { expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); console.debug("====>getSlotActsAnsGetSlotTestCallback_0300 finish====>"); - done(); + notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ + console.debug("====>removeSlot CONTENT_INFORMATION enter====>"); + expect(err.code).assertEqual(0); + done(); + }) } console.debug("====>addSlot SlotType.CONTENT_INFORMATION: ====>"); await notification.addSlot(notification.SlotType.CONTENT_INFORMATION, addSlotActsAnsGetSlotTestCallbackThird); @@ -171,7 +183,11 @@ describe('ActsAnsGetSlotTestCallback', function () { expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); console.debug("====>getSlotActsAnsGetSlotTestCallback_0400 finish====>"); - done(); + notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ + console.debug("====>removeSlot OTHER_TYPES enter====>"); + expect(err.code).assertEqual(0); + done(); + }) } console.debug("====>addSlot SlotType.OTHER_TYPES: ====>"); await notification.addSlot(notification.SlotType.OTHER_TYPES, addSlotActsAnsGetSlotTestCallbackFourth); @@ -205,7 +221,11 @@ describe('ActsAnsGetSlotTestCallback', function () { expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); console.debug("====>getSlotActsAnsGetSlotTestCallback_0500 finish====>"); - done(); + notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ + console.debug("====>removeSlot OTHER_TYPES enter====>"); + expect(err.code).assertEqual(0); + done(); + }) } console.debug("====>addSlot SlotType.UNKNOWN_TYPE: ====>"); await notification.addSlot(notification.SlotType.UNKNOWN_TYPE, addSlotActsAnsGetSlotTestCallbackFifth); @@ -215,4 +235,4 @@ describe('ActsAnsGetSlotTestCallback', function () { console.debug("====>time out ActsAnsGetSlotTestCallback_0500====>"); }, 1000); }) -}) \ No newline at end of file +}) \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/entry/src/main/js/test/ExampleJsunit.test.js index 52d839f55eaaea90f0bc557f7851e33a3da1d8c1..c22d1875f5df6ef5886422761b171bf2caa649e3 100755 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/entry/src/main/js/test/ExampleJsunit.test.js +++ b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/entry/src/main/js/test/ExampleJsunit.test.js @@ -42,7 +42,11 @@ describe('ActsAnsGetSlotTestPromise', function () { expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); console.debug("====>getSlotActsAnsGetSlotTestPromise_0100 finish====>"); - done(); + notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ + console.debug("====>removeSlot SOCIAL_COMMUNICATION enter====>"); + expect(err.code).assertEqual(0); + done(); + }) }) console.debug("====>ActsAnsGetSlotTestPromise_0100 end====>"); setTimeout(function(){ @@ -75,7 +79,11 @@ describe('ActsAnsGetSlotTestPromise', function () { expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); console.debug("====>getSlotPromise SERVICE_INFORMATION ActsAnsGetSlotTestPromise_0200 finish====>"); - done(); + notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ + console.debug("====>removeSlot SERVICE_INFORMATION enter====>"); + expect(err.code).assertEqual(0); + done(); + }) }) console.debug("====>ActsAnsGetSlotTestPromise_0200 end====>"); setTimeout(function(){ @@ -109,7 +117,11 @@ describe('ActsAnsGetSlotTestPromise', function () { expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); console.debug("====>getSlotPromise CONTENT_INFORMATION ActsAnsGetSlotTestPromise_0300 finish====>"); - done(); + notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ + console.debug("====>removeSlot CONTENT_INFORMATION enter====>"); + expect(err.code).assertEqual(0); + done(); + }) }) console.info("====>ActsAnsGetSlotTestPromise_0300 end====>"); setTimeout(function(){ @@ -143,7 +155,11 @@ describe('ActsAnsGetSlotTestPromise', function () { expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); console.debug("====>getSlotPromise OTHER_TYPES ActsAnsGetSlotTestPromise_0400 finish====>"); - done(); + notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ + console.debug("====>removeSlot OTHER_TYPES enter====>"); + expect(err.code).assertEqual(0); + done(); + }) }) console.debug("====>ActsAnsGetSlotTestPromise_0400 end====>"); setTimeout(function(){ @@ -177,7 +193,11 @@ describe('ActsAnsGetSlotTestPromise', function () { expect(data.lightEnabled).assertEqual(false); expect(data.lightColor).assertEqual(0); console.debug("====>getSlotPromise UNKNOWN_TYPE ActsAnsGetSlotTestPromise_0500 finish====>"); - done(); + notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ + console.debug("====>removeSlot OTHER_TYPES enter====>"); + expect(err.code).assertEqual(0); + done(); + }) }) console.debug("====>ActsAnsGetSlotTestPromise_0500 end====>"); setTimeout(function(){ diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/Test.json b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/Test.json index 89343b335270eb0e18dc9f99da2d9ae58c370a1b..4b45c096602f21bcbc483f800f29a03daf431427 100755 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/Test.json +++ b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/Test.json @@ -2,7 +2,7 @@ "description": "Configuration for hjunit demo Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "60000", "package": "com.example.actsansslotsystemcallback", "shell-timeout": "60000" }, diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/entry/src/main/js/test/ExampleJsunit.test.js index 1e18628d2a31ca437fd7e9283baf45d69c1610fb..8cbbee37c47dcba3931027c5c34d5d48f2716b14 100755 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/entry/src/main/js/test/ExampleJsunit.test.js +++ b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/entry/src/main/js/test/ExampleJsunit.test.js @@ -19,8 +19,8 @@ describe('ActsAnsSlotSystemCallback', function () { /* * @tc.number : ActsAnsSlotSystemCallback_0100 - * @tc.name : Verify getSlots after adding slots and removeSlot - * @tc.desc : getSlots after adding all type slots and removing slot + * @tc.name : Verify getSlots after adding slots and removeAllSlots + * @tc.desc : getSlots after adding all type slots and remove all slots */ it('ActsAnsSlotSystemCallback_0100', 0, async function (done) { console.debug("====>ActsAnsSlotSystemCallback_0100 start====>"); @@ -159,9 +159,9 @@ describe('ActsAnsSlotSystemCallback', function () { expect(data[3].lightEnabled).assertEqual(true); expect(data[3].lightColor).assertEqual(4); console.debug("====>getSlots end====>"); - console.debug("====>ActsAnsSlotSystemCallback_0100 end====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot ActsAnsSlotSystemCallback_0100 err====>" + JSON.stringify(err)); + notification.removeAllSlots((err)=>{ + console.debug("====>removeAllSlots ActsAnsSlotSystemCallback_0100 err====>" + JSON.stringify(err)); + console.debug("====>ActsAnsSlotSystemCallback_0100 end====>"); expect(err.code).assertEqual(0); done(); }) @@ -170,7 +170,7 @@ describe('ActsAnsSlotSystemCallback', function () { expect().assertFail(); } }) - setTimeout(timeOut, 10000); + setTimeout(timeOut, 2000); }) /* @@ -230,9 +230,13 @@ describe('ActsAnsSlotSystemCallback', function () { expect(data.lightEnabled).assertEqual(true); expect(data.lightColor).assertEqual(1); console.debug("====>getSlotActsAnsSlotSystemCallback_0200 finish====>"); - console.debug("====>ActsAnsSlotSystemCallback_0200 end====>"); - done(); + notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ + console.debug("====>removeSlot SOCIAL_COMMUNICATION err====>" + JSON.stringify(err)); + console.debug("====>ActsAnsSlotSystemCallback_0200 end====>"); + expect(err.code).assertEqual(0); + done(); + }) }) - setTimeout(timeOutTwo, 10000); + setTimeout(timeOutTwo, 2000); }) }) \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/Test.json b/notification/ans_standard/actsansslottest/actsansslotsystempromise/Test.json index 4faaf4430610f95852e2fcc5ec1f9eafbcc89aa0..affaa959951dc57c442efb8cfd24434e9381e363 100755 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/Test.json +++ b/notification/ans_standard/actsansslottest/actsansslotsystempromise/Test.json @@ -2,7 +2,7 @@ "description": "Configuration for hjunit demo Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "180000", + "test-timeout": "60000", "package": "com.example.actsansslotsystempromise", "shell-timeout": "60000" }, diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansslotsystempromise/entry/src/main/js/test/ExampleJsunit.test.js index acbae78c837b2028c7f817c606c1b2ebefefbe02..1d6cb4b7f2a9c3d8f4484feffa38d82be74ed96b 100755 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/entry/src/main/js/test/ExampleJsunit.test.js +++ b/notification/ans_standard/actsansslottest/actsansslotsystempromise/entry/src/main/js/test/ExampleJsunit.test.js @@ -191,12 +191,16 @@ describe('ActsAnsSlotSystemPromise', function () { expect(data.lightEnabled).assertEqual(true); expect(data.lightColor).assertEqual(2); console.debug("====>getSlotPromise SERVICE_INFORMATION ActsAnsSlotSystemPromise_0100 finish====>"); - done(); + notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ + console.debug("====>removeSlot SERVICE_INFORMATION err====>" + JSON.stringify(err)); + console.debug("====>ActsAnsSlotSystemPromise_0100 end====>"); + expect(err.code).assertEqual(0); + done(); + }) }) - console.debug("====>ActsAnsSlotTestSystem_0100 end====>"); setTimeout(function (){ console.debug("====>time out ActsAnsSlotTestSystem_0100====>"); - }, 10000); + }, 2000); }) @@ -240,8 +244,8 @@ describe('ActsAnsSlotSystemPromise', function () { }) console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION: ====>"); notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION).then((data) => { - console.debug("====>getSlotActsAnsSlotSystemPromise_0200 enter====>"); - console.debug("====>getSlotActsAnsSlotSystemPromise_0200 data====>" + JSON.stringify(data)); + console.debug("====>getSlot ActsAnsSlotSystemPromise_0200 enter====>"); + console.debug("====>getSlot ActsAnsSlotSystemPromise_0200 data====>" + JSON.stringify(data)); expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); expect(data.level).assertEqual(notification.SlotLevel.LEVEL_NONE); expect(data.desc).assertEqual("slot_SOCIAL_COMMUNICATION_Desc_First"); @@ -251,12 +255,16 @@ describe('ActsAnsSlotSystemPromise', function () { expect(data.sound).assertEqual("slot_SOCIAL_COMMUNICATION_Sound_First"); expect(data.lightEnabled).assertEqual(true); expect(data.lightColor).assertEqual(1); - console.debug("====>getSlotActsAnsSlotSystemPromise_0200 finish====>"); - done(); + console.debug("====>getSlot ActsAnsSlotSystemPromise_0200 finish====>"); + notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ + console.debug("====>removeSlot SOCIAL_COMMUNICATION err====>" + JSON.stringify(err)); + console.debug("====>ActsAnsSlotSystemPromise_0200 end====>"); + expect(err.code).assertEqual(0); + done(); + }) }) - console.debug("====>ActsAnsSlotSystemPromise_0200 end====>"); setTimeout(function (){ console.debug("====>time out ActsAnsSlotSystemPromise_0200====>"); - }, 10000); + }, 2000); }) }) \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/Test.json b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/Test.json index d192e65c6fd06254998eda4d3848e0055af12072..2325780daf1d89da874936f208cc9ddcf6a22fb3 100755 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/Test.json +++ b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/Test.json @@ -2,9 +2,9 @@ "description": "Configuration for hjunit demo Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "150000", + "test-timeout": "60000", "package": "com.example.actsansslotaddremoveall", - "shell-timeout": "150000" + "shell-timeout": "60000" }, "kits": [ { diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplayfive/entry/src/main/js/test/BadgeDisplay.js b/notification/ans_standard/publish_test/badgedisplayed/badgedisplayfive/entry/src/main/js/test/BadgeDisplay.js index a19d807cb042b4418a971d0f48ac5f10a33dc3b2..20bec55557db5899469ac52ec22d03ec273c7730 100644 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplayfive/entry/src/main/js/test/BadgeDisplay.js +++ b/notification/ans_standard/publish_test/badgedisplayed/badgedisplayfive/entry/src/main/js/test/BadgeDisplay.js @@ -42,10 +42,11 @@ describe('ActsAnsBadgeDisplayFiveTest', function () { * @tc.desc: verify the function of displayBadge */ it('ActsBadgeDisplay_test_1000', 0, async function (done) { - await notify.displayBadge( + var promise = await notify.displayBadge( { bundle:"com.example.actsanslocalcandisplaytest" - },"").then(console.log("====>ActsBadgeDisplay_test_1000 success====>")) + },"") + expect(promise).assertEqual(undefined) done(); setTimeout(function(){ console.debug("====>time out ActsBadgeDisplay_test_1000====>"); diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplayfour/entry/src/main/js/test/BadgeDisplay.js b/notification/ans_standard/publish_test/badgedisplayed/badgedisplayfour/entry/src/main/js/test/BadgeDisplay.js index 9e157f7b9c3e39777fa2e037583e7b8b130303f6..0f25281666081216ea4fc9159918bd253c5ab0c2 100644 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplayfour/entry/src/main/js/test/BadgeDisplay.js +++ b/notification/ans_standard/publish_test/badgedisplayed/badgedisplayfour/entry/src/main/js/test/BadgeDisplay.js @@ -42,10 +42,11 @@ describe('ActsAnsBadgeDisplayFourTest', function () { * @tc.desc: verify the function of displayBadge */ it('ActsBadgeDisplay_test_0800', 0, async function (done) { - await notify.displayBadge( + var promise = await notify.displayBadge( { bundle:"com.example.actsanslocalcandisplaytest" - },100).then(console.log("====>ActsBadgeDisplay_test_0800 success====>")) + },100) + expect(promise).assertEqual(undefined) done(); setTimeout(function(){ console.debug("====>time out ActsBadgeDisplay_test_0800====>"); diff --git a/notification/ans_standard/publish_test/badgedisplayedset/badgedisplaysetfive/entry/src/main/js/test/BadgeDisplay.js b/notification/ans_standard/publish_test/badgedisplayedset/badgedisplaysetfive/entry/src/main/js/test/BadgeDisplay.js index ce87740e6785bd3cfd7278f2e5f6a050a1c56ba1..38d0b2ee60a8fe49b50f8d4ab210c4e0fea034d7 100644 --- a/notification/ans_standard/publish_test/badgedisplayedset/badgedisplaysetfive/entry/src/main/js/test/BadgeDisplay.js +++ b/notification/ans_standard/publish_test/badgedisplayedset/badgedisplaysetfive/entry/src/main/js/test/BadgeDisplay.js @@ -42,10 +42,11 @@ describe('ActsAnsBadgeDisplaySetFiveTest', function () { * @tc.desc: verify the function of displayBadge */ it('ActsBadgeDisplaySet_test_1000', 0, async function (done) { - await notify.displayBadge( + var promise = await notify.displayBadge( { bundle:"com.example.actsanslocalcandisplaytest" - },"").then(console.log("====>ActsBadgeDisplaySet_test_1000 success====>")) + },"") + expect(promise).assertEqual(undefined) done(); setTimeout(function(){ console.debug("====>time out ActsBadgeDisplaySet_test_1000====>"); diff --git a/notification/ans_standard/publish_test/badgedisplayedset/badgedisplaysetfour/entry/src/main/js/test/BadgeDisplay.js b/notification/ans_standard/publish_test/badgedisplayedset/badgedisplaysetfour/entry/src/main/js/test/BadgeDisplay.js index a3381bf8dca81f93d69389e29186fc4c507cd481..1b37e730a0e34378c20415ba2aa44cd880a64845 100644 --- a/notification/ans_standard/publish_test/badgedisplayedset/badgedisplaysetfour/entry/src/main/js/test/BadgeDisplay.js +++ b/notification/ans_standard/publish_test/badgedisplayedset/badgedisplaysetfour/entry/src/main/js/test/BadgeDisplay.js @@ -42,10 +42,11 @@ describe('ActsAnsBadgeDisplaySetFourTest', function () { * @tc.desc: verify the function of displayBadge */ it('ActsBadgeDisplaySet_test_0800', 0, async function (done) { - await notify.displayBadge( + var promise = await notify.displayBadge( { bundle:"com.example.actsanslocalcandisplaytest" - },100).then(console.log("====>ActsBadgeDisplaySet_test_0800 success====>")) + },100) + expect(promise).assertEqual(undefined) done(); setTimeout(function(){ console.debug("====>time out ActsBadgeDisplaySet_test_0800====>"); diff --git a/notification/ans_standard/publish_test/getactive/BUILD.gn b/notification/ans_standard/publish_test/getactive/BUILD.gn index c197203201f27bd338a798fa293ab5ee021c055c..423ed662f775ac5d28437d9f64d69b5bd37c7868 100644 --- a/notification/ans_standard/publish_test/getactive/BUILD.gn +++ b/notification/ans_standard/publish_test/getactive/BUILD.gn @@ -17,7 +17,7 @@ group("getactive") { testonly = true if (is_standard_system) { deps = [ - #"getactivenormal:getactivenormal", + #"getactivenormal:ActsAnsActiveTest", #"getcancelactivenum:ActsAnsGetCancelActiveNumTest", ] } diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/.gitignore b/notification/ans_standard/publish_test/getactive/getactivenormal/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..82dc42bd41e44f0a17e007c62feabac9a3f35d72 --- /dev/null +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +/entry/.preview +.cxx diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/.gitignore b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..eaf91e2ac647df635a09f01b8a2a254252aae8d7 --- /dev/null +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/compiler.xml b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/compiler.xml new file mode 100644 index 0000000000000000000000000000000000000000..245a82c8279131bde0c8c09a1f1791c8b0312984 --- /dev/null +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/gradle.xml b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/gradle.xml new file mode 100644 index 0000000000000000000000000000000000000000..c848cf9e3b543d3cc2089b7ea3ddf4ed6abda171 --- /dev/null +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/gradle.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/jarRepositories.xml b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/jarRepositories.xml new file mode 100644 index 0000000000000000000000000000000000000000..aa00d771aa98b60cc8db06b5e24919c06b208cda --- /dev/null +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/misc.xml b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..9883d055f8725da2d0f5c1cecc525b815e5dfcec --- /dev/null +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/BUILD.gn b/notification/ans_standard/publish_test/getactive/getactivenormal/BUILD.gn index ca554d8372d5fca0164f751bbae2b984cd829c0e..a4bbd35fcd1d4fb6568c18d870ca81f8a047f5e6 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/BUILD.gn +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/BUILD.gn @@ -13,14 +13,19 @@ import("//test/xts/tools/build/suite.gni") -group("getactivenormal") { - testonly = true - if (is_standard_system) { - deps = [ - "active:ActsAnsGetActiveTest", - - #"sub:ActsAnsActiveSubscriberTest", - "publish:ActsAnsActivePublishTest", - ] - } +ohos_js_hap_suite("ActsAnsActiveTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAnsActiveTest" +} +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/subscribe/publishsecond/Test.json b/notification/ans_standard/publish_test/getactive/getactivenormal/Test.json similarity index 66% rename from notification/ans_standard/publish_test/subscribe/publishsecond/Test.json rename to notification/ans_standard/publish_test/getactive/getactivenormal/Test.json index 9c9a3aabb09bcb217240f053b152e5b4d300849c..66dfea3f6917780cef8b7508c2461358ed574764 100644 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/Test.json +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/Test.json @@ -3,13 +3,13 @@ "driver": { "type": "JSUnitTest", "test-timeout": "60000", - "package": "com.example.actsanspublishtwotest", - "shell-timeout": "60000" + "package": "com.example.actsansactivetest", + "shell-timeout": "21600000" }, "kits": [ { "test-file-name": [ - "ActsAnsPublishTwoTest.hap" + "ActsAnsActiveTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/test/GetActiveInfo.test.js b/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/test/GetActiveInfo.test.js deleted file mode 100644 index f213c1ae0f209869689acff513d8da3cf26e52e0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/test/GetActiveInfo.test.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -var time = 1000 -describe('ActsAnsGetActiveTest', function () { - console.info("===ActsSubscriberTest start===>"); - - /* - * @tc.number: ActsActive_test_0100 - * @tc.name: getAllActiveNotifications() - * @tc.desc: verify the function of getAllActiveNotifications - */ - it('ActsActive_test_0100', 0, async function (done) { - await notify.getAllActiveNotifications((error, data) => { - console.log("===>getAllActiveNotifications1===>" + data) - expect(typeof(data)).assertEqual('object') - for (let i = 0; i < data.length; i++) { - console.log("===>getAllActiveNotificationshashCode1===>" + data[i].hashCode) - console.log("===>getAllActiveNotificationsid1===>" + data[i].id) - console.log("===>getAllActiveNotificationslotType1===>" + data[i].slotType) - console.log("===>getAllActiveNotificationclassification1===>" + data[i].classification) - console.log("===>getAllActiveNotificationsortingKey1===>" + data[i].sortingKey) - console.log("===>getAllActiveNotificationscontentType1===>" + data[i].content.contentType) - console.log("===>getAllActiveNotificationstitle1===>" + data[i].content.normal.title) - console.log("===>getAllActiveNotificationstext1===>" + data[i].content.normal.text) - console.log("===>getAllActiveNotificationsadditionalText1===>" + data[i].content.normal.additionalText) - } - }) - - var promise = await notify.getAllActiveNotifications() - expect(typeof(promise)).assertEqual('object') - for (let i = 0; i < promise.length; i++) { - console.log("===>getAllActiveNotificationsPromisehashCode1===>" + promise[i].hashCode) - console.log("===>getAllActiveNotificationsPromiseid1===>" + promise[i].id) - console.log("===>getAllActiveNotificationsPromiseslotType1===>" + promise[i].slotType) - console.log("===>getAllActiveNotificationsPromiseclassification1===>" + promise[i].classification) - console.log("===>getAllActiveNotificationsPromisesortingKey1===>" + promise[i].sortingKey) - console.log("===>getAllActiveNotificationsPromisecontentType1===>" + promise[i].content.contentType) - console.log("===>getAllActiveNotificationsPromisetitle1===>" + promise[i].content.normal.title) - console.log("===>getAllActiveNotificationsPromisetext1===>" + promise[i].content.normal.text) - console.log("===>getAllActiveNotificationsPromiseadditionalText1===>" + promise[i].content.normal.additionalText) - } - done(); - setTimeout(function(){ - console.debug("====>time out ActsActive_test_0100====>"); - }, time); - }) -}) - diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/entry/.gitignore b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3543521e9fef8e7322940a87c2b45dd0061b0f45 --- /dev/null +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/config.json b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/config.json similarity index 86% rename from notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/config.json rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/config.json index 9bf183d7a4a4eb2ec516cff973502446efe42fd9..e9e0378539f0aa38e7ea3fdb55589d2e15f91ff2 100644 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/config.json +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.actsanspublishtwotest", + "bundleName": "com.example.actsansactivetest", "vendor": "example", "version": { "code": 1, @@ -14,7 +14,7 @@ }, "deviceConfig": {}, "module": { - "package": "com.example.actsanspublishtwotest", + "package": "com.example.actsansactivetest", "name": ".MyApplication", "deviceType": [ "phone" @@ -36,7 +36,7 @@ ] } ], - "name": "com.example.actsanspublishtwotest.MainAbility", + "name": "com.example.actsansactivetest.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", @@ -59,4 +59,4 @@ } ] } -} +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/app.js similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/app.js rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/app.js diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/i18n/en-US.json rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/i18n/en-US.json diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/i18n/zh-CN.json rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/i18n/zh-CN.json diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/default/pages/index/index.css rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/pages/index/index.css diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/pages/index/index.hml similarity index 71% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/pages/index/index.hml rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/pages/index/index.hml index 8e5bbd698cf7316754b1666319656dfd7bae644f..4ebf4a3ed6e61257d32e6b5bddb74805068415c8 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/pages/index/index.hml +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/pages/index/index.hml @@ -1,5 +1,5 @@
- active程序启动 + active
diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/default/pages/index/index.js rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/default/pages/index/index.js diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/js/resources/base/element/string.json rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/resources/base/element/string.json diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/resources/base/media/icon.png rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/resources/base/media/icon.png diff --git a/notification/ans_standard/publishicontest/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/test/List.test.js similarity index 94% rename from notification/ans_standard/publishicontest/entry/src/main/js/test/List.test.js rename to notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/test/List.test.js index f6a0c80457aa4bd78d0066b7ca6c3dcbcd08b773..0be04f26cd91ad114e80c825772636defa682ebf 100644 --- a/notification/ans_standard/publishicontest/entry/src/main/js/test/List.test.js +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/test/List.test.js @@ -12,4 +12,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./Icon.js') \ No newline at end of file +require('./active.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/test/active.js b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/test/active.js new file mode 100644 index 0000000000000000000000000000000000000000..9c851efb9f497890bfb4444f3852802246c2fd80 --- /dev/null +++ b/notification/ans_standard/publish_test/getactive/getactivenormal/entry/src/main/js/test/active.js @@ -0,0 +1,172 @@ +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +var time = 1000 +describe('ActsAnsActiveTest', function () { + console.info("===========ActsAnsActiveTest start====================>"); + + //consume + async function consumeCallback(err, data) { + console.debug("==========================>consumeCallback data : =======================>" + JSON.stringify(data)); + await notify.getAllActiveNotifications((error, data) => { + console.log("==========================>getAllActiveNotifications1=======================>" + data) + expect(typeof(data)).assertEqual('object') + for (let i = 0; i < data.length; i++) { + console.log("==========================>getAllActiveNotificationshashCode1=======================>" + data[i].hashCode) + console.log("==========================>getAllActiveNotificationsid1=======================>" + data[i].id) + console.log("==========================>getAllActiveNotificationslotType1=======================>" + data[i].slotType) + console.log("==========================>getAllActiveNotificationclassification1=======================>" + data[i].classification) + console.log("==========================>getAllActiveNotificationsortingKey1=======================>" + data[i].sortingKey) + console.log("==========================>getAllActiveNotificationscontentType1=======================>" + data[i].content.contentType) + console.log("==========================>getAllActiveNotificationstitle1=======================>" + data[i].content.normal.title) + console.log("==========================>getAllActiveNotificationstext1=======================>" + data[i].content.normal.text) + console.log("==========================>getAllActiveNotificationsadditionalText1=======================>" + data[i].content.normal.additionalText) + } + }) + + var notificationInfo = await notify.getAllActiveNotifications() + expect(typeof(notificationInfo)).assertEqual('object') + for (let i = 0; i < notificationInfo.length; i++) { + console.log("==========================>getAllActiveNotificationsPromisehashCode1=======================>" + notificationInfo[i].hashCode) + console.log("==========================>getAllActiveNotificationsPromiseid1=======================>" + notificationInfo[i].id) + console.log("==========================>getAllActiveNotificationsPromiseslotType1=======================>" + notificationInfo[i].slotType) + console.log("==========================>getAllActiveNotificationsPromiseclassification1=======================>" + notificationInfo[i].classification) + console.log("==========================>getAllActiveNotificationsPromisesortingKey1=======================>" + notificationInfo[i].sortingKey) + console.log("==========================>getAllActiveNotificationsPromisecontentType1=======================>" + notificationInfo[i].content.contentType) + console.log("==========================>getAllActiveNotificationsPromisetitle1=======================>" + notificationInfo[i].content.normal.title) + console.log("==========================>getAllActiveNotificationsPromisetext1=======================>" + notificationInfo[i].content.normal.text) + console.log("==========================>getAllActiveNotificationsPromiseadditionalText1=======================>" + notificationInfo[i].content.normal.additionalText) + } + } + //subscribeOn + function subscribeOnCallback(err) { + console.debug("==========================>subscribeOnCallback=======================>"); + } + //subscribe + function subscribeCallback(err) { + console.debug("==========================>subscribeCallback=======================>"); + } + function publishCallback001(){ + console.log('ActsNotificationTest ACTS_Publish_0100 asyncCallback') + } + + /* + * @tc.number: ActsWantAgent_test_0100 + * @tc.name: createSubscriber(),subscribe() + * @tc.desc: verify the function of createSubscriber,subscribe + */ + it('ActsActiveSubscriber_test_0100', 0, async function (done) { + console.debug("===============ActsWantAgent_test_0100======begin====================>"); + + var subInfo ={ + onConsume:consumeCallback, + onConnect:subscribeOnCallback, + } + try{ + await notify.subscribe(subInfo,subscribeCallback); + }catch(err) { + console.error('=ActsActiveSubscriber_test_0100 订阅 subscribeCallback err:'+err); + } + console.debug("===============ActsActiveSubscriber_test_0100=======end===================>"); + done(); + setTimeout(function(){ + console.debug("====>time out ActsActiveSubscriber_test_0100====>"); + }, time); + }) + + /* + * @tc.number: ACTS_GetActiveNumTest_0100 + * @tc.name: getActiveNotifications(),getActiveNotificationNums() + * @tc.desc: verify the function of getActiveNotifications,getActiveNotificationNums + */ + it('ACTS_GetActiveNumTest_0100', 0,async function (done) { + await notify.publish({ + id: 1, + content: { + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test1_title", + text: "test1_text", + additionalText: "test1_additionalText" + }, + }, + slotType:notify.SlotType.SOCIAL_COMMUNICATION, + classification:"classification1", + sortingKey:"sortingKey1", + },publishCallback001); + await notify.publish({ + id: 2, + content: { + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test2_title", + text: "test2_text", + additionalText: "test2_additionalText" + }, + }, + slotType:notify.SlotType.SOCIAL_COMMUNICATION, + classification:"classification2", + sortingKey:"sortingKey2", + },publishCallback001); + + await notify.getActiveNotifications( + (error,data) => { + console.log("============PublishgetActiveNotificationsTest1============"+data) + expect(typeof(data)).assertEqual('object') + for (let i = 0; i < data.length; i++) { + console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].hashCode) + console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].id) + console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].classification) + console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].sortingKey) + console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].slotType) + console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].content.contentType) + console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].content.normal.title) + console.log("==========================>PublishgegetAllActiveNotifications1tActiveNotificationsTest1=======================>" + data[i].content.normal.text) + console.log("==========================>PublishgetActiveNotificationsTest1=======================>" + data[i].content.normal.additionalText) + } + }) + + var promise = await notify.getActiveNotifications(); + expect(typeof(promise)).assertEqual('object') + for (let i = 0; i < promise.length; i++) { + console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].hashCode) + console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].id) + console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].slotType) + console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].classification) + console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].sortingKey) + console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.contentType) + console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.title) + console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.text) + console.log("==========================>publishgetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.additionalText) + } + + await notify.getActiveNotificationCount((error,data) => { + console.log("============getActiveNotificationNumsTest1============"+JSON.stringify(data)) + expect(typeof(data)).assertEqual('number') + }) + + var num = await notify.getActiveNotificationCount() + console.log("============getActiveNotificationNumsTest1Promise============"+JSON.stringify(num)) + console.log("============ACTS_PublishTest1_0100 finished============") + expect(typeof(num)).assertEqual('number') + done(); + setTimeout(function(){ + console.debug("====>time out ACTS_GetActiveNumTest_0100====>"); + }, time); + }) +}) + diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/BUILD.gn b/notification/ans_standard/publish_test/getactive/getactivenormal/publish/BUILD.gn deleted file mode 100644 index 1ce0eb7222a98988859964c7ea8995c7983a8333..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# 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("ActsAnsActivePublishTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsActivePublishTest" -} -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/getactive/getactivenormal/publish/Test.json b/notification/ans_standard/publish_test/getactive/getactivenormal/publish/Test.json deleted file mode 100644 index a7bf5a8450049f6c083e4452c4d75ebd00a5e4a6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "com.example.actsansactivepublishtest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsActivePublishTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/config.json b/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/config.json deleted file mode 100644 index 38706dca82ff979aa8da236fbd26fe0044b43a8d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansactivepublishtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansactivepublishtest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsansactivepublishtest.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 - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 6c7b69992197af98eff1f3a1eac25a677f4ec87b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -var time = 1000 -describe('ActsAnsActivePublishTest', function () { - function publishCallback001(){ - console.log('ActsNotificationTest ACTS_Publish_0100 asyncCallback') - } - - /* - * @tc.number: ACTS_GetActiveNumTest_0100 - * @tc.name: getActiveNotifications(),getActiveNotificationNums() - * @tc.desc: verify the function of getActiveNotifications,getActiveNotificationNums - */ - it('ACTS_GetActiveNumTest_0100', 0,async function (done) { - await notification.publish({ - id: 1, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test1_title", - text: "test1_text", - additionalText: "test1_additionalText" - }, - }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION, - classification:"classification1", - sortingKey:"sortingKey1", - },publishCallback001); - await notification.publish({ - id: 2, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test2_title", - text: "test2_text", - additionalText: "test2_additionalText" - }, - }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION, - classification:"classification2", - sortingKey:"sortingKey2", - },publishCallback001); - - await notification.getActiveNotifications( - (error,data) => { - console.log("==PublishgetActiveNotificationsTest1=="+data) - expect(typeof(data)).assertEqual('object') - for (let i = 0; i < data.length; i++) { - console.log("===>PublishgetActiveNotificationsTest1===>" + data[i].hashCode) - console.log("===>PublishgetActiveNotificationsTest1===>" + data[i].id) - console.log("===>PublishgetActiveNotificationsTest1===>" + data[i].classification) - console.log("===>PublishgetActiveNotificationsTest1===>" + data[i].sortingKey) - console.log("===>PublishgetActiveNotificationsTest1===>" + data[i].slotType) - console.log("===>PublishgetActiveNotificationsTest1===>" + data[i].content.contentType) - console.log("===>PublishgetActiveNotificationsTest1===>" + data[i].content.normal.title) - console.log("===>PublishgetActiveNotificationsTest1===>" + data[i].content.normal.text) - console.log("===>PublishgetActiveNotificationsTest1===>" + data[i].content.normal.additionalText) - } - }) - - var promise = await notification.getActiveNotifications(); - expect(typeof(promise)).assertEqual('object') - for (let i = 0; i < promise.length; i++) { - console.log("==>publishgetAllActiveNotificationsPromisehashCode==>" + promise[i].hashCode) - console.log("==>publishgetAllActiveNotificationsPromisehashCode==>" + promise[i].id) - console.log("==>publishgetAllActiveNotificationsPromisehashCode==>" + promise[i].slotType) - console.log("==>publishgetAllActiveNotificationsPromisehashCode==>" + promise[i].classification) - console.log("==>publishgetAllActiveNotificationsPromisehashCode==>" + promise[i].sortingKey) - console.log("==>publishgetAllActiveNotificationsPromisehashCode==>" + promise[i].content.contentType) - console.log("==>publishgetAllActiveNotificationsPromisehashCode==>" + promise[i].content.normal.title) - console.log("==>publishgetAllActiveNotificationsPromisehashCode==>" + promise[i].content.normal.text) - console.log("==>publishgetAllActiveNotificationsPromisehashCode==>" + promise[i].content.normal.additionalText) - } - - await notification.getActiveNotificationCount((error,data) => { - console.log("==getActiveNotificationNumsTest1=="+JSON.stringify(data)) - expect(typeof(data)).assertEqual('number') - }) - - var promise = await notification.getActiveNotificationCount(); - console.log("==getActiveNotificationNumsTest1Promise=="+JSON.stringify(promise)) - console.log("==ACTS_PublishTest1_0100 finished==") - expect(typeof(promise)).assertEqual('number') - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_GetActiveNumTest_0100====>"); - }, time); - }) -}) diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/getactive/getactivenormal/signature/openharmony_sx.p7b similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishfirst/signature/openharmony_sx.p7b rename to notification/ans_standard/publish_test/getactive/getactivenormal/signature/openharmony_sx.p7b diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/BUILD.gn b/notification/ans_standard/publish_test/getactive/getactivenormal/sub/BUILD.gn deleted file mode 100644 index 19f81bfe930bef22db042d0c7b1258521c0ff739..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# 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("ActsAnsActiveSubscriberTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsActiveSubscriberTest" -} -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/getactive/getactivenormal/sub/Test.json b/notification/ans_standard/publish_test/getactive/getactivenormal/sub/Test.json deleted file mode 100644 index 033380827174c51e440686645549042efc4d04f4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "21600000", - "package": "com.example.actsansactivesubscribertest", - "shell-timeout": "21600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsActiveSubscriberTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/config.json b/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/config.json deleted file mode 100644 index 4cda20ec3957315bc5503730b7d4f245f232ff69..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansactivesubscribertest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansactivesubscribertest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsansactivesubscribertest.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 - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/test/List.test.js deleted file mode 100644 index 41999288d49304127387014dc88894130a148ab4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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('./Subscriber.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/test/Subscriber.js b/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/test/Subscriber.js deleted file mode 100644 index 7471eab846a17bb00f7c1294471fe61fdc89cbb0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/sub/entry/src/main/js/test/Subscriber.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -var time = 1000 -describe('ActsAnsActiveSubscriberTest', function () { - console.info("===ActsSubscriberTest start===>"); - - //consume - function consumeCallback(err, data) { - console.debug("===>consumeCallback data : ===>" + JSON.stringify(data)); - } - //subscribeOn - function subscribeOnCallback(err) { - console.debug("===>subscribeOnCallback===>"); - } - //subscribe - function subscribeCallback(err) { - console.debug("===>subscribeCallback===>"); - } - - /* - * @tc.number: ActsWantAgent_test_0100 - * @tc.name: createSubscriber(),subscribe() - * @tc.desc: verify the function of createSubscriber,subscribe - */ - it('ActsActiveSubscriber_test_0100', 0, async function (done) { - console.debug("==ActsWantAgent_test_0100==begin==>"); - - var subInfo ={ - onConsume:consumeCallback, - onConnect:subscribeOnCallback, - } - try{ - await notify.subscribe(subInfo,subscribeCallback); - }catch(err) { - console.error('=ActsActiveSubscriber_test_0100 订阅 subscribeCallback err:'+err); - } - console.debug("==ActsActiveSubscriber_test_0100==end==>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsActiveSubscriber_test_0100====>"); - }, time); - }) -}) - diff --git a/notification/ans_standard/publish_test/getactive/getcancelactivenum/entry/.gitignore b/notification/ans_standard/publish_test/getactive/getcancelactivenum/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3543521e9fef8e7322940a87c2b45dd0061b0f45 --- /dev/null +++ b/notification/ans_standard/publish_test/getactive/getcancelactivenum/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/notification/ans_standard/publish_test/getactive/getcancelactivenum/entry/src/main/js/test/GetCancelActiveNum.test.js b/notification/ans_standard/publish_test/getactive/getcancelactivenum/entry/src/main/js/test/GetCancelActiveNum.test.js index 6f8c7160756974fd10de66bb89e3cbbe2838b6fa..93a2dce9c7d53f32e802628014897d2e125e633c 100644 --- a/notification/ans_standard/publish_test/getactive/getcancelactivenum/entry/src/main/js/test/GetCancelActiveNum.test.js +++ b/notification/ans_standard/publish_test/getactive/getcancelactivenum/entry/src/main/js/test/GetCancelActiveNum.test.js @@ -10,7 +10,7 @@ * 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. + * limitations under the License.ActsGetCancelActiveNum_test_0200 */ import notify from '@ohos.notification' @@ -134,14 +134,14 @@ describe('ActsAnsGetCancelActiveNumTest', function () { console.log("==========================>publishGetAllActiveNotificationsPromisehashCode=======================>" + promise[i].content.normal.additionalText) } - await notify.getActiveNotificationCount((error,data) => { + await notify.getActiveNotificationCount((err,data) => { console.log("============getActiveNotificationNumsTest1============"+JSON.stringify(data)) expect(typeof(data)).assertEqual('number') }) - var promise = await notify.getActiveNotificationCount(); - expect(typeof(promise)).assertEqual('number') - console.log("============getActiveNotificationNumsTest1Promise============"+JSON.stringify(promise)) + var num = await notify.getActiveNotificationCount(); + expect(typeof(num)).assertEqual('number') + console.log("============getActiveNotificationNumsTest1Promise============"+JSON.stringify(num)) console.log("============ActsGetCancelActiveNum_test_0200 finished============") done(); setTimeout(function(){ @@ -156,16 +156,15 @@ describe('ActsAnsGetCancelActiveNumTest', function () { */ it('ActsGetCancelActiveNum_test_0300', 0,async function (done) { - await notify.cancel(1,cancelAllCallBack); - - await notify.getActiveNotificationCount((error,data) => { - expect(typeof(data)).assertEqual('number') - console.log("============getActiveNotificationCancelNums============"+data) + await notify.cancel(1,cancelAllCallBack) + await notify.getActiveNotificationCount((error, data) => { + expect(typeof (data)).assertEqual('number') + console.log("============getActiveNotificationCancelNums============" + JSON.stringify(data)) }) - var promise = await notify.getActiveNotificationCount(); - expect(typeof(promise)).assertEqual('number') - console.log("============getActiveNotificationCancelNumsPromise============"+JSON.stringify(promise)) + var cancelNum = await notify.getActiveNotificationCount(); + expect(typeof (cancelNum)).assertEqual('number') + console.log("============getActiveNotificationCancelNumsPromise============" + JSON.stringify(cancelNum)) console.log("============ActsGetCancelActiveNum_test_0300 finished============") done(); setTimeout(function(){ diff --git a/notification/ans_standard/publish_test/publishcontentype/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/publishcontentype/entry/src/main/js/test/ExampleJsunit.test.js index a8a93f0e9a80a524326e28e88978515ddecf0cee..2064c7474ab0307798e0f4d1d5689901f91a62d0 100644 --- a/notification/ans_standard/publish_test/publishcontentype/entry/src/main/js/test/ExampleJsunit.test.js +++ b/notification/ans_standard/publish_test/publishcontentype/entry/src/main/js/test/ExampleJsunit.test.js @@ -86,7 +86,7 @@ describe('ActsAnsNotificationTest', function () { //consume function consumeCallback(err,data) { console.debug("==========================>consumeDoNotCallback1 data : =======================>" + err + JSON.stringify(data)); - comsumData = data + expect(data).assertEqual('object') } //subscribeOn function subscribeOnCallback(err) { @@ -144,13 +144,10 @@ describe('ActsAnsNotificationTest', function () { }, publishMULTILINEContentCallback001); }catch(error){ console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0100 error'+JSON.stringify(error.code))} -// console.log("============ACTS_PublishMULTILINEContent_0100 finished============"+comsumData.request.id) done(); setTimeout(function(){ console.debug("====>time out ACTS_PublishMULTILINEContent_0100====>"); }, time); - expect(comsumData.request.id).assertEqual(1) - }) /* @@ -183,12 +180,10 @@ describe('ActsAnsNotificationTest', function () { }catch(error){ console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0200 asyncCallback'+error) } -// console.log("============ACTS_PublishMULTILINEContent_0200 finished============"+comsumData.request.id) done(); setTimeout(function(){ console.debug("====>time out ACTS_PublishMULTILINEContent_0200====>"); }, time); - expect(comsumData.request.id).assertEqual(2) }) /* @@ -219,7 +214,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishMULTILINEContent_0300====>"); }, time); - expect(comsumData.request.id).assertEqual(3) }) /* @@ -246,7 +240,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishMULTILINEContent_0400====>"); }, time); - expect(comsumData.request.id).assertEqual(4) }) /* * @tc.number: ACTS_PublishMULTILINEContent_0500 @@ -272,7 +265,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishMULTILINEContent_0500====>"); }, time); - expect(comsumData.request.id).assertEqual(5) }) /* @@ -299,7 +291,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishMULTILINEContent_0600====>"); }, time); - expect(comsumData.request.id).assertEqual(6) }) /* @@ -326,7 +317,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishLONGContent_0100====>"); }, time); - expect(comsumData.request.id).assertEqual(7) }) /* @@ -353,7 +343,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishLONGContent_0200====>"); }, time); - expect(comsumData.request.id).assertEqual(8) }) /* @@ -380,7 +369,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishLONGContent_0300====>"); }, time); - expect(comsumData.request.id).assertEqual(9) }) /* @@ -406,7 +394,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishLONGContent_0400====>"); }, time); - expect(comsumData.request.id).assertEqual(10) }) /* @@ -432,7 +419,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishLONGContent_0500====>"); }, time); - expect(comsumData.request.id).assertEqual(11) }) /* @@ -458,7 +444,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishLONGContent_0600====>"); }, time); - expect(comsumData.request.id).assertEqual(12) }) /* @@ -484,7 +469,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_Publish_SlotTypeContent_0100====>"); }, time); - expect(comsumData.request.id).assertEqual(13) }) /* @@ -510,7 +494,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_Publish_SlotTypeContent_0200====>"); }, time); - expect(comsumData.request.id).assertEqual(14) }) /* @@ -536,7 +519,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_Publish_SlotTypeContent_0300====>"); }, time); - expect(comsumData.request.id).assertEqual(15) }) /* @@ -562,7 +544,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_Publish_SlotTypeContent_0400====>"); }, time); - expect(comsumData.request.id).assertEqual(16) }) /* @@ -587,7 +568,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_Publish_SlotTypeContent_0500====>"); }, time); - expect(comsumData.request.id).assertEqual(17) }) /* @@ -612,7 +592,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_Publish_SlotTypeContent_0600====>"); }, time); - expect(comsumData.request.id).assertEqual(18) }) /* @@ -637,7 +616,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_Publish_SlotTypeContent_0700====>"); }, time); - expect(comsumData.request.id).assertEqual(19) }) /* @@ -662,7 +640,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_Publish_SlotTypeContent_0800====>"); }, time); - expect(comsumData.request.id).assertEqual(20) }) /* @@ -688,7 +665,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeOther_0100====>"); }, time); - expect(comsumData.request.id).assertEqual(21) }) /* @@ -714,7 +690,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeOther_0200====>"); }, time); - expect(comsumData.request.id).assertEqual(22) }) /* @@ -740,7 +715,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeOther_0300====>"); }, time); - expect(comsumData.request.id).assertEqual(23) }) /* @@ -766,7 +740,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeOther_0400====>"); }, time); - expect(comsumData.request.id).assertEqual(24) }) /* @@ -791,7 +764,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeOther_0500====>"); }, time); - expect(comsumData.request.id).assertEqual(25) }) /* @@ -816,7 +788,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeOther_0600====>"); }, time); - expect(comsumData.request.id).assertEqual(26) }) /* @@ -841,7 +812,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeOther_0700====>"); }, time); - expect(comsumData.request.id).assertEqual(27) }) /* @@ -866,7 +836,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeOther_0800====>"); }, time); - expect(comsumData.request.id).assertEqual(28) }) /* @@ -892,7 +861,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeService_0100====>"); }, time); - expect(comsumData.request.id).assertEqual(29) }) /* @@ -918,7 +886,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeService_0200====>"); }, time); - expect(comsumData.request.id).assertEqual(30) }) /* @@ -944,7 +911,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeService_0300====>"); }, time); - expect(comsumData.request.id).assertEqual(31) }) /* @@ -970,7 +936,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeService_0400====>"); }, time); - expect(comsumData.request.id).assertEqual(32) }) /* @@ -995,7 +960,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeService_0500====>"); }, time); - expect(comsumData.request.id).assertEqual(33) }) /* @@ -1020,7 +984,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeService_0600====>"); }, time); - expect(comsumData.request.id).assertEqual(34) }) /* @@ -1045,7 +1008,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeService_0700====>"); }, time); - expect(comsumData.request.id).assertEqual(35) }) /* @@ -1070,7 +1032,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeService_0800====>"); }, time); - expect(comsumData.request.id).assertEqual(36) }) /* @@ -1096,7 +1057,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeSocial_0100====>"); }, time); - expect(comsumData.request.id).assertEqual(37) }) /* @@ -1122,7 +1082,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeSocial_0200====>"); }, time); - expect(comsumData.request.id).assertEqual(38) }) /* @@ -1148,7 +1107,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeSocial_0300====>"); }, time); - expect(comsumData.request.id).assertEqual(39) }) /* @@ -1174,7 +1132,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeSocial_0400====>"); }, time); - expect(comsumData.request.id).assertEqual(40) }) /* @@ -1199,7 +1156,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeSocial_0500====>"); }, time); - expect(comsumData.request.id).assertEqual(41) }) /* @@ -1224,7 +1180,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeSocial_0600====>"); }, time); - expect(comsumData.request.id).assertEqual(42) }) /* @@ -1250,7 +1205,6 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeSocial_0700====>"); }, time); - expect(comsumData.request.id).assertEqual(43) }) /* @@ -1275,6 +1229,5 @@ describe('ActsAnsNotificationTest', function () { setTimeout(function(){ console.debug("====>time out ACTS_PublishSlotTypeSocial_0800====>"); }, time); - expect(comsumData.request.id).assertEqual(44) }) -}) \ No newline at end of file +}) diff --git a/notification/ans_standard/publish_test/publishicontest/entry/src/main/config.json b/notification/ans_standard/publish_test/publishicontest/entry/src/main/config.json index 730f1958ad069e7eb57b45e126249a8fa0fa518e..5e23348affcf339ee9054fc54f4516d1d11e25ee 100644 --- a/notification/ans_standard/publish_test/publishicontest/entry/src/main/config.json +++ b/notification/ans_standard/publish_test/publishicontest/entry/src/main/config.json @@ -42,7 +42,8 @@ "label": "$string:app_name", "type": "page", "isVisible": "true", - "launchType": "standard" + "launchType": "standard", + "visible": true } ], "js": [ @@ -58,4 +59,4 @@ } ] } -} \ No newline at end of file +} diff --git a/notification/ans_standard/publish_test/subscribe/BUILD.gn b/notification/ans_standard/publish_test/subscribe/BUILD.gn index a2b04dc63be55da8145a4f9c33205b8f037d333c..d985e16c852a5e1d53ba1d01348cd65028d68ecf 100644 --- a/notification/ans_standard/publish_test/subscribe/BUILD.gn +++ b/notification/ans_standard/publish_test/subscribe/BUILD.gn @@ -17,8 +17,7 @@ group("subscribe") { testonly = true if (is_standard_system) { deps = [ - "publishfirst:ActsAnsPublishOneTest", - "publishsecond:ActsAnsPublishTwoTest", + "publish:ActsAnsPublishTest", "subscribe:ActsAnsSubscriberTest", ] } diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/BUILD.gn b/notification/ans_standard/publish_test/subscribe/publish/BUILD.gn similarity index 94% rename from notification/ans_standard/publish_test/subscribe/publishsecond/BUILD.gn rename to notification/ans_standard/publish_test/subscribe/publish/BUILD.gn index f198bf413cda40508c77d6f56255e649f00885bb..760165ac854049d60e51f95d4c22f26c43c09363 100644 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/BUILD.gn +++ b/notification/ans_standard/publish_test/subscribe/publish/BUILD.gn @@ -12,9 +12,9 @@ # limitations under the License. import("//test/xts/tools/build/suite.gni") -ohos_hap("ActsAnsPublishTwoTest") { +ohos_hap("ActsAnsPublishTest") { hap_profile = "./entry/src/main/config.json" - hap_name = "ActsAnsPublishTwoTest" + hap_name = "ActsAnsPublishTest" subsystem_name = XTS_SUITENAME final_hap_path = "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/Test.json b/notification/ans_standard/publish_test/subscribe/publish/Test.json similarity index 74% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/Test.json rename to notification/ans_standard/publish_test/subscribe/publish/Test.json index a93fa0112cbe5bcd26ead1ecb3a079b8a5fb0d70..f7a2623f05c045447fd01c3aa9227bc487bdd122 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/active/Test.json +++ b/notification/ans_standard/publish_test/subscribe/publish/Test.json @@ -3,13 +3,13 @@ "driver": { "type": "JSUnitTest", "test-timeout": "60000", - "package": "com.example.actsansgetactivetest", + "package": "com.example.actsanspublishtest", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsAnsGetActiveTest.hap" + "ActsAnsPublishTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/config.json b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/config.json similarity index 86% rename from notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/config.json rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/config.json index c0f7877313ffd40cc04d2b662b6ee5d87b5483bf..afe023398aa275767538102192abb64d9acec11d 100644 --- a/notification/ans_standard/publish_test/getactive/getactivenormal/active/entry/src/main/config.json +++ b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.actsansgetactivetest", + "bundleName": "com.example.actsanspublishtest", "vendor": "example", "version": { "code": 1, @@ -14,7 +14,7 @@ }, "deviceConfig": {}, "module": { - "package": "com.example.actsansgetactivetest", + "package": "com.example.actsanspublishtest", "name": ".MyApplication", "deviceType": [ "phone" @@ -36,7 +36,7 @@ ] } ], - "name": "com.example.actsansgetactivetest.MainAbility", + "name": "com.example.actsanspublishtest.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/app.js similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/app.js rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/app.js diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/i18n/en-US.json rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/i18n/en-US.json diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/i18n/zh-CN.json rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/i18n/zh-CN.json diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/pages/index/index.css rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.css diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/pages/index/index.hml rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.hml diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/default/pages/index/index.js rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.js diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/resources/base/element/string.json rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/resources/base/element/string.json diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/resources/base/media/icon.png rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/resources/base/media/icon.png diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/ExampleJsunit.test.js similarity index 62% rename from notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/test/ExampleJsunit.test.js rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/ExampleJsunit.test.js index 2907d31f53f87061a1a9d4d59ad367e6d261a0d3..9bca8fa0a792838a27cfcf2b106aa277ab9130ef 100644 --- a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/test/ExampleJsunit.test.js +++ b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/ExampleJsunit.test.js @@ -15,8 +15,8 @@ import notification from '@ohos.notification' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('ActsAnsPublishOneTest', function () { +var time = 1000 +describe('ActsAnsPublishTest', function () { function publishCallback001(){ console.log('ActsAnsPublishTest ACTS_PublishTest_0100 asyncCallback') } @@ -28,8 +28,7 @@ describe('ActsAnsPublishOneTest', function () { */ it('ACTS_PublishTest_0100', 0,async function (done) { await notification.publish({ - id: 1, - content: { + content:{ contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: "test1_title", @@ -37,10 +36,30 @@ describe('ActsAnsPublishOneTest', function () { additionalText: "test1_additionalText" }, }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION, - classification:"classification1", - sortingKey:"sortingKey1", + 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, },publishCallback001); done(); + setTimeout(function(){ + console.debug("====>time out ACTS_PublishTest_0100====>"); + }, time); }) }) \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/List.test.js similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactivenormal/publish/entry/src/main/js/test/List.test.js rename to notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/List.test.js diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/subscribe/publish/signature/openharmony_sx.p7b similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publishsecond/signature/openharmony_sx.p7b rename to notification/ans_standard/publish_test/subscribe/publish/signature/openharmony_sx.p7b diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/Test.json b/notification/ans_standard/publish_test/subscribe/publishfirst/Test.json deleted file mode 100644 index 76d4dedbe985af96c43ce5255ee930d628e72559..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishfirst/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "com.example.actsanspublishonetest", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsPublishOneTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/config.json b/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/config.json deleted file mode 100644 index 8fbeef9ca0777e542da828caa263db598f5150a5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/config.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanspublishonetest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanspublishonetest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsanspublishonetest.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 - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index fc2437b2b0af5bd75dfc14e0ea743d011159ede3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - 发布接口调用 - -
diff --git a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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/subscribe/publishfirst/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/test/List.test.js deleted file mode 100644 index c0b876e81cf0a75db974ee932d8fc06a1d5a6e66..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishfirst/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/subscribe/publishsecond/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index b235e58c10080925fdcea67bc3da34a5cb097f9b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - 第二个发布接口 - -
diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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/subscribe/publishsecond/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 2af91e1045f5460ee1cae9c38ef54f7cc158a4a0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "publish2" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index c2be5ce06737ea7c5c2d902be01f8a2a704c8a0c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' - -describe('ActsAnsPublishTwoTest', function () { - function publishCallback002(){ - console.log('ActsAnsPublishTest ACTS_PublishTest_0200 asyncCallback') - } - - /* - * @tc.number: ACTS_PublishTwoTest_0200 - * @tc.name: publish() - * @tc.desc: verify the function of publish - */ - it('ACTS_PublishTwoTest_0200', 0,async function (done) { - await notification.publish({ - id: 2, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test2_title", - text: "test2_text", - additionalText: "test2_additionalText" - }, - }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION, - classification:"classification2", - sortingKey:"sortingKey2", - },publishCallback002); - done(); - }) -}) \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/test/List.test.js deleted file mode 100644 index c0b876e81cf0a75db974ee932d8fc06a1d5a6e66..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publishsecond/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/entry/src/main/js/test/Subscriber.js b/notification/ans_standard/publish_test/subscribe/subscribe/entry/src/main/js/test/Subscriber.js index 5d8b2f57529fb92e590e133ac1cf8c614450662c..63796edea8102273908788348faa4152f3f6432f 100644 --- a/notification/ans_standard/publish_test/subscribe/subscribe/entry/src/main/js/test/Subscriber.js +++ b/notification/ans_standard/publish_test/subscribe/subscribe/entry/src/main/js/test/Subscriber.js @@ -16,99 +16,256 @@ import notify from '@ohos.notification' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' var time = 1000 describe('ActsAnsSubscriberTest', function () { - console.info("==ActsDoNotSubscriberTest start==>"); - - //consume - function consumeCallbackOne(err,data) { - console.debug("==>consumeDoNotCallback1 data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + console.info("==ActsAnsSubscriberTest start==>"); + //ActsSubscriber_test_0100 + var subInfoa ={ + onConsume:consumeCallbackc, + onConnect:connectCallbacka, + } + function consumeCallbackc(err,data) { + console.debug("==>consumeCallbackc data : ==>" +err+ JSON.stringify(data)); + checkConsumeData(data) + notify.unsubscribe(subInfoa, unSubscribeCallbacka); + } + function connectCallbacka(err) { + console.debug("==>connectCallbacka code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbacka(err) { + console.debug("==>subscribeCallbacka code==>" +err.code); + expect(err.code).assertEqual(0); + } + function unSubscribeCallbacka(err){ + console.debug("==>unSubscribeCallbacka code==>" +err.code); + expect(err.code).assertEqual(0); + } + //ActsSubscriber_test_0200 + function connectCallbackb(err) { + console.debug("==>connectCallbackb code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbackb(err) { + console.debug("==>subscribeCallbackb code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbackc(err) { + console.debug("==>subscribeCallbackc code==>" +err.code); + expect(err.code).assertEqual(0); + } + function unSubscribeCallbackb(err){ + console.debug("==>unSubscribeCallbackb code==>" +err.code); + expect(err.code).assertEqual(0); + } + //ActsSubscriber_test_0300 + function connectCallbackc(err) { + console.debug("==>connectCallbackc code==>" +err.code); + expect(err.code).assertEqual(0); + } + function connectCallbackd(err) { + console.debug("==>connectCallbackd code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbackd(err) { + console.debug("==>subscribeCallbackd code==>" +err.code); + expect(err.code).assertEqual(0); } - function consumeCallbackTwo(err,data) { - console.debug("==>consumeDoNotCallback2 data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + function subscribeCallbacke(err) { + console.debug("==>subscribeCallbacke code==>" +err.code); + expect(err.code).assertEqual(0); } - function consumeCallbackTree(err,data) { - console.debug("==>consumeDoNotCallback3 data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + function unSubscribeCallbackc(err){ + console.debug("==>unSubscribeCallbackc code==>" +err.code); + expect(err.code).assertEqual(0); } - function consumeCallbackFour(err,data) { - console.debug("==>consumeDoNotCallback4 data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + function unSubscribeCallbackd(err){ + console.debug("==>unSubscribeCallbackd code==>" +err.code); + expect(err.code).assertEqual(0); } - function consumeCallbackFive(err,data) { - console.debug("==>consumeDoNotCallback5 data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + //ActsSubscriber_test_0400 + function connectCallbacke(err) { + console.debug("==>connectCallbacke code==>" +err.code); + expect(err.code).assertEqual(0); } - function consumeCallbackSix(err,data) { - console.debug("==>consumeDoNotCallback6 data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + function subscribeCallbackf(err) { + console.debug("==>subscribeCallbackf code==>" +err.code); + expect(err.code).assertEqual(0); } - function consumeCallbackSeven(err,data) { - console.debug("==>consumeDoNotCallback7 data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + function unSubscribeCallbacke(err){ + console.debug("==>unSubscribeCallbacke code==>" +err.code); + expect(err.code).assertEqual(0); } - function consumeCallbackEight(err,data) { - console.debug("==>consumeDoNotCallback8 data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + //ActsSubscriber_test_0500 + function connectCallbackf(err) { + console.debug("==>connectCallbackf code==>" +err.code); + expect(err.code).assertEqual(0); + } + function connectCallbackg(err) { + console.debug("==>connectCallbackg code==>" +err.code); + expect(err.code).assertEqual(0); + } + function connectCallbackh(err) { + console.debug("==>connectCallbackh code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbackg(err) { + console.debug("==>subscribeCallbackg code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbackh(err) { + console.debug("==>subscribeCallbackh code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbacki(err) { + console.debug("==>subscribeCallbacki code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbackj(err) { + console.debug("==>subscribeCallbackj code==>" +err.code); + expect(err.code).assertEqual(0); + } + function unSubscribeCallbackf(err){ + console.debug("==>unSubscribeCallbackf code==>" +err.code); + expect(err.code).assertEqual(0); + } + function unSubscribeCallbackg(err){ + console.debug("==>unSubscribeCallbackg code==>" +err.code); + expect(err.code).assertEqual(0); + } + function unSubscribeCallbackh(err){ + console.debug("==>unSubscribeCallbackh code==>" +err.code); + expect(err.code).assertEqual(0); + } + //ActsSubscriber_test_0600 + var subInfob = { + onConsume:consumeCallbacka, + onConnect:connectCallbacki, } function consumeCallbacka(err,data) { console.debug("==>consumeCallbacka data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + checkConsumeData(data) + notify.unsubscribe(subInfob, unSubscribeCallbacki); + } + function connectCallbacki(err) { + console.debug("==>connectCallbacki code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbackl(err) { + console.debug("==>subscribeCallbackl code==>" +err.code); + expect(err.code).assertEqual(0); + } + function unSubscribeCallbacki(err){ + console.debug("==>unSubscribeCallbacki code==>" +err.code); + expect(err.code).assertEqual(0); + } + //ActsSubscriber_test_0700 + var subInfoc ={ + onConsume:consumeCallbackb, + onConnecte:connectCallbackj, } function consumeCallbackb(err,data) { console.debug("==>consumeCallbackb data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + checkConsumeData(data) + notify.unsubscribe(subInfoc, unSubscribeCallbackj); } - function consumeCallbackc(err,data) { - console.debug("==>consumeCallbackc data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + function connectCallbackj(err) { + console.debug("==>connectCallbackj code==>" +err.code); + expect(err.code).assertEqual(0); + } + function unSubscribeCallbackj(err){ + console.debug("==>unSubscribeCallbackj code==>" +err.code); + expect(err.code).assertEqual(0); + } + //ActsSubscriber_test_0800 + var subInfod ={ + onConsume:consumeCallbackd, + onConnect:connectCallbackm, } function consumeCallbackd(err,data) { console.debug("==>consumeCallbackd data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + checkConsumeData(data) + notify.unsubscribe(subInfod, unSubscribeCallbackl); + } + function connectCallbackm(err) { + console.debug("==>connectCallbackm code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbackn(err) { + console.debug("==>subscribeCallbackn code==>" +err.code); + expect(err.code).assertEqual(0); + } + function unSubscribeCallbackl(err){ + console.debug("==>unSubscribeCallbackl code==>" +err.code); + expect(err.code).assertEqual(0); + } + //ActsSubscriber_test_0900 + var subInfoe ={ + onConsume:consumeCallbacke, + onConnect:connectCallbackn, } function consumeCallbacke(err,data) { console.debug("==>consumeCallbacke data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + checkConsumeData(data) + notify.unsubscribe(subInfoe, unSubscribeCallbackm); } - function consumeCallbackf(err,data) { - console.debug("==>consumeCallbackf data : ==>" +err+ JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") + function connectCallbackn(err) { + console.debug("==>connectCallbackn code==>" +err.code); + expect(err.code).assertEqual(0); } - //subscribeOn - function subscribeOnCallback(err) { - console.debug("==>subscribeDoNotOnCallback==>"); + function unSubscribeCallbackm(err){ + console.debug("==>unSubscribeCallbackm code==>" +err.code); + expect(err.code).assertEqual(0); } - //subscribe - function subscribeCallback(err) { - console.debug("==>subscribeDoNotCallback==>"); - + //ActsSubscriber_test_1400 + function connectCallbackl(err){ + console.debug("==>connectCallbackl code==>" +err.code); + expect(err.code).assertEqual(0); + } + function subscribeCallbacko(err){ + console.debug("==>subscribeCallbacko code==>" +err.code); + expect(err.code).assertEqual(0); + } + function unSubscribeCallbackn(err){ + console.debug("==>unSubscribeCallbackn code==>" +err.code); + expect(err.code).assertEqual(0); } - function publishCallback001(){ - console.log('ActsAnsSubscriberTest ACTS_Publish_0100 asyncCallback') + function checkConsumeData(data){ + expect(data.request.id).assertEqual(1); + expect(data.request.content.contentType).assertEqual(0); + expect(data.request.content.normal.title).assertEqual("test1_title"); + expect(data.request.content.normal.text).assertEqual("test1_text"); + expect(data.request.content.normal.additionalText).assertEqual("test1_additionalText"); + expect(data.request.slotType).assertEqual(65535); + expect(data.request.isOngoing).assertEqual(true); + expect(data.request.isUnremovable).assertEqual(false); + expect(data.request.deliveryTime).assertEqual(1624950453); + expect(data.request.tapDismissed).assertEqual(true); + expect(data.request.autoDeletedTime).assertEqual(1625036817); + expect(data.request.color).assertEqual(2); + expect(data.request.colorEnabled).assertEqual(true); + expect(data.request.isAlertOnce).assertEqual(true); + expect(data.request.isStopwatch).assertEqual(true); + expect(data.request.isCountDown).assertEqual(true); + expect(data.request.progressValue).assertEqual(12); + expect(data.request.progressMaxValue).assertEqual(100); + expect(data.request.isIndeterminate).assertEqual(true); + expect(data.request.statusBarText).assertEqual("statusBarText"); + expect(data.request.isFloatingIcon).assertEqual(true); + expect(data.request.label).assertEqual("0100_1"); + expect(data.request.badgeIconStyle).assertEqual(1); + expect(data.request.showDeliveryTime).assertEqual(true); } /* - * @tc.number: ActsDoNotSubscriber_test_0100 + * @tc.number: ActsSubscriber_test_0100 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ it('ActsSubscriber_test_0100', 0, async function (done) { - console.debug("==ActsDoNotSubscriber_test_0100==begin==>"); - - var subInfo ={ - onConsumed:consumeCallbackOne, - onConnected:subscribeOnCallback, - } - try { - await notify.subscribe(subInfo, subscribeCallback); - } - catch(err) { - console.error('=ActsDoNotSubscriber_test_0100 订阅 subscribeDoNotCallback err:'+err); - } - console.debug("==ActsSubscriber_test_0100==end3==>"); + console.debug("==ActsSubscriber_test_0100==begin==>"); + await notify.subscribe(subInfoa, subscribeCallbacka); + console.debug("==ActsSubscriber_test_0100==end==>"); done(); - setTimeout(function(){ + setTimeout(function(){ console.debug("====>time out ActsSubscriber_test_0100====>"); }, time); }) @@ -121,18 +278,14 @@ describe('ActsAnsSubscriberTest', function () { it('ActsSubscriber_test_0200', 0, async function (done) { console.debug("==ActsSubscriber_test_0200==begin==>"); var subInfo ={ - onConsumed:consumeCallbackTwo, - onConnected:subscribeOnCallback, - } - try{ - await notify.subscribe(subInfo,subscribeCallback); - await notify.subscribe(subInfo,subscribeCallback); - }catch(err) { - console.error('=ActsDoNotSubscriber_test_0200 订阅 subscribeDoNotCallback err:'+err); + onConnect:connectCallbackb, } - console.debug("==ActsSubscriber_test_0200==end3==>"); + await notify.subscribe(subInfo,subscribeCallbackb); + await notify.subscribe(subInfo,subscribeCallbackc); + await notify.unsubscribe(subInfo, unSubscribeCallbackb); + console.debug("==ActsSubscriber_test_0200==end==>"); done(); - setTimeout(function(){ + setTimeout(function(){ console.debug("====>time out ActsSubscriber_test_0200====>"); }, time); }) @@ -146,22 +299,18 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==ActsSubscriber_test_0300==begin==>"); var subInfo ={ - onConsumed:consumeCallbackTree, - onConnected:subscribeOnCallback, + onConnect:connectCallbackc, } var subInfo2 ={ - onConsumed:consumeCallbackFour, - onConnected:subscribeOnCallback, + onConnect:connectCallbackd, } - try{ - await notify.subscribe(subInfo,subscribeCallback); - await notify.subscribe(subInfo2,subscribeCallback); - }catch(err) { - console.error('=ActsSubscriber_test_0300 订阅 subscribeDoNotCallback err:'+err); - } - console.debug("==ActsSubscriber_test_0300==end3==>"); + await notify.subscribe(subInfo,subscribeCallbackd); + await notify.subscribe(subInfo2,subscribeCallbacke); + await notify.unsubscribe(subInfo, unSubscribeCallbackc); + await notify.unsubscribe(subInfo2, unSubscribeCallbackd); + console.debug("==ActsSubscriber_test_0300==end==>"); done(); - setTimeout(function(){ + setTimeout(function(){ console.debug("====>time out ActsSubscriber_test_0300====>"); }, time); }) @@ -173,17 +322,15 @@ describe('ActsAnsSubscriberTest', function () { */ it('ActsSubscriber_test_0400', 0, async function (done) { console.debug("==ActsSubscriber_test_0400==begin==>"); - try{ - await notify.subscribe({ - onConsumed:consumeCallbackFive, - onConnected:subscribeOnCallback, - },subscribeCallback); - }catch(err) { - console.error('=ActsSubscriber_test_0400 订阅 subscribeDoNotCallback err:'+err); - } - console.debug("==ActsSubscriber_test_0400==end3==>"); + await notify.subscribe({ + onConnect:connectCallbacke, + },subscribeCallbackf); + await notify.unsubscribe({ + onConnect:connectCallbacke, + }, unSubscribeCallbacke); + console.debug("==ActsSubscriber_test_0400==end==>"); done(); - setTimeout(function(){ + setTimeout(function(){ console.debug("====>time out ActsSubscriber_test_0400====>"); }, time); }) @@ -197,27 +344,26 @@ describe('ActsAnsSubscriberTest', function () { console.debug("==ActsSubscriber_test_0500==begin==>"); var subInfo ={ - onConsumed:consumeCallbackSix, - onConnected:subscribeOnCallback, + onConnect:connectCallbackf, } var subInfo2 ={ - onConsumed:consumeCallbackSeven, - onConnected:subscribeOnCallback, + onConnect:connectCallbackg, } - try{ - await notify.subscribe(subInfo,subscribeCallback); - await notify.subscribe(subInfo,subscribeCallback); - await notify.subscribe(subInfo2,subscribeCallback); + await notify.subscribe(subInfo,subscribeCallbackg); + await notify.subscribe(subInfo,subscribeCallbackh); + await notify.subscribe(subInfo2,subscribeCallbacki); await notify.subscribe({ - onConsumed:consumeCallbackEight, - onConnected:subscribeOnCallback, - },subscribeCallback); - }catch(err) { - console.error('=ActsSubscriber_test_0500 订阅 subscribeDoNotCallback err:'+err); - } - console.debug("==ActsSubscriber_test_0500==end3==>"); + onConnect:connectCallbackh, + },subscribeCallbackj); + + await notify.unsubscribe(subInfo, unSubscribeCallbackf); + await notify.unsubscribe(subInfo2, unSubscribeCallbackg); + await notify.unsubscribe({ + onConnect:connectCallbackh, + }, unSubscribeCallbackh); + console.debug("==ActsSubscriber_test_0500==end==>"); done(); - setTimeout(function(){ + setTimeout(function(){ console.debug("====>time out ActsSubscriber_test_0500====>"); }, time); }) @@ -229,20 +375,10 @@ describe('ActsAnsSubscriberTest', function () { */ it('ActsSubscriber_test_0600', 0, async function (done) { console.debug("==ActsSubscriber_test_0600==begin==>"); - - var subInfo ={ - onConsumed:consumeCallbacka, - onConnected:subscribeOnCallback, - } - try { - await notify.subscribe(subInfo, {bundleNames:["com.neu.actsanspublishonetest"]},subscribeCallback); - } - catch(err) { - console.error('=ActsSubscriber_test_0600 订阅 subscribeDoNotCallback err:'+err); - } + await notify.subscribe(subInfob, {bundleNames:["com.example.actsanspublishtest"]},subscribeCallbackl); console.debug("==ActsSubscriber_test_0600==end3==>"); done(); - setTimeout(function(){ + setTimeout(function(){ console.debug("====>time out ActsSubscriber_test_0600====>"); }, time); }) @@ -254,22 +390,12 @@ describe('ActsAnsSubscriberTest', function () { */ it('ActsSubscriber_test_0700', 0, async function (done) { console.debug("==ActsSubscriber_test_0700==begin==>"); - - var subInfo ={ - onConsumed:consumeCallbackb, - onConnected:subscribeOnCallback, - } - try { - await notify.subscribe(subInfo, {bundleNames:["com.neu.actsanspublishonetest"]}).then( - console.log("ActsSubscriber_test_0700=======promise") + await notify.subscribe(subInfoc, {bundleNames:["com.example.actsanspublishtest"]}).then( + console.log("ActsSubscriber_test_0700=======promise") ); - } - catch(err) { - console.error('=ActsSubscriber_test_0700 订阅 promise err:'+err); - } - console.debug("==ActsSubscriber_test_0700==end3==>"); + console.debug("==ActsSubscriber_test_0700==end==>"); done(); - setTimeout(function(){ + setTimeout(function(){ console.debug("====>time out ActsSubscriber_test_0700====>"); }, time); }) @@ -280,22 +406,12 @@ describe('ActsAnsSubscriberTest', function () { * @tc.desc: verify the function of subscribe */ it('ActsSubscriber_test_0800', 0, async function (done) { - console.debug("==ActsDoNotSubscriber_test_0100==begin==>"); - - var subInfo ={ - onConsumed:consumeCallbackc, - onConnected:subscribeOnCallback, - } - try { - await notify.subscribe(subInfo, {bundleNames:["com.neu.actsanspublishonetest","com.neu.actsanspublishtwotest"]},subscribeCallback); - } - catch(err) { - console.error('=ActsSubscriber_test_0800 订阅 subscribeCallback err:'+err); - } - console.debug("==ActsSubscriber_test_0800==end3==>"); + console.debug("==ActsSubscriber_test_1000==begin==>"); + await notify.subscribe(subInfod, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]},subscribeCallbackn); + console.debug("==ActsSubscriber_test_9000==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0800====>"); + setTimeout(function(){ + console.debug("====>time out ActsSubscriber_test_9000====>"); }, time); }) @@ -305,102 +421,95 @@ describe('ActsAnsSubscriberTest', function () { * @tc.desc: verify the function of subscribe */ it('ActsSubscriber_test_0900', 0, async function (done) { - console.debug("==ActsSubscriber_test_0800==begin==>"); - - var subInfo ={ - onConsumed:consumeCallbackd, - onConnected:subscribeOnCallback, - } - try { - await notify.subscribe(subInfo, {bundleNames:["com.neu.actsanspublishonetest","com.neu.actsanspublishtwotest"],}).then( - console.log("ActsSubscriber_test_0900=======promise") + console.debug("==ActsSubscriber_test_1000==begin==>"); + await notify.subscribe(subInfoe, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]}).then( + console.log("ActsSubscriber_test_1100=======promise") ); - } - catch(err) { - console.error('=ActsSubscriber_test_0900 订阅 promise err:'+err); - } - console.debug("==ActsSubscriber_test_0900==end3==>"); + console.debug("==ActsSubscriber_test_1000==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0900====>"); + setTimeout(function(){ + console.debug("====>time out ActsSubscriber_test_1000====>"); }, time); }) - /* * @tc.number: ActsSubscriber_test_1000 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ it('ActsSubscriber_test_1000', 0, async function (done) { - console.debug("==ActsSubscriber_test_1000==begin==>"); - - var subInfo ={ - onConsumed:consumeCallbacke, - onConnected:subscribeOnCallback, - } - try { - await notify.subscribe(subInfo, {bundleNames:["com.neu.actsanspublishonetest","com.neu.actsanspublishonetest"]},subscribeCallback); - } - catch(err) { - console.error('=ActsSubscriber_test_1000 订阅 subscribeCallback err:'+err); - } - console.debug("==ActsSubscriber_test_1000==end3==>"); + console.debug("==ActsSubscriber_test_1100==begin==>"); + var promise = notify.subscribe(100,{bundleNames:["com.example.actsanspublishtest"]}); + expect(promise).assertEqual(undefined); + console.debug("==ActsSubscriber_test_1100==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_1000====>"); + setTimeout(function(){ + console.debug("====>time out ActsSubscriber_test_1100====>"); }, time); }) - /* * @tc.number: ActsSubscriber_test_1100 * @tc.name: subscribe() * @tc.desc: verify the function of subscribe */ it('ActsSubscriber_test_1100', 0, async function (done) { + console.debug("==ActsSubscriber_test_1200==begin==>"); + var subInfo = null + var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); + expect(promise).assertEqual(undefined); + console.debug("==ActsSubscriber_test_1200==end==>"); + done(); + setTimeout(function(){ + console.debug("====>time out ActsSubscriber_test_1200====>"); + }, time); + }) + /* + * @tc.number: ActsSubscriber_test_1200 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsSubscriber_test_1200', 0, async function (done) { + console.debug("==ActsSubscriber_test_1300==begin==>"); + var subInfo = "#$#%$%$^&%^%" + var promise = notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); + expect(promise).assertEqual(undefined); + console.debug("==ActsSubscriber_test_1300==end==>"); + done(); + setTimeout(function(){ + console.debug("====>time out ActsSubscriber_test_1300====>"); + }, time); + }) + /* + * @tc.number: ActsSubscriber_test_1300 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe + */ + it('ActsSubscriber_test_1300', 0, async function (done) { console.debug("==ActsSubscriber_test_1100==begin==>"); - - var subInfo ={ - onConsumed:consumeCallbackf, - onConnected:subscribeOnCallback, - } - try { - await notify.subscribe(subInfo, {bundleNames:["com.neu.actsanspublishonetest","com.neu.actsanspublishonetest"]}).then( - console.log("ActsSubscriber_test_1100=======promise") - ); - } - catch(err) { - console.error('=ActsSubscriber_test_1100 订阅 subscribeDoNotCallback err:'+err); - } - console.debug("==ActsSubscriber_test_1100==end3==>"); + var subInfo = "" + var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); + expect(promise).assertEqual(undefined); + console.debug("==ActsSubscriber_test_1400==end==>"); done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_1100====>"); + setTimeout(function(){ + console.debug("====>time out ActsSubscriber_test_1400====>"); }, time); }) - /* - * @tc.number: ACTS_publishTest_0100 - * @tc.name: publish() - * @tc.desc: verify the function of publish + * @tc.number: ActsSubscriber_test_1400 + * @tc.name: subscribe() + * @tc.desc: verify the function of subscribe */ - it('ACTS_publishTest_0100', 0,async function (done) { - await notify.publish({ - id: 1, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test1_title", - text: "test1_text", - additionalText: "test1_additionalText" - }, - }, - slotType:notify.SlotType.SOCIAL_COMMUNICATION, - classification:"classification1", - sortingKey:"sortingKey1", - },publishCallback001); - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_publishTest_0100====>"); + it('ActsSubscriber_test_1400', 0, async function (done) { + console.debug("==ActsSubscriber_test_1100==begin==>"); + var subInfo ={ + onConnect:connectCallbackl, + } + await notify.subscribe(subInfo,{bundleNames:["wrongBudleName"]},subscribeCallbacko); + await notify.unsubscribe(subInfo, unSubscribeCallbackn); + console.debug("==ActsSubscriber_test_1400==end==>"); + done(); + setTimeout(function(){ + console.debug("====>time out ActsSubscriber_test_1400====>"); }, time); }) }) diff --git a/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/List.test.js index 41999288d49304127387014dc88894130a148ab4..1e69dcaaaa2ef4a8815f61589597a2ae4273951d 100644 --- a/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/List.test.js +++ b/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/List.test.js @@ -12,4 +12,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require('./Subscriber.js') \ No newline at end of file +require('./UnSubscriber.js') diff --git a/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/Subscriber.js b/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/Subscriber.js deleted file mode 100644 index 2ef168bcf43c46f8f5bd609367b84098d078e495..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/Subscriber.js +++ /dev/null @@ -1,328 +0,0 @@ -/* - * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -var time = 1000 -describe('ActsAnsUnSubscriberTest', function () { - console.info("==ActsDoNotSubscriberTest start==>"); - //subscribeOn - function subscribeOnCallback(err) { - console.debug("===>subscribeDoNotOnCallback===>"); - } - //subscribe - function subscribeCallback(err) { - console.debug("===>subscribeDoNotCallback===>"); - - } - function unSubscribeCallbackOne(err) { - console.debug("===>unSubscribeCallbackOne===>"); - } - function unSubscribeCallbackTwo(err) { - console.debug("===>unSubscribeCallbackTwo===>"); - } - function unSubscribeCallbackThree(err) { - console.debug("===>unSubscribeCallbackThree===>"); - } - function unSubscribeCallbackFour(err) { - console.debug("===>unSubscribeCallbackFour===>"); - } - function unSubscribeCallbackFive(err) { - console.debug("===>unSubscribeCallbackFive===>"); - } - function unSubscribeCallbackSix(err) { - console.debug("===>unSubscribeCallbackSix===>"); - } - function unSubscribeCallbackSeven(err) { - console.debug("===>unSubscribeCallbackSeven===>"); - } - function unSubscribeCallbackEight(err) { - console.debug("===>unSubscribeCallbackEight===>"); - } - - function publishCallback001(){ - console.log('ActsAnsSubscriberTest ACTS_Publish_0100 asyncCallback') - } - - /* - * @tc.number: ActsDoNotSubscriber_test_0100 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsUnSubscriber_test_0100', 0, async function (done) { - console.debug("===ActsDoNotSubscriber_test_0100===begin===>"); - - var subInfoOne ={ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackOne - } - try { - await notify.subscribe(subInfoOne, subscribeCallback); - } - catch(err) { - console.error('=ActsDoNotSubscriber_test_0100 订阅 subscribeDoNotCallback err:'+err); - } - try{ - await notify.unsubscribe(subInfoOne, unSubscribeCallbackOne); - } - catch(err) { - console.error('=ActsSubscriber_test_0100 取消订阅 unSubscribeCallbackOne err:'+err); - } - console.debug("===ActsSubscriber_test_0100===end3===>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0100====>"); - }, time); - }) - - /* - * @tc.number: ActsDoNotSubscriber_test_0200 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsUnSubscriber_test_0200', 0, async function (done) { - console.debug("===ActsSubscriber_test_0200===begin===>"); - - var subInfoOne ={ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackOne - } - try { - await notify.subscribe(subInfoOne, subscribeCallback); - } - catch(err) { - console.error('=ActsSubscriber_test_0200 订阅 subscribeDoNotCallback err:'+err); - } - try{ - notify.unsubscribe(subInfoOne).then(()=> - console.log("====promise====") - ) - } - catch(err) { - console.error('=ActsSubscriber_test_0200 取消订阅 unSubscribeCallbackOne err:'+err); - } - console.debug("===ActsSubscriber_test_0200===end3===>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0200====>"); - }, time); - }) - - /* - * @tc.number: ActsSubscriber_test_0300 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsUnSubscriber_test_0300', 0, async function (done) { - console.debug("===ActsSubscriber_test_0300===begin===>"); - var subInfoTwo ={ - // onConsumed:consumeCallbackTwo, - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackTwo - } - try{ - await notify.subscribe(subInfoTwo,subscribeCallback); - await notify.subscribe(subInfoTwo,subscribeCallback); - }catch(err) { - console.error('=ActsSubscriber_test_0300 订阅 subscribeDoNotCallback err:'+err); - } - try{ - await notify.unsubscribe(subInfoTwo, unSubscribeCallbackTwo); - await notify.unsubscribe(subInfoTwo, unSubscribeCallbackTwo); - } - catch(err) { - console.error('=ActsSubscriber_test_0300 取消订阅 unSubscribeCallbackOne err:'+err); - } - console.debug("===ActsSubscriber_test_0300===end3===>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0300====>"); - }, time); - }) - - /* - * @tc.number: ActsSubscriber_test_0400 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsUnSubscriber_test_0400', 0, async function (done) { - console.debug("====ActsSubscriber_test_0400===begin====>"); - var subInfoTwo ={ - // onConsumed:consumeCallbackTwo, - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackTwo - } - try{ - await notify.subscribe(subInfoTwo,subscribeCallback); - await notify.subscribe(subInfoTwo,subscribeCallback); - }catch(err) { - console.error('=ActsSubscriber_test_0400 订阅 subscribeDoNotCallback err:'+err); - } - try{ - notify.unsubscribe(subInfoTwo).then( - console.log("===unsubscribeTwo Promise===") - ) - notify.unsubscribe(subInfoTwo).then( - console.log("===unsubscribeTwo Promise===") - ) - } - catch(err) { - console.error('=ActsSubscriber_test_0400 取消订阅 unSubscribeCallbackOne err:'+err); - } - console.debug("===ActsSubscriber_test_0400===end3===>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0400====>"); - }, time); - }) - - /* - * @tc.number: ActsSubscriber_test_0500 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsUnSubscriber_test_0500', 0, async function (done) { - console.debug("===============ActsSubscriber_test_0500======begin====================>"); - - var subInfo1 ={ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackThree, - } - var subInfo2 ={ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackFour, - } - try{ - await notify.subscribe(subInfo1,subscribeCallback); - await notify.subscribe(subInfo2,subscribeCallback); - }catch(err) { - console.error('=ActsSubscriber_test_0500 订阅 subscribeDoNotCallback err:'+err); - } - try{ - await notify.unsubscribe(subInfo1, unSubscribeCallbackThree); - await notify.unsubscribe(subInfo2, unSubscribeCallbackFour); - } - catch(err) { - console.error('=ActsSubscriber_test_0500 取消订阅 unSubscribeCallback err:'+err); - } - console.debug("===ActsSubscriber_test_0500===end3===>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0500====>"); - }, time); - }) - - /* - * @tc.number: ActsSubscriber_test_0600 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsUnSubscriber_test_0600', 0, async function (done) { - console.debug("===ActsSubscriber_test_0600===begin====>"); - - var subInfo1 ={ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackThree, - } - var subInfo2 ={ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackFour, - } - try{ - await notify.subscribe(subInfo1,subscribeCallback); - await notify.subscribe(subInfo2,subscribeCallback); - }catch(err) { - console.error('=ActsSubscriber_test_0600 订阅 subscribeDoNotCallback err:'+err); - } - try{ - notify.unsubscribe(subInfo1).then( - console.log("==unsubscribeTree Promise==") - ) - notify.unsubscribe(subInfo2).then( - console.log("===unsubscribeTree Promise===") - ) - } - catch(err) { - console.error('=ActsSubscriber_test_0600 取消订阅 unSubscribeCallback err:'+err); - } - console.debug("===ActsSubscriber_test_0600===end3===>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0600====>"); - }, time); - }) - - /* - * @tc.number: ActsSubscriber_test_0700 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsUnSubscriber_test_0700', 0, async function (done) { - console.debug("===ActsSubscriber_test_0700===begin===>"); - try{ - await notify.subscribe({ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackFive - },subscribeCallback); - }catch(err) { - console.error('=ActsSubscriber_test_0700 订阅 subscribeDoNotCallback err:'+err); - } - try{ - await notify.unsubscribe({ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackFive - },unSubscribeCallbackFive); - }catch(err) { - console.error('=ActsSubscriber_test_0700 订阅 subscribeDoNotCallback err:'+err); - } - console.debug("===ActsSubscriber_test_0700===end3===>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0700====>"); - }, time); - }) - - /* - * @tc.number: ActsSubscriber_test_0800 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsUnSubscriber_test_0800', 0, async function (done) { - console.debug("===ActsSubscriber_test_0800===begin===>"); - try{ - await notify.subscribe({ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackFive - },subscribeCallback); - }catch(err) { - console.error('=ActsSubscriber_test_0800 订阅 subscribeDoNotCallback err:'+err); - } - try{ - notify.unsubscribe({ - onConnecte:subscribeOnCallback, - onDestroy:unSubscribeCallbackFive - }).then( - console.log("====unsubscribeFour Promise====") - ) - }catch(err) { - console.error('=ActsSubscriber_test_0800 订阅 subscribeDoNotCallback err:'+err); - } - console.debug("===ActsSubscriber_test_0800===end3===>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsSubscriber_test_0800====>"); - }, time); - }) -}) - diff --git a/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/UnSubscriber.js b/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/UnSubscriber.js new file mode 100644 index 0000000000000000000000000000000000000000..1173c1d4463ad4c8d8e5b09b1e615f254d4affe2 --- /dev/null +++ b/notification/ans_standard/publish_test/unsubscribe/entry/src/main/js/test/UnSubscriber.js @@ -0,0 +1,388 @@ +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +var time = 1000 +describe('ActsAnsUnSubscriberTest', function () { + console.debug("===============ActsAnsUnSubscriberTest=================>"); + function unSubscribeCallbackOne(err) { + console.debug("===========Ans_UnSubscriber_0100 unSubscribeCallbackOne err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + function onConnecteOne(err) { + expect(err.code).assertEqual(0) + console.debug("===============Ans_UnSubscriber_0100 onConnecte err.code=================>"+err.code); + } + function onDisconnectOne(err) { + expect(err.code).assertEqual(0) + console.debug("===============Ans_UnSubscriber_0100 onDisconnect err.code=================>"+err.code); + } + + /* + * @tc.number: Ans_UnSubscriber_0100 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void; + * @tc.desc: Verify that the subscription can be successfully unsubscribed(callback) + */ + it('Ans_UnSubscriber_0100', 0, async function (done) { + console.info("===========Ans_UnSubscriber_0100 start=============>"); + var subscriber ={ + onConnect:onConnecteOne, + onDisconnect:onDisconnectOne + } + await notify.subscribe(subscriber); + console.info("===========Ans_UnSubscriber_0100 subscribe=============>"); + await notify.unsubscribe(subscriber, unSubscribeCallbackOne); + console.info("===========Ans_UnSubscriber_0100 unsubscribe=============>"); + done(); + setTimeout(function(){ + console.debug("===========Ans_UnSubscriber_0100 done=============>"); + }, time); + }) + + function onConnecteTwo(err) { + console.debug("============Ans_UnSubscriber_0200 onConnecteTwo err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + function onDisconnectTwo(err) { + console.debug("============Ans_UnSubscriber_0200 onDisconnectTwo err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + + /* + * @tc.number: Ans_UnSubscriber_0200 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise; + * @tc.desc: Verify that the subscription can be successfully unsubscribed(promise) + */ + it('Ans_UnSubscriber_0200', 0, async function (done) { + console.info("===========Ans_UnSubscriber_0200 start=============>"); + var subscriber ={ + onConnect:onConnecteTwo, + onDisconnect:onDisconnectTwo + } + await notify.subscribe(subscriber); + console.info("===========Ans_UnSubscriber_0200 subscribe=============>"); + await notify.unsubscribe(subscriber); + console.info("===========Ans_UnSubscriber_0200 unsubscribe=============>"); + done(); + setTimeout(function(){ + console.debug("===========Ans_UnSubscriber_0200 done=============>"); + }, time); + }) + + function onConnecteThree(err) { + console.debug("=======Ans_UnSubscriber_0300 onConnecteThree err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + function onDisconnectThree(err) { + console.debug("=======Ans_UnSubscriber_0300 onDisconnectThree err.code=================>"+err.code); + expect().assertFail(); + } + function unSubscribeCallbackThree(err){ + console.debug("Ans_UnSubscriber_0300 unSubscribeCallbackThree err.code=================>"+err.code); + expect(err.code).assertNotEqual(0); + } + + /* + * @tc.number: Ans_UnSubscriber_0300 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void; + * @tc.desc: Verify the use of the wrong subscriber to unsubscribe(callback) + */ + it('Ans_UnSubscriber_0300', 0, async function (done) { + console.info("===========Ans_UnSubscriber_0300 start=============>"); + var subscriber ={ + onConnect:onConnecteThree, + onDisconnect:onDisconnectThree + } + var subscriberErr ={ + onConnect:"", + onDisconnect:"" + } + await notify.subscribe(subscriber); + console.info("===========Ans_UnSubscriber_0300 subscribe=============>"); + await notify.unsubscribe(subscriberErr,unSubscribeCallbackThree); + console.info("===========Ans_UnSubscriber_0300 unsubscribe=============>"); + done(); + setTimeout(function(){ + console.debug("===========Ans_UnSubscriber_0300 done=============>"); + }, time); + }) + + function onConnecteFour(err) { + console.debug("=======Ans_UnSubscriber_0400 onConnecteFour err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + function onDisconnectFour(err) { + console.debug("=======Ans_UnSubscriber_0400 onDisconnectFour err.code=================>"+err.code); + expect().assertFail(); + } + + /* + * @tc.number: Ans_UnSubscriber_0400 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise; + * @tc.desc: Verify the use of the wrong subscriber to unsubscribe(promise) + */ + it('Ans_UnSubscriber_0400', 0, async function (done) { + console.info("===========Ans_UnSubscriber_0400 start=============>"); + var subscriber ={ + onConnect:onConnecteFour, + onDisconnect:onDisconnectFour + } + var subscriberErr ={ + onConnect:"", + onDisconnect:"" + } + await notify.subscribe(subscriber); + console.info("===========Ans_UnSubscriber_0400 subscribe=============>"); + await notify.unsubscribe(subscriberErr); + console.info("===========Ans_UnSubscriber_0400 unsubscribe=============>"); + done(); + setTimeout(function(){ + console.debug("===========Ans_UnSubscriber_0400 done=============>"); + }, time); + }) + + function onConnecteFive(err) { + console.debug("=======Ans_UnSubscriber_0500 onConnecteFive err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + function onDisconnectFive(err) { + console.debug("=======Ans_UnSubscriber_0500 onDisconnectFive err.code=================>"+err.code); + expect().assertFail(); + } + function unSubscribeCallbackFive(err){ + console.debug("Ans_UnSubscriber_0500 unSubscribeCallbackFive err.code=================>"+err.code); + expect(err.code).assertNotEqual(0); + } + function onConnecteTest(err) { + console.debug("=======Ans_UnSubscriber_0500 onConnecteTest err.code=================>"+err.code); + expect().assertFail(); + } + function onDisconnectTest(err) { + console.debug("=======Ans_UnSubscriber_0500 onDisconnectTest err.code=================>"+err.code); + expect().assertFail(); + } + + /* + * @tc.number: Ans_UnSubscriber_0500 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void; + * @tc.desc: Verify that inconsistent subscriber is used to unsubscribe(callback) + */ + it('Ans_UnSubscriber_0500', 0, async function (done) { + console.info("===========Ans_UnSubscriber_0500 start=============>"); + var subscriber ={ + onConnect:onConnecteFive, + onDisconnect:onDisconnectFive + } + var subscriberTest ={ + onConnect:onConnecteTest, + onDisconnect:onDisconnectTest + } + await notify.subscribe(subscriber); + console.info("===========Ans_UnSubscriber_0500 subscribe=============>"); + await notify.unsubscribe(subscriberTest,unSubscribeCallbackFive); + console.info("===========Ans_UnSubscriber_0500 unsubscribe=============>"); + done(); + setTimeout(function(){ + console.debug("===========Ans_UnSubscriber_0500 done=============>"); + }, time); + }) + + function onConnecteSix(err) { + console.debug("=======Ans_UnSubscriber_0600 onConnecteSix err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + function onDisconnectSix(err) { + console.debug("=======Ans_UnSubscriber_0600 onDisconnectSix err.code=================>"+err.code); + expect().assertFail(); + } + function onConnecteTestTwo(err) { + console.debug("=======Ans_UnSubscriber_0600 onConnecteTestTwo err.code=================>"+err.code); + expect().assertFail(); + } + function onDisconnectTestTwo(err) { + console.debug("=======Ans_UnSubscriber_0600 onDisconnectTestTwo err.code=================>"+err.code); + expect().assertFail(); + } + + /* + * @tc.number: Ans_UnSubscriber_0600 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise; + * @tc.desc: Verify that inconsistent subscriber is used to unsubscribe(promise) + */ + it('Ans_UnSubscriber_0600', 0, async function (done) { + console.info("===========Ans_UnSubscriber_0600 start=============>"); + var subscriber ={ + onConnect:onConnecteSix, + onDisconnect:onDisconnectSix + } + var subscriberTest ={ + onConnect:onConnecteTestTwo, + onDisconnect:onDisconnectTestTwo + } + await notify.subscribe(subscriber); + console.info("===========Ans_UnSubscriber_0600 subscribe=============>"); + await notify.unsubscribe(subscriberTest); + console.info("===========Ans_UnSubscriber_0600 unsubscribe=============>"); + done(); + setTimeout(function(){ + console.debug("===========Ans_UnSubscriber_0600 done=============>"); + }, time); + }) + + function onConnecteSeven(err) { + console.debug("=======Ans_UnSubscriber_0700 onConnecteSeven err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + var timesOfOnDis + function onDisconnectSeven(err) { + console.debug("=======Ans_UnSubscriber_0700 onDisconnectSeven err.code=================>"+err.code); + timesOfOnDis ++; + if (timesOfOnDis == 1){ + expect(err.code).assertEqual(0) + }else if(timesOfOnDis == 2){ + expect().assertFail(); + } + } + function unSubscribeCallbackSevenFirst(err){ + console.debug("Ans_UnSubscriber_0700 unSubscribeCallbackSevenFirst err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + function unSubscribeCallbackSevenSecond(err){ + console.debug("Ans_UnSubscriber_0700 unSubscribeCallbackSevenSecond err.code=================>"+err.code); + expect(err.code).assertNotEqual(0); + } + + /* + * @tc.number: Ans_UnSubscriber_0700 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void; + * @tc.desc:Verification: After the subscription is successful, unsubscribe twice in a row.(callback) + */ + it('Ans_UnSubscriber_0700', 0, async function (done) { + console.info("===========Ans_UnSubscriber_0700 start=============>"); + timesOfOnDis = 0 + var subscriber ={ + onConnect:onConnecteSeven, + onDisconnect:onDisconnectSeven + } + await notify.subscribe(subscriber); + console.info("===========Ans_UnSubscriber_0700 subscribe=============>"); + await notify.unsubscribe(subscriber, unSubscribeCallbackSevenFirst); + console.info("===========Ans_UnSubscriber_0700 unsubscribe first end=============>"); + await notify.unsubscribe(subscriber, unSubscribeCallbackSevenSecond); + console.info("===========Ans_UnSubscriber_0700 unsubscribe second end=============>"); + done(); + setTimeout(function(){ + console.info("===========Ans_UnSubscriber_0700 done=============>"); + }, time); + }) + + function onConnecteEight(err) { + console.debug("=======Ans_UnSubscriber_0800 onConnecteEight err.code=================>"+err.code); + expect(err.code).assertEqual(0) + } + function onDisconnectEight(err) { + console.debug("=======Ans_UnSubscriber_0800 onDisconnectEight err.code=================>"+err.code); + timesOfOnDis ++; + if (timesOfOnDis == 1){ + expect(err.code).assertEqual(0) + }else if(timesOfOnDis == 2){ + expect().assertFail(); + } + } + + /* + * @tc.number: Ans_UnSubscriber_0800 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise; + * @tc.desc: Verification: After the subscription is successful, unsubscribe twice in a row.(promise) + */ + it('Ans_UnSubscriber_0800', 0, async function (done) { + console.info("===========Ans_UnSubscriber_0800 start=============>"); + timesOfOnDis = 0 + var subscriber ={ + onConnect:onConnecteEight, + onDisconnect:onDisconnectEight + } + await notify.subscribe(subscriber); + console.info("===========Ans_UnSubscriber_0800 subscribe=============>"); + await notify.unsubscribe(subscriber); + console.info("===========Ans_UnSubscriber_0800 unsubscribe first=============>"); + await notify.unsubscribe(subscriber); + console.info("===========Ans_UnSubscriber_0800 unsubscribe second=============>"); + done(); + setTimeout(function(){ + console.info("===========Ans_UnSubscriber_0800 done=============>"); + }, time); + }) + + function onDisconnectTestNine(err) { + console.debug("=======Ans_UnSubscriber_0900 onDisconnectTestNine err.code=================>"+err.code); + expect().assertFail(); + } + function subscribeCallbackNine(err){ + console.debug("Ans_UnSubscriber_0900 subscribeCallbackNine err.code=================>"+err.code); + expect(err.code).assertNotEqual(0); + } + function unSubscribeCallbackNine(err){ + console.debug("Ans_UnSubscriber_0900 unSubscribeCallbackNine err.code=================>"+err.code); + expect(err.code).assertNotEqual(0); + } + /* + * @tc.number: Ans_UnSubscriber_0900 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void; + * @tc.desc: Verify that after the subscribe fails, the unsubscribe fails(callback) + */ + it('Ans_UnSubscriber_0900', 0, async function (done) { + console.info("===========Ans_UnSubscriber_0900 start=============>"); + var subscriber ={ + onConnect:"", + onDisconnect:onDisconnectTestNine + } + await notify.subscribe(subscriber, subscribeCallbackNine); + notify.unsubscribe(subscriber, unSubscribeCallbackNine); + done(); + setTimeout(function(){ + console.info("===========Ans_UnSubscriber_0900 done=============>"); + }, time); + }) + + function onDisconnectTestTen(err) { + console.debug("=======Ans_UnSubscriber_1000 onDisconnectTestTen err.code=================>"+err.code); + expect().assertFail(); + } + function subscribeCallbackTen(err){ + console.debug("Ans_UnSubscriber_1000 subscribeCallbackNine err.code=================>"+err.code); + expect(err.code).assertNotEqual(0); + } + /* + * @tc.number: Ans_UnSubscriber_1000 + * @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise; + * @tc.desc: Verify that after the subscribe fails, the unsubscribe fails(promise) + */ + it('Ans_UnSubscriber_1000', 0, async function (done) { + console.info("===========Ans_UnSubscriber_1000 start=============>"); + var subscriber = { + onConnect:"", + onDisconnect:onDisconnectTestTen + } + await notify.subscribe(subscriber, subscribeCallbackTen); + console.info("===========Ans_UnSubscriber_1000 subscribe end=============>"); + await notify.unsubscribe(subscriber); + done(); + setTimeout(function(){ + console.info("===========Ans_UnSubscriber_1000 done=============>"); + }, time); + }) +}) + diff --git a/notification/ans_standard/publishicontest/entry/src/main/js/default/app.js b/notification/ans_standard/publishicontest/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publishicontest/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publishicontest/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publishicontest/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publishicontest/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publishicontest/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publishicontest/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publishicontest/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publishicontest/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publishicontest/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publishicontest/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publishicontest/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publishicontest/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index c3b6a96287aa8ad4c9bf0e44ccba5d69b68ae02c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publishicontest/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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/publishicontest/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publishicontest/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 30895093f1f793272b0638cbde300dd08dfcf1c0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publishicontest/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Subscriber" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publishicontest/entry/src/main/js/resources/base/media/icon.png b/notification/ans_standard/publishicontest/entry/src/main/js/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publishicontest/entry/src/main/js/resources/base/media/icon.png and /dev/null differ diff --git a/notification/ans_standard/publishicontest/entry/src/main/js/test/Icon.js b/notification/ans_standard/publishicontest/entry/src/main/js/test/Icon.js deleted file mode 100644 index 925ce5d0c2836c0cf8f345b5d42705ac25c68970..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publishicontest/entry/src/main/js/test/Icon.js +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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 largeBuffer -var smallBuffer -var opts -var subInfo -var largeIcon -var smallIcon - -describe('ActsAnsIconTest', function () { - console.info("===========ActsAnsIconTest start====================>"); - - //consume - function consumeCallback(err,data) { - console.debug("==========================consumeCallback data : =======================>" +err+ JSON.stringify(data)); - data.largeIcon.getPixelBytesNumber().then((dataLarge)=>{ - console.info("==================getPixelBytesNumber_largeIcon dataLarge==================>"+ dataLarge); - console.info("==================getPixelBytesNumber_largeIcon largeBuffer==================>"+ largeBuffer); - expect(dataLarge).assertequal(largeBuffer); - }) - - data.smallIcon.getPixelBytesNumber().then((dataSmall)=>{ - console.info("==================getPixelBytesNumber_smallIcon dataSmall==================>"+ dataSmall); - console.info("==================getPixelBytesNumber_smallIcon smallBuffer==================>"+ smallBuffer); - expect(dataSmall).assertequal(smallBuffer); - }) - } - - function subscribeCallback(err) { - console.info("==========================subscribeCallback start=======================>"); - console.info("================subscribeCallback err : =======================>" + JSON.stringify(err)); - console.info("==========================subscribeCallback end=======================>"); - } - - function publishCallback(err){ - console.info("==========================publishCallback start=======================>"); - console.info("================publishCallback err : =======================>" + JSON.stringify(err)); - console.info("==========================publishCallback end=======================>"); - } - /* - * @tc.number: ActsAnsIconTest_0100 - * @tc.name: createPixelMap() - * @tc.desc: publish icon test - */ - it('ActsAnsIconTest_0100', 0, async function (done) { - console.debug("===============ActsAnsIconTest_0100 start====================>"); - subInfo ={ - onConsume:consumeCallback, - } - await notify.subscribe(subInfo,subscribeCallback); - - largeBuffer = new ArrayBuffer(64); - smallBuffer = new ArrayBuffer(32); - opts = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}} - const promise_Large = image.createPixelMap(largeBuffer, opts); - promise_Large.then((data) => { - console.debug("==========================createPixelMap_promise_Large=======================>"); - largeIcon = data; - console.debug("==========================createPixelMap_promise_Large largeIcon=======================>"+largeIcon); - - const promise_Small = image.createPixelMap(smallBuffer, opts); - promise_Small.then((data) => { - console.debug("==========================createPixelMap_promise_Small=======================>"); - smallIcon = data; - console.debug("==========================createPixelMap_promise_Small smallIcon=======================>"+smallIcon); - - notify.publish({ - id: 1, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test1_title", - text: "test1_text", - additionalText: "test1_additionalText" - }, - }, - slotType:notify.SlotType.SOCIAL_COMMUNICATION, - classification:"classification1", - sortingKey:"sortingKey1", - smallIcon:smallIcon, - largeIcon:largeIcon, - },publishCallback); - done(); - }); - - }); - - }) - - /* - * @tc.number: ActsAnsIconTest_0200 - * @tc.name: createPixelMap() - * @tc.desc: publish icon test - */ - it('ActsAnsIconTest_0200', 0, async function (done) { - console.debug("===============ActsAnsIconTest_0200 start====================>"); - subInfo ={ - onConsume:consumeCallback, - } - await notify.subscribe(subInfo,subscribeCallback); - - largeBuffer = new ArrayBuffer(0); - smallBuffer = new ArrayBuffer(0); - opts = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}} - const promise_Large = image.createPixelMap(largeBuffer, opts); - promise_Large.then((data) => { - console.debug("==========================createPixelMap_promise_Large=======================>"); - largeIcon = data; - console.debug("==========================createPixelMap_promise_Large largeIcon=======================>"+largeIcon); - - const promise_Small = image.createPixelMap(smallBuffer, opts); - promise_Small.then((data) => { - console.debug("==========================createPixelMap_promise_Small=======================>"); - smallIcon = data; - console.debug("==========================createPixelMap_promise_Small smallIcon=======================>"+smallIcon); - - notify.publish({ - id: 1, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test1_title", - text: "test1_text", - additionalText: "test1_additionalText" - }, - }, - slotType:notify.SlotType.SOCIAL_COMMUNICATION, - classification:"classification1", - sortingKey:"sortingKey1", - smallIcon:smallIcon, - largeIcon:largeIcon, - },publishCallback); - done(); - }); - - }); - - }) -}) - diff --git a/notification/ans_standard/publishicontest/signature/openharmony_sx.p7b b/notification/ans_standard/publishicontest/signature/openharmony_sx.p7b deleted file mode 100755 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publishicontest/signature/openharmony_sx.p7b and /dev/null differ