diff --git a/resourceschedule/resourceschedule_standard/BUILD.gn b/resourceschedule/resourceschedule_standard/BUILD.gn index 7aab0b9e0d07e2b0f9fabd9675142fa9ee1623c3..569e4acd99afb98b956424ef8f6d0f54cede6597 100644 --- a/resourceschedule/resourceschedule_standard/BUILD.gn +++ b/resourceschedule/resourceschedule_standard/BUILD.gn @@ -21,6 +21,7 @@ group("resourceschedule_standard") { "continuoustaskrelyhap:ContinuousTaskRelyHap", "deviceusagestatisticsjsunit:resourceschedule_deviceusagestatisticsjsunit_js_test", "reminderagent:resourceschedule_reminderagent_js_test", + "reminderagentManager:resourceschedule_reminderagentmgr_js_test", "workscheduler:resourceschedule_workscheduler_js_test", ] } diff --git a/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/test/List.test.js b/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/test/List.test.js index f3bc65d89006da669b7e5787cf9036f4ea91f15f..56d3dee2db870697d80526c30b759eeeab19b8b1 100644 --- a/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/test/List.test.js +++ b/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/test/List.test.js @@ -14,9 +14,8 @@ */ import bundlestate_test from './BundleState.test.js' import DeviceUsageStatisticsJsTest from './DeviceUsageStatisticsJsunit.test.js' -import UsageStatisticsTest from './UsageStatistics.test.js' + export default function testsuite() { bundlestate_test() DeviceUsageStatisticsJsTest() - UsageStatisticsTest() } diff --git a/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/test/UsageStatistics.test.js b/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/test/UsageStatistics.test.js deleted file mode 100644 index 18b763be2a6ec2e54fc28f2f487f925142a058b4..0000000000000000000000000000000000000000 --- a/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/js/test/UsageStatistics.test.js +++ /dev/null @@ -1,491 +0,0 @@ -/* - * Copyright (C) 2022 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 usageStatistics from '@ohos.resourceschedule.usageStatistics' - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' - -export default function UsageStatistics() { -describe("UsageStatistics", function () { - beforeAll(function() { - - /* - * @tc.setup: setup invoked before all testcases - */ - console.info('beforeAll called') - }) - - afterAll(function() { - - /* - * @tc.teardown: teardown invoked after all testcases - */ - console.info('afterAll called') - }) - - beforeEach(function() { - - /* - * @tc.setup: setup invoked before each testcases - */ - console.info('beforeEach called') - }) - - afterEach(function() { - - /* - * @tc.teardown: teardown invoked after each testcases - */ - console.info('afterEach caled') - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0025 - * @tc.name: UsageStatistics001 - * @tc.desc: test isIdleState promise. - */ - it("UsageStatistics001", 0, async function (done) { - console.info('----------------------UsageStatistics001---------------------------'); - let bundleName = 'ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function'; - try { - usageStatistics.isIdleState(bundleName).then((res) => { - console.info('test UsageStatistics001 isIdleState promise success.' + res); - expect(res).assertFalse(); - done() - }).catch((err) => { - console.info('test UsageStatistics001 isIdleState promise failure.' + err.code); - }); - } catch (error) { - console.info('isIdleState throw error, code is: ' + error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0026 - * @tc.name: UsageStatistics002 - * @tc.desc: test isIdleState callback. - */ - it("UsageStatistics002", 0, async function (done) { - console.info('----------------------UsageStatistics002---------------------------'); - let bundleName = 'ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function'; - try { - usageStatistics.isIdleState(bundleName, (err, res) => { - if(err) { - console.info('test UsageStatistics002 isIdleState callback failure.' + err.code); - } else { - console.info('test UsageStatistics002 isIdleState callback success.' + res); - expect(res).assertFalse(); - done(); - } - }); - } catch (error) { - console.info('isIdleState throw error, code is: ' + error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0027 - * @tc.name: UsageStatistics003 - * @tc.desc: test queryAppGroup promise. - */ - it("UsageStatistics003", 0, async function (done) { - console.info('----------------------UsageStatistics003---------------------------'); - let bundleName = 'ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function'; - try { - usageStatistics.queryAppGroup(bundleName).then( res => { - console.info('test UsageStatistics003 queryAppGroup promise success.' + res); - expect(res).assertEqual(10); - done(); - }).catch( err => { - console.info('tets UsageStatistics003 queryAppGroup promise failure.' + err.code); - }); - } catch (error) { - console.info('queryAppGroup throw error, code is: ' + error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0028 - * @tc.name: UsageStatistics004 - * @tc.desc: test queryAppGroup callback. - */ - it("UsageStatistics004", 0, async function (done) { - console.info('----------------------UsageStatistics004---------------------------'); - let bundleName = 'ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function'; - try { - usageStatistics.queryAppGroup(bundleName, (err, res) => { - if(err) { - console.info('test UsageStatistics004 queryAppGroup callback failure.' + err.code); - } else { - console.info('tets UsageStatistics004 queryAppGroup callback success.' + res); - expect(res).assertEqual(10); - done(); - } - }); - } catch (error) { - console.info('queryAppGroup throw error, code is: ' + error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0029 - * @tc.name: UsageStatistics005 - * @tc.desc: test queryCurrentBundleEvents promise. - */ - it("UsageStatistics005", 0, async function (done) { - console.info('----------------------UsageStatistics005---------------------------'); - let beginTime = 0; - let endTime = 20000000000000; - try { - usageStatistics.queryCurrentBundleEvents(beginTime, endTime).then((res) => { - console.info('test UsageStatistics005 queryCurrentBundleEvents promise success.' + res); - expect(res).assertInstanceOf("Array"); - done(); - }).catch((err) => { - console.info('test UsageStatistics005 queryCurrentBundleEvents promise failure.' + err.code); - }); - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0030 - * @tc.name: UsageStatistics006 - * @tc.desc: test queryCurrentBundleEvents callback. - */ - it("UsageStatistics006", 0, async function (done) { - console.info('----------------------UsageStatistics006---------------------------'); - let beginTime = 0; - let endTime = 20000000000000; - try { - usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => { - if(err) { - console.info('tets UsageStatistics006 queryCurrentBundleEvents callback failure.' + err.code); - } else { - console.info('test UsageStatistics006 queryCurrentBundleEvents callback success.' + res); - expect(res).assertInstanceOf("Array"); - done(); - } - }); - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0031 - * @tc.name: UsageStatistics007 - * @tc.desc: test BundleEvents bundleName. - */ - it("UsageStatistics007", 0, async function (done) { - console.info('----------------------UsageStatistics007---------------------------'); - let beginTime = 10; - let endTime = 20000000000000; - try { - usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => { - if(err) { - console.info('tets UsageStatistics007 queryCurrentBundleEvents callback failure.' + err.code); - } else { - console.info('test UsageStatistics007 queryCurrentBundleEvents callback success.' + res); - expect(res).assertInstanceOf("Array"); - if(res === undefined) { - res = [{bundleName: 'www.baidu.com'}]; - } - console.info('test BundleEvents bundleName :' + res[0].bundleName); - done(); - } - }); - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0032 - * @tc.name: UsageStatistics008 - * @tc.desc: test BundleEvents eventId. - */ - it("UsageStatistics008", 0, async function (done) { - console.info('----------------------UsageStatistics008---------------------------'); - let beginTime = 10; - let endTime = 20000000000000; - try { - usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => { - if(err) { - console.info('tets UsageStatistics008 queryCurrentBundleEvents callback failure.' + err.code); - } else { - console.info('test UsageStatistics008 queryCurrentBundleEvents callback success.' + res); - expect(res).assertInstanceOf("Array"); - if(res === undefined) { - res = [{eventId: 0}]; - } - console.info('test BundleEvents eventId :' + res[0].eventId); - done(); - } - }) - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0033 - * @tc.name: UsageStatistics009 - * @tc.desc: test BundleEvents eventOccurredTime. - */ - it("UsageStatistics009", 0, async function (done) { - console.info('----------------------UsageStatistics009---------------------------'); - let beginTime = 10; - let endTime = 20000000000000; - try { - usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => { - if(err) { - console.info('tets UsageStatistics009 queryCurrentBundleEvents callback failure.' + err.code); - } else { - console.info('test UsageStatistics009 queryCurrentBundleEvents callback success.' + res); - expect(res).assertInstanceOf("Array"); - if(res === undefined) { - res = [{eventOccurredTime: 10000000000000}]; - } - console.info('test BundleEvents eventOccurredTime :' + res[0].eventOccurredTime); - done(); - } - }) - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0034 - * @tc.name: UsageStatistics0010 - * @tc.desc: test BundleEvents appGroup. - */ - it("UsageStatistics0010", 0, async function (done) { - console.info('----------------------UsageStatistics0010---------------------------'); - let beginTime = 10; - let endTime = 20000000000000; - try { - usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => { - if(err) { - console.info('tets UsageStatistics0010 queryCurrentBundleEvents callback failure.' + err.code); - } else { - console.info('test UsageStatistics0010 queryCurrentBundleEvents callback success.' + res); - expect(res).assertInstanceOf("Array"); - if(res === undefined) { - res = [{appGroup: 1}]; - } - console.info('test BundleEvents appGroup :' + res[0].appGroup); - done(); - } - }) - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0035 - * @tc.name: UsageStatistics0011 - * @tc.desc: test BundleEvents indexOfLink. - */ - it("UsageStatistics0011", 0, async function (done) { - console.info('----------------------UsageStatistics0011---------------------------'); - let beginTime = 10; - let endTime = 20000000000000; - try { - usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => { - if(err) { - console.info('tets UsageStatistics0011 queryCurrentBundleEvents callback failure.' + err.code); - } else { - console.info('test UsageStatistics0011 queryCurrentBundleEvents callback success.' + res); - expect(res).assertInstanceOf("Array"); - if(res === undefined) { - res = [{indexOfLink: 'id'}]; - } - console.info('test BundleEvents indexOfLink :' + res[0].indexOfLink); - done(); - } - }) - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0036 - * @tc.name: UsageStatistics0012 - * @tc.desc: test BundleEvents nameOfClass. - */ - it("UsageStatistics0012", 0, async function (done) { - console.info('----------------------UsageStatistics0012---------------------------'); - let beginTime = 10; - let endTime = 20000000000000; - try { - usageStatistics.queryCurrentBundleEvents(beginTime, endTime, (err, res) => { - if(err) { - console.info('tets UsageStatistics0012 queryCurrentBundleEvents callback failure.' + err.code); - } else { - console.info('test UsageStatistics0012 queryCurrentBundleEvents callback success.' + res); - expect(res).assertInstanceOf("Array"); - if(res === undefined) { - res = [{nameOfClass: 'BundleEvents'}]; - } - console.info('test BundleEvents nameOfClass :' + res[0].nameOfClass); - done(); - } - }) - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0037 - * @tc.name: UsageStatistics0013 - * @tc.desc: test isIdleState promise. - */ - it("UsageStatistics0013", 0, async function (done) { - console.info('----------------------UsageStatistics0013---------------------------'); - try { - usageStatistics.isIdleState(12345).then((res) => { - console.info('test UsageStatistics0013 isIdleStateone promise success.' + res); - }).catch((err) => { - console.info('test UsageStatistics0013 isIdleState promise failure.' + err.code); - }); - } catch (error) { - console.info('isIdleState throw error, code is: ' + error.code + ',message is: ' + error.message); - expect(error.code).assertEqual("401"); - done(); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0038 - * @tc.name: UsageStatistics0014 - * @tc.desc: test isIdleState callback. - */ - it("UsageStatistics0014", 0, async function (done) { - console.info('----------------------UsageStatistics0014---------------------------'); - try { - usageStatistics.isIdleState("", (err, res) => { - if(err) { - console.info('test UsageStatistics0014 isIdleState callback failure.' + err.code); - } else { - console.info('test UsageStatistics0014 isIdleState callback success.' + res); - } - }); - } catch (error) { - console.info('isIdleState throw error, code is: ' + error.code + ',message is: ' + error.message); - expect(error.code).assertEqual("401"); - done(); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0039 - * @tc.name: UsageStatistics0015 - * @tc.desc: test queryAppGroup promise. - */ - it("UsageStatistics0015", 0, async function (done) { - console.info('----------------------UsageStatistics0015---------------------------'); - try { - usageStatistics.queryAppGroup(123456).then( res => { - console.info('test UsageStatistics0015 queryAppGroup promise success.'+ res); - }).catch( err => { - console.info('tets UsageStatistics0015 queryAppGroup promise failure.' + err.code); - }); - } catch (error) { - console.info('queryAppGroup throw error, code is: ' + error.code + ',message is: ' + error.message); - expect(error.code).assertEqual("401"); - done(); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0040 - * @tc.name: UsageStatistics0016 - * @tc.desc: test queryAppGroup callback. - */ - it("UsageStatistics0016", 0, async function (done) { - console.info('----------------------UsageStatistics0016---------------------------'); - try { - usageStatistics.queryAppGroup(null, (err, res) => { - if(err) { - console.info('test UsageStatistics0016 queryAppGroup callback failure.' + err.code); - } else { - console.info('tets UsageStatistics0016 queryAppGroup callback success.' + res); - } - }); - } catch (error) { - console.info('queryAppGroup throw error, code is: ' + error.code + ',message is: ' + error.message); - expect(error.code).assertEqual("401"); - done(); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0041 - * @tc.name: UsageStatistics0017 - * @tc.desc: test queryCurrentBundleEvents promise. - */ - it("UsageStatistics0017", 0, async function (done) { - console.info('----------------------UsageStatistics0017---------------------------'); - try { - usageStatistics.queryCurrentBundleEvents(true, false).then((res) => { - console.info('test UsageStatistics0017 queryCurrentBundleEvents promise success.' + res); - }).catch((err) => { - console.info('test UsageStatistics0017 queryCurrentBundleEvents promise failure.' + err.code); - }); - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - expect(error.code).assertEqual("401"); - done(); - } - }) - - /* - * @tc.number:SUB_RESOURCESCHEDULE_USAGEINFO_QUERY_XTS_0042 - * @tc.name: UsageStatistics0018 - * @tc.desc: test queryCurrentBundleEvents callback. - */ - it("UsageStatistics0018", 0, async function (done) { - console.info('----------------------UsageStatistics0018---------------------------'); - try { - usageStatistics.queryCurrentBundleEvents("", "1235456", (err, res) => { - if(err) { - console.info('tets UsageStatistics0018 queryCurrentBundleEvents callback failure.' + err.code); - } else { - console.info('test UsageStatistics0018 queryCurrentBundleEvents callback success.' + res); - } - }); - } catch (error) { - console.info('queryCurrentBundleEvents throw error, code is: ' + - error.code + ',message is: ' + error.message); - expect(error.code).assertEqual("401"); - done(); - } - }) -})} diff --git a/resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/List.test.js b/resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/List.test.js index 99881bebcb3d5d4c1d0550ce804f83064787ecc2..62824b71256ac7bc2b86e6da9fe6420327d6f940 100644 --- a/resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/List.test.js +++ b/resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/List.test.js @@ -13,9 +13,8 @@ * limitations under the License. */ import ReminderAgentTest from './ReminderAgentJs.test.js' -import ReminderAgentManagerTest from './ReminderAgentManagerJs.test.js' + export default function testsuite() { ReminderAgentTest() -ReminderAgentManagerTest() } diff --git a/resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/ReminderAgentJs.test.js b/resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/ReminderAgentJs.test.js index 76a392b4baee964fce97e067a413ed9d32184b09..6025bb74eee3ccd86d2b5e7b5650e8eec27a8b1c 100644 --- a/resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/ReminderAgentJs.test.js +++ b/resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/ReminderAgentJs.test.js @@ -2800,7 +2800,8 @@ export default function ReminderAgentTest() { let firstId = 0; let secondId = 0; let diffId = 0 - for (let i = 0; i < maxLimitNumsOfApp; i++) { + reminderAgent.cancelAllReminders().then(() =>{ + for (let i = 0; i < maxLimitNumsOfApp; i++) { (function (i) { setTimeout(function () { reminderAgent.publishReminder(timer).then((reminderId) => { @@ -2811,12 +2812,13 @@ export default function ReminderAgentTest() { secondId = reminderId diffId = secondId - firstId expect(29).assertEqual(diffId); + done(); } }); - }, 500 * i); + }, 500); })(i); } - done(); + }) }) /** diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/BUILD.gn b/resourceschedule/resourceschedule_standard/reminderagentManager/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..620c816d7332252cba1e73058e1d20be416463c3 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/BUILD.gn @@ -0,0 +1,35 @@ +# 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("resourceschedule_reminderagentmgr_js_test") { + hap_profile = "./src/main/config.json" + deps = [ + ":resourceschedule_js_assets", + ":resourceschedule_js_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsResourcescheduleReminderAgentMgrTest" + subsystem_name = "notification" + part_name = "distributed_notification_service" +} +ohos_js_assets("resourceschedule_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} +ohos_resources("resourceschedule_js_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/Test.json b/resourceschedule/resourceschedule_standard/reminderagentManager/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..17f24ca21de287034ae4bad71d6251119cb0d50d --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for resourceschedule js api Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "300000", + "shell-timeout": "300000", + "bundle-name": "ohos.acts.resourceschedule.reminderagentMgr.js.function", + "package-name": "ohos.acts.resourceschedule.reminderagentMgr.js.function" + }, + "kits": [ + { + "test-file-name": [ + "ActsResourcescheduleReminderAgentMgrTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/signature/openharmony_sx.p7b b/resourceschedule/resourceschedule_standard/reminderagentManager/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..19950f1bc1f859de3380460702902327f3f819f4 Binary files /dev/null and b/resourceschedule/resourceschedule_standard/reminderagentManager/signature/openharmony_sx.p7b differ diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/config.json b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..bccf0ce862e4098570dd47ecb3bf236a79039140 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/config.json @@ -0,0 +1,107 @@ +{ + "app": { + "bundleName": "ohos.acts.resourceschedule.reminderagentMgr.js.function", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.resourceschedule.reminderagentMgr.js.function", + "name": ".entry", + "deviceType": [ + "tablet", + "default", + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.PUBLISH_AGENT_REMINDER", + "reason": "SYSTEM_GRANT", + "usedScene": { + "ability": [ + ".FormAbility" + ], + "when": "inuse" + } + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + }, + "mainAbility": ".MainAbility", + "srcPath": "" + } +} \ No newline at end of file diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/app.js b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/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/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/i18n/en-US.json b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/i18n/zh-CN.json b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..096c4d3d6046124485b28f71efab32009529c20d --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "鸿蒙" + } +} \ No newline at end of file diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/pages/index/index.css b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/pages/index/index.hml b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/pages/index/index.js b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..af4eb3e36a12da5f06a27d61d5fd178a846dc866 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,32 @@ +/* + * 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'); + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + }, +} diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/app.js b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/i18n/en-US.json b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/i18n/zh-CN.json b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/pages/index/index.css b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,30 @@ +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/pages/index/index.hml b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/pages/index/index.js b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 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 { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/test/List.test.js b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b84a7e1714241334e48ec37315a4a50c09eaeb36 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * 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 ReminderAgentManagerTest from './ReminderAgentManagerJs.test.js' +export default function testsuite() { +ReminderAgentManagerTest() + +} diff --git a/resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/ReminderAgentManagerJs.test.js b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/test/ReminderAgentManagerJs.test.js similarity index 100% rename from resourceschedule/resourceschedule_standard/reminderagent/src/main/js/test/ReminderAgentManagerJs.test.js rename to resourceschedule/resourceschedule_standard/reminderagentManager/src/main/js/test/ReminderAgentManagerJs.test.js diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/resources/base/element/string.json b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c94190af0230b530a80cf81a94026ad30411a66d --- /dev/null +++ b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ResourcescheduleJSApiTest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/resources/base/media/icon.png b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/resourceschedule/resourceschedule_standard/reminderagentManager/src/main/resources/base/media/icon.png differ