diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ee3a7077b7d52935d3f70b5cb70e38ea9d0e33f1
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,84 @@
+/*
+ * 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 { Core, ExpectExtend } from 'deccjsunit/index'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: "",
+ testTime: 0
+ },
+ onInit() {
+ console.info('ActsProcessManageJsTest onInit');
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('ActsProcessManageJsTest onShow');
+ console.info('ActsProcessManageJsTest testTime' + this.testTime);
+ if (this.testTime == 0) {
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ core.addService('expect', expectExtend)
+ core.init()
+ const configService = core.getDefaultService('config')
+ this.timeout = 30000;
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ }
+ this.testTime++;
+ },
+ onReady() {
+ console.info('ActsProcessManageJsTest onReady');
+ },
+ onActive() {
+ console.info('ActsProcessManageJsTest onActive');
+ },
+ onInactive() {
+ console.info('ActsProcessManageJsTest onInactive');
+ },
+ onHide() {
+ console.info('ActsProcessManageJsTest onHide');
+ },
+ onDestroy() {
+ console.info('ActsProcessManageJsTest onDestroy');
+ },
+ onBackPress() {
+ console.info('ActsProcessManageJsTest onBackPress');
+ },
+ onNewRequest() {
+ console.info('ActsProcessManageJsTest onNewRequest');
+ },
+ onStartContinuation() {
+ console.info('ActsProcessManageJsTest onStartContinuation');
+ },
+ onSaveData(value) {
+ console.info('ActsProcessManageJsTest onSaveData:' + JSON.stringify(value));
+ },
+ onRestoreData(value) {
+ console.info('ActsProcessManageJsTest onRestoreData:' + JSON.stringify(value));
+ },
+ onCompleteContinuation(code) {
+ console.info('ActsProcessManageJsTest onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ActsProcessManageJsTest onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..03574a36c533357eef7fc0acc5e21af14f4e5f67
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "actsparticleabilitytest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/test/ActsKillProcessTest.test.js b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/test/ActsKillProcessTest.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..c6fe236bdd1df7c72241b09661e067bb0f9f1b0b
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/test/ActsKillProcessTest.test.js
@@ -0,0 +1,287 @@
+/*
+ * 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"
+import appManager from '@ohos.application.AppManager';
+import featureAbility from '@ohos.ability.featureAbility'
+
+const ACCOUNT_ID = 100;
+const NULL_ACCOUNT_ID = 102;
+const BUNDLE_NAME = 'com.example.actskillprocesswithaccountcloseapi7';
+const NULL_BUNDLE_NAME = 'com.aaa.bbb';
+const START_ABILITY_NAME = 'com.example.actskillprocesswithaccountcloseapi7.MainAbility';
+
+describe('ActskillProcessWithaccountTest', function () {
+
+ beforeEach(async (done) => {
+ console.log('======>beforeEach killProcessWithAccountFATest<=======');
+
+ await featureAbility.startAbility({
+ want:
+ {
+ bundleName: BUNDLE_NAME,
+ abilityName: START_ABILITY_NAME
+ }
+ }).then(async () => {
+ console.log("====>end ACTS_KillProcessWithAccountFA startability ====>success!")
+ done();
+ })
+ })
+
+ function sleep(time) {
+ let delta;
+ if (typeof time != 'number' || time <= 0) {
+ delta = 100;
+ } else {
+ delta = Math.round(time);
+ }
+ for (let start = Date.now(); Date.now() - start <= delta;);
+ }
+
+ function checkRunningProcess(name, dataInfo) {
+ for (let i = 0, len = dataInfo.length; i < len; i++) {
+ if (dataInfo[i].processName == name) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @tc.number: ACTS_KillProcessWithAccountFA_0100
+ * @tc.name: Provide the system interface of the specified user management application.
+ * @tc.desc: Validates the ability to stop the specified process for the specified user.
+ */
+ it('ACTS_KillProcessWithAccountFA_0100', 0, async function (done) {
+ console.debug("====>ACTS_KillProcessWithAccountFA_0100 start startAbility====>");
+
+ var procrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0100 ==1== getProcessRunningInfos ======> '
+ + JSON.stringify(procrssinfo));
+ var infores = checkRunningProcess(BUNDLE_NAME, procrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0100====>infores = " + infores)
+ expect(infores).assertEqual(true);
+
+ await appManager.killProcessWithAccount(BUNDLE_NAME, ACCOUNT_ID).then(async () => {
+ console.log('ACTS_KillProcessWithAccountFA_0100 killProcess ======> start');
+ })
+
+ setTimeout(async () => {
+ var copyprocrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0100 getProcessRunningInfos ======> '
+ + JSON.stringify(copyprocrssinfo));
+ var outcopy = checkRunningProcess(BUNDLE_NAME, copyprocrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0100====>outcopy = " + outcopy)
+ expect(outcopy).assertEqual(false);
+ done();
+ }, 3000)
+ })
+
+ /**
+ * @tc.number: ACTS_KillProcessWithAccountFA_0300
+ * @tc.name: Provide the system interface of the specified user management application.
+ * @tc.desc: Authentication cannot stop the specified process for the specified user.
+ */
+ it('ACTS_KillProcessWithAccountFA_0300', 0, async function (done) {
+ console.debug("====>ACTS_KillProcessWithAccountFA_0300 start startAbility====>");
+
+ var getinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0300 getProcessRunningInfos =1= ======> '
+ + JSON.stringify(getinfo));
+ var res = checkRunningProcess(BUNDLE_NAME, getinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0300====>res = " + res)
+ expect(res).assertEqual(true);
+
+ appManager.killProcessWithAccount(NULL_BUNDLE_NAME, ACCOUNT_ID).then(() => {
+ console.log('ACTS_KillProcessWithAccountFA_0300 ======> ');
+ })
+
+ setTimeout(async () => {
+ var procrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0300 ==1== getProcessRunningInfos ======> '
+ + JSON.stringify(procrssinfo));
+ var infores = checkRunningProcess(BUNDLE_NAME, procrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0300====>infores = " + infores)
+ expect(infores).assertEqual(true);
+
+ await appManager.killProcessWithAccount(BUNDLE_NAME, ACCOUNT_ID).then(async () => {
+ console.log('ACTS_KillProcessWithAccountFA_0300 killProcess ======> start');
+ sleep(500)
+ var copyprocrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0300 getProcessRunningInfos ======> '
+ + JSON.stringify(copyprocrssinfo));
+ var outcopy = checkRunningProcess(BUNDLE_NAME, copyprocrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0300====> outcopy = " + outcopy)
+ expect(outcopy).assertEqual(false);
+ done();
+ })
+ }, 1500)
+ })
+
+ /**
+ * @tc.number: ACTS_KillProcessWithAccountFA_0400
+ * @tc.name: Provide the system interface of the specified user management application.
+ * @tc.desc: Authentication cannot stop the specified process for the specified user.
+ */
+ it('ACTS_KillProcessWithAccountFA_0400', 0, async function (done) {
+ console.debug("====>ACTS_KillProcessWithAccountFA_0400 start startAbility====>");
+
+ var getinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0400 getProcessRunningInfos =1= ======> '
+ + JSON.stringify(getinfo));
+ var res = checkRunningProcess(BUNDLE_NAME, getinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0400====>res = " + res)
+ expect(res).assertEqual(true);
+
+ appManager.killProcessWithAccount(BUNDLE_NAME, NULL_ACCOUNT_ID).then(() => {
+ console.log('ACTS_KillProcessWithAccountFA_0400 killProcess ======> start');
+ })
+
+ setTimeout(async () => {
+ var procrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0400 ==1== getProcessRunningInfos ======> '
+ + JSON.stringify(procrssinfo));
+ var infores = checkRunningProcess(BUNDLE_NAME, procrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0400====>infores = " + infores)
+ expect(infores).assertEqual(true);
+
+ appManager.killProcessWithAccount(BUNDLE_NAME, ACCOUNT_ID).then(async () => {
+ console.log('ACTS_KillProcessWithAccountFA_0400 killProcess2 ======> start');
+
+ sleep(500)
+ var copyprocrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0400 ==2== getProcessRunningInfos ======>'
+ + JSON.stringify(copyprocrssinfo));
+ var out = checkRunningProcess(BUNDLE_NAME, copyprocrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0400====>infores = " + out)
+ expect(out).assertEqual(false);
+ done();
+ })
+ }, 1500)
+ })
+
+ /**
+ * @tc.number: ACTS_KillProcessWithAccountFA_0500
+ * @tc.name: Provide the system interface of the specified user management application.
+ * @tc.desc: Validates the ability to stop the specified process for the specified user.
+ */
+ it('ACTS_KillProcessWithAccountFA_0500', 0, async function (done) {
+ console.debug("====>ACTS_KillProcessWithAccountFA_0500 start startAbility====>");
+
+ var procrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0500 ==1== getProcessRunningInfos ======> '
+ + JSON.stringify(procrssinfo));
+ var infores = checkRunningProcess(BUNDLE_NAME, procrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0500====>infores = " + infores)
+ expect(infores).assertEqual(true);
+
+ await appManager.killProcessWithAccount(BUNDLE_NAME, ACCOUNT_ID, (async () => {
+ console.log('ACTS_KillProcessWithAccountFA_0500 killProcess ======> start');
+ }))
+
+ setTimeout(async () => {
+ var copyprocrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0500 getProcessRunningInfos ======> '
+ + JSON.stringify(copyprocrssinfo));
+ var outcopy = checkRunningProcess(BUNDLE_NAME, copyprocrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0500====>outcopy = " + outcopy)
+ expect(outcopy).assertEqual(false);
+ done();
+ }, 3000)
+ })
+
+ /**
+ * @tc.number: ACTS_KillProcessWithAccountFA_0700
+ * @tc.name: Provide the system interface of the specified user management application.
+ * @tc.desc: Authentication cannot stop the specified process for the specified user.
+ */
+ it('ACTS_KillProcessWithAccountFA_0700', 0, async function (done) {
+ console.debug("====>ACTS_KillProcessWithAccountFA_0700 start startAbility====>");
+
+ var getinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0700 getProcessRunningInfos =1= ======> '
+ + JSON.stringify(getinfo));
+ var res = checkRunningProcess(BUNDLE_NAME, getinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0700====>res = " + res)
+ expect(res).assertEqual(true);
+
+ appManager.killProcessWithAccount(NULL_BUNDLE_NAME, ACCOUNT_ID, (() => {
+ console.log('ACTS_KillProcessWithAccountFA_0700 killProcess ======> start');
+ }))
+
+ setTimeout(async () => {
+ var procrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0700 ==1== getProcessRunningInfos ======> '
+ + JSON.stringify(procrssinfo));
+ var infores = checkRunningProcess(BUNDLE_NAME, procrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0700====>infores = " + infores)
+ expect(infores).assertEqual(true);
+
+ await appManager.killProcessWithAccount(BUNDLE_NAME, ACCOUNT_ID).then(async () => {
+ console.log('ACTS_KillProcessWithAccountFA_0700 killProcess ======> start');
+ sleep(500)
+ var copyprocrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0700 getProcessRunningInfos ======> '
+ + JSON.stringify(copyprocrssinfo));
+ var outcopy = checkRunningProcess(BUNDLE_NAME, copyprocrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0700====> outcopy = " + outcopy)
+ expect(outcopy).assertEqual(false);
+ done();
+ })
+ }, 1500)
+ })
+
+ /**
+ * @tc.number: ACTS_KillProcessWithAccountFA_0800
+ * @tc.name: Provide the system interface of the specified user management application.
+ * @tc.desc: Authentication cannot stop the specified process for the specified user.
+ */
+ it('ACTS_KillProcessWithAccountFA_0800', 0, async function (done) {
+ console.debug("====>ACTS_KillProcessWithAccountFA_0800 start startAbility====>");
+
+ var getinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0800 getProcessRunningInfos =1= ======> '
+ + JSON.stringify(getinfo));
+ var res = checkRunningProcess(BUNDLE_NAME, getinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0800====>res = " + res)
+ expect(res).assertEqual(true);
+
+ appManager.killProcessWithAccount(BUNDLE_NAME, NULL_ACCOUNT_ID, (() => {
+ console.log('ACTS_KillProcessWithAccountFA_0800 killProcess ======> start');
+ }))
+
+ setTimeout(async () => {
+ var procrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0800 ==1== getProcessRunningInfos ======> '
+ + JSON.stringify(procrssinfo));
+ var infores = checkRunningProcess(BUNDLE_NAME, procrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0800====>infores = " + infores)
+ expect(infores).assertEqual(true);
+
+ await appManager.killProcessWithAccount(BUNDLE_NAME, ACCOUNT_ID).then(async () => {
+ console.log('ACTS_KillProcessWithAccountFA_0800 killProcess ======> start');
+ sleep(500)
+ var copyprocrssinfo = await appManager.getProcessRunningInfos()
+ console.log('ACTS_KillProcessWithAccountFA_0800 getProcessRunningInfos ======> '
+ + JSON.stringify(copyprocrssinfo));
+ var outcopy = checkRunningProcess(BUNDLE_NAME, copyprocrssinfo)
+ console.log("====>ACTS_KillProcessWithAccountFA_0800====> outcopy = " + outcopy)
+ expect(outcopy).assertEqual(false);
+ done();
+ })
+ }, 1500)
+ })
+
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..e07d3ce04e33968af6dc4a1e43012c664618308e
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/entry/src/main/js/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+require('./ActsKillProcessTest.test.js')
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountApi7Test/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/BUILD.gn b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..63bd5aebe3359e79a8a82d27415b60668fc09d4f
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/BUILD.gn
@@ -0,0 +1,34 @@
+# 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_hap("ActsKillProcessWithAccountCloseApi7") {
+ hap_name = "ActsKillProcessWithAccountCloseApi7"
+ hap_profile = "./src/main/config.json"
+ subsystem_name = XTS_SUITENAME
+ final_hap_path =
+ "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
+ testonly = true
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/js/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/config.json b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..855f8170cc9d1c19fe29832e72c43452e47a0969
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/config.json
@@ -0,0 +1,99 @@
+{
+ "app": {
+ "bundleName": "com.example.actskillprocesswithaccountcloseapi7",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.actskillprocesswithaccountcloseapi7",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.example.actskillprocesswithaccountcloseapi7.MainAbility",
+ "visible": true,
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
+ "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ },
+ {
+ "name":"ohos.permission.REMOVE_CACHE_FILES",
+ "reason":"need use ohos.permission.REMOVE_CACHE_FILES"
+ },
+ {
+ "name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
+ "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
+ },
+ {
+ "name":"ohos.permission.MANAGE_MISSIONS",
+ "reason":"need use ohos.permission.MANAGE_MISSIONS"
+ },
+ {
+ "name":"ohos.permission.GET_RUNNING_INFO",
+ "reason":"need use ohos.permission.GET_RUNNING_INFO"
+ },
+ {
+ "name":"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS",
+ "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS"
+ },
+ {
+ "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
+ "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/app.js b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..5d3012c7d6777f4b04710913de6f1aa718fa8cc9
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/app.js
@@ -0,0 +1,28 @@
+/*
+ * 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('ProcessManageSystemAppB onCreate');
+ },
+ onDestroy() {
+ console.info('ProcessManageSystemAppB onDestroy');
+ },
+ onShow() {
+ console.info('ProcessManageSystemAppB onShow');
+ },
+ onHide() {
+ console.info('ProcessManageSystemAppB onHide');
+ }
+};
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e5f1d275cae20f143cdaff8756419d8c7fb99e60
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/default/pages/index/index.js
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import commonEvent from '@ohos.commonevent'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ console.info('ACTS_ProcessManage SystemAppB onInit');
+ this.title = "ACTS_ProcessManage SystemAppB";
+ },
+ onReady() {
+ console.info('ACTS_ProcessManage SystemAppB onReady');
+ },
+ onActive() {
+ console.info('ACTS_ProcessManage SystemAppB onActive');
+ },
+ onShow() {
+ console.info('ACTS_ProcessManage SystemAppB onShow');
+ },
+ onInactive() {
+ console.info('ACTS_ProcessManage SystemAppB onInactive');
+ },
+ onHide() {
+ console.info('ACTS_ProcessManage SystemAppB onHide');
+ },
+ onDestroy() {
+ console.info('ACTS_ProcessManage SystemAppB onDestroy');
+ },
+ onBackPress() {
+ console.info('ACTS_ProcessManage SystemAppB onBackPress');
+ },
+ onNewRequest() {
+ console.info('ACTS_ProcessManage SystemAppB onNewRequest');
+ },
+ onStartContinuation() {
+ console.info('ACTS_ProcessManage SystemAppB onStartContinuation');
+ },
+ onSaveData(value) {
+ console.info('ACTS_ProcessManage SystemAppB onSaveData:' + JSON.stringify(value));
+ },
+ onRestoreData(value) {
+ console.info('ACTS_ProcessManage SystemAppB onRestoreData:' + JSON.stringify(value));
+ },
+ onCompleteContinuation(code) {
+ console.info('ACTS_ProcessManage SystemAppB onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ACTS_ProcessManage SystemAppB onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..fd60cdefa929070f1798c6e36f0502f1e1e219a4
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "particlestartability"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/ActsKillProcessWithAccountCloseApi7/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/BUILD.gn b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..f46f18c5174f811e09bc997e1dd83a0216336e56
--- /dev/null
+++ b/aafwk/aafwk_standard/ActsKillProcessWithAccountApi7/BUILD.gn
@@ -0,0 +1,24 @@
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+group("ActsKillProcessWithAccountApi7") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [
+ "ActsKillProcessWithAccountApi7Test:ActsKillProcessWithAccountApi7Test",
+ "ActsKillProcessWithAccountCloseApi7:ActsKillProcessWithAccountCloseApi7",
+ ]
+ }
+}
diff --git a/aafwk/aafwk_standard/BUILD.gn b/aafwk/aafwk_standard/BUILD.gn
index e4e998bec5ac33333fc357e6bc4518fac4b5f8b3..a3ecdcc3290e48f5047456c8aab7e994be7d97e7 100755
--- a/aafwk/aafwk_standard/BUILD.gn
+++ b/aafwk/aafwk_standard/BUILD.gn
@@ -18,13 +18,17 @@ group("aafwk_standard") {
if (is_standard_system) {
deps = [
"ActsStServiceAbilityClientCaseTest:ActsStServiceAbilityClientCaseTest",
+ "ActsDataAbilityJsTest:ActsDataAbilityJsTest",
+ "ActsKillProcessWithAccountApi7:ActsKillProcessWithAccountApi7",
"abilitymanager:actsabilitymanagertest",
"actsabilitydistributetest:ActsAbilityDistributeTest",
"actsabilitydistributetest:ActsAbilityDistributeTest",
+ "actsabilitymanageretstest:ActsAbilityManagerEtsTest",
"amsabilitymanager/amsMissionSnapshotTest:ActsAmsMissionSnapshotTest",
"amsabilitymanager/amsMissionSnapshotTestSingleton:ActsAmsMissionSnapshotTestSingleton",
"amsabilitymanager/amsMissionSnapshotTestSingletonS:ActsAmsMissionSnapshotTestSingletonS",
"amsdatauriutils:ActsAmsDataUriUtilsTest",
+ "amsgetabilityprocessinfo:amsgetabilityprocessinfo",
"amsmultiapp/MultiAppPage:ActsAmsMultiPageApp",
"amsmultiapp/MultiAppPageConnectService:ActsAmsMultiPageAppConnectService",
"amsmultiapp/MultiAppPageConnect_Service:ActsAmsMultiAppPageConnectService",
@@ -43,10 +47,12 @@ group("aafwk_standard") {
"amsmultiapp/amsmultiapptester:ActsAmsMultiAppTester",
"amsmultiapp/amsmultidataabilityclone:ActsAmsMultiDataAbilityClone",
"amsmultiapp/amsmultidataabilityself:ActsAmsMultiDataAbilitySelf",
+ "amsprocessmanageapi7:amsprocessmanageapi7",
"amszipfileunzipfilest:ActsAmsZipfileUnzipfileSTest",
"context:context",
"featureability:featureability",
"formmanager:formmanager",
+ "lanuageConfigapi7:lanuageConfigapi7",
"serviceability/sceneProject/particlestartability:ParticleStartAbility",
"serviceability/sceneProject/particletestserver:ParticleTestServer",
"serviceability/stserviceabilityserver:amsStServiceAilityServer",
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js
index ded5295b9d4f023dba85ca970fd7153074861554..590bd0c3bf9215878b0bfcf03ff0955ef3786650 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js
@@ -39,6 +39,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
index a447767a22ad613f535ab34f909ca063ef75793b..a812c464a14b89e593b93efdb87c92d865856290 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
-
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
@@ -55,16 +43,20 @@ describe('ActsAmsCallBackFifthScene', function () {
console.info('----ActsAmsCallBackFifthScene----');
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsCallBackFifthScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamscallbackfifthscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamscallbackfifthscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
+ if (data[i].want.bundleName != 'com.example.actsamscallbackfifthscene') {
+ console.log("ActsAmsCallBackFifthScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsCallBackFifthScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
}
+
await featureAbility.startAbility(
{
want:
@@ -76,8 +68,12 @@ describe('ActsAmsCallBackFifthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -89,8 +85,12 @@ describe('ActsAmsCallBackFifthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -102,9 +102,12 @@ describe('ActsAmsCallBackFifthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
- setTimeout(done(), 5000);
+ setTimeout(done, 5000);
});
function timeout(done) {
@@ -114,346 +117,147 @@ describe('ActsAmsCallBackFifthScene', function () {
}
function sleep(delay) {
- var start = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
* @tc.number : Acts_Ams_test_6600
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_6600', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- abilityManager.getAllRunningProcesses(
+ appManager.getProcessRunningInfos(
(error, info) => {
- console.info('getAllRunningProcesses error.code \
+ console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_6600 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_6600 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
- });
+ }
+ );
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_7000
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
+ * @tc.name : getMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_7000', 0, async function (done) {
var maxnum = 10;
- var flag = 1;
- abilityManager.queryRecentAbilityMissionInfos(maxnum, flag,
- (error, data) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + data.length + ']');
- console.info('Acts_Ams_test_7000 queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(data[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_6800
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
- * @tc.desc : Query Running Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_6800', 0, async function (done) {
- var maxnum = 10;
- abilityManager.queryRunningAbilityMissionInfos(maxnum,
+ missionManager.getMissionInfos("", maxnum,
(error, data) => {
- console.info('queryRunningAbilityMissionInfos error.code : \
+ console.info('Acts_Ams_test_7000 getMissionInfos error.code : \
' + error.code + ',data length [' + data.length + ']');
- console.info('Acts_Ams_test_6800 queryRunningAbilityMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
+ expect(data.length).assertEqual(4);
for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(data[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9000
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by CallBack)
- */
- it('Acts_Ams_test_9000', 0, async function (done) {
- abilityManager.getActiveProcessInfos(
- (error, info) => {
- console.info('getActiveProcessInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_9000 getActiveProcessInfos data ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_10000
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_10000', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getActiveAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_10000 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(3);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].missionId)).assertEqual("number");
- expect(info[i].missionId).assertLarger(0);
-
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_11000
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_11000', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getPreviousAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_11000 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(3);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].missionId)).assertEqual("number");
- expect(info[i].missionId).assertLarger(0);
-
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
+ console.info('Acts_Ams_test_7000 getMissionInfos data[' + i + "]: " + JSON.stringify(data[i]));
+ expect(typeof (data[i].missionId)).assertEqual("number");
+ expect(data[i].missionId).assertLarger(0);
+
+ expect(typeof (data[i].want)).assertEqual("object");
+ expect(typeof (data[i].want.deviceId)).assertEqual("string");
+ expect(typeof (data[i].want.bundleName)).assertEqual("string");
+ expect(data[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(data[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (data[i].want.abilityName)).assertEqual("string");
+ expect(data[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(data[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (data[i].label)).assertEqual("string");
+ expect(typeof (data[i].iconPath)).assertEqual("string");
}
done();
- });
+ }
+ );
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_7200
- * @tc.name : removeMission : Remove Mission
+ * @tc.name : clearMission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it('Acts_Ams_test_7200', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.removeMission(result[1].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_7200 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.clearMission(result[1].missionId,
(error, info) => {
- console.info('Acts_Ams_test_7200 removeMission error.code \
+ console.info('Acts_Ams_test_7200 clearMission error.code \
' + error.code + ',data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
- });
+ }
+ );
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_7600
- * @tc.name : moveMissionToTop : Move Mission To Top
+ * @tc.name : moveMissionToFront : Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it('Acts_Ams_test_7600', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.moveMissionToTop(result[0].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_7600 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.moveMissionToFront(result[0].missionId,
(error, info) => {
- console.info('Acts_Ams_test_7600 moveMissionToTop error.code \
+ console.info('Acts_Ams_test_7600 moveMissionToFront error.code \
' + error.code + ',data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
- });
+ }
+ );
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_12000
- * @tc.name : deleteMissions : Remove Missions
+ * @tc.name : clearMission : Remove Missions
* @tc.desc : Remove Missions(by CallBack)
*/
it('Acts_Ams_test_12000', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.deleteMissions([result[0].id],
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_12000 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.clearMission(result[0].missionId,
(error, info) => {
- console.info('Acts_Ams_test_12000 deleteMissions error.code \
+ console.info('Acts_Ams_test_12000 clearMission error.code \
' + error.code + ',data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
- });
+ }
+ );
setTimeout(timeout, 5000);
})
@@ -463,14 +267,15 @@ describe('ActsAmsCallBackFifthScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it('Acts_Ams_test_8000', 0, async function (done) {
- abilityManager.killProcessesByBundleName('com.ix.verify.io',
+ appManager.killProcessesByBundleName('com.ix.verify.io',
(error, info) => {
console.info('Acts_Ams_test_8000 killProcessesByBundleName error.code: \
' + error.code + ',data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0);
done();
- });
+ }
+ );
setTimeout(timeout, 5000);
})
-})
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js
index d280f5629e3781e92b248dde4bfbecca5fd5140d..3ba401843b653bc303d30b6ab8d556c67d0b1525 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js
@@ -40,6 +40,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
index ef6213c489f1c1e757fe5b22e640429160f76a48..a28022c48c68a6b55235c4059e4a17d9fd6691f2 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
-
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
@@ -52,16 +40,20 @@ describe('ActsAmsCallBackFirstScene', function () {
console.info('----ActsAmsCallBackFirstScene----');
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsCallBackFirstScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamscallbackfirstscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamscallbackfirstscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
+ if (data[i].want.bundleName != 'com.example.actsamscallbackfirstscene') {
+ console.log("ActsAmsCallBackFirstScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsCallBackFirstScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
}
+
await featureAbility.startAbility(
{
want:
@@ -73,7 +65,10 @@ describe('ActsAmsCallBackFirstScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
setTimeout(done(), 5000);
});
@@ -85,53 +80,41 @@ describe('ActsAmsCallBackFirstScene', function () {
}
function sleep(delay) {
- var start = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
* @tc.number : Acts_Ams_test_0200
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_0200', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- abilityManager.getAllRunningProcesses(
+ appManager.getProcessRunningInfos(
(error, info) => {
- console.info('getAllRunningProcesses error.code \
+ console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_0200 getAllRunningProcesses data ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_0200 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
});
@@ -140,231 +123,33 @@ describe('ActsAmsCallBackFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_0400
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
+ * @tc.name : getMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_0400', 0, async function (done) {
var maxnum = 10;
- abilityManager.queryRunningAbilityMissionInfos(maxnum,
+ missionManager.getMissionInfos("", maxnum,
(error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
+ console.info('Acts_Ams_test_0400 getMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_0400 queryRunningAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(2);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].id)).assertEqual("number");
- expect(info[i].id).assertLarger(0);
-
- expect(typeof (info[i].baseAbility)).assertEqual("object");
- expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
- expect(info[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
- expect(info[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
- expect(info[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].missionDescription)).assertEqual("object");
- expect(typeof (info[i].missionDescription.label)).assertEqual("string");
- expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_0600
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
- * @tc.desc : Query Recent Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_0600', 0, async function (done) {
- var maxnum = 10;
- var flag = 1;
- abilityManager.queryRecentAbilityMissionInfos(maxnum, flag,
- (error, info) => {
- console.info('queryRunningAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_0600 queryRecentAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(2);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].id)).assertEqual("number");
- expect(info[i].id).assertLarger(0);
-
- expect(typeof (info[i].baseAbility)).assertEqual("object");
- expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
- expect(info[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
- expect(info[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
- expect(info[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].missionDescription)).assertEqual("object");
- expect(typeof (info[i].missionDescription.label)).assertEqual("string");
- expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_8600
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by CallBack)
- */
- it('Acts_Ams_test_8600', 0, async function (done) {
- abilityManager.getActiveProcessInfos(
- (error, info) => {
- console.info('getActiveProcessInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_8600 getActiveProcessInfos data ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9600
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_9600', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getActiveAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_9600 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(2);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].missionId)).assertEqual("number");
- expect(info[i].missionId).assertLarger(0);
-
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_10600
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_10600', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getPreviousAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_10600 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(2);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_0400 getMissionInfos data[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
+ expect(typeof (info[i].want)).assertEqual("object");
+ expect(typeof (info[i].want.deviceId)).assertEqual("string");
+ expect(typeof (info[i].want.bundleName)).assertEqual("string");
+ expect(info[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(info[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (info[i].want.abilityName)).assertEqual("string");
+ expect(info[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(info[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (info[i].label)).assertEqual("string");
+ expect(typeof (info[i].iconPath)).assertEqual("string");
}
done();
});
@@ -373,18 +158,21 @@ describe('ActsAmsCallBackFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_1400
- * @tc.name : removeMissions : Remove Missions
+ * @tc.name : clearMissions : Remove Missions
* @tc.desc : Remove Missions(by CallBack)
*/
it('Acts_Ams_test_1400', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var missionID = result[0].id + 100;
- abilityManager.removeMissions([missionID],
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_1400 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var missionID = result[0].missionId + 100;
+ missionManager.clearMission(missionID,
(error, info) => {
- console.info('Acts_Ams_test_1400 removeMissions error.code \
+ console.info('Acts_Ams_test_1400 clearMissions error.code \
' + error.code + ',data [' + info + ']');
- expect(info).assertLarger(0);
+ expect(error.code).assertLarger(-1);
done();
});
setTimeout(timeout, 5000);
@@ -392,17 +180,20 @@ describe('ActsAmsCallBackFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_0800
- * @tc.name : removeMission : Remove Mission
+ * @tc.name : clearMission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it('Acts_Ams_test_0800', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.removeMission(result[0].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_0800 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.clearMission(result[0].missionId,
(error, info) => {
- console.info('Acts_Ams_test_0800 removeMission error.code \
+ console.info('Acts_Ams_test_0800 clearMission error.code \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
@@ -414,35 +205,35 @@ describe('ActsAmsCallBackFirstScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it('Acts_Ams_test_1600', 0, async function (done) {
- abilityManager.killProcessesByBundleName('com.ix.simulate.feature',
+ appManager.killProcessesByBundleName('com.ix.simulate.feature',
(error, info) => {
console.info('Acts_Ams_test_1600 killProcessesByBundleName error.code: \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
-
})
/*
* @tc.number : Acts_Ams_test_1200
- * @tc.name : moveMissionToTop : Move Mission To Top
+ * @tc.name : moveMissionToFront : Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it('Acts_Ams_test_1200', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.moveMissionToTop(result[0].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_1200 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.moveMissionToFront(result[0].missionId,
(error, info) => {
- console.info('Acts_Ams_test_1200 moveMissionToTop error.code \
+ console.info('Acts_Ams_test_1200 moveMissionToFront error.code \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
})
-})
-
-
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js
index 317505e8dc895d1578a0454cc2d096005a81302c..8b48ca37486b43a1a860e41c0efc46e09cfb7858 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js
@@ -39,6 +39,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
index 70a17b595ad757499f0c70776184158ee27a332a..7aee5154f30196191c3d1c070ae5b7e61a073b74 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
@@ -12,30 +12,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
-
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
"com.example.SimulateFeatureAbilityFir",
"com.example.VerifyActThirdAbility",
"com.example.VerifyIoThirdAbility",
- "com.example.SimulateEntryAbilityFir",
+ "com.example.SimulateEntryAbility",
"com.example.actsamscallbackfourthscene.MainAbility"
]
@@ -58,16 +46,20 @@ describe('ActsAmsCallBackFourthScene', function () {
console.info('----ActsAmsCallBackFourthScene----');
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsCallBackFourthScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamscallbackfourthscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamscallbackfourthscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
+ if (data[i].want.bundleName != 'com.example.actsamscallbackfourthscene') {
+ console.log("ActsAmsCallBackFourthScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsCallBackFourthScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
}
+
await featureAbility.startAbility(
{
want:
@@ -79,8 +71,12 @@ describe('ActsAmsCallBackFourthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -92,8 +88,12 @@ describe('ActsAmsCallBackFourthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -105,19 +105,26 @@ describe('ActsAmsCallBackFourthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.ix.simulate.entry",
- abilityName: "com.example.SimulateEntryAbility",
+ abilityName: "com.example.SimulateEntryAbilityFir",
action: "action1",
parameters:
{},
},
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
}
);
setTimeout(done(), 5000);
@@ -130,53 +137,41 @@ describe('ActsAmsCallBackFourthScene', function () {
}
function sleep(delay) {
- var start = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
* @tc.number : Acts_Ams_test_5000
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_5000', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- abilityManager.getAllRunningProcesses(
+ appManager.getProcessRunningInfos(
(error, info) => {
- console.info('getAllRunningProcesses error.code \
+ console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_5000 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_5000 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
});
@@ -186,251 +181,33 @@ describe('ActsAmsCallBackFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_5400
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
+ * @tc.name : getMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_5400', 0, async function (done) {
var maxnum = 100;
- var flag = 1;
- abilityManager.queryRecentAbilityMissionInfos(maxnum, flag,
- (error, data) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + data.length + ']');
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(4);
- for (var i = 0; i < data.length; i++) {
- console.info('Acts_Ams_test_5400 queryRecentAbilityMissionInfos id: \
- ' + data[i].id + ' baseAbility.deviceId: \
- ' + data[i].baseAbility.deviceId + ' baseAbility.bundleName: \
- ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: \
- ' + data[i].baseAbility.abilityName + ' topAbility.deviceId: \
- ' + data[i].topAbility.deviceId + ' topAbility.bundleName: \
- ' + data[i].topAbility.bundleName + ' topAbility.abilityName: \
- ' + data[i].topAbility.abilityName + ' missionDescription.label: \
- ' + data[i].missionDescription.label + ' missionDescription.iconPath: \
- ' + data[i].missionDescription.iconPath);
-
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(data[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_5200
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
- * @tc.desc : Query Running Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_5200', 0, async function (done) {
- var maxnum = 30;
- abilityManager.queryRunningAbilityMissionInfos(maxnum,
+ missionManager.getMissionInfos("", maxnum,
(error, data) => {
- console.info('queryRunningAbilityMissionInfos error.code : \
+ console.info('Acts_Ams_test_5400 getMissionInfos error.code : \
' + error.code + ',data length [' + data.length + ']');
expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(4);
+ expect(data.length).assertEqual(5);
for (var i = 0; i < data.length; i++) {
- console.info('Acts_Ams_test_5200 queryRunningAbilityMissionInfos id: \
- ' + data[i].id + ' baseAbility.deviceId: \
- ' + data[i].baseAbility.deviceId + ' baseAbility.bundleName: \
- ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: \
- ' + data[i].baseAbility.abilityName + ' topAbility.deviceId: \
- ' + data[i].topAbility.deviceId + ' topAbility.bundleName: \
- ' + data[i].topAbility.bundleName + ' topAbility.abilityName: \
- ' + data[i].topAbility.abilityName + ' missionDescription.label: \
- ' + data[i].missionDescription.label + ' missionDescription.iconPath: \
- ' + data[i].missionDescription.iconPath);
-
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(data[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_8900
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by CallBack)
- */
- it('Acts_Ams_test_8900', 0, async function (done) {
- abilityManager.getActiveProcessInfos(
- (error, info) => {
- console.info('getActiveProcessInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_8900 getActiveProcessInfos data ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9900
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_9900', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getActiveAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_9900 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(4);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].missionId)).assertEqual("number");
- expect(info[i].missionId).assertLarger(0);
-
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_10900
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_10900', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getPreviousAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_10900 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(4);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].missionId)).assertEqual("number");
- expect(info[i].missionId).assertLarger(0);
-
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
+ console.info('Acts_Ams_test_5400 getMissionInfos data[' + i + "]: " + JSON.stringify(data[i]));
+ expect(typeof (data[i].missionId)).assertEqual("number");
+ expect(data[i].missionId).assertLarger(0);
+
+ expect(typeof (data[i].want)).assertEqual("object");
+ expect(typeof (data[i].want.deviceId)).assertEqual("string");
+ expect(typeof (data[i].want.bundleName)).assertEqual("string");
+ expect(data[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(data[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (data[i].want.abilityName)).assertEqual("string");
+ expect(data[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(data[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (data[i].label)).assertEqual("string");
+ expect(typeof (data[i].iconPath)).assertEqual("string");
}
done();
});
@@ -439,18 +216,20 @@ describe('ActsAmsCallBackFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_5600
- * @tc.name : removeMission : Remove Mission
+ * @tc.name : clearMission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it('Acts_Ams_test_5600', 0, async function (done) {
var maxnum = 30;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.removeMission(result[0].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_5600 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.clearMission(result[0].missionId,
(error, info) => {
- console.info('Acts_Ams_test_5600 removeMission error.code \
+ console.info('Acts_Ams_test_5600 clearMission error.code \
' + error.code + ',data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
@@ -458,18 +237,20 @@ describe('ActsAmsCallBackFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_6000
- * @tc.name : moveMissionToTop : Move Mission To Top
+ * @tc.name : moveMissionToFront : Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it('Acts_Ams_test_6000', 0, async function (done) {
var maxnum = 30;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.moveMissionToTop(result[1].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_6000 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.moveMissionToFront(result[1].missionId,
(error, info) => {
- console.info('Acts_Ams_test_6000 moveMissionToTop error.code \
+ console.info('Acts_Ams_test_6000 moveMissionToFront error.code \
' + error.code + ',data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
@@ -481,7 +262,7 @@ describe('ActsAmsCallBackFourthScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it('Acts_Ams_test_6400', 0, async function (done) {
- abilityManager.killProcessesByBundleName('xxxxxxxxx',
+ missionManager.killProcessesByBundleName('xxxxxxxxx',
(error, info) => {
console.info('Acts_Ams_test_6400 killProcessesByBundleName error.code \
' + error.code + ',data [' + info + ']');
@@ -494,20 +275,22 @@ describe('ActsAmsCallBackFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_11900
- * @tc.name : deleteMissions : delete Missions
+ * @tc.name : clearMissions : delete Missions
* @tc.desc : delete Missions(by CallBack)
*/
it('Acts_Ams_test_11900', 0, async function (done) {
var maxnum = 30;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.deleteMissions([result[1].id, result[0].id],
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_11900 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.clearAllMissions(
(error, info) => {
- console.info('Acts_Ams_test_11900 deleteMissions error.code: \
+ console.info('Acts_Ams_test_11900 clearAllMissions error.code: \
' + error.code + ',data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
})
-})
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js
index ded5295b9d4f023dba85ca970fd7153074861554..590bd0c3bf9215878b0bfcf03ff0955ef3786650 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js
@@ -39,6 +39,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
index 66b2c6ccbf0cd1496ad9070ce8d7e7dcbb63dbb1..15cf58f95e742bce3da7d4414e28546209f3203c 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
-
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
@@ -54,16 +42,20 @@ describe('ActsAmsCallBackSecondScene', function () {
console.info('----ActsAmsCallBackSecondScene----');
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsCallBackSecondScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamscallbacksecondscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamscallbacksecondscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
+ if (data[i].want.bundleName != 'com.example.actsamscallbacksecondscene') {
+ console.log("ActsAmsCallBackSecondScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsCallBackSecondScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
}
+
await featureAbility.startAbility(
{
want:
@@ -75,8 +67,12 @@ describe('ActsAmsCallBackSecondScene', function () {
parameters:
{},
},
+ }, (error, data) => {
+ console.info('ActsAmsCallBackSecondScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
}
);
+
await featureAbility.startAbility(
{
want:
@@ -88,6 +84,9 @@ describe('ActsAmsCallBackSecondScene', function () {
parameters:
{},
},
+ }, (error, data) => {
+ console.info('ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
}
);
setTimeout(done(), 5000);
@@ -100,53 +99,41 @@ describe('ActsAmsCallBackSecondScene', function () {
}
function sleep(delay) {
- var start = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
* @tc.number : Acts_Ams_test_1800
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_1800', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- abilityManager.getAllRunningProcesses(
+ appManager.getProcessRunningInfos(
(error, info) => {
- console.info('getAllRunningProcesses error.code \
+ console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_1800 getAllRunningProcesses data ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_1800 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
});
@@ -155,231 +142,33 @@ describe('ActsAmsCallBackSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_2000
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
+ * @tc.name : getMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_2000', 0, async function (done) {
var maxnum = 20;
- abilityManager.queryRunningAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_2000 queryRunningAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(3);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].id)).assertEqual("number");
- expect(info[i].id).assertLarger(0);
-
- expect(typeof (info[i].baseAbility)).assertEqual("object");
- expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
- expect(info[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
- expect(info[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
- expect(info[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].missionDescription)).assertEqual("object");
- expect(typeof (info[i].missionDescription.label)).assertEqual("string");
- expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_2200
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
- * @tc.desc : Query Recent Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_2200', 0, async function (done) {
- var maxnum = 20;
- var flag = 1;
- abilityManager.queryRecentAbilityMissionInfos(maxnum, flag,
+ missionManager.getMissionInfos("", maxnum,
(error, info) => {
- console.info('queryRunningAbilityMissionInfos error.code : \
+ console.info('Acts_Ams_test_2000 getMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_2200 queryRecentAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(3);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].id)).assertEqual("number");
- expect(info[i].id).assertLarger(0);
-
- expect(typeof (info[i].baseAbility)).assertEqual("object");
- expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
- expect(info[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
- expect(info[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
- expect(info[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].missionDescription)).assertEqual("object");
- expect(typeof (info[i].missionDescription.label)).assertEqual("string");
- expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_8700
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by CallBack)
- */
- it('Acts_Ams_test_8700', 0, async function (done) {
- abilityManager.getActiveProcessInfos(
- (error, info) => {
- console.info('getActiveProcessInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_8700 getActiveProcessInfos data ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9700
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_9700', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getActiveAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_9700 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_2000 getMissionInfos data[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_10700
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_10700', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getPreviousAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_10700 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(3);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].missionId)).assertEqual("number");
- expect(info[i].missionId).assertLarger(0);
-
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
+ expect(typeof (info[i].want)).assertEqual("object");
+ expect(typeof (info[i].want.deviceId)).assertEqual("string");
+ expect(typeof (info[i].want.bundleName)).assertEqual("string");
+ expect(info[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(info[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (info[i].want.abilityName)).assertEqual("string");
+ expect(info[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(info[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (info[i].label)).assertEqual("string");
+ expect(typeof (info[i].iconPath)).assertEqual("string");
}
done();
});
@@ -388,17 +177,20 @@ describe('ActsAmsCallBackSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_2400
- * @tc.name : removeMission : Remove Mission
+ * @tc.name : clearMission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it('Acts_Ams_test_2400', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.removeMission(result[1].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_2400 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.clearMission(result[1].missionId,
(error, info) => {
- console.info('Acts_Ams_test_2400 removeMission error.code \
+ console.info('Acts_Ams_test_2400 clearMission error.code \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
@@ -406,17 +198,20 @@ describe('ActsAmsCallBackSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_2800
- * @tc.name : moveMissionToTop : Move Mission To Top
+ * @tc.name : moveMissionToFront : Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it('Acts_Ams_test_2800', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.moveMissionToTop(result[0].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_2800 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.moveMissionToFront(result[0].missionId,
(error, info) => {
- console.info('Acts_Ams_test_2800 moveMissionToTop error.code \
+ console.info('Acts_Ams_test_2800 moveMissionToFront error.code \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
@@ -428,7 +223,7 @@ describe('ActsAmsCallBackSecondScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it('Acts_Ams_test_3200', 0, async function (done) {
- abilityManager.killProcessesByBundleName('XXXXXXXXXXXX',
+ appManager.killProcessesByBundleName('XXXXXXXXXXXX',
(error, info) => {
console.info('Acts_Ams_test_3200 killProcessesByBundleName error.code: \
' + error.code + ',data [' + info + ']');
@@ -440,22 +235,22 @@ describe('ActsAmsCallBackSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_3000
- * @tc.name : removeMissions: Remove Missions
+ * @tc.name : clearMissions: Remove Missions
* @tc.desc : Remove Missions(by CallBack)
*/
it('Acts_Ams_test_3000', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.removeMissions([result[0].id],
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_3000 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.clearMission(result[0].missionId,
(error, info) => {
- console.info('Acts_Ams_test_3000 removeMissions error.code \
+ console.info('Acts_Ams_test_3000 clearMission error.code \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
});
setTimeout(timeout, 5000);
})
-
-})
-
-
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js
index ded5295b9d4f023dba85ca970fd7153074861554..590bd0c3bf9215878b0bfcf03ff0955ef3786650 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js
@@ -39,6 +39,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
index 6ff3630b1da5727f5f1864f5580a94e85ee66099..0dcdf5c2cb5915b8daacc3f80a31149727dd63fa 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
@@ -12,22 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
@@ -52,16 +41,20 @@ describe('ActsAmsCallBackThirdScene', function () {
console.info('----ActsAmsCallBackThirdScene----');
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsCallBackThirdScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamscallbackthirdscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamscallbackthirdscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
+ if (data[i].want.bundleName != 'com.example.actsamscallbackthirdscene') {
+ console.log("ActsAmsCallBackThirdScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsCallBackThirdScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
}
+
await featureAbility.startAbility(
{
want:
@@ -73,8 +66,12 @@ describe('ActsAmsCallBackThirdScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -86,7 +83,10 @@ describe('ActsAmsCallBackThirdScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
setTimeout(done(), 5000);
});
@@ -98,53 +98,41 @@ describe('ActsAmsCallBackThirdScene', function () {
}
function sleep(delay) {
- var startTime = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
* @tc.number : Acts_Ams_test_3400
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by CallBack)
*/
it('Acts_Ams_test_3400', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- abilityManager.getAllRunningProcesses(
+ appManager.getProcessRunningInfos(
(error, info) => {
- console.info('getAllRunningProcesses error.code \
+ console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code \
' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_3400 getAllRunningProcesses data ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_3400 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
});
@@ -153,231 +141,33 @@ describe('ActsAmsCallBackThirdScene', function () {
/*
* @tc.number : Acts_Ams_test_3600
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
+ * @tc.name : getMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by CallBack)
*/
it('Acts_Ams_test_3600', 0, async function (done) {
var maxnum = 20;
- abilityManager.queryRunningAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_3600 queryRunningAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(3);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].id)).assertEqual("number");
- expect(info[i].id).assertLarger(0);
-
- expect(typeof (info[i].baseAbility)).assertEqual("object");
- expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
- expect(info[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
- expect(info[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
- expect(info[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].missionDescription)).assertEqual("object");
- expect(typeof (info[i].missionDescription.label)).assertEqual("string");
- expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_3800
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
- * @tc.desc : Query Recent Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_3800', 0, async function (done) {
- var maxnum = 20;
- var flag = 2;
- abilityManager.queryRecentAbilityMissionInfos(maxnum, flag,
- (error, info) => {
- console.info('queryRunningAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_3800 queryRecentAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(3);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].id)).assertEqual("number");
- expect(info[i].id).assertLarger(0);
-
- expect(typeof (info[i].baseAbility)).assertEqual("object");
- expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string");
- expect(info[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string");
- expect(info[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string");
- expect(info[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (info[i].missionDescription)).assertEqual("object");
- expect(typeof (info[i].missionDescription.label)).assertEqual("string");
- expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_8800
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by CallBack)
- */
- it('Acts_Ams_test_8800', 0, async function (done) {
- abilityManager.getActiveProcessInfos(
- (error, info) => {
- console.info('getActiveProcessInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- console.info('Acts_Ams_test_8800 getActiveProcessInfos data ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9800
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_9800', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getActiveAbilityMissionInfos(maxnum,
+ missionManager.getMissionInfos("", maxnum,
(error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
+ console.info('Acts_Ams_test_3600 getMissionInfos error.code : \
' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_9800 getActiveAbilityMissionInfos info ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertEqual(3);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_3600 getMissionInfos info[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].missionId)).assertEqual("number");
expect(info[i].missionId).assertLarger(0);
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
- }
- done();
- });
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_10800
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by CallBack)
- */
- it('Acts_Ams_test_10800', 0, async function (done) {
- var maxnum = 10;
- abilityManager.getPreviousAbilityMissionInfos(maxnum,
- (error, info) => {
- console.info('queryRecentAbilityMissionInfos error.code : \
- ' + error.code + ',data length [' + info.length + ']');
- console.info('Acts_Ams_test_10800 getPreviousAbilityMissionInfos info ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertEqual(3);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].missionId)).assertEqual("number");
- expect(info[i].missionId).assertLarger(0);
-
- expect(typeof (info[i].bottomAbility)).assertEqual("object");
- expect(typeof (info[i].bottomAbility.deviceId)).assertEqual("string");
- expect(info[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.bundleName)).assertEqual("string");
- expect(info[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.abilityName)).assertEqual("string");
- expect(info[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].bottomAbility.uri)).assertEqual("string");
- expect(info[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].bottomAbility.shortName)).assertEqual("string");
- expect(info[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].topAbility)).assertEqual("object");
- expect(typeof (info[i].topAbility.deviceId)).assertEqual("string");
- expect(info[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (info[i].topAbility.bundleName)).assertEqual("string");
- expect(info[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(info[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.abilityName)).assertEqual("string");
- expect(info[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(info[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (info[i].topAbility.uri)).assertEqual("string");
- expect(info[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (info[i].topAbility.shortName)).assertEqual("string");
- expect(info[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (info[i].windowMode)).assertEqual("number");
- expect(info[i].windowMode).assertEqual(0);
+ expect(typeof (info[i].want)).assertEqual("object");
+ expect(typeof (info[i].want.deviceId)).assertEqual("string");
+ expect(typeof (info[i].want.bundleName)).assertEqual("string");
+ expect(info[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(info[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (info[i].want.abilityName)).assertEqual("string");
+ expect(info[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(info[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (info[i].label)).assertEqual("string");
+ expect(typeof (info[i].iconPath)).assertEqual("string");
}
done();
});
@@ -386,55 +176,68 @@ describe('ActsAmsCallBackThirdScene', function () {
/*
* @tc.number : Acts_Ams_test_4000
- * @tc.name : removeMission : Remove Mission
+ * @tc.name : clearMission : Remove Mission
* @tc.desc : Remove Mission(by CallBack)
*/
it('Acts_Ams_test_4000', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.removeMission(result[1].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_4000 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.clearMission(result[1].missionId,
(error, info) => {
- console.info('Acts_Ams_test_4000 removeMission error.code \
+ console.info('Acts_Ams_test_4000 clearMission error.code \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
- });
+ }
+ );
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_4400
- * @tc.name : moveMissionToTop : Move Mission To Top
+ * @tc.name : moveMissionToFront : Move Mission To Top
* @tc.desc : Move Mission To Top(by CallBack)
*/
it('Acts_Ams_test_4400', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.moveMissionToTop(result[0].id,
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_4400 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.moveMissionToFront(result[0].missionId,
(error, info) => {
- console.info('Acts_Ams_test_4400 moveMissionToTop error.code \
+ console.info('Acts_Ams_test_4400 moveMissionToFront error.code \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
- });
+ }
+ );
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_11800
- * @tc.name : deleteMissions : delete Missions
+ * @tc.name : clearMissions : delete Missions
* @tc.desc : delete Missions(by CallBack)
*/
it('Acts_Ams_test_11800', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- abilityManager.deleteMissions([result[0].id],
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_11800 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ missionManager.clearMission(result[0].missionId,
(error, info) => {
- console.info('Acts_Ams_test_11800 deleteMissions error.code \
+ console.info('Acts_Ams_test_11800 clearMissions error.code \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(0);
+ expect(error.code).assertEqual(0);
done();
- });
+ }
+ );
+ done();
setTimeout(timeout, 5000);
})
@@ -444,15 +247,15 @@ describe('ActsAmsCallBackThirdScene', function () {
* @tc.desc : Kill Processes By BundleName(by CallBack)
*/
it('Acts_Ams_test_4800', 0, async function (done) {
- abilityManager.killProcessesByBundleName('xxxxxxxxxxx',
+ appManager.killProcessesByBundleName('xxxxxxxxxxx',
(error, info) => {
console.info('Acts_Ams_test_4800 killProcessesByBundleName error.code: \
' + error.code + ',data [' + info + ']');
- expect(info).assertEqual(2097215);
+ expect(error.code).assertEqual(2097215);
done();
- });
+ }
+ );
+ done();
setTimeout(timeout, 5000);
})
-})
-
-
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json
index 703124fbf940b305c81db024e9f357b3aa9f2b73..f02cf70ee9fc043a341f2934a01bae7b426aecdc 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/Test.json
@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
- "test-timeout": "120000",
+ "test-timeout": "300000",
"package": "com.example.actsamstestfifthscene",
"shell-timeout": "600000"
},
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js
index 317505e8dc895d1578a0454cc2d096005a81302c..8b48ca37486b43a1a860e41c0efc46e09cfb7858 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js
@@ -39,6 +39,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
index ed497243e7bdabc786dafcb295a7e0e17ff689f8..e39fd291d68276c83938d5f383100522b5b31851 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
@@ -12,30 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
-
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
"com.example.SimulateFeatureAbilityFir",
- "com.example.VerifyIoThirdAbility",
- "com.example.actsamstestfifthscene.MainAbility",
- "com.example.SimulateFeatureAbilitySed"
+ "com.example.actsamstestfifthscene.MainAbility"
]
var bundleNameList = [
@@ -47,24 +33,25 @@ var bundleNameList = [
"com.ohos.telephonydataability",
"com.ohos.contactsdataability",
"com.ix.simulate.feature",
- "com.example.actsamstestfifthscene",
- "com.ix.verify.io"
+ "com.example.actsamstestfifthscene"
]
describe('ActsAmsTestFifthScene', function () {
console.info('----ActsAmsTestFifthScene----');
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsTestFifthScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamstestfifthscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamstestfifthscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
- }
+ console.log("ActsAmsTestFifthScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsTestFifthScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
+
await featureAbility.startAbility(
{
want:
@@ -81,8 +68,12 @@ describe('ActsAmsTestFifthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -99,8 +90,12 @@ describe('ActsAmsTestFifthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -117,7 +112,10 @@ describe('ActsAmsTestFifthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
setTimeout(done(), 5000);
});
@@ -129,314 +127,127 @@ describe('ActsAmsTestFifthScene', function () {
}
function sleep(delay) {
- var start = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
- * @tc.number : Acts_Ams_test_6500
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by Promise)
- */
- it('Acts_Ams_test_6500', 0, async function (done) {
+ * @tc.number : Acts_Ams_test_0100
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by Promise)
+ */
+ it('Acts_Ams_test_0100', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- var info = await abilityManager.getAllRunningProcesses();
- console.info('getAllRunningProcesses data length [' + info.length + ']');
- console.info('Acts_Ams_test_6500 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
+ var info = await appManager.getProcessRunningInfos();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
setTimeout(timeout, 5000);
})
/*
- * @tc.number : Acts_Ams_test_7500
- * @tc.name : moveMissionToTop : Move Mission To Top
- * @tc.desc : Move Mission To Top(by Promise)
- */
- it('Acts_Ams_test_7500', 0, async function (done) {
+ * @tc.number : Acts_Ams_test_1100
+ * @tc.name : moveMissionToFront : Move Mission To Top
+ * @tc.desc : Move Mission To Top(by Promise)
+ */
+ it('Acts_Ams_test_1100', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.moveMissionToTop(result[1].id);
- console.info('Acts_Ams_test_7500 moveMissionToTop data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
+ var result = await missionManager.getMissionInfos("", maxnum).catch(err => {
+ console.log('Acts_Ams_test_1100 getMissionInfos failed: ' + err);
+ });
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_1100 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.moveMissionToFront(result[0].missionId);
+ console.info('Acts_Ams_test_1100 moveMissionToFront data [' + info + ']');
expect(info).assertEqual(0);
- sleep(1000);
- var ret = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- expect(result[1].baseAbility.bundleName).assertEqual(ret[0].baseAbility.bundleName);
- expect(result[1].topAbility.bundleName).assertEqual(ret[0].topAbility.bundleName);
done();
setTimeout(timeout, 5000);
})
/*
- * @tc.number : Acts_Ams_test_6900
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
- * @tc.desc : Query Recent Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_6900', 0, async function (done) {
+ * @tc.number : Acts_Ams_test_0300
+ * @tc.name : getMissionInfos : Query Running Ability Mission Infos
+ * @tc.desc : Query Running Ability Mission Infos(by Promise)
+ */
+ it('Acts_Ams_test_0300', 0, async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']');
- console.info('Acts_Ams_test_6900 queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum).catch(err => {
+ console.log('Acts_Ams_test_0300 getMissionInfos failed: ' + err);
+ });
+ console.info('Acts_Ams_test_0300 getMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_8500
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by Promise)
- */
- it('Acts_Ams_test_8500', 0, async function (done) {
- var info = await abilityManager.getActiveProcessInfos();
- console.info('Acts_Ams_test_8500 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9500
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_9500', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getActiveAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_9500 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
+ expect(data.length).assertEqual(4);
for (var i = 0; i < data.length; i++) {
+ console.info('Acts_Ams_test_0300 getMissionInfos data[' + i + "]: " + JSON.stringify(data[i]));
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
+ expect(typeof (data[i].want)).assertEqual("object");
+ expect(typeof (data[i].want.deviceId)).assertEqual("string");
+ expect(typeof (data[i].want.bundleName)).assertEqual("string");
+ expect(data[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(data[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (data[i].want.abilityName)).assertEqual("string");
+ expect(data[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(data[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (data[i].label)).assertEqual("string");
+ expect(typeof (data[i].iconPath)).assertEqual("string");
}
done();
setTimeout(timeout, 5000);
})
/*
- * @tc.number : Acts_Ams_test_10500
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_10500', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getPreviousAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_10500 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].missionId)).assertEqual("number");
- expect(data[i].missionId).assertLarger(0);
-
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
+ * @tc.number : Acts_Ams_test_0700
+ * @tc.name : clearMission : Remove Mission
+ * @tc.desc : Remove Mission(by Promise)
+ */
+ it('Acts_Ams_test_0700', 0, async function (done) {
+ var maxnum = 10;
+ var result = await missionManager.getMissionInfos("", maxnum).catch(err => {
+ console.log('Acts_Ams_test_0700 getMissionInfos failed: ' + err);
+ });
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_0700 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
}
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_6700
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
- * @tc.desc : Query Running Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_6700', 0, async function (done) {
- var maxnum = 10;
- var data = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']');
- console.info('Acts_Ams_test_6700 queryRunningAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_11500
- * @tc.name : deleteMissions: delete Missions
- * @tc.desc : delete Missions(by Promise)
- */
- it('Acts_Ams_test_11500', 0, async function (done) {
- var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.deleteMissions([result[1].id]);
- console.info('Acts_Ams_test_11500 deleteMissions data [' + info + ']');
+ var info = await missionManager.clearMission(result[1].missionId);
+ console.info('Acts_Ams_test_0700 clearMission data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
/*
- * @tc.number : Acts_Ams_test_7900
- * @tc.name : killProcessesByBundleName : Kill Processes By BundleName
- * @tc.desc : Kill Processes By BundleName(by Promise)
- */
- it('Acts_Ams_test_7900', 0, async function (done) {
- var info = await abilityManager.killProcessesByBundleName('com.ix.verify.io');
- console.info('Acts_Ams_test_7900 killProcessesByBundleName data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
+ * @tc.number : Acts_Ams_test_1500
+ * @tc.name : killProcessesByBundleName : Kill Processes By BundleName
+ * @tc.desc : Kill Processes By BundleName(by Promise)
+ */
+ it('Acts_Ams_test_1500', 0, async function (done) {
+ var info = await appManager.killProcessesByBundleName('com.ix.simulate.feature');
+ console.info('Acts_Ams_test_1500 killProcessesByBundleName data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
-
})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/Test.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/Test.json
index aa9e125d72712b52d9db4813c3667929d14d597a..4bd37e87f41bbd17e4e4d12f92e5298214501d4d 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/Test.json
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/Test.json
@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
- "test-timeout": "120000",
+ "test-timeout": "300000",
"package": "com.example.actsamstestfirstscene",
"shell-timeout": "600000"
},
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js
index ded5295b9d4f023dba85ca970fd7153074861554..590bd0c3bf9215878b0bfcf03ff0955ef3786650 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js
@@ -39,6 +39,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
index a6a77dd6dba0f6c0cb4907a774ee6e90918d0021..6bc56ed06cec8111b1496cf1cad9b12550a21ba3 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
-
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
@@ -52,14 +40,17 @@ describe('ActsAmsTestFirstScene', function () {
console.info('----ActsAmsTestFirstScene----');
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsTestFirstScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamstestfirstscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamstestfirstscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
+ if (data[i].want.bundleName != 'com.example.actsamstestfirstscene') {
+ console.log("ActsAmsTestFirstScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsTestFirstScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
}
await featureAbility.startAbility(
@@ -78,7 +69,10 @@ describe('ActsAmsTestFirstScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
setTimeout(done(), 5000);
});
@@ -90,65 +84,57 @@ describe('ActsAmsTestFirstScene', function () {
}
function sleep(delay) {
- var start = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
* @tc.number : Acts_Ams_test_0100
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it('Acts_Ams_test_0100', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- var info = await abilityManager.getAllRunningProcesses();
- console.info('Acts_Ams_test_0100 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
+ var info = await appManager.getProcessRunningInfos();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
setTimeout(timeout, 5000);
})
+
/*
* @tc.number : Acts_Ams_test_1100
- * @tc.name : moveMissionToTop : Move Mission To Top
+ * @tc.name : moveMissionToFront : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_1100', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.moveMissionToTop(result[0].id);
- console.info('Acts_Ams_test_1100 moveMissionToTop data [' + info + ']');
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_0100 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.moveMissionToFront(result[0].missionId);
+ console.info('Acts_Ams_test_1100 moveMissionToFront data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
@@ -156,209 +142,30 @@ describe('ActsAmsTestFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_0300
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
+ * @tc.name : getMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_0300', 0, async function (done) {
var maxnum = 10;
- var data = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- console.info('Acts_Ams_test_0300 queryRunningAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(2);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(data[i].topAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_0500
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
- * @tc.desc : Query Recent Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_0500', 0, async function (done) {
- var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.info('Acts_Ams_test_0500 queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(2);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_8100
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by Promise)
- */
- it('Acts_Ams_test_8100', 0, async function (done) {
- var info = await abilityManager.getActiveProcessInfos();
- console.info('Acts_Ams_test_8100 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9100
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_9100', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getActiveAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_9100 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(2);
for (var i = 0; i < data.length; i++) {
+ console.info('Acts_Ams_test_0300 getMissionInfos data[' + i + "]: " + JSON.stringify(data[i]));
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_10100
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_10100', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getPreviousAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_10100 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(2);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].missionId)).assertEqual("number");
- expect(data[i].missionId).assertLarger(0);
-
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
+ expect(typeof (data[i].want)).assertEqual("object");
+ expect(typeof (data[i].want.deviceId)).assertEqual("string");
+ expect(typeof (data[i].want.bundleName)).assertEqual("string");
+ expect(data[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(data[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (data[i].want.abilityName)).assertEqual("string");
+ expect(data[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(data[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (data[i].label)).assertEqual("string");
+ expect(typeof (data[i].iconPath)).assertEqual("string");
}
done();
setTimeout(timeout, 5000);
@@ -366,14 +173,17 @@ describe('ActsAmsTestFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_0700
- * @tc.name : removeMission : Remove Mission
+ * @tc.name : clearMission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
it('Acts_Ams_test_0700', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.removeMission(result[0].id);
- console.info('Acts_Ams_test_0700 removeMission data [' + info + ']');
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_0700 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.clearMission(result[0].missionId);
+ console.info('Acts_Ams_test_0700 clearMission data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
@@ -381,16 +191,19 @@ describe('ActsAmsTestFirstScene', function () {
/*
* @tc.number : Acts_Ams_test_11100
- * @tc.name : deleteMissions: delete Missions
+ * @tc.name : clearMissions: delete Missions
* @tc.desc : delete Missions(by Promise)
*/
it('Acts_Ams_test_11100', 0, async function (done) {
var maxnum = 10;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_11100 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
expect(result.length).assertEqual(1);
- var missionID = result[0].id + 1;
- var info = await abilityManager.deleteMissions([missionID]);
- console.info('Acts_Ams_test_11100 deleteMissions data [' + info + ']');
+ var missionID = result[0].missionId + 1;
+ var info = await missionManager.clearMission(missionID);
+ console.info('Acts_Ams_test_11100 clearMissions data [' + info + ']');
expect(info).assertLarger(0);
done();
setTimeout(timeout, 5000);
@@ -402,10 +215,10 @@ describe('ActsAmsTestFirstScene', function () {
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it('Acts_Ams_test_1500', 0, async function (done) {
- var info = await abilityManager.killProcessesByBundleName('com.ix.simulate.feature');
+ var info = await appManager.killProcessesByBundleName('com.ix.simulate.feature');
console.info('Acts_Ams_test_1500 killProcessesByBundleName data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
-})
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/Test.json b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/Test.json
index 8429b0324c1d1e9b1640aab2577257140ab8ab84..cf3b5c6e2b9a34eb75eea53b4e0b376a865f1e20 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/Test.json
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/Test.json
@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
- "test-timeout": "120000",
+ "test-timeout": "300000",
"package": "com.example.actsamstestfourthscene",
"shell-timeout": "60000"
},
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js
index ded5295b9d4f023dba85ca970fd7153074861554..590bd0c3bf9215878b0bfcf03ff0955ef3786650 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js
@@ -39,6 +39,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
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 7ca0d328296698e38b3eec0089c07242acc1ffeb..0fc802257d857bc5d0fa0620e68d66966c84df23 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
@@ -12,31 +12,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
-
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
"com.example.SimulateFeatureAbilityFir",
- "com.example.VerifyActThirdAbility",
- "com.example.VerifyIoThirdAbility",
"com.example.actsamstestfourthscene.MainAbility",
- "com.example.SimulateEntryAbilityFir"
+ "com.example.VerifyIoThirdAbility"
]
var bundleNameList = [
@@ -48,25 +34,28 @@ var bundleNameList = [
"com.ohos.telephonydataability",
"com.ohos.contactsdataability",
"com.ix.simulate.feature",
- "com.ix.verify.io",
- "com.ix.simulate.entry",
"com.example.actsamstestfourthscene",
- "com.ix.verify.act"
+ "com.ix.verify.io"
]
+
describe('ActsAmsTestFourthScene', function () {
console.info('----ActsAmsTestFourthScene----');
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsTestFourthScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamstestfourthscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamstestfourthscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
+ if (data[i].want.bundleName != 'com.example.actsamstestfourthscene') {
+ console.log("ActsAmsTestFourthScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsTestFourthScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
}
+
await featureAbility.startAbility(
{
want:
@@ -83,8 +72,12 @@ describe('ActsAmsTestFourthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -101,8 +94,12 @@ describe('ActsAmsTestFourthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -119,8 +116,12 @@ describe('ActsAmsTestFourthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestFourthScene VerifyActThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -137,7 +138,10 @@ describe('ActsAmsTestFourthScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestFourthScene SimulateEntryAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
setTimeout(done(), 5000);
});
@@ -149,67 +153,28 @@ describe('ActsAmsTestFourthScene', function () {
}
function sleep(delay) {
- var start = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
- * @tc.number : Acts_Ams_test_4900
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
+ * @tc.number : Acts_Ams_test_1700
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
- it('Acts_Ams_test_4900', 0, async function (done) {
+ it('Acts_Ams_test_1700', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- var info = await abilityManager.getAllRunningProcesses();
- console.info('getAllRunningProcesses data length [' + info.length + ']');
- console.info('Acts_Ams_test_4900 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_8400
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by Promise)
- */
- it('Acts_Ams_test_8400', 0, async function (done) {
- var info = await abilityManager.getActiveProcessInfos();
- console.info('Acts_Ams_test_8400 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
+ var info = await appManager.getProcessRunningInfos();
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
@@ -226,205 +191,33 @@ describe('ActsAmsTestFourthScene', function () {
})
/*
- * @tc.number : Acts_Ams_test_5300
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
+ * @tc.number : Acts_Ams_test_2100
+ * @tc.name : getMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by Promise)
*/
- it('Acts_Ams_test_5300', 0, async function (done) {
- var maxnum = 100;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']');
+ it('Acts_Ams_test_2100', 0, async function (done) {
+ var maxnum = 20;
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.info('Acts_Ams_test_2100 getMissionInfos error.code : \
+ ' + error.code + ',data length [' + data.length + ']');
expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(4);
- for (var i = 0; i < data.length; i++) {
- console.info('Acts_Ams_test_5300 queryRecentAbilityMissionInfos id: \
- ' + data[i].id + ' baseAbility.deviceId: \
- ' + data[i].baseAbility.deviceId + ' baseAbility.bundleName: \
- ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: \
- ' + data[i].baseAbility.abilityName + ' topAbility.deviceId: \
- ' + data[i].topAbility.deviceId + ' topAbility.bundleName: \
- ' + data[i].topAbility.bundleName + ' topAbility.abilityName: \
- ' + data[i].topAbility.abilityName + ' missionDescription.label: \
- ' + data[i].missionDescription.label + ' missionDescription.iconPath: \
- ' + data[i].missionDescription.iconPath);
-
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_5100
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
- * @tc.desc : Query Running Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_5100', 0, async function (done) {
- var maxnum = 30;
- var data = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']');
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(4);
- for (var i = 0; i < data.length; i++) {
- console.info('Acts_Ams_test_5100 queryRunningAbilityMissionInfos id: \
- ' + data[i].id + ' baseAbility.deviceId: \
- ' + data[i].baseAbility.deviceId + ' baseAbility.bundleName: \
- ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: \
- ' + data[i].baseAbility.abilityName + ' topAbility.deviceId: \
- ' + data[i].topAbility.deviceId + ' topAbility.bundleName: \
- ' + data[i].topAbility.bundleName + ' topAbility.abilityName: \
- ' + data[i].topAbility.abilityName + ' missionDescription.label: \
- ' + data[i].missionDescription.label + ' missionDescription.iconPath: \
- ' + data[i].missionDescription.iconPath);
-
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9400
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_9400', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getActiveAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_9400 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(4);
+ expect(data.length).assertEqual(5);
for (var i = 0; i < data.length; i++) {
+ console.info('Acts_Ams_test_2100 getMissionInfos data[' + i + "]: " + JSON.stringify(data[i]));
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_10400
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_10400', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getPreviousAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_10400 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(4);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].missionId)).assertEqual("number");
- expect(data[i].missionId).assertLarger(0);
-
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
+ expect(typeof (data[i].want)).assertEqual("object");
+ expect(typeof (data[i].want.deviceId)).assertEqual("string");
+ expect(typeof (data[i].want.bundleName)).assertEqual("string");
+ expect(data[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(data[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (data[i].want.abilityName)).assertEqual("string");
+ expect(data[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(data[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (data[i].label)).assertEqual("string");
+ expect(typeof (data[i].iconPath)).assertEqual("string");
}
done();
setTimeout(timeout, 5000);
@@ -437,9 +230,11 @@ describe('ActsAmsTestFourthScene', function () {
*/
it('Acts_Ams_test_5500', 0, async function (done) {
var maxnum = 30;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.removeMission(result[0].id);
- console.info('Acts_Ams_test_5500 removeMission data [' + info + ']');
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_5500 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await abilityManager.clearMission(result[0].id);
expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(0);
done();
@@ -448,31 +243,35 @@ describe('ActsAmsTestFourthScene', function () {
/*
* @tc.number : Acts_Ams_test_5900
- * @tc.name : moveMissionToTop : Move Mission To Top
+ * @tc.name : moveMissionToFront : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_5900', 0, async function (done) {
- var maxnum = 30;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.moveMissionToTop(result[0].id);
- console.info('Acts_Ams_test_5900 moveMissionToTop data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
+ var maxnum = 20;
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_5900 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.moveMissionToFront(result[0].missionId);
+ console.info('Acts_Ams_test_5900 moveMissionToFront data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
/*
- * @tc.number : Acts_Ams_test_6100
- * @tc.name : removeMissions: Remove Missions
- * @tc.desc : Remove Missions(by Promise)
+ * @tc.number : Acts_Ams_test_2100
+ * @tc.name : clearMission : Remove Mission
+ * @tc.desc : Remove Mission(by Promise)
*/
it('Acts_Ams_test_6100', 0, async function (done) {
- var maxnum = 30;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.removeMissions([result[0].id, result[1].id]);
- console.info('Acts_Ams_test_6100 removeMissions data [' + info + ']');
- expect(typeof (info)).assertEqual("number");
+ var maxnum = 20;
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_6100 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.clearAllMissions();
+ console.info('Acts_Ams_test_6100 clearAllMissions data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
@@ -484,7 +283,7 @@ describe('ActsAmsTestFourthScene', function () {
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it('Acts_Ams_test_6300', 0, async function (done) {
- var info = await abilityManager.killProcessesByBundleName('xxxxxxxxxxxx');
+ var info = await appManager.killProcessesByBundleName('xxxxxxxxxxxx');
console.info('Acts_Ams_test_6300 killProcessesByBundleName data [' + info + ']');
expect(typeof (info)).assertEqual("number");
expect(info).assertEqual(2097215);
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/Test.json b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/Test.json
index f889d08f761ccaabe63f8a0ed329490f9fa519d7..2a9a90561bebb0b996de85ebf4eab2367d244f0f 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/Test.json
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/Test.json
@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
- "test-timeout": "120000",
+ "test-timeout": "300000",
"package": "com.example.actsamstestsecondscene",
"shell-timeout": "600000"
},
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js
index ded5295b9d4f023dba85ca970fd7153074861554..590bd0c3bf9215878b0bfcf03ff0955ef3786650 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js
@@ -39,6 +39,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
index 5a52dbb6cbcb8c66416042b3722ac4c177ff5604..37c078535d6766b063a9b4f980a8d8546b11dbd1 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
-
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
@@ -54,16 +42,20 @@ describe('ActsAmsTestSecondScene', function () {
console.info('----ActsAmsTestSecondScene----');
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsTestSecondScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamstestsecondscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamstestsecondscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
+ if (data[i].want.bundleName != 'com.example.actsamstestsecondscene') {
+ console.log("ActsAmsTestSecondScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsTestSecondScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
}
+
await featureAbility.startAbility(
{
want:
@@ -80,8 +72,12 @@ describe('ActsAmsTestSecondScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -98,7 +94,10 @@ describe('ActsAmsTestSecondScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
setTimeout(done(), 5000);
});
@@ -110,50 +109,39 @@ describe('ActsAmsTestSecondScene', function () {
}
function sleep(delay) {
- var start = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
* @tc.number : Acts_Ams_test_1700
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it('Acts_Ams_test_1700', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- var info = await abilityManager.getAllRunningProcesses();
- console.info('Acts_Ams_test_1700 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
+ var info = await appManager.getProcessRunningInfos();
+ console.info('Acts_Ams_test_1700 getProcessRunningInfos JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
}
done();
setTimeout(timeout, 5000);
@@ -161,14 +149,17 @@ describe('ActsAmsTestSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_2700
- * @tc.name : moveMissionToTop : Move Mission To Top
+ * @tc.name : moveMissionToFront : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_2700', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.moveMissionToTop(result[0].id);
- console.info('Acts_Ams_test_2700 moveMissionToTop data [' + info + ']');
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_2700 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.moveMissionToFront(result[0].missionId);
+ console.info('Acts_Ams_test_2700 moveMissionToFront data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
@@ -176,240 +167,49 @@ describe('ActsAmsTestSecondScene', function () {
/*
* @tc.number : Acts_Ams_test_1900
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
+ * @tc.name : getMissionInfos : Query Running Ability Mission Infos
* @tc.desc : Query Running Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_1900', 0, async function (done) {
var maxnum = 20;
- var data = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']');
- console.info('Acts_Ams_test_1900 queryRunningAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_2100
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
- * @tc.desc : Query Recent Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_2100', 0, async function (done) {
- var maxnum = 20;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']');
- console.info('Acts_Ams_test_2100 queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_8200
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by Promise)
- */
- it('Acts_Ams_test_8200', 0, async function (done) {
- var info = await abilityManager.getActiveProcessInfos();
- console.info('Acts_Ams_test_8200 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9200
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_9200', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getActiveAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_9200 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.info('Acts_Ams_test_1900 getMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(3);
for (var i = 0; i < data.length; i++) {
+ console.info('Acts_Ams_test_1900 getMissionInfos data[' + i + "]: " + JSON.stringify(data[i]));
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
+ expect(typeof (data[i].want)).assertEqual("object");
+ expect(typeof (data[i].want.deviceId)).assertEqual("string");
+ expect(typeof (data[i].want.bundleName)).assertEqual("string");
+ expect(data[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(data[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (data[i].want.abilityName)).assertEqual("string");
+ expect(data[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(data[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (data[i].label)).assertEqual("string");
+ expect(typeof (data[i].iconPath)).assertEqual("string");
}
done();
setTimeout(timeout, 5000);
})
- /*
- * @tc.number : Acts_Ams_test_10200
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_10200', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getPreviousAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_10200 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].missionId)).assertEqual("number");
- expect(data[i].missionId).assertLarger(0);
-
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_11200
- * @tc.name : deleteMissions: delete Missions
- * @tc.desc : delete Missions(by Promise)
- */
- it('Acts_Ams_test_11200', 0, async function (done) {
- var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.deleteMissions([result[0].id]);
- console.info('Acts_Ams_test_11200 deleteMissions data [' + info + ']');
- expect(info).assertEqual(0);
- done();
- setTimeout(timeout, 5000);
- })
-
/*
* @tc.number : Acts_Ams_test_2100
- * @tc.name : removeMission : Remove Mission
+ * @tc.name : clearMission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
it('Acts_Ams_test_2300', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.removeMission(result[0].id);
- console.info('Acts_Ams_test_2300 removeMission data [' + info + ']');
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_2300 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.clearMission(result[0].missionId);
+ console.info('Acts_Ams_test_2300 clearMission data [' + info + ']');
expect(info).assertEqual(0);
done();
setTimeout(timeout, 5000);
@@ -421,11 +221,10 @@ describe('ActsAmsTestSecondScene', function () {
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it('Acts_Ams_test_3100', 0, async function (done) {
- var info = await abilityManager.killProcessesByBundleName('XXXXXXXXXXXX');
+ var info = await appManager.killProcessesByBundleName('XXXXXXXXXXXX');
console.info('Acts_Ams_test_3100 killProcessesByBundleName data [' + info + ']');
expect(info).assertEqual(2097215);
done();
setTimeout(timeout, 5000);
})
-})
-
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/Test.json b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/Test.json
index cd2c04356e443c5de382ab0c7c3e7954ed72ba6a..629d269911692abfa2847d5990a4785a1dd4ab53 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/Test.json
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/Test.json
@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
- "test-timeout": "120000",
+ "test-timeout": "300000",
"package": "com.example.actsamstestthirdscene",
"shell-timeout": "600000"
},
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js
index ded5295b9d4f023dba85ca970fd7153074861554..590bd0c3bf9215878b0bfcf03ff0955ef3786650 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js
@@ -39,6 +39,7 @@ export default {
const configService = core.getDefaultService('config')
configService.setConfig(this)
+ this.timeout = 10000
require('../../../test/List.test')
core.execute()
diff --git a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
index 6dd0bdb08376a0e48c72be6b145c1e2be876ce18..17677f5903c57a561066f19a60121f6688299c5e 100644
--- a/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
@@ -12,23 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+import missionManager from '@ohos.application.missionManager'
+import appManager from "@ohos.application.appManager"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-var WeightReasonCode = {
- REASON_UNKNOWN: 0,
- WEIGHT_FOREGROUND: 100,
- WEIGHT_FOREGROUND_SERVICE: 125,
- WEIGHT_VISIBLE: 200,
- WEIGHT_PERCEPTIBLE: 230,
- WEIGHT_SERVICE: 300,
- WEIGHT_TOP_SLEEPING: 325,
- WEIGHT_CANT_SAVE_STATE: 350,
- WEIGHT_CACHED: 400,
- WEIGHT_GONE: 1000
-}
-
var abilityNameList = [
"com.ohos.launcher.MainAbility",
"com.ohos.callui.ServiceAbility",
@@ -54,16 +42,20 @@ describe('ActsAmsTestThirdScene', function () {
beforeAll(async function (done) {
var maxnum = 10;
- var flag = 1;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.log('queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.log('ActsAmsTestThirdScene beforeAll getMissionInfos data: ' + JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
- if (data[i].baseAbility.bundleName != 'com.example.actsamstestthirdscene' &&
- data[i].topAbility.bundleName != 'com.example.actsamstestthirdscene') {
- var info = abilityManager.removeMission(data[i].id);
- console.log(' removeMission data [' + info + ']');
+ if (data[i].want.bundleName != 'com.example.actsamstestthirdscene') {
+ console.log("ActsAmsTestThirdScene, missionId: " + data[i].missionId)
+ missionManager.clearMission(data[i].missionId,
+ (error, info) => {
+ console.info('ActsAmsTestThirdScene beforeAll clearMission error.code \
+ ' + error.code + ', want.bundleName:' + data[i].want.bundleName);
+ }
+ );
}
}
+
await featureAbility.startAbility(
{
want:
@@ -80,8 +72,12 @@ describe('ActsAmsTestThirdScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
+
await featureAbility.startAbility(
{
want:
@@ -98,7 +94,10 @@ describe('ActsAmsTestThirdScene', function () {
parameters:
{},
},
- },
+ }, (error, data) => {
+ console.info('ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
);
setTimeout(done(), 5000);
});
@@ -110,92 +109,39 @@ describe('ActsAmsTestThirdScene', function () {
}
function sleep(delay) {
- var start = (new Date()).getTime();
- var endTime = (new Date()).getTime();
- for (let index = 1; index > 0; index++) {
- if (endTime - startTime > delay) {
- break;
- } else {
- endTime = (new Date()).getTime();
- }
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
}
}
/*
* @tc.number : Acts_Ams_test_3300
- * @tc.name : getAllRunningProcesses : Get All Running Processes Info
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
* @tc.desc : Get All Running Processes Info(by Promise)
*/
it('Acts_Ams_test_3300', 0, async function (done) {
console.info("sleep begin");
sleep(5000);
console.info("sleep end");
- var info = await abilityManager.getAllRunningProcesses();
- console.info('Acts_Ams_test_3300 getAllRunningProcesses JSON String: ' + JSON.stringify(info));
+ var info = await appManager.getProcessRunningInfos();
+ console.info('Acts_Ams_test_3300 getProcessRunningInfos JSON String: ' + JSON.stringify(info));
expect(Array.isArray(info)).assertEqual(true);
expect(info.length).assertLarger(0);
for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_3300 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
expect(typeof (info[i].pid)).assertEqual("number");
expect(info[i].pid).assertLarger(0);
expect(typeof (info[i].processName)).assertEqual("string");
expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].pkgList)).assertEqual(true);
- expect(info[i].pkgList.length).assertEqual(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
expect(typeof (info[i].uid)).assertEqual("number");
expect(info[i].uid).assertLarger(0);
-
- expect(typeof (info[i].lastMemoryLevel)).assertEqual("number");
- expect(info[i].lastMemoryLevel).assertEqual(1);
-
- expect(typeof (info[i].weight)).assertEqual("number");
- expect(info[i].weight).assertEqual(-1);
-
- expect(typeof (info[i].weightReasonCode)).assertEqual("number");
- expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_3500
- * @tc.name : queryRunningAbilityMissionInfos : Query Running Ability Mission Infos
- * @tc.desc : Query Running Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_3500', 0, async function (done) {
- var maxnum = 20;
- var data = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- console.info('Acts_Ams_test_3500 queryRunningAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
}
done();
setTimeout(timeout, 5000);
@@ -203,166 +149,31 @@ describe('ActsAmsTestThirdScene', function () {
/*
* @tc.number : Acts_Ams_test_3700
- * @tc.name : queryRecentAbilityMissionInfos : Query Recent Ability Mission Infos
+ * @tc.name : getMissionInfos : Query Recent Ability Mission Infos
* @tc.desc : Query Recent Ability Mission Infos(by Promise)
*/
it('Acts_Ams_test_3700', 0, async function (done) {
var maxnum = 20;
- var flag = 2;
- var data = await abilityManager.queryRecentAbilityMissionInfos(maxnum, flag);
- console.info('Acts_Ams_test_3700 queryRecentAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].id)).assertEqual("number");
- expect(data[i].id).assertLarger(0);
-
- expect(typeof (data[i].baseAbility)).assertEqual("object");
- expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string");
- expect(data[i].baseAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string");
- expect(data[i].baseAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].baseAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string");
- expect(data[i].baseAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].baseAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
-
- expect(typeof (data[i].missionDescription)).assertEqual("object");
- expect(typeof (data[i].missionDescription.label)).assertEqual("string");
- expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string");
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_8300
- * @tc.name : getActiveProcessInfos : Get All Active Processes Info
- * @tc.desc : Get All Active Processes Info(by Promise)
- */
- it('Acts_Ams_test_8300', 0, async function (done) {
- var info = await abilityManager.getActiveProcessInfos();
- console.info('Acts_Ams_test_8300 getActiveProcessInfos JSON String: ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_9300
- * @tc.name : getActiveAbilityMissionInfos : Get Active Ability Mission Infos
- * @tc.desc : Get Active Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_9300', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getActiveAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_9300 getActiveAbilityMissionInfos data ' + JSON.stringify(data));
+ var data = await missionManager.getMissionInfos("", maxnum);
+ console.info('Acts_Ams_test_3700 getMissionInfos data ' + JSON.stringify(data));
expect(Array.isArray(data)).assertEqual(true);
expect(data.length).assertEqual(3);
for (var i = 0; i < data.length; i++) {
+ console.info('Acts_Ams_test_3700 getMissionInfos data[' + i + "]: " + JSON.stringify(data[i]));
expect(typeof (data[i].missionId)).assertEqual("number");
expect(data[i].missionId).assertLarger(0);
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
- }
- done();
- setTimeout(timeout, 5000);
- })
-
- /*
- * @tc.number : Acts_Ams_test_10300
- * @tc.name : getPreviousAbilityMissionInfos : Get Previous Ability Mission Infos
- * @tc.desc : Get Previous Ability Mission Infos(by Promise)
- */
- it('Acts_Ams_test_10300', 0, async function (done) {
- var upperLimit = 20;
- var data = await abilityManager.getPreviousAbilityMissionInfos(upperLimit);
- console.info('Acts_Ams_test_10300 getPreviousAbilityMissionInfos data ' + JSON.stringify(data));
- expect(Array.isArray(data)).assertEqual(true);
- expect(data.length).assertEqual(3);
- for (var i = 0; i < data.length; i++) {
- expect(typeof (data[i].missionId)).assertEqual("number");
- expect(data[i].missionId).assertLarger(0);
-
- expect(typeof (data[i].bottomAbility)).assertEqual("object");
- expect(typeof (data[i].bottomAbility.deviceId)).assertEqual("string");
- expect(data[i].bottomAbility.deviceId.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.bundleName)).assertEqual("string");
- expect(data[i].bottomAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].bottomAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.abilityName)).assertEqual("string");
- expect(data[i].bottomAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].bottomAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].bottomAbility.uri)).assertEqual("string");
- expect(data[i].bottomAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].bottomAbility.shortName)).assertEqual("string");
- expect(data[i].bottomAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].topAbility)).assertEqual("object");
- expect(typeof (data[i].topAbility.deviceId)).assertEqual("string");
- expect(typeof (data[i].topAbility.bundleName)).assertEqual("string");
- expect(data[i].topAbility.bundleName.length).assertLarger(0);
- expect(bundleNameList.indexOf(data[i].topAbility.bundleName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.abilityName)).assertEqual("string");
- expect(data[i].topAbility.abilityName.length).assertLarger(0);
- expect(abilityNameList.indexOf(data[i].topAbility.abilityName)).assertLarger(-1);
- expect(typeof (data[i].topAbility.uri)).assertEqual("string");
- expect(data[i].topAbility.uri.length).assertEqual(0);
- expect(typeof (data[i].topAbility.shortName)).assertEqual("string");
- expect(data[i].topAbility.shortName.length).assertEqual(0);
-
- expect(typeof (data[i].windowMode)).assertEqual("number");
- expect(data[i].windowMode).assertEqual(0);
+ expect(typeof (data[i].want)).assertEqual("object");
+ expect(typeof (data[i].want.deviceId)).assertEqual("string");
+ expect(typeof (data[i].want.bundleName)).assertEqual("string");
+ expect(data[i].want.bundleName.length).assertLarger(0);
+ expect(bundleNameList.indexOf(data[i].want.bundleName)).assertLarger(-1);
+ expect(typeof (data[i].want.abilityName)).assertEqual("string");
+ expect(data[i].want.abilityName.length).assertLarger(0);
+ expect(abilityNameList.indexOf(data[i].want.abilityName)).assertLarger(-1);
+
+ expect(typeof (data[i].label)).assertEqual("string");
+ expect(typeof (data[i].iconPath)).assertEqual("string");
}
done();
setTimeout(timeout, 5000);
@@ -370,45 +181,54 @@ describe('ActsAmsTestThirdScene', function () {
/*
* @tc.number : Acts_Ams_test_3900
- * @tc.name : removeMission : Remove Mission
+ * @tc.name : clearMission : Remove Mission
* @tc.desc : Remove Mission(by Promise)
*/
it('Acts_Ams_test_3900', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.removeMission(result[1].id);
- console.info('Acts_Ams_test_3900 removeMission data [' + info + ']');
- expect(info).assertEqual(0);
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_3900 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.clearMission(result[1].missionId);
+ console.info('Acts_Ams_test_3900 clearMission data [' + info + ']');
+ expect(info.code).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_4300
- * @tc.name : moveMissionToTop : Move Mission To Top
+ * @tc.name : moveMissionToFront : Move Mission To Top
* @tc.desc : Move Mission To Top(by Promise)
*/
it('Acts_Ams_test_4300', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.moveMissionToTop(result[0].id);
- console.info('Acts_Ams_test_4300 moveMissionToTop data [' + info + ']');
- expect(info).assertEqual(0);
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_4300 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.moveMissionToFront(result[0].missionId);
+ console.info('Acts_Ams_test_4300 moveMissionToFront data [' + info + ']');
+ expect(info.code).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
/*
* @tc.number : Acts_Ams_test_4500
- * @tc.name : removeMissions: Remove Missions
+ * @tc.name : clearMissions: Remove Missions
* @tc.desc : Remove Missions(by Promise)
*/
it('Acts_Ams_test_4500', 0, async function (done) {
var maxnum = 20;
- var result = await abilityManager.queryRunningAbilityMissionInfos(maxnum);
- var info = await abilityManager.removeMissions([result[0].id]);
- console.info('Acts_Ams_test_4500 removeMissions data [' + info + ']');
- expect(info).assertEqual(0);
+ var result = await missionManager.getMissionInfos("", maxnum);
+ for (var i = 0; i < result.length; i++) {
+ console.info('Acts_Ams_test_4500 getMissionInfos result[' + i + "]: " + JSON.stringify(result[i]));
+ }
+ var info = await missionManager.clearMission(result[0].missionId);
+ console.info('Acts_Ams_test_4500 clearMission data [' + info + ']');
+ expect(info.code).assertEqual(0);
done();
setTimeout(timeout, 5000);
})
@@ -419,11 +239,10 @@ describe('ActsAmsTestThirdScene', function () {
* @tc.desc : Kill Processes By BundleName(by Promise)
*/
it('Acts_Ams_test_4700', 0, async function (done) {
- var info = await abilityManager.killProcessesByBundleName('XXXXXXXX');
+ var info = await appManager.killProcessesByBundleName('XXXXXXXX');
console.info('Acts_Ams_test_4700 killProcessesByBundleName data [' + info + ']');
- expect(info).assertEqual(2097215);
+ expect(info.code).assertEqual(2097215);
done();
setTimeout(timeout, 5000);
})
-})
-
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/Test.json b/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/Test.json
index 7ac78910a917151702c06e3c5dc79a842b8ab169..a6b680b41c72c41310edb2fb8ba9f6a3e039b819 100644
--- a/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/Test.json
+++ b/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/Test.json
@@ -3,7 +3,7 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "120000",
- "package": "com.ohos.launcher",
+ "package": "com.example.myapplication11",
"abilityName": "com.ohos.launcherSed11.MainAbility",
"shell-timeout": "600000"
},
diff --git a/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/config.json
index ca3e263df7b3475d5ee35dc4da26d6231af80f43..3d20621699b918849c37d9dfbc93f24d3a955793 100644
--- a/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/config.json
+++ b/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/config.json
@@ -1,6 +1,6 @@
{
"app": {
- "bundleName": "com.ohos.launcher",
+ "bundleName": "com.example.myapplication11",
"vendor": "example",
"version": {
"code": 1000000,
diff --git a/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js
index 37ddae73e5795969c05b96599c8f352cce179426..a69c29d1ead901bef68abfc0c1b37ebc6139ae3b 100644
--- a/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import missionManager from '@ohos.application.missionManager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsAmsCallBackSixth Scene', function () {
@@ -51,7 +51,7 @@ describe('ActsAmsCallBackSixth Scene', function () {
* @tc.desc : Clear Missions(by CallBack)
*/
it('Acts_Ams_test_12200', 0, async function (done) {
- abilityManager.clearMissions(
+ missionManager.clearAllMissions(
(error,info) => {
console.info('Acts_Ams_test_12200 clearMissions error.code ' + error.code + ',data [' + info + ']' );
expect(typeof(info)).assertEqual("number");
@@ -59,4 +59,4 @@ describe('ActsAmsCallBackSixth Scene', function () {
});
done();
})
-})
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/Test.json b/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/Test.json
index b13ed4b357308cc813fa04ebdefd19c4edfbf4fb..cd28daa3f6802d671f0c40555e53736bfbd3f370 100644
--- a/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/Test.json
+++ b/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/Test.json
@@ -3,7 +3,7 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "120000",
- "package": "com.ohos.launcher",
+ "package": "com.example.myapplication111",
"abilityName": "com.ohos.launcherSed111.MainAbility",
"shell-timeout": "600000"
},
diff --git a/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/config.json
index 572b3d75735927d6767690f6c3197270bf3fb660..0eece2ae89479755d13673d82ad12ee703831865 100644
--- a/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/config.json
+++ b/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/config.json
@@ -1,6 +1,6 @@
{
"app": {
- "bundleName": "com.ohos.launcher",
+ "bundleName": "com.example.myapplication111",
"vendor": "example",
"version": {
"code": 1000000,
diff --git a/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js
index 7e9feae45a3ba88089459a283d5423fc3eb962b3..8609e3a4097d611fe33aa9bf88b5034caf18ba39 100644
--- a/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js
+++ b/aafwk/aafwk_standard/abilitymanager/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import featureAbility from '@ohos.ability.featureAbility'
-import abilityManager from '@ohos.app.abilityManager'
+import missionManager from '@ohos.application.missionManager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ActsAmsCallBackSixth Scene', function () {
@@ -51,10 +51,10 @@ describe('ActsAmsCallBackSixth Scene', function () {
* @tc.desc : Clear Missions(by Promise)
*/
it('Acts_Ams_test_12100', 0, async function (done) {
- var info = await abilityManager.clearMissions();
+ var info = await missionManager.clearAllMissions();
console.info('Acts_Ams_test_12100 clearMissions data [' + info + ']');
expect(typeof(info)).assertEqual("number");
expect(info).assertEqual(0);
done();
})
-})
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/BUILD.gn b/aafwk/aafwk_standard/actsabilitymanageretstest/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..0d799ef4ee841395559d3c59fb524fdf04b0570c
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/BUILD.gn
@@ -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.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("ActsAbilityManagerEtsTest") {
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_ets_assets",
+ ":hjs_demo_ets_resources",
+ ]
+ ets2abc = true
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsAbilityManagerEtsTest"
+}
+ohos_js_assets("hjs_demo_ets_assets") {
+ source_dir = "./entry/src/main/ets/MainAbility"
+}
+ohos_resources("hjs_demo_ets_resources") {
+ sources = [ "./entry/src/main/resources" ]
+ hap_profile = "./entry/src/main/config.json"
+}
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/Test.json b/aafwk/aafwk_standard/actsabilitymanageretstest/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..6a84fb1bc2651c4320e869a3990bc98ce5ca1b28
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for aceceshi Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "600000",
+ "package": "com.ohos.acecollaboration",
+ "shell-timeout": "60000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsAbilityManagerEtsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/config.json b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..0fb6c3d49860110029fe38061ee4fbbc8a236fe3
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/config.json
@@ -0,0 +1,159 @@
+{
+ "app": {
+ "bundleName": "com.ohos.acecollaboration",
+ "vendor": "ohos",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.ohos.acecollaboration",
+ "name": ".MyApplication",
+ "mainAbility": "com.ohos.acecollaboration.MainAbility",
+ "deviceType": [
+ "phone"
+ ],
+ "reqPermissions": [
+ {
+ "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name": "ohos.permission.GET_BUNDLE_INFO"
+ }
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "visible": true,
+ "srcPath": "MainAbility",
+ "srcLanguage": "ets",
+ "name": "com.ohos.acecollaboration.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:entry_MainAbility",
+ "type": "page",
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "srcPath": "MainAbility2",
+ "name": ".MainAbility2",
+ "srcLanguage": "ets",
+ "icon": "$media:icon",
+ "description": "$string:description_mainability2",
+ "formsEnabled": false,
+ "label": "$string:entry_MainAbility2",
+ "type": "page",
+ "launchType": "standard"
+ },
+ {
+ "srcPath": "ServiceAbility",
+ "name": ".ServiceAbility",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:description_serviceability",
+ "type": "service"
+ },
+ {
+ "srcPath": "ServiceAbility2",
+ "name": ".ServiceAbility2",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:description_serviceability2",
+ "type": "service"
+ },
+ {
+ "srcPath": "ServiceAbility3",
+ "name": ".ServiceAbility3",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:description_serviceability3",
+ "type": "service"
+ },
+ {
+ "srcPath": "ServiceAbility4",
+ "name": ".ServiceAbility4",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:description_serviceability4",
+ "type": "service"
+ },
+ {
+ "srcPath": "ServiceAbility5",
+ "name": ".ServiceAbility5",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:description_serviceability5",
+ "type": "service"
+ },
+ {
+ "srcPath": "ServiceAbility6",
+ "name": ".ServiceAbility6",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:description_serviceability6",
+ "type": "service"
+ },
+ {
+ "srcPath": "ServiceAbility7",
+ "name": ".ServiceAbility7",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:description_serviceability7",
+ "type": "service"
+ }
+ ],
+ "js": [
+ {
+ "mode": {
+ "syntax": "ets",
+ "type": "pageAbility"
+ },
+ "pages": [
+ "pages/index"
+ ],
+ "name": "MainAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ },
+ {
+ "mode": {
+ "syntax": "ets",
+ "type": "pageAbility"
+ },
+ "pages": [
+ "pages/index"
+ ],
+ "name": ".MainAbility2",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "defPermissions": [
+ {
+ "name": "com.ohos.acecollaboration.DataAbilityShellProvider.PROVIDER"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/app.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5d603333c7bf5167e7d1d3ead6c9daa9c4b2862d
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/app.ets
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ onCreate() {
+ console.info('Application onCreate')
+ },
+ onDestroy() {
+ console.info('Application onDestroy')
+ },
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a4ac0111471b4f1f725a67debb3f8d9fa2e80fa4
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/pages/index.ets
@@ -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 file from '@system.file';
+import {Core, ExpectExtend, ReportExtend} from "deccjsunit/index.ets";
+import testsuite from "../test/List.test.ets";
+import featureAbility from "@ohos.ability.featureAbility";
+
+async function startService2() {
+ var str = {
+ "want": {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.ohos.acecollaboration.ServiceAbility2",
+ },
+ };
+ var data = featureAbility.startAbility(str);
+ console.info('particleAbility_connectAbility_test_0100 startAbility succeeded: ' + JSON.stringify(data));
+}
+async function startService3() {
+ var str = {
+ "want": {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.ohos.acecollaboration.ServiceAbility3",
+ },
+ };
+ var data = featureAbility.startAbility(str);
+ console.info('particleAbility_connectAbility_test_0200 startAbility succeeded: ' + JSON.stringify(data));
+}
+async function startService4() {
+ var str = {
+ "want": {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.ohos.acecollaboration.ServiceAbility4",
+ },
+ };
+ var data = featureAbility.startAbility(str);
+ console.info('particleAbility_connectAbility_test_0300 startAbility succeeded: ' + JSON.stringify(data));
+}
+async function startService5() {
+ var str = {
+ "want": {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.ohos.acecollaboration.ServiceAbility5",
+ },
+ };
+ var data = featureAbility.startAbility(str);
+ console.info('particleAbility_connectAbility_test_0400 startAbility succeeded: ' + JSON.stringify(data));
+}
+async function startService6(){
+ var str = {
+ "want": {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.ohos.acecollaboration.ServiceAbility6",
+ },
+ };
+ var data = featureAbility.startAbility(str);
+ console.info('particleAbility_connectAbility_test_0500 startAbility succeeded: ' + JSON.stringify(data));
+}
+async function startService7(){
+ var str = {
+ "want": {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.ohos.acecollaboration.ServiceAbility7",
+ },
+ };
+ var data = featureAbility.startAbility(str);
+ console.info('particleAbility_connectAbility_test_0600 startAbility succeeded: ' + JSON.stringify(data));
+}
+
+@Entry
+@Component
+struct MyComponent {
+ aboutToAppear() {
+ console.info("start run testcase!!!!")
+ featureAbility.getWant()
+ .then((Want) => {
+ const core = Core.getInstance();
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ });
+ core.addService('expect', expectExtend);
+ const reportExtend = new ReportExtend(file);
+ core.addService('report', reportExtend);
+ core.init();
+ core.subscribeEvent('task', reportExtend);
+ const configService = core.getDefaultService('config');
+ console.info('parameters---->' + JSON.stringify(Want.parameters));
+ configService.setConfig(Want.parameters);
+ testsuite();
+ core.execute();
+ console.info('Operation successful. Data: ' + JSON.stringify(Want));
+ })
+ .catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+ })
+ }
+
+ build() {
+ Flex({
+ direction: FlexDirection.Column,
+ alignItems: ItemAlign.Center,
+ justifyContent: FlexAlign.Center
+ }) {
+ Text('ACE ETS TEST 组件协同')
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ Button('disconnectAbility_promise')
+ .fontSize(40)
+ .height(40)
+ .margin({ top: 20 })
+ .fontWeight(FontWeight.Bold)
+ .onClick(() => {
+ startService2();
+ });
+ Button('disconnectAbility_callback')
+ .fontSize(40)
+ .height(40)
+ .margin({ top: 20 })
+ .fontWeight(FontWeight.Bold)
+ .onClick(() => {
+ startService3();
+ });
+ Button('connectotherAbility')
+ .fontSize(40)
+ .height(40)
+ .margin({ top: 20 })
+ .fontWeight(FontWeight.Bold)
+ .onClick(() => {
+ startService4();
+ });
+ Button('connectnull')
+ .fontSize(40)
+ .height(40)
+ .margin({ top: 20 })
+ .fontWeight(FontWeight.Bold)
+ .onClick(() => {
+ startService5();
+ });
+ Button('connecterror')
+ .fontSize(40)
+ .height(40)
+ .margin({top:20})
+ .fontWeight(FontWeight.Bold)
+ .onClick(() => {
+ startService6();
+ });
+ Button('connectAPI8')
+ .fontSize(40)
+ .height(40)
+ .margin({top:20})
+ .fontWeight(FontWeight.Bold)
+ .onClick(() => {
+ startService7();
+ });
+
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/ContextJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/ContextJsunit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bcf072662fb6f4c67f9e3d538ea2c8800f4a1de6
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/ContextJsunit.test.ets
@@ -0,0 +1,249 @@
+/**
+ * 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 {describe, beforeEach, afterEach, it, expect} from "deccjsunit/index.ets";
+import Utils from './Utils';
+
+export default function contextJsunit() {
+ describe('appInfoTest', function () {
+ beforeEach(async function (done) {
+ console.info("context before each called");
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(2000);
+ console.info("context after each called");
+ });
+
+ /*
+ * @tc.number: context_getCacheDir_test_0100
+ * @tc.name: getCacheDir : Obtains the Cache directory on internal storage.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it("context_getCacheDir_test_0100", 0, async function (done) {
+ console.log("------------------start context_getCacheDir_test_0100-------------------");
+ try {
+ var timeOldStamp = await Utils.getNowTime();
+ var context = await featureAbility.getContext();
+ context.getCacheDir().then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getCacheDir_test_0100', timeOldStamp, timeNewStamp)
+ console.log("context_getCacheDir_test_0100: CacheDir is " + data);
+ })
+ } catch (error) {
+ console.log("logMessage context_getCacheDir_test_0100: error = " + error);
+ expect(error).assertEqual("/data/accounts/account_0/appdata/com.ohos.acecollaboration/cache");
+ }
+ var data1 = await context.getCacheDir();
+ expect(typeof (data1)).assertEqual("string");
+ expect(data1).assertEqual("/data/accounts/account_0/appdata/com.ohos.acecollaboration/cache");
+ done();
+ console.log("------------------end context_getCacheDir_test_0100-------------------");
+ });
+
+ /*
+ * @tc.number: context_getCacheDir_test_0200
+ * @tc.name: getCacheDir : Obtains the Cache directory on internal storage.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it("context_getCacheDir_test_0200", 0, async function (done) {
+ console.log("------------------start context_getCacheDir_test_0200-------------------");
+ try {
+ var timeOldStamp = await Utils.getNowTime();
+ var context = await featureAbility.getContext();
+ context.getCacheDir((err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getCacheDir_test_0200', timeOldStamp, timeNewStamp)
+ console.log("context_getCacheDir_test_0200: getCacheDir successful, result = " + data);
+ });
+ } catch (error) {
+ console.log("logMessage context_getCacheDir_test_0200: error = " + error);
+ expect(error).assertEqual("/data/accounts/account_0/appdata/com.ohos.acecollaboration/cache");
+ }
+ var data1 = await context.getCacheDir();
+ expect(typeof (data1)).assertEqual("string");
+ expect(data1).assertEqual("/data/accounts/account_0/appdata/com.ohos.acecollaboration/cache");
+ done();
+ console.log("------------------end context_getCacheDir_test_0200-------------------");
+ });
+
+ /*
+ * @tc.number: context_getFilesDir_test_0100
+ * @tc.name: getFilesDir : Obtains the files directory on internal storage.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it("context_getFilesDir_test_0100", 0, async function (done) {
+ console.log("------------------start context_getFilesDir_test_0100-------------------");
+ try {
+ var timeOldStamp = await Utils.getNowTime();
+ var context = await featureAbility.getContext();
+ context.getFilesDir().then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getFilesDir_test_0100', timeOldStamp, timeNewStamp)
+ console.log("context_getFilesDir_test_0100:FilesDir is " + data);
+ })
+ } catch (error) {
+ console.log("logMessage context_getFilesDir_test_0100: error = " + error);
+ expect(error).assertEqual("/data/accounts/account_0/appdata/com.ohos.acecollaboration/files");
+ }
+ var data1 = await context.getFilesDir();
+ expect(typeof (data1)).assertEqual("string");
+ expect(data1).assertEqual("/data/accounts/account_0/appdata/com.ohos.acecollaboration/files");
+ done();
+ console.log("------------------end context_getFilesDir_test_0100-------------------");
+ });
+
+ /*
+ * @tc.number: context_getFilesDir_test_0200
+ * @tc.name: getFilesDir : Obtains the files directory on internal storage.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it("context_getFilesDir_test_0200", 0, async function (done) {
+ console.log("------------------start context_getFilesDir_test_0200-------------------");
+ try {
+ var timeOldStamp = await Utils.getNowTime();
+ var context = await featureAbility.getContext();
+ context.getFilesDir((err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getFilesDir_test_0200', timeOldStamp, timeNewStamp)
+ console.log("context_getFilesDir_test_0200: getFilesDir successful, result = " + data);
+ });
+ } catch (error) {
+ console.log("logMessage context_getFilesDir_test_0200: error = " + error);
+ expect(error).assertEqual("/data/accounts/account_0/appdata/com.ohos.acecollaboration/files");
+ }
+ var data1 = await context.getFilesDir();
+ expect(typeof (data1)).assertEqual("string");
+ expect(data1).assertEqual("/data/accounts/account_0/appdata/com.ohos.acecollaboration/files");
+ done();
+ console.log("------------------end context_getFilesDir_test_0200-------------------");
+ });
+
+
+ /*
+ * @tc.number: context_getOrCreateDistributedDir_test_0100
+ * @tc.name: getOrCreateDistributedDir : Obtains the directory of Distributed files.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it("context_getOrCreateDistributedDir_0100", 0, async function (done) {
+ console.log("------------------start context_getOrCreateDistributedDir_0100-------------------");
+ try {
+ var timeOldStamp = await Utils.getNowTime();
+ var context = await featureAbility.getContext();
+ context.getOrCreateDistributedDir().then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getOrCreateDistributedDir_0100', timeOldStamp, timeNewStamp);
+ console.log("context_getOrCreateDistributedDir_0100: DistributedDir is " + data);
+ })
+ } catch (error) {
+ console.log("logMessage context_getOrCreateDistributedDir_0100: error = " + error);
+ expect(error).assertEqual("/data/storage/el2/distributedfiles/entry");
+ }
+ var data1 = await context.getOrCreateDistributedDir();
+ expect(typeof (data1)).assertEqual("string");
+ expect(data1).assertEqual("/data/storage/el2/distributedfiles/entry");
+ done();
+ console.log("------------------end context_getOrCreateDistributedDir_0100-------------------");
+ });
+
+ /*
+ * @tc.number: context_getOrCreateDistributedDir_0200
+ * @tc.name: getOrCreateDistributedDir : Obtains the directory of Distributed files.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it("context_getOrCreateDistributedDir_0200", 0, async function (done) {
+ console.log("------------------start context_getOrCreateDistributedDir_0200-------------------");
+ try {
+ var timeOldStamp = await Utils.getNowTime();
+ var context = await featureAbility.getContext();
+ context.getOrCreateDistributedDir((err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getOrCreateDistributedDir_0200', timeOldStamp, timeNewStamp);
+ console.log("context_getOrCreateDistributedDir_0200: getOrCreateDistributedDir successful, result = " + data);
+ });
+ } catch (error) {
+ console.log("logMessage context_getOrCreateDistributedDir_0200: error = " + error);
+ expect(error).assertEqual("/data/storage/el2/distributedfiles/entry");
+ }
+ var data1 = await context.getOrCreateDistributedDir();
+ expect(typeof (data1)).assertEqual("string");
+ expect(data1).assertEqual("/data/storage/el2/distributedfiles/entry");
+ done();
+ console.log("------------------end context_getOrCreateDistributedDir_0200-------------------");
+ });
+
+ /*
+ * @tc.number: context_getAppType_0100
+ * @tc.name: getAppType : Obtains the type of current application.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it("context_getAppType_0100", 0, async function (done) {
+ console.log("------------------start context_getAppType_0100-------------------");
+ try {
+ var timeOldStamp = await Utils.getNowTime();
+ var context = await featureAbility.getContext();
+ context.getAppType().then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getAppType_0100_0100', timeOldStamp, timeNewStamp);
+ console.log("context_getAppType_0100: AppType is " + data);
+ })
+ } catch (error) {
+ console.log("logMessage context_getAppType_0100: error = " + error);
+ expect(error).assertEqual("system");
+ }
+ var data1 = await context.getAppType();
+ expect(typeof (data1)).assertEqual("string");
+ expect(data1).assertEqual("system");
+ done();
+ console.log("------------------end context_getAppType_0100-------------------");
+ });
+
+ /*
+ * @tc.number: context_getAppType_0200
+ * @tc.name: getAppType : Obtains the type of current application.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it("context_getAppType_0200", 0, async function (done) {
+ console.log("------------------start context_getAppType_0200-------------------");
+ try {
+ var timeOldStamp = await Utils.getNowTime();
+ var context = await featureAbility.getContext();
+ context.getAppType((err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getAppType_0200_0100', timeOldStamp, timeNewStamp);
+ console.log("context_getAppType_0200: getAppType successful, result = " + data);
+ });
+ } catch (error) {
+ console.log("logMessage context_getAppType_0200: error = " + error);
+ expect(error).assertEqual("system");
+ }
+ var data1 = await context.getAppType();
+ expect(typeof (data1)).assertEqual("string");
+ expect(data1).assertEqual("system");
+ done();
+ console.log("------------------end context_getAppType_0200-------------------");
+ });
+ })
+}
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/DataAbility.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/DataAbility.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f8ed690f0e208ab7048cf556a52abcfdf37be511
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/DataAbility.test.ets
@@ -0,0 +1,818 @@
+/**
+ * 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 {describe, expect, it} from 'deccjsunit/index.ets'
+
+const URI_CONTACTS = 'dataability:///com.ohos.contactsdataability';
+const contactUri = 'dataability:///com.ohos.contactsdataability/contacts/groups';
+const contactUri2 = 'dataability:///com.ohos.contactsdataability/contacts/groups2';
+import Utils from './Utils';
+
+const INSERT_ONE = 'dataAbility_insert_test ';
+const QUERY_TWO = 'dataAbility_query_test ';
+const UPDATE_THREE = 'dataAbility_update_test ';
+const DELETE_FOUR = 'dataAbility_delete_test ';
+
+export default function DataAbilityJsunit() {
+ var dataAbilityHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS);
+ var pacMap = {
+ 'group_name': 'test1',
+ 'ringtone_modify_time': 28
+ };
+
+ var pacMap_3 = {
+ 'group_name': 'test3',
+ 'ringtone_modify_time': 20
+ };
+
+ var pacMap_4 = {
+ 'group_name': 'test4',
+ 'ringtone_modify_time': 40
+ };
+
+ describe('appInfoTest', function () {
+
+ /*
+ * @tc.number: dataAbility_insert_test_001
+ * @tc.name: call : Inserts a single data record into the database.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it(INSERT_ONE + '001', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(INSERT_ONE + '001 start......');
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'insert', '', pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(INSERT_ONE + '001', timeOldStamp, timeNewStamp);
+ if (err) {
+ wrong = err;
+ console.error(INSERT_ONE + '001 error: ' + JSON.stringify(err));
+ } else {
+ details = data;
+ console.info(INSERT_ONE + '001 succeeded data: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
+ done();
+ console.log(INSERT_ONE + '001 end ......');
+ });
+
+ /*
+ * @tc.number: dataAbility_insert_test_002
+ * @tc.name: call : Inserts a single data record into the database.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(INSERT_ONE + '002', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(INSERT_ONE + '002 start......');
+ pacMap.group_name = 'test2';
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'insert', '', pacMap).then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(INSERT_ONE + '002', timeOldStamp, timeNewStamp);
+ details = data;
+ console.info(INSERT_ONE + '002 succeeded data: ' + JSON.stringify(data));
+ }).catch((error) => {
+ wrong = error;
+ console.error(INSERT_ONE + '002 error: ' + JSON.stringify(error));
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
+ done();
+ console.log(INSERT_ONE + '002 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_insert_test_003
+ * @tc.name: call : Inserts a incorrect uri data record into the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(INSERT_ONE + '003', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(INSERT_ONE + '003 start......');
+ dataAbilityHelper.call(contactUri2, 'insert', '', pacMap).then((data) => {
+ details = data
+ console.info(INSERT_ONE + '003 succeeded: ' + JSON.stringify(data));
+ }).catch((error) => {
+ wrong = error;
+ console.error(INSERT_ONE + '003 error: ' + JSON.stringify(error));
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
+ done();
+ console.log(INSERT_ONE + '003 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_insert_test_004
+ * @tc.name: call : Inserts a null uri data record into the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(INSERT_ONE + '004', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(INSERT_ONE + '004 start......');
+ dataAbilityHelper.call('', 'insert', '', pacMap).then((data) => {
+ details = data;
+ console.info(INSERT_ONE + '004 succeeded: ' + JSON.stringify(data));
+ }).catch((error) => {
+ wrong = error;
+ console.error(INSERT_ONE + '004 error: ' + JSON.stringify(error));
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
+ done();
+ console.log(INSERT_ONE + '004 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_insert_test_005
+ * @tc.name: call : Inserts a null methold data record into the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(INSERT_ONE + '005', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(INSERT_ONE + '005 start......');
+ let pacMap = {
+ 'group_name': 'test4',
+ 'ringtone_modify_time': 28
+ };
+ dataAbilityHelper.call(contactUri, "", "", pacMap).then((data) => {
+ details = data;
+ console.info(INSERT_ONE + '005 succeeded: ' + JSON.stringify(data));
+ }).catch((error) => {
+ wrong = error;
+ console.error(INSERT_ONE + '005 error: ' + JSON.stringify(error));
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 1) : expectDetails(wrong, true, 2);
+ done();
+ console.log(INSERT_ONE + '005 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_query_test_001
+ * @tc.name: call : Queries data in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(QUERY_TWO + '001', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(QUERY_TWO + '001 start......');
+ let arg = "{\"equalTo\": \"group_name\"}";
+ let pacMap = {
+ "group_name": "test1",
+ "columns": "group_name,ringtone_modify_time"
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'query', arg, pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(QUERY_TWO + '001', timeOldStamp, timeNewStamp);
+ wrong = err;
+ if (wrong) {
+ console.error(QUERY_TWO + '001 error: ' + JSON.stringify(wrong));
+ } else {
+ details = data;
+ console.info(QUERY_TWO + '001 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
+ done();
+ console.log(QUERY_TWO + '001 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_query_test_002
+ * @tc.name: call : Queries data in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(QUERY_TWO + '002', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(QUERY_TWO + '002 start......');
+ let arg = "{\"between\": \"ringtone_modify_time\"}";
+ let pacMap = {
+ 'ringtone_modify_time': "15, 30",
+ "columns": "group_name,ringtone_modify_time"
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'query', arg, pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(QUERY_TWO + '002', timeOldStamp, timeNewStamp);
+ wrong = err;
+ if (wrong) {
+ console.error(QUERY_TWO + '002 error: ' + JSON.stringify(wrong));
+ } else {
+ details = data;
+ console.info(QUERY_TWO + '002 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
+ done();
+ console.log(QUERY_TWO + '002 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_query_test_003
+ * @tc.name: call : Queries data in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(QUERY_TWO + '003', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(QUERY_TWO + '003 start......');
+ let arg = {
+ 'like': 'group_name'
+ };
+ let pacMap = {
+ 'group_name': '%test%',
+ 'columns': 'group_name,ringtone_modify_time'
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'query', arg, pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(QUERY_TWO + '003', timeOldStamp, timeNewStamp);
+ wrong = err;
+ if (wrong) {
+ console.error(QUERY_TWO + '003 error: ' + JSON.stringify(wrong));
+ } else {
+ details = data;
+ console.info(QUERY_TWO + '003 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
+ done();
+ console.log(QUERY_TWO + '003 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_query_test_004
+ * @tc.name: call : Queries data in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(QUERY_TWO + '004', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(QUERY_TWO + '004 start......');
+ let arg = {
+ 'greaterThanOrEqualTo': 'ringtone_modify_time'
+ };
+ let pacMap = {
+ 'ringtone_modify_time': 20,
+ 'columns': 'group_name,ringtone_modify_time'
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'query', arg, pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(QUERY_TWO + '004', timeOldStamp, timeNewStamp);
+ if (err) {
+ wrong = err;
+ console.error(QUERY_TWO + '004 error: ' + JSON.stringify(err));
+ return;
+ } else {
+ details = data;
+ console.info(QUERY_TWO + '004 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
+ done();
+ console.log(QUERY_TWO + '004 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_query_test_005
+ * @tc.name: call : Queries abnormal data in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(QUERY_TWO + '005', 0, async function (done) {
+ let details;
+ let wrong;
+ let pacMap = {
+ 'ringtone_modify_time': 20,
+ 'columns': 'group_name,ringtone_modify_time'
+ };
+ console.log(INSERT_ONE + '003 start......');
+ dataAbilityHelper.call(contactUri2, 'query', '', pacMap).then((data) => {
+ details = data
+ console.info(QUERY_TWO + '005 succeeded: ' + JSON.stringify(data));
+ }).catch((error) => {
+ wrong = error;
+ console.error(QUERY_TWO + '005 error: ' + JSON.stringify(error));
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
+ done();
+ console.log(QUERY_TWO + '005 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_query_test_006
+ * @tc.name: call : Queries abnormal data in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(QUERY_TWO + '006', 0, async function (done) {
+ let details;
+ let wrong;
+ let pacMap = {
+ 'ringtone_modify_time': 20,
+ 'columns': 'group_name,ringtone_modify_time'
+ };
+ console.log(QUERY_TWO + '004 start......');
+ dataAbilityHelper.call('', 'query', '', pacMap).then((data) => {
+ details = data;
+ console.info(QUERY_TWO + '006 succeeded: ' + JSON.stringify(data));
+ }).catch((error) => {
+ wrong = error;
+ console.error(QUERY_TWO + '006 error: ' + JSON.stringify(error));
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, false, 4) : expectDetails(wrong, true, 2);
+ done();
+ console.log(QUERY_TWO + '006 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_update_test_001
+ * @tc.name: call : Updates data records in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(UPDATE_THREE + '001', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(UPDATE_THREE + '001 start......');
+ let arg = "{\"equalTo\": \"ringtone_modify_time\"}";
+ let pacMap = {
+ 'ringtone_modify_time': 28,
+ 'group_name': 'testupdata1'
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'update', arg, pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(UPDATE_THREE + '001', timeOldStamp, timeNewStamp);
+ if (err) {
+ wrong = err;
+ console.error(UPDATE_THREE + '001 error: ' + JSON.stringify(err));
+ } else {
+ details = data;
+ console.info(UPDATE_THREE + '001 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(UPDATE_THREE + '001 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_update_test_002
+ * @tc.name: call : Updates data records in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(UPDATE_THREE + '002', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(UPDATE_THREE + '002 start......');
+ let arg = "{\"between\": \"ringtone_modify_time\"}";
+ let pacMap = {
+ 'ringtone_modify_time': "15, 30",
+ 'group_name': 'testupdata2'
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'update', arg, pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(UPDATE_THREE + '002', timeOldStamp, timeNewStamp);
+ if (err) {
+ wrong = err;
+ console.error(UPDATE_THREE + '002 error: ' + JSON.stringify(err));
+ } else {
+ details = data;
+ console.info(UPDATE_THREE + '002 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(UPDATE_THREE + '002 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_update_test_003
+ * @tc.name: call : Updates data records in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(UPDATE_THREE + '003', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(UPDATE_THREE + '003 start......');
+ let arg = {
+ 'contains': 'group_name'
+ };
+ let pacMap = {
+ 'group_name': 'ata2',
+ 'ringtone_modify_time': 100
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'update', arg, pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(UPDATE_THREE + '003', timeOldStamp, timeNewStamp);
+ if (err) {
+ wrong = err;
+ console.error(UPDATE_THREE + '003 error: ' + JSON.stringify(err));
+ } else {
+ details = data;
+ console.info(UPDATE_THREE + '003 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(UPDATE_THREE + '003 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_update_test_004
+ * @tc.name: call : Updates data records in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(UPDATE_THREE + '004', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(UPDATE_THREE + '004 start......');
+ let arg = {
+ 'lessThan': 'ringtone_modify_time'
+ };
+ let pacMap = {
+ 'ringtone_modify_time': 32,
+ 'group_name': 'testupdata2'
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'update', arg, pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(UPDATE_THREE + '004', timeOldStamp, timeNewStamp);
+ if (err) {
+ wrong = err;
+ console.error(UPDATE_THREE + '004 error: ' + JSON.stringify(err));
+ } else {
+ details = data;
+ console.info(UPDATE_THREE + '004 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(UPDATE_THREE + '004 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_update_test_005
+ * @tc.name: call : Updates abnormal data records in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(UPDATE_THREE + '005', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(UPDATE_THREE + '005 start......');
+
+ let pacMap = {
+ 'ringtone_modify_time': 32,
+ 'group_name': 'testupdata2'
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri2, 'update', '', pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(UPDATE_THREE + '005', timeOldStamp, timeNewStamp);
+ if (err) {
+ wrong = err;
+ console.error(UPDATE_THREE + '005 error: ' + JSON.stringify(err));
+ } else {
+ details = data;
+ console.info(UPDATE_THREE + '005 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(UPDATE_THREE + '005 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_update_test_006
+ * @tc.name: call : Updates abnormal data records in the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(UPDATE_THREE + '006', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(UPDATE_THREE + '006 start......');
+ let pacMap = {
+ 'ringtone_modify_time': 32,
+ 'group_name': 'testupdata2'
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call('', 'update', '', pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(UPDATE_THREE + '006', timeOldStamp, timeNewStamp);
+ if (err) {
+ wrong = err;
+ console.error(UPDATE_THREE + '006 error: ' + JSON.stringify(err));
+ } else {
+ details = data;
+ console.info(UPDATE_THREE + '006 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(UPDATE_THREE + '006 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_delete_test_001
+ * @tc.name: call : Deletes one or more data records from the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ dataAbilityHelper.call(contactUri, 'insert', '', pacMap, (err, data) => {
+ if (err) {
+ console.error('Operation failed1. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation succeeded1: ' + JSON.stringify(data));
+ });
+ it(DELETE_FOUR + '001', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(DELETE_FOUR + '001 start......');
+ let arg2 = "{\"equalTo\": \"group_name\"}";
+ let pacMap2 = {
+ 'group_name': 'test1'
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'delete', arg2, pacMap2, (err2, data2) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(DELETE_FOUR + '001', timeOldStamp, timeNewStamp);
+ if (err2) {
+ wrong = err2;
+ console.error(DELETE_FOUR + '001 error: ' + JSON.stringify(err2));
+ } else {
+ details = data2;
+ console.info(DELETE_FOUR + '001 succeeded: ' + JSON.stringify(data2));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(DELETE_FOUR + '001 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_delete_test_002
+ * @tc.name: call : Deletes one or more data records from the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it(DELETE_FOUR + '002', 0, async function (done) {
+ let details;
+ let wrong
+ console.log(DELETE_FOUR + '002 start......');
+ let arg = "{\"lessThan\": \"ringtone_modify_time\"}";
+ let pacMap = {
+ 'ringtone_modify_time': 32,
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'delete', arg, pacMap, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(DELETE_FOUR + '002', timeOldStamp, timeNewStamp);
+ if (err) {
+ wrong = err;
+ console.error(DELETE_FOUR + '002 error: ' + JSON.stringify(err));
+ } else {
+ details = data;
+ console.info(DELETE_FOUR + '002 succeeded: ' + JSON.stringify(data));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(DELETE_FOUR + '002 end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_delete_test_003
+ * @tc.name: call : Deletes one or more data records from the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ dataAbilityHelper.call(contactUri, 'insert', '', pacMap_3, (err, data) => {
+ if (err) {
+ console.error('Operation failed3. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation succeeded3: ' + JSON.stringify(data));
+ });
+ it(DELETE_FOUR + '003', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(DELETE_FOUR + '003 start......');
+ let arg2 = {
+ 'like': 'group_name'
+ };
+ let pacMap2 = {
+ 'group_name': '%test%'
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'delete', arg2, pacMap2, (err2, data2) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(DELETE_FOUR + '003', timeOldStamp, timeNewStamp);
+ if (err2) {
+ wrong = err2;
+ console.error(DELETE_FOUR + '003 error: ' + JSON.stringify(err2));
+ } else {
+ details = data2;
+ console.info(DELETE_FOUR + '003 delete succeeded: ' + JSON.stringify(data2));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(DELETE_FOUR + '003 delete end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_delete_test_004
+ * @tc.name: call : Deletes one or more data records from the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ dataAbilityHelper.call(contactUri, 'insert', '', pacMap_4, (err, data) => {
+ if (err) {
+ console.error('Operation failed4. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation succeeded4: ' + JSON.stringify(data));
+ });
+ it(DELETE_FOUR + '004', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(DELETE_FOUR + '004 start......');
+ let arg2 = {
+ 'greaterThanOrEqualTo': 'ringtone_modify_time'
+ };
+ let pacMap2 = {
+ 'ringtone_modify_time': 40
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri, 'delete', arg2, pacMap2, (err2, data2) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(DELETE_FOUR + '004', timeOldStamp, timeNewStamp);
+ if (err2) {
+ wrong = err2;
+ console.error(DELETE_FOUR + '004 error: ' + JSON.stringify(err2));
+ } else {
+ details = data2;
+ console.info(DELETE_FOUR + '004 delete succeeded: ' + JSON.stringify(data2));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(DELETE_FOUR + '004 delete end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_delete_test_005
+ * @tc.name: call : Deletes abnormal data records from the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ dataAbilityHelper.call(contactUri, 'insert', '', pacMap_4, (err, data) => {
+ if (err) {
+ console.error('Operation failed4. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation succeeded5: ' + JSON.stringify(data));
+ });
+ it(DELETE_FOUR + '005', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(DELETE_FOUR + '005 start......');
+ let pacMap2 = {
+ 'ringtone_modify_time': 40
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call(contactUri2, 'delete', '', pacMap2, (err2, data2) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(DELETE_FOUR + '005', timeOldStamp, timeNewStamp);
+ if (err2) {
+ wrong = err2;
+ console.error(DELETE_FOUR + '005 error: ' + JSON.stringify(err2));
+ } else {
+ details = data2;
+ console.info(DELETE_FOUR + '005 delete succeeded: ' + JSON.stringify(data2));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(DELETE_FOUR + '005 delete end......');
+ });
+
+ /*
+ * @tc.number: dataAbility_delete_test_006
+ * @tc.name: call : Deletes abnormal data records from the database.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ dataAbilityHelper.call(contactUri, 'insert', '', pacMap_4, (err, data) => {
+ if (err) {
+ console.error('Operation failed4. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation succeeded4: ' + JSON.stringify(data));
+ });
+ it(DELETE_FOUR + '006', 0, async function (done) {
+ let details;
+ let wrong;
+ console.log(DELETE_FOUR + '006 start......');
+ let pacMap2 = {
+ 'ringtone_modify_time': 40
+ };
+ var timeOldStamp = await Utils.getNowTime();
+ dataAbilityHelper.call('', 'delete', '', pacMap2, (err2, data2) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime(DELETE_FOUR + '006', timeOldStamp, timeNewStamp);
+ if (err2) {
+ wrong = err2;
+ console.error(DELETE_FOUR + '006 error: ' + JSON.stringify(err2));
+ } else {
+ details = data2;
+ console.info(DELETE_FOUR + '006 delete succeeded: ' + JSON.stringify(data2));
+ }
+ });
+ await Utils.sleep(1000);
+ details != null ? expectDetails(details, true, 3) : expectDetails(wrong, true, 2);
+ done();
+ console.log(DELETE_FOUR + '006 delete end......');
+ });
+ })
+
+ function expectDetails(data, isTrue, keyStatus) {
+ if (data != -1) {
+ expect(typeof (data)).assertEqual("object");
+ expect(typeof (data.result)).assertEqual(isTrue ? 'number' : 'string');
+ }
+ switch (keyStatus) {
+ case 1:
+ expect(data.result > 0).assertTrue();
+ break
+
+ case 2:
+ expect(data == -1).assertTrue();
+ break
+
+ case 3:
+ expect(data.result).assertEqual(0);
+ break
+ }
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..023315f7c62d5e8ca4b19fef1d668d6c9dc74d82
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets
@@ -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.
+ */
+
+import addContextAndAbilityJsunit from './addContextAndAbilityJsunit.test.ets';
+import getHapModuleInfoJsunit from './getHapModuleInfoJsunit.test.ets';
+import getAbilityInfoJsunit from './getAbilityInfoJsunit.test.ets';
+import getApplicationContext from './getApplicationContextJsunit.test.ets';
+import getAppVersionInfoJsunit from './getAppVersionInfoJsunit.test.ets';
+import ContextJsunit from './ContextJsunit.test.ets';
+import DataAbilityJsunit from './DataAbility.test.ets';
+
+export default function testsuite() {
+ ContextJsunit();
+ DataAbilityJsunit();
+ addContextAndAbilityJsunit();
+ getHapModuleInfoJsunit();
+ getAbilityInfoJsunit();
+ getApplicationContext();
+ getAppVersionInfoJsunit();
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/Utils.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/Utils.ets
new file mode 100644
index 0000000000000000000000000000000000000000..d347b04062965c665153e7ac358028d6ae274d53
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/Utils.ets
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default class Utils {
+ static sleep(time) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ resolve(reject)
+ }, time)
+ }).then(() => {
+ console.info(`sleep ${time} over...`)
+ })
+ }
+
+ static getNowTime() {
+ return new Date().getTime();
+ }
+
+ /**
+ * 接口调用时间
+ * @param startTime 接口调用开始时间
+ * @param endTime 接口调用结束时间
+ */
+ static getDurationTime(msg, startTime, endTime) {
+ console.info(msg + 'Get Interface startTime: ' + startTime);
+ console.info(msg + 'Get Interface endTime: ' + endTime);
+ var duration = (endTime - startTime)
+ console.info(msg + 'Get Interface Duration: ' + duration);
+ return duration;
+ }
+}
+
+
+
+
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/addContextAndAbilityJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/addContextAndAbilityJsunit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..8aaedaf046defd0f66645c3170fe2ab31c05b222
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/addContextAndAbilityJsunit.test.ets
@@ -0,0 +1,300 @@
+/**
+ * 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 {describe, it, expect} from "deccjsunit/index.ets";
+import Utils from './Utils';
+import ability_featureAbility from '@ohos.ability.featureAbility';
+import abilityManager from "@ohos.app.abilitymanager"
+
+const TAG_TEST_0100 = ' context_isUpdatingConfigurations_test_0100 ';
+const TAG_TEST_0200 = ' context_isUpdatingConfigurations_test_0200 ';
+const TAG_TEST_0300 = ' context_printDrawnCompleted_test_0100 ';
+const TAG_TEST_0400 = ' context_printDrawnCompleted_test_0200 ';
+const TAG_TEST_0500 = ' context_getAppMemorySize_test_0100 ';
+const TAG_TEST_0600 = ' context_getAppMemorySize_test_0200 ';
+const TAG_TEST_0700 = ' context_isRamConstrainedDevice_test_0100 ';
+const TAG_TEST_0800 = ' context_isRamConstrainedDevice_test_0200 ';
+const TAG_TEST_0900 = ' context_featureAbility_test_0100 ';
+const TAG_TEST_0010 = ' context_featureAbility_test_0200 ';
+const TAG_TEST_0011 = ' context_featureAbility_test_0300 ';
+const TAG_TEST_0012 = ' context_featureAbility_test_0400 ';
+
+export default function addContextAndAbilityJsunit() {
+ describe('appInfoTest', function () {
+ /*
+ * @tc.number: context_isUpdatingConfigurations_test_0100
+ * @tc.name: isUpdatingConfigurations : Obtains whether the configuration of the current ability is changing.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0100, 0, async function (done) {
+ console.info(TAG_TEST_0100 + 'promise START');
+ let detailed;
+ var startTime = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ await context.isUpdatingConfigurations().then((data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0100, startTime, endTime)
+ console.info(TAG_TEST_0100 + ' promise data is:' + JSON.stringify(data));
+ detailed = data;
+ }).catch((error) => {
+ console.error(TAG_TEST_0100 + 'promise errors is: ' + JSON.stringify(error));
+ })
+ expect(typeof (detailed)).assertEqual("boolean");
+ expect(detailed).assertEqual(false);
+ done();
+ console.log('------------------ ' + TAG_TEST_0100 + ' end -------------------');
+ });
+
+ /*
+ * @tc.number: context_isUpdatingConfigurations_test_0200
+ * @tc.name: isUpdatingConfigurations : Obtains whether the configuration of the current ability is changing.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0200, 0, async function (done) {
+ let detailed;
+ console.info(TAG_TEST_0200 + 'callBack START');
+ try {
+ var startTime = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ context.isUpdatingConfigurations((error, data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0200, startTime, endTime)
+ detailed = data;
+ console.info(TAG_TEST_0200 + ' callBack succeeded. data is:' + JSON.stringify(data));
+ });
+ } catch (error) {
+ console.error(TAG_TEST_0200 + 'Operation failed. Cause: ' + JSON.stringify(error));
+ }
+ await Utils.sleep(2000)
+ expect(typeof (detailed)).assertEqual("boolean");
+ expect(detailed).assertEqual(false);
+ done();
+ console.log('------------------ ' + TAG_TEST_0200 + ' end -------------------');
+ });
+
+ /*
+ * @tc.number: context_printDrawnCompleted_test_0100
+ * @tc.name: printDrawnCompleted : Inform the system of the time required to complete the drawing of the page
+ capability.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0300, 0, async function (done) {
+ let detailed;
+ console.info(TAG_TEST_0300 + 'callBack START');
+ var startTime = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ await context.printDrawnCompleted().then((data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0300, startTime, endTime)
+ console.info(TAG_TEST_0300 + ' promise data is:' + JSON.stringify(data));
+ detailed = data;
+ }).catch((error) => {
+ console.error(TAG_TEST_0300 + 'promise error is: ' + JSON.stringify(error));
+ });
+ await Utils.sleep(2000)
+ expect(detailed).assertEqual(null);
+ done();
+ console.log('------------------ ' + TAG_TEST_0300 + ' end -------------------');
+ })
+
+
+ /*
+ * @tc.number: context_printDrawnCompleted_test_0200
+ * @tc.name: printDrawnCompleted : Inform the system of the time required to complete the drawing of the page
+ capability.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0400, 0, async function (done) {
+ let detailed;
+ console.info(TAG_TEST_0400 + 'callBack START');
+ try {
+ var startTime = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ context.printDrawnCompleted((error, data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0300, startTime, endTime)
+ detailed = data;
+ console.info(TAG_TEST_0400 + ' callBack succeeded. data is:' + JSON.stringify(data));
+ });
+ } catch (error) {
+ console.error(TAG_TEST_0400 + 'Operation failed. Cause: ' + JSON.stringify(error));
+ }
+ await Utils.sleep(2000)
+ expect(detailed).assertEqual(null);
+ done();
+ console.log('------------------ ' + TAG_TEST_0400 + ' end -------------------');
+ })
+
+
+ /*
+ * @tc.number: context_getAppMemorySize_test_0100
+ * @tc.name: getAppMemorySize : Obtains the memory size of the application.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0500, 0, async function (done) {
+ console.info(TAG_TEST_0500 + 'promise START');
+ let detailed;
+ var startTime = await Utils.getNowTime();
+ await abilityManager.getAppMemorySize()
+ .then((data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0500, startTime, endTime)
+ console.info(TAG_TEST_0500 + ' promise data is:' + JSON.stringify(data));
+ detailed = data;
+ }).catch((error) => {
+ console.error(TAG_TEST_0500 + 'promise errors is: ' + JSON.stringify(error));
+ })
+ await Utils.sleep(2000)
+ expect(typeof (detailed)).assertEqual("number");
+ expect(detailed).assertEqual(512);
+ done();
+ console.log('------------------ ' + TAG_TEST_0500 + ' end -------------------');
+ });
+
+ /*
+ * @tc.number: context_getAppMemorySize_test_0200
+ * @tc.name: getAppMemorySize : Obtains the memory size of the application.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0600, 0, async function (done) {
+ console.info(TAG_TEST_0600 + 'callBack START');
+ var startTime = await Utils.getNowTime();
+ abilityManager.getAppMemorySize((error, data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0500, startTime, endTime)
+ console.info(TAG_TEST_0600 + ' callBack error is: ' + JSON.stringify(error));
+ console.info(TAG_TEST_0600 + ' callBack data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("number");
+ expect(data).assertEqual(512);
+ console.log('------------------ ' + TAG_TEST_0600 + ' end -------------------');
+ done();
+ })
+ });
+
+ /*
+ * @tc.number: context_isRamConstrainedDevice_test_0100
+ * @tc.name: isRamConstrainedDevice : Obtains whether the current device has low ram.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0700, 0, async function (done) {
+ let detailed;
+ console.info(TAG_TEST_0700 + 'promise START');
+ var startTime = await Utils.getNowTime();
+ await abilityManager.isRamConstrainedDevice().then((data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0500, startTime, endTime)
+ console.info(TAG_TEST_0700 + ' promise data is:' + JSON.stringify(data));
+ detailed = data;
+ }).catch((error) => {
+ console.error(TAG_TEST_0700 + 'promise errors is: ' + JSON.stringify(error));
+ })
+ await Utils.sleep(1000)
+ expect(typeof (detailed)).assertEqual("boolean");
+ expect(detailed).assertEqual(false)
+ done();
+ console.log('------------------ ' + TAG_TEST_0700 + ' end -------------------');
+ });
+
+ /*
+ * @tc.number: context_isRamConstrainedDevice_test_0200
+ * @tc.name: isRamConstrainedDevice : Obtains whether the current device has low ram.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0800, 0, async function (done) {
+ console.info(TAG_TEST_0800 + 'callBack START');
+ var startTime = await Utils.getNowTime();
+ abilityManager.isRamConstrainedDevice((error, data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0500, startTime, endTime)
+ console.info(TAG_TEST_0800 + ' callBack error is:' + error);
+ console.info(TAG_TEST_0800 + ' callBack data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("boolean");
+ expect(data).assertEqual(false);
+ done();
+ })
+ console.log('------------------ ' + TAG_TEST_0800 + ' end -------------------');
+ });
+ /*
+ * @tc.number: context_featureAbility_test_0100
+ * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode
+ * @tc.desc: Check the featureAbility.ErrorCode.NO_ERROR
+ * @tc.level 0
+ */
+ it(TAG_TEST_0900, 0, async function (done) {
+ console.info(TAG_TEST_0900 + ' NO_ERROR START');
+ var no_error = ability_featureAbility.ErrorCode.NO_ERROR
+ console.info(TAG_TEST_0900 + ' featureAbility no_error is: ' + no_error);
+ expect(typeof (no_error)).assertEqual("number");
+ expect(no_error).assertEqual(0);
+ done();
+ console.log('------------------ ' + TAG_TEST_0900 + ' end -------------------');
+ });
+
+ /*
+ * @tc.number: context_featureAbility_test_0200
+ * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode
+ * @tc.desc: Check the featureAbility.ErrorCode.INVALID_PARAMETER
+ * @tc.level 0
+ */
+ it(TAG_TEST_0010, 0, async function (done) {
+ console.info(TAG_TEST_0010 + ' INVALID_PARAMETER START');
+ var invalid_parameter = ability_featureAbility.ErrorCode.INVALID_PARAMETER
+ console.info(TAG_TEST_0010 + ' featureAbility invalid_parameter is: ' + invalid_parameter);
+ expect(typeof (invalid_parameter)).assertEqual("number");
+ expect(invalid_parameter).assertEqual(-1);
+ done();
+ console.log('------------------ ' + TAG_TEST_0010 + ' end -------------------');
+ });
+
+ /*
+ * @tc.number: context_featureAbility_test_0300
+ * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode
+ * @tc.desc: Check the featureAbility.ErrorCode.ABILITY_NOT_FOUND
+ * @tc.level 0
+ */
+ it(TAG_TEST_0011, 0, async function (done) {
+ console.info(TAG_TEST_0011 + ' ABILITY_NOT_FOUND START');
+ var ability_not_found = ability_featureAbility.ErrorCode.ABILITY_NOT_FOUND
+ console.info(TAG_TEST_0011 + ' featureAbility ability_not_found is: ' + ability_not_found);
+ expect(typeof (ability_not_found)).assertEqual("number");
+ expect(ability_not_found).assertEqual(-2);
+ done();
+ console.log('------------------ ' + TAG_TEST_0011 + ' end -------------------');
+ });
+
+ /*
+ * @tc.number: context_featureAbility_test_0400
+ * @tc.name: featureAbility.ErrorCode : featureAbility.ErrorCode
+ * @tc.desc: Check the featureAbility.ErrorCode.PERMISSION_DENY
+ * @tc.level 0
+ */
+ it(TAG_TEST_0012, 0, async function (done) {
+ console.info(TAG_TEST_0012 + ' PERMISSION_DENY START');
+ var permission_deny = ability_featureAbility.ErrorCode.PERMISSION_DENY
+ console.info(TAG_TEST_0012 + ' featureAbility permission_deny is: ' + permission_deny);
+ expect(typeof (permission_deny)).assertEqual("number");
+ expect(permission_deny).assertEqual(-3);
+ done();
+ console.log('------------------ ' + TAG_TEST_0012 + ' end -------------------');
+ });
+ })
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAbilityInfoJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAbilityInfoJsunit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..447fc3ba91a560f2422bc4eba3d83b82063c4cf8
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAbilityInfoJsunit.test.ets
@@ -0,0 +1,333 @@
+/**
+ * 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 {describe, it, expect} from "deccjsunit/index.ets";
+import Utils from './Utils';
+import ability_featureAbility from '@ohos.ability.featureAbility';
+
+export default function getHapModuleInfoJsunit() {
+ describe('appInfoTest', function () {
+
+ /**
+ * @tc.number: context_getAbilityInfo_test_0100
+ * @tc.name: getAbilityInfo:Query the current attributionability details.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_getAbilityInfo_test_0100', 0, async function (done) {
+ console.info('[context_getAbilityInfo_test_0100] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ await context.getAbilityInfo()
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getAbilityInfo_test_0100', timeOldStamp, timeNewStamp);
+ console.info('[context_getAbilityInfo_test_0100] data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ }).catch((error) => {
+ console.error('[context_getAbilityInfo_test_0100] failed:' + JSON.stringify(error));
+ })
+ var promise = await context.getAbilityInfo();
+ console.info('--[context_getAbilityInfo_test_0100] check---');
+ checkAbilityInfo('context_getAbilityInfo_test_0100', promise);
+ console.info('[context_getAbilityInfo_test_0100] FINISH');
+ done();
+ });
+
+ async function startAbility2() {
+ var str = {
+ "want": {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.ohos.acecollaboration.MainAbility2",
+ },
+ };
+ ability_featureAbility.startAbility(str).then((data) => {
+ console.info('context_getAbilityInfo_test_0300 startMainAbility2 succeeded: ' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('context_getAbilityInfo_test_0300 startMainAbility2 failed. Cause: ' + JSON.stringify(error));
+ });
+ }
+
+ /**
+ * @tc.number: context_getAbilityInfo_test_0200
+ * @tc.name: getAbilityInfo:Query the current attributionability details.
+ * @tc.desc: Check the return value of the interface (by AsyncCallback)
+ * @tc.level 0
+ */
+ it('context_getAbilityInfo_test_0200', 0, async function (done) {
+ try {
+ console.info('[context_getAbilityInfo_test_0200] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ context.getAbilityInfo((error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getAbilityInfo_test_0200', timeOldStamp, timeNewStamp);
+ console.info('[context_getAbilityInfo_test_0200] data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ });
+ } catch (error) {
+ console.error('[context_getAbilityInfo_test_0200] failed: ' + JSON.stringify(error));
+ }
+ var callback = await context.getAbilityInfo();
+ console.info('---[context_getAbilityInfo_test_0200] check---');
+ checkAbilityInfo('context_getAbilityInfo_test_0200', callback);
+ console.info('[context_getAbilityInfo_test_0200] FINISH');
+ done();
+ })
+
+
+ /**
+ * @tc.number: context_getAbilityInfo_test_0300_1
+ * @tc.name: getAbilityInfo:Query the current attributionability details.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it('context_getAbilityInfo_test_0300_1', 0, async function (done) {
+ console.info('[context_getAbilityInfo_test_0300] STARTability');
+ startAbility2();
+ done();
+ });
+
+ /**
+ * @tc.number: context_getAbilityInfo_test_0400
+ * @tc.name: getAbilityInfo:Query the current attributionability details.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_getAbilityInfo_test_0400', 0, async function (done) {
+ console.info('[context_getAbilityInfo_test_0400] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ await context.getAbilityInfo()
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getAbilityInfo_test_0400', timeOldStamp, timeNewStamp);
+ console.info('[context_getAbilityInfo_test_0400] data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ }).catch((error) => {
+ console.error('[context_getAbilityInfo_test_0400] failed:' + JSON.stringify(error));
+ })
+ var promise = await context.getAbilityInfo();
+ console.info('--[context_getAbilityInfo_test_0400] check---');
+ checkAbilityInfo('context_getAbilityInfo_test_0400', promise);
+ console.info('[context_getAbilityInfo_test_0400] FINISH');
+ done();
+ });
+
+ function checkAbilityInfo(msg, data) {
+ console.log(msg + "checkAbilityInfo start " + JSON.stringify(data));
+ console.log(msg + "checkAbilityInfo bundleName : " + data.bundleName);
+ console.log(msg + "checkAbilityInfo name : " + data.name);
+ console.log(msg + "checkAbilityInfo label : " + data.label);
+ console.log(msg + "checkAbilityInfo description : " + data.description);
+ console.log(msg + "checkAbilityInfo icon : " + data.icon);
+ console.log(msg + "checkAbilityInfo descriptionId : " + data.descriptionId);
+ console.log(msg + "checkAbilityInfo iconId : " + data.iconId);
+ console.log(msg + "checkAbilityInfo moduleName : " + data.moduleName);
+ console.log(msg + "checkAbilityInfo process : " + data.process);
+ console.log(msg + "checkAbilityInfo targetAbility : " + data.targetAbility);
+ console.log(msg + "checkAbilityInfo backgroundModes : " + data.backgroundModes);
+ console.log(msg + "checkAbilityInfo isVisible : " + data.isVisible);
+ console.log(msg + "checkAbilityInfo formEnabled : " + data.formEnabled);
+ console.log(msg + "checkAbilityInfo type : " + data.type)
+ console.log(msg + "checkAbilityInfo orientation : " + data.orientation);
+ console.log(msg + "checkAbilityInfo launchMode : " + data.launchMode);
+ console.log(msg + "checkAbilityInfo permissions length : " + data.permissions.length);
+ for (var j = 0; j < data.permissions.length; j++) {
+ console.log(msg + "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]);
+ }
+ console.log(msg + "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length);
+ for (var k = 0; k < data.deviceTypes.length; k++) {
+ console.log(msg + "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
+ }
+ console.log(msg + "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length);
+ for (var i = 0; i < data.deviceCapabilities.length; i++) {
+ console.log(msg + "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]);
+ }
+ console.log(msg + "checkAbilityInfo readPermission : " + data.readPermission);
+ console.log(msg + "checkAbilityInfo writePermission : " + data.writePermission);
+ console.log(msg + "checkAbilityInfo formEntity : " + data.formEntity);
+ console.log(msg + "checkAbilityInfo minFormHeight : " + data.minFormHeight);
+ console.log(msg + "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight);
+ console.log(msg + "checkAbilityInfo minFormWidth : " + data.minFormWidth);
+ console.log(msg + "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
+ console.log(msg + "checkAbilityInfo uri : " + data.uri);
+ console.log(msg + "checkAbilityInfo customizeData : " + data.customizeData);
+ console.log(msg + "checkAbilityInfo labelId : " + data.labelId);
+ console.log(msg + "checkAbilityInfo subType : " + data.subType);
+
+ expect(typeof (data)).assertEqual("object");
+ expect(typeof (data.bundleName)).assertEqual("string");
+ expect(typeof (data.name)).assertEqual("string");
+ expect(typeof (data.label)).assertEqual("string");
+ expect(typeof (data.description)).assertEqual("string");
+ expect(typeof (data.icon)).assertEqual("string");
+ expect(typeof (data.labelId)).assertEqual("number");
+ expect(typeof (data.descriptionId)).assertEqual("number");
+ expect(typeof (data.iconId)).assertEqual("number");
+ expect(typeof (data.moduleName)).assertEqual("string");
+ expect(typeof (data.process)).assertEqual("string");
+ expect(typeof (data.targetAbility)).assertEqual("string");
+ expect(typeof (data.backgroundModes)).assertEqual("number");
+ expect(typeof (data.isVisible)).assertEqual("boolean");
+ expect(typeof (data.formEnabled)).assertEqual("boolean");
+ expect(typeof (data.type)).assertEqual("number");
+ expect(typeof (data.subType)).assertEqual("number");
+ expect(typeof (data.orientation)).assertEqual("number");
+ expect(typeof (data.launchMode)).assertEqual("number");
+ expect(Array.isArray(data.permissions)).assertEqual(true);
+ expect(Array.isArray(data.deviceTypes)).assertEqual(true);
+ expect(Array.isArray(data.deviceCapabilities)).assertEqual(true);
+ expect(typeof (data.readPermission)).assertEqual("string");
+ expect(typeof (data.writePermission)).assertEqual("string");
+ expect(typeof (data.applicationInfo)).assertEqual("object");
+ expect(typeof (data.formEntity)).assertEqual("number");
+ expect(typeof (data.minFormHeight)).assertEqual("number");
+ expect(typeof (data.defaultFormHeight)).assertEqual("number");
+ expect(typeof (data.minFormWidth)).assertEqual("number");
+ expect(typeof (data.defaultFormWidth)).assertEqual("number");
+ expect(typeof (data.uri)).assertEqual("string");
+
+ expect(data.bundleName).assertEqual("com.ohos.acecollaboration");
+ expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility");
+ expect(data.label).assertEqual("$string:entry_MainAbility");
+ expect(data.description).assertEqual("$string:mainability_description");
+ expect(data.icon).assertEqual("$media:icon");
+ expect(data.descriptionId > 0).assertTrue();
+ expect(data.iconId > 0).assertTrue();
+ expect(data.moduleName).assertEqual("entry");
+ expect(data.process).assertEqual("");
+ expect(data.targetAbility).assertEqual("");
+ expect(data.backgroundModes).assertEqual(0);
+ expect(data.isVisible).assertEqual(true);
+ expect(data.formEnabled).assertEqual(false);
+ expect(data.type).assertEqual(1);
+ expect(data.orientation).assertEqual(0);
+ expect(data.launchMode).assertEqual(1);
+ expect(data.deviceTypes[0]).assertEqual("phone");
+ expect(data.readPermission).assertEqual("");
+ expect(data.writePermission).assertEqual("");
+ checkApplicationInfo(msg, data.applicationInfo);
+ expect(data.formEntity).assertEqual(0);
+ expect(data.minFormHeight).assertEqual(0);
+ expect(data.defaultFormHeight).assertEqual(0);
+ expect(data.minFormWidth).assertEqual(0);
+ expect(data.defaultFormWidth).assertEqual(0);
+ expect(data.uri).assertEqual("");
+ expect(data.labelId > 0).assertTrue();
+ expect(data.subType).assertEqual(0);
+
+ console.log(msg + "---checkAbilityInfo End--- ");
+ }
+
+ function checkApplicationInfo(msg, info) {
+ console.log(msg + "checkApplicationInfo start : " + JSON.stringify(info));
+ console.log(msg + "checkApplicationInfo name : " + info.name);
+ console.log(msg + "checkApplicationInfo description : " + info.description);
+ console.log(msg + "checkApplicationInfo descriptionId : " + info.descriptionId);
+ console.log(msg + "checkApplicationInfo systemApp : " + info.systemApp);
+ console.log(msg + "checkApplicationInfo enabled : " + info.enabled);
+ console.log(msg + "checkApplicationInfo label : " + info.label);
+ console.log(msg + "checkApplicationInfo labelId : " + info.labelId);
+ console.log(msg + "checkApplicationInfo icon : " + info.icon);
+ console.log(msg + "checkApplicationInfo iconId : " + info.iconId);
+ console.log(msg + "checkApplicationInfo process : " + info.process);
+ console.log(msg + "checkApplicationInfo supportedModes : " + info.supportedModes);
+
+ console.log(msg + "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
+ for (var j = 0; j < info.moduleSourceDirs.length; j++) {
+ console.log(msg + "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
+ }
+ console.log(msg + "checkApplicationInfo permissions length : " + info.permissions.length);
+ for (var k = 0; k < info.permissions.length; k++) {
+ console.log(msg + "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]);
+ }
+ console.log(msg + "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
+ for (var i = 0; i < info.moduleInfos.length; i++) {
+ console.log(msg + "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : "
+ + info.moduleInfos[i].moduleName);
+ console.log(msg + "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : "
+ + info.moduleInfos[i].moduleSourceDir);
+ }
+ console.log(msg + "checkApplicationInfo entryDir : " + info.entryDir);
+
+ expect(typeof (info)).assertEqual("object");
+ expect(typeof (info.name)).assertEqual("string");
+ expect(typeof (info.description)).assertEqual("string");
+ expect(typeof (info.descriptionId)).assertEqual("number");
+ expect(typeof (info.systemApp)).assertEqual("boolean");
+ expect(typeof (info.enabled)).assertEqual("boolean");
+ expect(typeof (info.label)).assertEqual("string");
+ expect(typeof (info.labelId)).assertEqual("string");
+ expect(typeof (info.icon)).assertEqual("string");
+ expect(typeof (info.iconId)).assertEqual("string");
+ expect(typeof (info.process)).assertEqual("string");
+ expect(typeof (info.supportedModes)).assertEqual("number");
+ expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
+ expect(Array.isArray(info.permissions)).assertEqual(true);
+ expect(Array.isArray(info.moduleInfos)).assertEqual(true);
+ expect(typeof (info.entryDir)).assertEqual("string");
+
+ expect(info.name).assertEqual("com.ohos.acecollaboration");
+ expect(info.description).assertEqual("$string:mainability_description");
+ expect(info.descriptionId > 0).assertTrue();
+ expect(info.systemApp).assertEqual(true);
+ expect(info.enabled).assertEqual(true);
+ expect(info.label).assertEqual("$string:entry_MainAbility");
+ expect(info.icon).assertEqual("$media:icon");
+ expect(info.process).assertEqual("");
+ expect(info.supportedModes).assertEqual(0);
+ expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ if (info.moduleSourceDirs.length == 1){
+ expect(info.moduleInfos[0].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }else if(info.moduleSourceDirs.length == 2) {
+ if (info.moduleInfos[0].moduleName == "myapplication1") {
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication1");
+ expect(info.moduleInfos[1].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }else{
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication2");
+ expect(info.moduleInfos[1].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }
+ }else {
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication1");
+ expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication2");
+ expect(info.moduleInfos[2].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }
+
+ console.log(msg + "---checkApplicationInfo End--- ");
+
+ }
+
+ })
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAppVersionInfoJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAppVersionInfoJsunit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..852ff5ee53828ce888492e87bfee2a8a8fc9f057
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getAppVersionInfoJsunit.test.ets
@@ -0,0 +1,92 @@
+/**
+ * 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 {describe, it, expect} from "deccjsunit/index.ets";
+import Utils from './Utils';
+import ability_featureAbility from '@ohos.ability.featureAbility';
+
+export default function getHapModuleInfoJsunit() {
+ describe('appInfoTest', function () {
+ /**
+ * @tc.number: context_getAppVersionInfo_test_0100
+ * @tc.name: getAppVersionInfo:Gets the version information for the application.
+ * @tc.desc: Check the return type of the interface (by Promise)
+ * @tc.level 0
+ */
+ it('context_getAppVersionInfo_test_0100', 0, async function (done) {
+ console.info('[context_getAppVersionInfo_test_0100] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ context.getAppVersionInfo()
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getAppVersionInfo_test_0100', timeOldStamp, timeNewStamp);
+ console.info('[context_getAppVersionInfo_test_0100] data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ }).catch((error) => {
+ console.error('[context_getAppVersionInfo_test_0100] failed:' + JSON.stringify(error));
+ })
+ var promise = await context.getAppVersionInfo();
+ console.info('---[context_getAppVersionInfo_test_0100] check---');
+ checkAppVersionInfo('context_getAppVersionInfo_test_0100', promise);
+ console.info('[context_getAppVersionInfo_test_0100] FINISH');
+ done();
+ });
+
+ /**
+ * @tc.number: context_getAppVersionInfo_test_0200
+ * @tc.name: getAppVersionInfo:Gets the version information for the application.
+ * @tc.desc: Check the return type of the interface (by Callback)
+ * @tc.level 0
+ */
+ it('context_getAppVersionInfo_test_0200', 0, async function (done) {
+ try {
+ console.info('[context_getAppVersionInfo_test_0200] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ context.getAppVersionInfo((error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getAppVersionInfo_test_0200', timeOldStamp, timeNewStamp);
+ console.info('[context_getAppVersionInfo_test_0200] data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ });
+ }
+ catch (error) {
+ console.error('[context_getAppVersionInfo_test_0200] failed: ' + JSON.stringify(error));
+ }
+ var callback = await context.getAppVersionInfo();
+ console.info('---[context_getAppVersionInfo_test_0200] check---');
+ checkAppVersionInfo('context_getAppVersionInfo_test_0200', callback);
+ console.info('[context_getAppVersionInfo_test_0200] FINISH');
+ done();
+ });
+
+ function checkAppVersionInfo(msg, data) {
+ console.log(msg + "checkAppVersionInfo start : " + JSON.stringify(data));
+ console.log(msg + "checkAppVersionInfo appName : " + data.appName);
+ console.log(msg + "checkAppVersionInfo versionCode : " + data.versionCode);
+ console.log(msg + "checkAppVersionInfo versionName : " + data.versionName);
+ expect(typeof (data)).assertEqual("object");
+ expect(typeof (data.appName)).assertEqual("string");
+ expect(typeof (data.versionCode)).assertEqual("number");
+ expect(typeof (data.versionName)).assertEqual("string");
+ expect(data.appName).assertEqual("");
+ expect(data.versionCode).assertEqual(1000000);
+ expect(data.versionName).assertEqual("1.0.0");
+ console.log(msg + "---checkAppVersionInfo End--- ");
+ }
+ })
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getApplicationContextJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getApplicationContextJsunit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c342915a809774aaeaa389eb9571582ef5ae3996
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getApplicationContextJsunit.test.ets
@@ -0,0 +1,46 @@
+/**
+ * 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 {describe, it, expect} from "deccjsunit/index.ets";
+import Utils from './Utils';
+import ability_featureAbility from '@ohos.ability.featureAbility';
+
+export default function getHapModuleInfoJsunit() {
+ describe('appInfoTest', function () {
+ /**
+ * @tc.number: context_getApplicationContext_test_0100
+ * @tc.name: getApplicationContext:Gets the application context information.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it('context_getApplicationContext_test_0100', 0, async function (done) {
+ try {
+ console.info('[context_getApplicationContext_test_0100] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext().getApplicationContext();
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getApplicationContext_test_0100', timeOldStamp, timeNewStamp);
+ console.info('[context_getApplicationContext_test_0100] data is:' + JSON.stringify(context));
+ }
+ catch (error) {
+ console.error('[context_getApplicationContext_test_0100] failed:' + JSON.stringify(error));
+ }
+ expect(typeof (context)).assertEqual("object");
+ console.info('[context_getApplicationContext_test_0100] FINISH');
+ done();
+ });
+
+ })
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7d99f6be366de1d94e506061ae4af379bccd8c37
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility/test/getHapModuleInfoJsunit.test.ets
@@ -0,0 +1,352 @@
+/**
+ * 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 {describe, it, expect} from "deccjsunit/index.ets";
+import Utils from './Utils';
+import ability_featureAbility from '@ohos.ability.featureAbility';
+
+export default function getHapModuleInfoJsunit() {
+ describe('appInfoTest', function () {
+ /**
+ * @tc.number: context_getHapModuleInfo_test_0100
+ * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application.
+ * @tc.desc: Check the return type of the interface (by Promise)
+ * @tc.level 0
+ */
+ it('context_getHapModuleInfo_test_0100', 0, async function (done) {
+ console.info('[context_getHapModuleInfo_test_0100] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ context.getHapModuleInfo()
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getHapModuleInfo_test_0100', timeOldStamp, timeNewStamp);
+ console.info('[context_getHapModuleInfo_test_0100] data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ })
+ .catch((error) => {
+ console.error('[context_getHapModuleInfo_test_0100] failed:' + JSON.stringify(error));
+ })
+ var promise = await context.getHapModuleInfo();
+ console.info('---[context_getHapModuleInfo_test_0100] check---');
+ checkHapModuleInfo('context_getHapModuleInfo_test_0100', promise);
+ console.info('[context_getHapModuleInfo_test_0100] FINISH');
+ done();
+ });
+
+ /**
+ * @tc.number: context_getHapModuleInfo_test_0200
+ * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application.
+ * @tc.desc: Check the return type of the interface (by Callback)
+ * @tc.level 0
+ */
+ it('context_getHapModuleInfo_test_0200', 0, async function (done) {
+ let callback;
+ try {
+ console.info('[context_getHapModuleInfo_test_0200] START');
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ context.getHapModuleInfo((error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getHapModuleInfo_test_0200', timeOldStamp, timeNewStamp);
+ console.info('[context_getHapModuleInfo_test_0200] data is:' + JSON.stringify(data));
+ callback = data;
+ expect(typeof (data)).assertEqual("object");
+ });
+ } catch (error) {
+ console.error('[context_getHapModuleInfo_test_0200] failed: ' + JSON.stringify(error));
+ }
+ await Utils.sleep(1000);
+ console.info('---[context_getHapModuleInfo_test_0200] check---');
+ checkHapModuleInfo('context_getHapModuleInfo_test_0200', callback);
+ console.info('[context_getHapModuleInfo_test_0200] FINISH');
+ done();
+ });
+
+ /**
+ * @tc.number: context_getHapModuleInfo_test_0300_1
+ * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application.
+ * @tc.desc: Check the return value of the interface
+ * @tc.level 0
+ */
+ it('context_getHapModuleInfo_test_0300_1', 0, async function (done) {
+ console.info('[context_getHapModuleInfo_test_0300_1] START');
+ var str = {
+ "want": {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.example.myapplication1.MainAbility",
+ },
+ };
+ ability_featureAbility.startAbility(str)
+ .then((data) => {
+ console.info('[context_getHapModuleInfo_test_0300_1] start myapplication1 successful: ' + JSON.stringify(data))
+ }).catch((error) => {
+ console.error('[context_getHapModuleInfo_test_0300_1] start myapplication1 Cause: ' + JSON.stringify(error));
+ })
+ done();
+ });
+
+ function checkHapModuleInfo(msg, data) {
+ console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data));
+ console.log(msg + "checkHapModuleInfo name : " + data.name);
+ console.log(msg + "checkHapModuleInfo description : " + data.description);
+ console.log(msg + "checkHapModuleInfo descriptionId : " + data.descriptionId);
+ console.log(msg + "checkHapModuleInfo icon : " + data.icon);
+ console.log(msg + "checkHapModuleInfo label : " + data.label);
+ console.log(msg + "checkHapModuleInfo labelId : " + data.labelId);
+ console.log(msg + "checkHapModuleInfo iconId : " + data.iconId);
+ console.log(msg + "checkHapModuleInfo backgroundImg : " + data.backgroundImg);
+ console.log(msg + "checkHapModuleInfo supportedModes : " + data.supportedModes);
+ console.log(msg + "checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length);
+ for (var j = 0; j < data.reqCapabilities.length; j++) {
+ console.log(msg + "getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]);
+ }
+ console.log(msg + "checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length);
+ for (var k = 0; k < data.deviceTypes.length; k++) {
+ console.log(msg + "getHapModuleInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
+ }
+ console.log(msg + "checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length);
+ console.log(msg + "checkHapModuleInfo moduleName : " + data.moduleName);
+ console.log(msg + "checkHapModuleInfo mainAbilityName : " + data.mainAbilityName);
+ console.log(msg + "checkHapModuleInfo installationFree : " + data.installationFree);
+ expect(typeof (data)).assertEqual("object");
+ expect(typeof (data.name)).assertEqual("string");
+ expect(typeof (data.description)).assertEqual("string");
+ expect(typeof (data.descriptionId)).assertEqual("number");
+ expect(typeof (data.icon)).assertEqual("string");
+ expect(typeof (data.label)).assertEqual("string");
+ expect(typeof (data.labelId)).assertEqual("number");
+ expect(typeof (data.iconId)).assertEqual("number");
+ expect(typeof (data.backgroundImg)).assertEqual("string");
+ expect(typeof (data.supportedModes)).assertEqual("number");
+ expect(Array.isArray(data.reqCapabilities)).assertEqual(true);
+ expect(Array.isArray(data.deviceTypes)).assertEqual(true);
+ expect(Array.isArray(data.abilityInfos)).assertEqual(true);
+ expect(typeof (data.moduleName)).assertEqual("string");
+ expect(typeof (data.mainAbilityName)).assertEqual("string");
+ expect(typeof (data.installationFree)).assertEqual("boolean");
+ expect(data.name).assertEqual("com.ohos.acecollaboration");
+ expect(data.description).assertEqual("");
+ expect(data.descriptionId).assertEqual(0);
+ expect(data.icon).assertEqual("$media:icon");
+ expect(data.label).assertEqual("$string:entry_MainAbility");
+ expect(data.labelId).assertEqual(0);
+ expect(data.iconId).assertEqual(0);
+ expect(data.backgroundImg).assertEqual("");
+ expect(data.supportedModes).assertEqual(0);
+ expect(data.deviceTypes[0]).assertEqual("phone");
+ for (var i = 0; i < data.abilityInfos.length; i++) {
+ console.log(msg + "-------AbilityInfo data.abilityInfos[" + i + "] : START ------" );
+ checkAbilityInfo(msg,data.abilityInfos[i]);
+ }
+ expect(data.moduleName).assertEqual("entry")
+ expect(data.mainAbilityName).assertEqual("");
+ expect(data.installationFree).assertEqual(false);
+ console.log(msg + "---checkHapModuleInfo End---");
+ }
+
+ function checkAbilityInfo(msg,data) {
+ console.log(msg+ "checkAbilityInfo start " + JSON.stringify(data));
+ console.log(msg+ "checkAbilityInfo bundleName : " + data.bundleName);
+ console.log(msg+ "checkAbilityInfo name : " + data.name);
+ console.log(msg+ "checkAbilityInfo label : " + data.label);
+ console.log(msg+ "checkAbilityInfo description : " + data.description);
+ console.log(msg+ "checkAbilityInfo icon : " + data.icon);
+ console.log(msg+ "checkAbilityInfo descriptionId : " + data.descriptionId);
+ console.log(msg+ "checkAbilityInfo iconId : " + data.iconId);
+ console.log(msg+ "checkAbilityInfo moduleName : " + data.moduleName);
+ console.log(msg+ "checkAbilityInfo process : " + data.process);
+ console.log(msg+ "checkAbilityInfo targetAbility : " + data.targetAbility);
+ console.log(msg+ "checkAbilityInfo backgroundModes : " + data.backgroundModes);
+ console.log(msg+ "checkAbilityInfo isVisible : " + data.isVisible);
+ console.log(msg+ "checkAbilityInfo formEnabled : " + data.formEnabled);
+ console.log(msg+ "checkAbilityInfo type : " + data.type)
+ console.log(msg+ "checkAbilityInfo orientation : " + data.orientation);
+ console.log(msg+ "checkAbilityInfo launchMode : " + data.launchMode);
+ console.log(msg+ "checkAbilityInfo permissions length : " + data.permissions.length);
+ for (var j = 0; j < data.permissions.length; j++) {
+ console.log(msg+ "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]);
+ }
+ console.log(msg+ "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length);
+ for (var k = 0; k < data.deviceTypes.length; k++) {
+ console.log(msg+ "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
+ }
+ console.log(msg+ "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length);
+ for (var i = 0; i < data.deviceCapabilities.length; i++) {
+ console.log(msg+ "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]);
+ }
+ console.log(msg+ "checkAbilityInfo readPermission : " + data.readPermission);
+ console.log(msg+ "checkAbilityInfo writePermission : " + data.writePermission);
+ console.log(msg+ "checkAbilityInfo formEntity : " + data.formEntity);
+ console.log(msg+ "checkAbilityInfo minFormHeight : " + data.minFormHeight);
+ console.log(msg+ "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight);
+ console.log(msg+ "checkAbilityInfo minFormWidth : " + data.minFormWidth);
+ console.log(msg+ "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
+ console.log(msg+ "checkAbilityInfo uri : " + data.uri);
+ console.log(msg+ "checkAbilityInfo labelId : " + data.labelId);
+ console.log(msg+ "checkAbilityInfo subType : " + data.subType);
+ expect(typeof (data)).assertEqual("object");
+ expect(typeof (data.bundleName)).assertEqual("string");
+ expect(typeof (data.name)).assertEqual("string");
+ expect(typeof (data.label)).assertEqual("string");
+ expect(typeof (data.description)).assertEqual("string");
+ expect(typeof (data.icon)).assertEqual("string");
+ expect(typeof (data.labelId)).assertEqual("number");
+ expect(typeof (data.descriptionId)).assertEqual("number");
+ expect(typeof (data.iconId)).assertEqual("number");
+ expect(typeof (data.moduleName)).assertEqual("string");
+ expect(typeof (data.process)).assertEqual("string");
+ expect(typeof (data.targetAbility)).assertEqual("string");
+ expect(typeof (data.backgroundModes)).assertEqual("number");
+ expect(typeof (data.isVisible)).assertEqual("boolean");
+ expect(typeof (data.formEnabled)).assertEqual("boolean");
+ expect(typeof (data.type)).assertEqual("number");
+ expect(typeof (data.subType)).assertEqual("number");
+ expect(typeof (data.orientation)).assertEqual("number");
+ expect(typeof (data.launchMode)).assertEqual("number");
+ expect(Array.isArray(data.permissions)).assertEqual(true);
+ expect(Array.isArray(data.deviceTypes)).assertEqual(true);
+ expect(Array.isArray(data.deviceCapabilities)).assertEqual(true);
+ expect(typeof (data.readPermission)).assertEqual("string");
+ expect(typeof (data.writePermission)).assertEqual("string");
+ expect(typeof (data.applicationInfo)).assertEqual("object");
+ expect(typeof (data.formEntity)).assertEqual("number");
+ expect(typeof (data.minFormHeight)).assertEqual("number");
+ expect(typeof (data.defaultFormHeight)).assertEqual("number");
+ expect(typeof (data.minFormWidth)).assertEqual("number");
+ expect(typeof (data.defaultFormWidth)).assertEqual("number");
+ expect(typeof (data.uri)).assertEqual("string");
+ expect(data.bundleName).assertEqual("com.ohos.acecollaboration");
+ expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility");
+ expect(data.label).assertEqual("$string:entry_MainAbility");
+ expect(data.description).assertEqual("$string:mainability_description");
+ expect(data.icon).assertEqual("$media:icon");
+ expect(data.descriptionId > 0).assertTrue();
+ expect(data.iconId > 0).assertTrue();
+ expect(data.moduleName).assertEqual("entry");
+ expect(data.process).assertEqual("");
+ expect(data.targetAbility).assertEqual("");
+ expect(data.backgroundModes).assertEqual(0);
+ expect(data.isVisible).assertEqual(true);
+ expect(data.formEnabled).assertEqual(false);
+ expect(data.type).assertEqual(1);
+ expect(data.orientation).assertEqual(0);
+ expect(data.launchMode).assertEqual(1);
+ expect(data.deviceTypes[0]).assertEqual("phone");
+ expect(data.readPermission).assertEqual("");
+ expect(data.writePermission).assertEqual("");
+ checkApplicationInfo(msg,data.applicationInfo);
+ expect(data.formEntity).assertEqual(0);
+ expect(data.minFormHeight).assertEqual(0);
+ expect(data.defaultFormHeight).assertEqual(0);
+ expect(data.minFormWidth).assertEqual(0);
+ expect(data.defaultFormWidth).assertEqual(0);
+ expect(data.uri).assertEqual("");
+ expect(data.labelId > 0).assertTrue();
+ expect(data.subType).assertEqual(0);
+ console.log(msg+ "---checkAbilityInfo End--- ");
+ }
+
+ function checkApplicationInfo(msg,info) {
+ console.log(msg+ "checkApplicationInfo start : " + JSON.stringify(info));
+ console.log(msg+ "checkApplicationInfo name : " + info.name);
+ console.log(msg+ "checkApplicationInfo description : " + info.description);
+ console.log(msg+ "checkApplicationInfo descriptionId : " + info.descriptionId);
+ console.log(msg+ "checkApplicationInfo systemApp : " + info.systemApp);
+ console.log(msg+ "checkApplicationInfo enabled : " + info.enabled);
+ console.log(msg+ "checkApplicationInfo label : " + info.label);
+ console.log(msg+ "checkApplicationInfo labelId : " + info.labelId);
+ console.log(msg+ "checkApplicationInfo icon : " + info.icon);
+ console.log(msg+ "checkApplicationInfo iconId : " + info.iconId);
+ console.log(msg+ "checkApplicationInfo process : " + info.process);
+ console.log(msg+ "checkApplicationInfo supportedModes : " + info.supportedModes);
+ console.log(msg+ "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
+ for (var j = 0; j < info.moduleSourceDirs.length; j++) {
+ console.log(msg+ "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
+ }
+ console.log(msg+ "checkApplicationInfo permissions length : " + info.permissions.length);
+ for (var k = 0; k < info.permissions.length; k++) {
+ console.log(msg+ "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]);
+ }
+ console.log(msg+ "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
+ for (var i = 0; i < info.moduleInfos.length; i++) {
+ console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " +
+ info.moduleInfos[i].moduleName);
+ console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " +
+ info.moduleInfos[i].moduleSourceDir);
+ }
+ console.log(msg+ "checkApplicationInfo entryDir : " + info.entryDir);
+ expect(typeof (info)).assertEqual("object");
+ expect(typeof (info.name)).assertEqual("string");
+ expect(typeof (info.description)).assertEqual("string");
+ expect(typeof (info.descriptionId)).assertEqual("number");
+ expect(typeof (info.systemApp)).assertEqual("boolean");
+ expect(typeof (info.enabled)).assertEqual("boolean");
+ expect(typeof (info.label)).assertEqual("string");
+ expect(typeof (info.labelId)).assertEqual("string");
+ expect(typeof (info.icon)).assertEqual("string");
+ expect(typeof (info.iconId)).assertEqual("string");
+ expect(typeof (info.process)).assertEqual("string");
+ expect(typeof (info.supportedModes)).assertEqual("number");
+ expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
+ expect(Array.isArray(info.permissions)).assertEqual(true);
+ expect(Array.isArray(info.moduleInfos)).assertEqual(true);
+ expect(typeof (info.entryDir)).assertEqual("string");
+ if (info.moduleSourceDirs.length == 1){
+ expect(info.moduleInfos[0].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }else if(info.moduleSourceDirs.length == 2) {
+ if (info.moduleInfos[0].moduleName == "myapplication1") {
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication1");
+ expect(info.moduleInfos[1].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }else{
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication2");
+ expect(info.moduleInfos[1].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }
+ }else {
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication1");
+ expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication2");
+ expect(info.moduleInfos[2].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }
+ expect(info.name).assertEqual("com.ohos.acecollaboration");
+ expect(info.description).assertEqual("$string:mainability_description");
+ expect(info.descriptionId > 0).assertTrue();
+ expect(info.systemApp).assertEqual(true);
+ expect(info.enabled).assertEqual(true);
+ expect(info.label).assertEqual("$string:entry_MainAbility");
+ expect(info.icon).assertEqual("$media:icon");
+ expect(info.process).assertEqual("");
+ expect(info.supportedModes).assertEqual(0);
+ expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ console.log(msg+ "---checkApplicationInfo End--- ");
+ }
+ })
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/app.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/app.ets
new file mode 100644
index 0000000000000000000000000000000000000000..fc86a0485f5fa3d43dc0d7a7d858e3f41ed87304
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/app.ets
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ onCreate() {
+ console.info('Application onCreate')
+ },
+ onDestroy() {
+ console.info('Application onDestroy')
+ },
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/pages/index.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/pages/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e90a861b06feb9417415562b2421a432ac6d461d
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/pages/index.ets
@@ -0,0 +1,66 @@
+/**
+ * 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 testsuite2 from "../test/List.test.ets";
+import file from '@system.file';
+import {Core, ExpectExtend, ReportExtend} from "deccjsunit/index.ets";
+
+@Entry
+@Component
+struct MyComponent {
+ aboutToAppear() {
+ console.info("start run testcase2!!!!")
+ featureAbility.getWant()
+ .then((Want) => {
+ const core = Core.getInstance();
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ });
+ core.addService('expect', expectExtend);
+ const reportExtend = new ReportExtend(file);
+ core.addService('report', reportExtend);
+ core.init();
+ core.subscribeEvent('task', reportExtend);
+ const configService = core.getDefaultService('config');
+ console.info('parameters2---->' + JSON.stringify(Want.parameters));
+ configService.setConfig(Want.parameters);
+ testsuite2();
+ core.execute();
+ console.info('Operation successful2. Data: ' + JSON.stringify(Want));
+ })
+ .catch((error) => {
+ console.error('Operation failed2. Cause: ' + JSON.stringify(error));
+ })
+ }
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Text('Hello World')
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ Button() {
+ Text('next page')
+ .fontSize(25)
+ .fontWeight(FontWeight.Bold)
+ }.type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/List.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3d3c47dce1c1f0a41a634b0d1559aa3b54c517e2
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/List.test.ets
@@ -0,0 +1,20 @@
+/**
+ * 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 getAbilityInfoJsunit from './getAbilityInfoJsunit2.test.ets';
+
+export default function testsuite2() {
+ getAbilityInfoJsunit();
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/Utils.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/Utils.ets
new file mode 100644
index 0000000000000000000000000000000000000000..44eeb6fe62c02130e9d8dd290b157426e2af9d2f
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/Utils.ets
@@ -0,0 +1,48 @@
+// @ts-nocheck
+/**
+ * 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 class Utils {
+ static sleep(time) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ resolve()
+ }, time)
+ }).then(() => {
+ console.info(`sleep ${time} over...`)
+ })
+ }
+
+ static getNowTime() {
+ return new Date().getTime();
+ }
+
+ /**
+ * 接口调用时间
+ * @param startTime 接口调用开始时间
+ * @param endTime 接口调用结束时间
+ */
+ static getDurationTime(msg, startTime, endTime) {
+ console.info(msg + 'Get Interface startTime: ' + startTime);
+ console.info(msg + 'Get Interface endTime: ' + endTime);
+ var duration = (endTime - startTime)
+ console.info(msg + 'Get Interface Duration: ' + duration);
+ return duration;
+ }
+}
+
+
+
+
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..827da661a688dc43e67505489d4e27b7da6d4ecd
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/MainAbility2/test/getAbilityInfoJsunit2.test.ets
@@ -0,0 +1,245 @@
+/**
+ * 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 {describe, it, expect} from "deccjsunit/index.ets";
+import Utils from './Utils';
+import ability_featureAbility from '@ohos.ability.featureAbility';
+
+export default function getAbilityInfoJsunit() {
+ describe('appInfoTest', function () {
+
+ /**
+ * @tc.number: context_getAbilityInfo_test_0300
+ * @tc.name: getAbilityInfo:Query the current attributionability details.
+ * @tc.desc: Check the return type of the interface (by Callback)
+ * @tc.level 0
+ */
+ it('context_getAbilityInfo_test_0300', 0, async function (done) {
+ try{
+ console.info('[context_getAbilityInfo_test_0300] START2');
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ await context.getAbilityInfo((error, data)=>{
+ var timeNewStamp= Utils.getNowTime();
+ Utils.getDurationTime('context_getAbilityInfo_test_0300',timeOldStamp,timeNewStamp);
+ console.info('[context_getAbilityInfo_test_0300] data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ });
+ } catch (error){
+ console.error('[context_getAbilityInfo_test_0300] failed: ' + JSON.stringify(error));
+ }
+ var callback = await context.getAbilityInfo();
+ console.info('---[context_getAbilityInfo_test_0300] check---');
+ checkAbilityInfo2('context_getAbilityInfo_test_0300',callback);
+ console.info('[context_getAbilityInfo_test_0300] FINISH');
+ done();
+ })
+
+ function checkAbilityInfo2(msg,data) {
+ console.log(msg+ "checkAbilityInfo2 start " + JSON.stringify(data));
+ console.log(msg+ "checkAbilityInfo2 bundleName : " + data.bundleName);
+ console.log(msg+ "checkAbilityInfo2 name : " + data.name);
+ console.log(msg+ "checkAbilityInfo2 label : " + data.label);
+ console.log(msg+ "checkAbilityInfo2 description : " + data.description);
+ console.log(msg+ "checkAbilityInfo2 icon : " + data.icon);
+ console.log(msg+ "checkAbilityInfo2 descriptionId : " + data.descriptionId);
+ console.log(msg+ "checkAbilityInfo2 iconId : " + data.iconId);
+ console.log(msg+ "checkAbilityInfo2 moduleName : " + data.moduleName);
+ console.log(msg+ "checkAbilityInfo2 process : " + data.process);
+ console.log(msg+ "checkAbilityInfo2 targetAbility : " + data.targetAbility);
+ console.log(msg+ "checkAbilityInfo2 backgroundModes : " + data.backgroundModes);
+ console.log(msg+ "checkAbilityInfo2 isVisible : " + data.isVisible);
+ console.log(msg+ "checkAbilityInfo2 formEnabled : " + data.formEnabled);
+ console.log(msg+ "checkAbilityInfo2 type : " + data.type)
+ console.log(msg+ "checkAbilityInfo2 orientation : " + data.orientation);
+ console.log(msg+ "checkAbilityInfo2 launchMode : " + data.launchMode);
+ console.log(msg+ "checkAbilityInfo2 permissions length : " + data.permissions.length);
+ for (var j = 0; j < data.permissions.length; j++) {
+ console.log(msg+ "getAbilityInfo2 data.permissions[" + j + "] : " + data.permissions[j]);
+ }
+ console.log(msg+ "checkAbilityInfo2 deviceTypes length : " + data.deviceTypes.length);
+ for (var k = 0; k < data.deviceTypes.length; k++) {
+ console.log(msg+ "getAbilityInfo2 data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
+ }
+ console.log(msg+ "checkAbilityInfo2 deviceCapabilities length : " + data.deviceCapabilities.length);
+ for (var i = 0; i < data.deviceCapabilities.length; i++) {
+ console.log(msg+ "getAbilityInfo2 data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]);
+ }
+ console.log(msg+ "checkAbilityInfo2 readPermission : " + data.readPermission);
+ console.log(msg+ "checkAbilityInfo2 writePermission : " + data.writePermission);
+ console.log(msg+ "checkAbilityInfo2 formEntity : " + data.formEntity);
+ console.log(msg+ "checkAbilityInfo2 minFormHeight : " + data.minFormHeight);
+ console.log(msg+ "checkAbilityInfo2 defaultFormHeight : " + data.defaultFormHeight);
+ console.log(msg+ "checkAbilityInfo2 minFormWidth : " + data.minFormWidth);
+ console.log(msg+ "checkAbilityInfo2 defaultFormWidth : " + data.defaultFormWidth);
+ console.log(msg+ "checkAbilityInfo2 uri : " + data.uri);
+ console.log(msg+ "checkAbilityInfo2 customizeData : " + data.customizeData);
+ console.log(msg+ "checkAbilityInfo2 labelId : " + data.labelId);
+ console.log(msg+ "checkAbilityInfo2 subType : " + data.subType);
+
+ expect(typeof (data)).assertEqual("object");
+ expect(typeof (data.bundleName)).assertEqual("string");
+ expect(typeof (data.name)).assertEqual("string");
+ expect(typeof (data.label)).assertEqual("string");
+ expect(typeof (data.description)).assertEqual("string");
+ expect(typeof (data.icon)).assertEqual("string");
+ expect(typeof (data.labelId)).assertEqual("number");
+ expect(typeof (data.descriptionId)).assertEqual("number");
+ expect(typeof (data.iconId)).assertEqual("number");
+ expect(typeof (data.moduleName)).assertEqual("string");
+ expect(typeof (data.process)).assertEqual("string");
+ expect(typeof (data.targetAbility)).assertEqual("string");
+ expect(typeof (data.backgroundModes)).assertEqual("number");
+ expect(typeof (data.isVisible)).assertEqual("boolean");
+ expect(typeof (data.formEnabled)).assertEqual("boolean");
+ expect(typeof (data.type)).assertEqual("number");
+ expect(typeof (data.subType)).assertEqual("number");
+ expect(typeof (data.orientation)).assertEqual("number");
+ expect(typeof (data.launchMode)).assertEqual("number");
+ expect(Array.isArray(data.permissions)).assertEqual(true);
+ expect(Array.isArray(data.deviceTypes)).assertEqual(true);
+ expect(Array.isArray(data.deviceCapabilities)).assertEqual(true);
+ expect(typeof (data.readPermission)).assertEqual("string");
+ expect(typeof (data.writePermission)).assertEqual("string");
+ expect(typeof (data.applicationInfo)).assertEqual("object");
+ expect(typeof (data.formEntity)).assertEqual("number");
+ expect(typeof (data.minFormHeight)).assertEqual("number");
+ expect(typeof (data.defaultFormHeight)).assertEqual("number");
+ expect(typeof (data.minFormWidth)).assertEqual("number");
+ expect(typeof (data.defaultFormWidth)).assertEqual("number");
+ expect(typeof (data.uri)).assertEqual("string");
+
+ expect(data.bundleName).assertEqual("com.ohos.acecollaboration");
+ expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility2");
+ expect(data.label).assertEqual("$string:entry_MainAbility2");
+ expect(data.description).assertEqual("$string:description_mainability2");
+ expect(data.icon).assertEqual("$media:icon");
+ expect(data.descriptionId > 0).assertTrue();
+ expect(data.iconId > 0).assertTrue();
+ expect(data.moduleName).assertEqual("entry");
+ expect(data.process).assertEqual("");
+ expect(data.targetAbility).assertEqual("");
+ expect(data.backgroundModes).assertEqual(0);
+ expect(data.isVisible).assertEqual(false);
+ expect(data.formEnabled).assertEqual(false);
+ expect(data.type).assertEqual(1);
+ expect(data.orientation).assertEqual(0);
+ expect(data.launchMode).assertEqual(1);
+ expect(data.deviceTypes[0]).assertEqual("phone");
+ expect(data.readPermission).assertEqual("");
+ expect(data.writePermission).assertEqual("");
+ checkApplicationInfo2(msg,data.applicationInfo);
+ expect(data.formEntity).assertEqual(0);
+ expect(data.minFormHeight).assertEqual(0);
+ expect(data.defaultFormHeight).assertEqual(0);
+ expect(data.minFormWidth).assertEqual(0);
+ expect(data.defaultFormWidth).assertEqual(0);
+ expect(data.uri).assertEqual("");
+ expect(data.labelId >0).assertTrue();
+ expect(data.subType).assertEqual(0);
+ console.log(msg+ "---checkAbilityInfo End--- ");
+ }
+
+ function checkApplicationInfo2(msg,info) {
+ console.log(msg+ "checkApplicationInfo start : " + JSON.stringify(info));
+ console.log(msg+ "checkApplicationInfo name : " + info.name);
+ console.log(msg+ "checkApplicationInfo description : " + info.description);
+ console.log(msg+ "checkApplicationInfo descriptionId : " + info.descriptionId);
+ console.log(msg+ "checkApplicationInfo systemApp : " + info.systemApp);
+ console.log(msg+ "checkApplicationInfo enabled : " + info.enabled);
+ console.log(msg+ "checkApplicationInfo label : " + info.label);
+ console.log(msg+ "checkApplicationInfo labelId : " + info.labelId);
+ console.log(msg+ "checkApplicationInfo icon : " + info.icon);
+ console.log(msg+ "checkApplicationInfo iconId : " + info.iconId);
+ console.log(msg+ "checkApplicationInfo process : " + info.process);
+ console.log(msg+ "checkApplicationInfo supportedModes : " + info.supportedModes);
+
+ console.log(msg+ "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
+ for (var j = 0; j < info.moduleSourceDirs.length; j++) {
+ console.log(msg+ "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
+ }
+ console.log(msg+ "checkApplicationInfo permissions length : " + info.permissions.length);
+ for (var k = 0; k < info.permissions.length; k++) {
+ console.log(msg+ "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]);
+ }
+ console.log(msg+ "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
+ for (var i = 0; i < info.moduleInfos.length; i++) {
+ console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " + info.moduleInfos[i].moduleName);
+ console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " + info.moduleInfos[i].moduleSourceDir);
+ }
+ console.log(msg+ "checkApplicationInfo entryDir : " + info.entryDir);
+
+ expect(typeof (info)).assertEqual("object");
+ expect(typeof (info.name)).assertEqual("string");
+ expect(typeof (info.description)).assertEqual("string");
+ expect(typeof (info.descriptionId)).assertEqual("number");
+ expect(typeof (info.systemApp)).assertEqual("boolean");
+ expect(typeof (info.enabled)).assertEqual("boolean");
+ expect(typeof (info.label)).assertEqual("string");
+ expect(typeof (info.labelId)).assertEqual("string");
+ expect(typeof (info.icon)).assertEqual("string");
+ expect(typeof (info.iconId)).assertEqual("string");
+ expect(typeof (info.process)).assertEqual("string");
+ expect(typeof (info.supportedModes)).assertEqual("number");
+ expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
+ expect(Array.isArray(info.permissions)).assertEqual(true);
+ expect(Array.isArray(info.moduleInfos)).assertEqual(true);
+ expect(typeof (info.entryDir)).assertEqual("string");
+
+ expect(info.name).assertEqual("com.ohos.acecollaboration");
+ expect(info.description).assertEqual("$string:mainability_description");
+ expect(info.descriptionId > 0).assertTrue();
+ expect(info.systemApp).assertEqual(true);
+ expect(info.enabled).assertEqual(true);
+ expect(info.label).assertEqual("$string:entry_MainAbility");
+ expect(info.icon).assertEqual("$media:icon");
+ expect(info.process).assertEqual("");
+ expect(info.supportedModes).assertEqual(0);
+ expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ if (info.moduleSourceDirs.length == 1){
+ expect(info.moduleInfos[0].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }else if(info.moduleSourceDirs.length == 2) {
+ if (info.moduleInfos[0].moduleName == "myapplication1") {
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication1");
+ expect(info.moduleInfos[1].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }else{
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication2");
+ expect(info.moduleInfos[1].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }
+ }else {
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication1");
+ expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication2");
+ expect(info.moduleInfos[2].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }
+ console.log(msg+ "---checkApplicationInfo End--- ");
+ }
+ })
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility/service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1503232a7024bbced8a52b26449f056600b0f0bf
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility/service.ts
@@ -0,0 +1,52 @@
+/**
+ * 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 rpc from '@ohos.rpc';
+
+class StubTest extends rpc.RemoteObject {
+ constructor(des) {
+ super(des)
+ }
+
+ onRemoteRequest(code, data, reply, option) {
+ console.info('ServiceAbility onRemoteRequest');
+ if (code === 1) {
+ let op1 = data.readInt();
+ let op2 = data.readInt();
+ reply.writeInt(op1 + op2);
+ console.info('ServiceAbility op1:' + op1 + ' op2:' + op2);
+ }
+ return true;
+ }
+}
+
+export default {
+ onStart() {
+ console.info('ServiceAbility onStart');
+ },
+ onStop() {
+ console.info('ServiceAbility onStop');
+ },
+ onCommand(want, startId) {
+ console.info('ServiceAbility onCommand');
+ },
+ onConnect(want) {
+ console.info('ServiceAbility onConnect');
+ return new StubTest("test");
+ },
+ onDisConnect(want) {
+ console.info('ServiceAbility onDisConnect');
+ },
+};
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a3c5e888497e748d7b1953bcbcbef23a6c0d0486
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility2/service.ts
@@ -0,0 +1,132 @@
+/**
+ * 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 particleAbility from '@ohos.ability.particleAbility';
+import rpc from '@ohos.rpc'
+
+class StubTest2 extends rpc.RemoteObject {
+ constructor(des) {
+ super(des)
+ }
+
+ onRemoteRequest(code, data, reply, option) {
+ console.info('ServiceAbility2 onRemoteRequest');
+ if (code === 1) {
+ let op1 = data.readInt();
+ let op2 = data.readInt();
+ reply.writeInt(op1 + op2);
+ console.info('ServiceAbility2 op1:' + op1 + ' op2:' + op2);
+ }
+ return true;
+ }
+}
+
+function getNowTime() {
+ return new Date().getTime();
+}
+
+function getDurationTime(msg, startTime, endTime) {
+ console.info(msg + 'Get Interface startTime: ' + startTime);
+ console.info(msg + 'Get Interface endTime: ' + endTime);
+ var duration = (endTime - startTime)
+ console.info(msg + 'Get Interface Duration: ' + duration);
+ return duration;
+}
+
+async function sleep(time: any) {
+ var now = new Date();
+ var exitTime = now.getTime() + time;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime)
+ break;
+ }
+ console.info(`sleep ${time} over...`);
+}
+
+export default {
+ onStart() {
+ console.info('ServiceAbility2 onStart');
+ },
+ onStop() {
+ console.info('ServiceAbility2 onStop');
+ },
+ onCommand(want, startId) {
+ console.info('ServiceAbility2 onCommand');
+ let request = {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.ohos.acecollaboration.ServiceAbility",
+ }
+ let options = {
+ onConnect: async function (element: any, proxy: any) {
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.deviceId : '
+ + JSON.stringify(element.deviceId));
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.bundleName : '
+ + JSON.stringify(element.bundleName));
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.abilityName : '
+ + JSON.stringify(element.abilityName));
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.uri : '
+ + JSON.stringify(element.uri));
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect element.shortName : '
+ + JSON.stringify(element.shortName));
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onConnect proxy : '
+ + JSON.stringify(proxy));
+ },
+ onDisconnect: async function (element1: any) {
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.deviceId : '
+ + JSON.stringify(element1.deviceId));
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.bundleName : '
+ + JSON.stringify(element1.bundleName));
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.abilityName: '
+ + JSON.stringify(element1.abilityName));
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.uri : '
+ + JSON.stringify(element1.uri));
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onDisconnect element.shortName : '
+ + JSON.stringify(element1.shortName));
+ },
+ onFailed: async function (code: any) {
+ console.log('particleAbility_connectAbility_test_0100 ConnectAbility onFailed errCode : ' + code);
+ },
+ }
+
+ let connection_succeeded: any;
+ console.info('particleAbility_connectAbility_test_0100 start ');
+ var timeOldStamp = getNowTime();
+ var connection = particleAbility.connectAbility(request, options);
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0100 connectability', timeOldStamp, timeNewStamp);
+ connection_succeeded = connection;
+ console.info('particleAbility_connectAbility_test_0100 service request is:' + JSON.stringify(request));
+ console.info('particleAbility_connectAbility_test_0100 options is:' + JSON.stringify(options));
+ console.info('particleAbility_connectAbility_test_0100 data is: ' + JSON.stringify(connection));
+ console.info('particleAbility_connectAbility_test_0100 connection=: ' + connection);
+ sleep(5000);
+ console.info('particleAbility_connectAbility_test_0100 disconnectability start ');
+ var timeOldStamp = getNowTime();
+ particleAbility.disconnectAbility(connection_succeeded).then((data: any) => {
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0100 disconnectability', timeOldStamp, timeNewStamp);
+ console.info('particleAbility_connectAbility_test_0100 disconnectability succeeded: ' +
+ JSON.stringify(data));
+ }).catch((error: any) => {
+ console.error('particleAbility_connectAbility_test_0100 disconnectability failed. Cause: ' +
+ JSON.stringify(error));
+ })
+ },
+ onConnect(want) {
+ console.info('ServiceAbility2 onConnect');
+ return new StubTest2("test");
+ },
+};
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..72c61a28d0ce923795b0a7b8d5a0dfa2e598af64
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility3/service.ts
@@ -0,0 +1,133 @@
+/**
+ * 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 particleAbility from '@ohos.ability.particleAbility';
+import rpc from '@ohos.rpc';
+
+class StubTest3 extends rpc.RemoteObject {
+ constructor(des) {
+ super(des)
+ }
+
+ onRemoteRequest(code, data, reply, option) {
+ console.info('ServiceAbility3 onRemoteRequest');
+ if (code === 1) {
+ let op1 = data.readInt();
+ let op2 = data.readInt();
+ reply.writeInt(op1 + op2);
+ console.info('ServiceAbility3 op1:' + op1 + ' op2:' + op2);
+ }
+ return true;
+ }
+}
+
+function getNowTime() {
+ return new Date().getTime();
+}
+
+function getDurationTime(msg, startTime, endTime) {
+ console.info(msg + 'Get Interface startTime: ' + startTime);
+ console.info(msg + 'Get Interface endTime: ' + endTime);
+ var duration = (endTime - startTime)
+ console.info(msg + 'Get Interface Duration: ' + duration);
+ return duration;
+}
+
+async function sleep(time: any) {
+ var now = new Date();
+ var exitTime = now.getTime() + time;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime)
+ break;
+ }
+ console.info(`sleep ${time} over...`);
+}
+
+export default {
+ onStart() {
+ console.info('ServiceAbility3 onStart');
+ },
+ onStop() {
+ console.info('ServiceAbility3 onStop');
+ },
+ onCommand(want, startId) {
+ console.info('ServiceAbility3 onCommand');
+ let request = {
+ "bundleName": "com.ohos.acecollaboration",
+ "abilityName": "com.ohos.acecollaboration.ServiceAbility",
+ }
+ let options = {
+ onConnect: async function (element: any, proxy: any) {
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.deviceId : '
+ + JSON.stringify(element.deviceId))
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.bundleName : '
+ + JSON.stringify(element.bundleName))
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.abilityName : '
+ + JSON.stringify(element.abilityName))
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.uri : '
+ + JSON.stringify(element.uri))
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect element.shortName : '
+ + JSON.stringify(element.shortName))
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onConnect proxy : '
+ + JSON.stringify(proxy));
+ },
+ onDisconnect: async function (element1: any) {
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.deviceId :'
+ + JSON.stringify(element1.deviceId));
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.bundleName :'
+ + JSON.stringify(element1.bundleName));
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.abilityName :'
+ + JSON.stringify(element1.abilityName));
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.uri : '
+ + JSON.stringify(element1.uri));
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onDisconnect element.shortName : '
+ + JSON.stringify(element1.shortName));
+ },
+ onFailed: function (code: any) {
+ console.log('particleAbility_connectAbility_test_0200 ConnectAbility onFailed errCode: ' + code)
+ },
+ }
+
+ let connection_succeeded: any;
+ console.info('particleAbility_connectAbility_test_0200 start ');
+ var timeOldStamp = getNowTime();
+ var connection = particleAbility.connectAbility(request, options);
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0200 connectability', timeOldStamp, timeNewStamp);
+ connection_succeeded = connection;
+ console.info('particleAbility_connectAbility_test_0200 service request is:' + JSON.stringify(request));
+ console.info('particleAbility_connectAbility_test_0200 options is:' + JSON.stringify(options));
+ console.info('particleAbility_connectAbility_test_0200 connection=: ' + connection);
+ sleep(5000);
+ console.info('particleAbility_connectAbility_test_0200 disconnectability start ');
+ try {
+ var timeOldStamp = getNowTime();
+ particleAbility.disconnectAbility(connection_succeeded, (error, data) => {
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0200 disconnectability', timeOldStamp, timeNewStamp);
+ console.info('particleAbility_connectAbility_test_0200 disconnectability succeeded: ' + JSON.stringify(data));
+ })
+ }
+ catch(error: any){
+ console.error('particleAbility_connectAbility_test_0200 disconnectability failed. Cause: ' +
+ JSON.stringify(error));
+ }
+ },
+ onConnect(want) {
+ console.info('ServiceAbility3 onConnect');
+ return new StubTest3("test");
+ },
+};
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d35fb6c9b69ef69e536f5b53d8843a4e2fc39d00
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility4/service.ts
@@ -0,0 +1,132 @@
+/**
+ * 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 particleAbility from '@ohos.ability.particleAbility';
+import rpc from '@ohos.rpc'
+
+class StubTest4 extends rpc.RemoteObject {
+ constructor(des) {
+ super(des)
+ }
+
+ onRemoteRequest(code, data, reply, option) {
+ console.info('ServiceAbility4 onRemoteRequest');
+ if (code === 1) {
+ let op1 = data.readInt();
+ let op2 = data.readInt();
+ reply.writeInt(op1 + op2);
+ console.info('ServiceAbility4 op1:' + op1 + ' op2:' + op2);
+ }
+ return true;
+ }
+}
+
+function getNowTime() {
+ return new Date().getTime();
+}
+
+function getDurationTime(msg, startTime, endTime) {
+ console.info(msg + 'Get Interface startTime: ' + startTime);
+ console.info(msg + 'Get Interface endTime: ' + endTime);
+ var duration = (endTime - startTime)
+ console.info(msg + 'Get Interface Duration: ' + duration);
+ return duration;
+}
+
+async function sleep(time: any) {
+ var now = new Date();
+ var exitTime = now.getTime() + time;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime)
+ break;
+ }
+ console.info(`sleep ${time} over...`);
+}
+
+export default {
+ onStart() {
+ console.info('ServiceAbility4 onStart');
+ },
+ onStop() {
+ console.info('ServiceAbility4 onStop');
+ },
+ onCommand(want, startId) {
+ console.info('ServiceAbility4 onCommand');
+ let request = {
+ "bundleName": "com.open.harmony.packagemag",
+ "abilityName": "com.open.harmony.packagemag.packServiceAbility",
+ }
+ let options = {
+ onConnect: async function (element: any, proxy: any) {
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.deviceId : '
+ + JSON.stringify(element.deviceId))
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.bundleName : '
+ + JSON.stringify(element.bundleName))
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.abilityName : '
+ + JSON.stringify(element.abilityName))
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.uri : '
+ + JSON.stringify(element.uri))
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect element.shortName : '
+ + JSON.stringify(element.shortName))
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onConnect proxy : '
+ + JSON.stringify(proxy));
+ },
+ onDisconnect: async function (element1: any) {
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.deviceId : '
+ + JSON.stringify(element1.deviceId));
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.bundleName: '
+ + JSON.stringify(element1.bundleName));
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.abilityName:'
+ + JSON.stringify(element1.abilityName));
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.uri: '
+ + JSON.stringify(element1.uri));
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onDisconnect element.shortName :'
+ + JSON.stringify(element1.shortName));
+ },
+ onFailed: function (code: any) {
+ console.log('particleAbility_connectAbility_test_0300 ConnectAbility onFailed errCode : '+ code);
+ },
+ }
+
+ let connection_succeeded: any;
+ console.info('particleAbility_connectAbility_test_0300 start ');
+ var timeOldStamp = getNowTime();
+ var connection = particleAbility.connectAbility(request, options);
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0300 connectability', timeOldStamp, timeNewStamp);
+ connection_succeeded = connection;
+ console.info('particleAbility_connectAbility_test_0300 service request is:' + JSON.stringify(request));
+ console.info('particleAbility_connectAbility_test_0300 options is:' + JSON.stringify(options));
+ console.info('particleAbility_connectAbility_test_0300 data is: ' + JSON.stringify(connection));
+ console.info('particleAbility_connectAbility_test_0300 connection=: ' + connection);
+ sleep(5000);
+ console.info('particleAbility_connectAbility_test_0300 disconnectability start ');
+ var timeOldStamp = getNowTime();
+ particleAbility.disconnectAbility(connection_succeeded).then((data: any) => {
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0300 disconnectability', timeOldStamp, timeNewStamp);
+ console.info('particleAbility_connectAbility_test_0300 disconnectability succeeded:'
+ + JSON.stringify(data));
+ }).catch ((error: any) =>{
+ console.error('particleAbility_connectAbility_test_0300 disconnectability failed. Cause: ' +
+ JSON.stringify(error));
+ })
+ },
+ onConnect(want) {
+ console.info('ServiceAbility4 onConnect');
+ return new StubTest4("test");
+ },
+};
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..16a737c348c7c200b1ef49acc08c922c755f6e26
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility5/service.ts
@@ -0,0 +1,147 @@
+/**
+ * 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 particleAbility from '@ohos.ability.particleAbility';
+import rpc from '@ohos.rpc'
+
+class StubTest5 extends rpc.RemoteObject {
+ constructor(des) {
+ super(des)
+ }
+
+ onRemoteRequest(code, data, reply, option) {
+ console.info('ServiceAbility5 onRemoteRequest');
+ if (code === 1) {
+ let op1 = data.readInt();
+ let op2 = data.readInt();
+ reply.writeInt(op1 + op2);
+ console.info('ServiceAbility5 op1:' + op1 + ' op2:' + op2);
+ }
+ return true;
+ }
+}
+
+function getNowTime() {
+ return new Date().getTime();
+}
+
+function getDurationTime(msg, startTime, endTime) {
+ console.info(msg + 'Get Interface startTime: ' + startTime);
+ console.info(msg + 'Get Interface endTime: ' + endTime);
+ var duration = (endTime - startTime)
+ console.info(msg + 'Get Interface Duration: ' + duration);
+ return duration;
+}
+
+async function sleep(time: any) {
+ var now = new Date();
+ var exitTime = now.getTime() + time;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime)
+ break;
+ }
+ console.info(`sleep ${time} over...`);
+}
+
+export default {
+ onStart() {
+ console.info('ServiceAbility5 onStart');
+ },
+ onStop() {
+ console.info('ServiceAbility5 onStop');
+ },
+ onCommand(want, startId) {
+ console.info('ServiceAbility5 onCommand');
+ let request = {
+ "bundleName": "",
+ "abilityName": "",
+ }
+ let options = {
+ onConnect: async function (element: any, proxy: any) {
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.deviceId : '
+ + JSON.stringify(element.deviceId))
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.bundleName : '
+ + JSON.stringify(element.bundleName))
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.abilityName : '
+ + JSON.stringify(element.abilityName))
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.uri : '
+ + JSON.stringify(element.uri))
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect element.shortName : '
+ + JSON.stringify(element.shortName))
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onConnect proxy : '
+ + JSON.stringify(proxy));
+ },
+ onDisconnect: function (element1: any) {
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.deviceId : '
+ + JSON.stringify(element1.deviceId));
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.bundleName: '
+ + JSON.stringify(element1.bundleName));
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.abilityName:'
+ + JSON.stringify(element1.abilityName));
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.uri : '
+ + JSON.stringify(element1.uri));
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onDisconnect element.shortName : '
+ + JSON.stringify(element1.shortName));
+ },
+ onFailed: function (code: any) {
+ console.log('particleAbility_connectAbility_test_0400 ConnectAbility onFailed errCode:' + code);
+ },
+ }
+
+ let connection_succeeded: any;
+ console.info('particleAbility_connectAbility_test_0400 start ');
+ var timeOldStamp = getNowTime();
+ var connection = particleAbility.connectAbility(request, options);
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0400 connectability', timeOldStamp, timeNewStamp);
+ connection_succeeded = connection;
+ console.info('particleAbility_connectAbility_test_0400 service request is:' + JSON.stringify(request));
+ console.info('particleAbility_connectAbility_test_0400 options is:' + JSON.stringify(options));
+ console.info('particleAbility_connectAbility_test_0400 connection=: ' + connection);
+ sleep(5000);
+ console.info('particleAbility_connectAbility_test_0400 disconnectability start ');
+ var timeOldStamp = getNowTime();
+ particleAbility.disconnectAbility(connection_succeeded).then((data: any) => {
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0400 disconnectability', timeOldStamp, timeNewStamp);
+ console.info('particleAbility_connectAbility_test_0400 disconnectability succeeded: ' +
+ JSON.stringify(data));
+ }).catch((error: any) => {
+ console.error('particleAbility_connectAbility_test_0400 disconnectability failed. Cause: ' +
+ JSON.stringify(error));
+ });
+ sleep(5000);
+ console.info('particleAbility_connectAbility_test_0400 disconnectability_fail start ');
+ try {
+ var timeOldStamp = getNowTime();
+ particleAbility.disconnectAbility(-1).then((data: any) => {
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0400 disconnectability_fail',
+ timeOldStamp, timeNewStamp);
+ console.info('particleAbility_connectAbility_test_0400 disconnectability_fail succeeded: ' +
+ JSON.stringify(data));
+ })
+ }
+ catch (error: any) {
+ console.error('particleAbility_connectAbility_test_0400 disconnectability_fail failed. Cause: ' +
+ JSON.stringify(error));
+ }
+ },
+ onConnect(want) {
+ console.info('ServiceAbility5 onConnect');
+ return new StubTest5("test");
+ },
+};
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b36d40babb5564311b59d2bb63837c2c6298a0a5
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility6/service.ts
@@ -0,0 +1,108 @@
+/**
+ * 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 particleAbility from '@ohos.ability.particleAbility';
+import rpc from '@ohos.rpc'
+
+class StubTest6 extends rpc.RemoteObject {
+ constructor(des) {
+ super(des)
+ }
+
+ onRemoteRequest(code, data, reply, option) {
+ console.info('ServiceAbility6 onRemoteRequest');
+ if (code === 1) {
+ let op1 = data.readInt();
+ let op2 = data.readInt();
+ reply.writeInt(op1 + op2);
+ console.info('ServiceAbility6 op1:' + op1 + ' op2:' + op2);
+ }
+ return true;
+ }
+}
+function getNowTime() {
+ return new Date().getTime();
+}
+
+function getDurationTime(msg, startTime, endTime) {
+ console.info(msg + 'Get Interface startTime: ' + startTime);
+ console.info(msg + 'Get Interface endTime: ' + endTime);
+ var duration = (endTime - startTime)
+ console.info(msg + 'Get Interface Duration: ' + duration);
+ return duration;
+}
+
+export default {
+ onStart() {
+ console.info('ServiceAbility onStart');
+ },
+ onStop() {
+ console.info('ServiceAbility onStop');
+ },
+ onCommand(want, startId) {
+ console.info('ServiceAbility onCommand');
+
+ let request = {
+ "bundleName":"com.ohos.acecollaboration",
+ "abilityName":"com.ohos.acecollaboration.xxx",
+ }
+ let options = {
+ onConnect:async function (element:any, proxy:any) {
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.deviceId : '
+ + JSON.stringify(element.deviceId))
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.bundleName : '
+ + JSON.stringify(element.bundleName))
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.abilityName : '
+ + JSON.stringify(element.abilityName))
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.uri : '
+ + JSON.stringify(element.uri))
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect element.shortName : '
+ + JSON.stringify(element.shortName))
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onConnect proxy : '
+ + JSON.stringify(proxy));
+ },
+ onDisconnect:function (element1:any) {
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.deviceId : '
+ + JSON.stringify(element1.deviceId));
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.bundleName: '
+ + JSON.stringify(element1.bundleName));
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.abilityName:'
+ + JSON.stringify(element1.abilityName));
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.uri : '
+ + JSON.stringify(element1.uri));
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility onDisconnect element.shortName : '
+ + JSON.stringify(element1.shortName));
+ },
+ onFailed:function (code:any) {
+ console.log('particleAbility_connectAbility_test_0500 ConnectAbility service onFailed errCode:' + code)
+ },
+ }
+
+ console.info('particleAbility_connectAbility_test_0500 errorabilityName start');
+ var timeOldStamp = getNowTime();
+ var connection = particleAbility.connectAbility(request, options);
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0500 connectability', timeOldStamp, timeNewStamp);
+ console.info('particleAbility_connectAbility_test_0500 errorabilityName request is:'
+ + JSON.stringify(request));
+ console.info('particleAbility_connectAbility_test_0500 errorabilityName options is:'
+ + JSON.stringify(options));
+ console.info('particleAbility_connectAbility_test_0500 errorabilityName connection=: ' + connection);
+ },
+ onConnect(want) {
+ console.info('ServiceAbility6 onConnect');
+ return new StubTest6("test");
+ },
+};
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..32fe65dec8ea4d8e89197d561f6cecc2785db423
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/ets/ServiceAbility7/service.ts
@@ -0,0 +1,135 @@
+/**
+ * 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 particleAbility from '@ohos.ability.particleAbility';
+import rpc from '@ohos.rpc'
+
+class StubTest7 extends rpc.RemoteObject {
+ constructor(des) {
+ super(des)
+ }
+
+ onRemoteRequest(code, data, reply, option) {
+ console.info('ServiceAbility7 onRemoteRequest');
+ if (code === 1) {
+ let op1 = data.readInt();
+ let op2 = data.readInt();
+ reply.writeInt(op1 + op2);
+ console.info('ServiceAbility7 op1:' + op1 + ' op2:' + op2);
+ }
+ return true;
+ }
+}
+
+function getNowTime() {
+ return new Date().getTime();
+}
+
+function getDurationTime(msg, startTime, endTime) {
+ console.info(msg + 'Get Interface startTime: ' + startTime);
+ console.info(msg + 'Get Interface endTime: ' + endTime);
+ var duration = (endTime - startTime)
+ console.info(msg + 'Get Interface Duration: ' + duration);
+ return duration;
+}
+
+async function sleep(time: any) {
+ var now = new Date();
+ var exitTime = now.getTime() + time;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime)
+ break;
+ }
+ console.info(`sleep ${time} over...`);
+}
+export default {
+ onStart() {
+ console.info('ServiceAbility7 onStart');
+ },
+ onStop() {
+ console.info('ServiceAbility7 onStop');
+ },
+ onCommand(want, startId) {
+ console.info('ServiceAbility7 onCommand');
+
+ let request = {
+ "bundleName":"com.example.myapplication",
+ "abilityName":"com.example.myapplication.ServiceAbility_API8",
+ }
+ let options = {
+ onConnect:async function (element:any, proxy:any) {
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.deviceId : '
+ + JSON.stringify(element.deviceId))
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.bundleName : '
+ + JSON.stringify(element.bundleName))
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.abilityName : '
+ + JSON.stringify(element.abilityName))
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.uri : '
+ + JSON.stringify(element.uri))
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect element.shortName : '
+ + JSON.stringify(element.shortName))
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onConnect proxy : '
+ + JSON.stringify(proxy));
+ },
+ onDisconnect:async function (element1:any) {
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.deviceId : '
+ + JSON.stringify(element1.deviceId));
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.bundleName: '
+ + JSON.stringify(element1.bundleName));
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.abilityName:'
+ + JSON.stringify(element1.abilityName));
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.uri : '
+ + JSON.stringify(element1.uri));
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onDisconnect element.shortName : '
+ + JSON.stringify(element1.shortName));
+ },
+ onFailed:function (code:any) {
+ console.log('particleAbility_connectAbility_test_0600 ConnectAbility onFailed errCode:' + code);
+ },
+ }
+
+ let connection_succeeded:any;
+ console.info('particleAbility_connectAbility_test_0600 start ');
+ var timeOldStamp = getNowTime();
+ var connection = particleAbility.connectAbility(request, options);
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0600 connectability', timeOldStamp, timeNewStamp);
+ connection_succeeded = connection;
+ console.info('particleAbility_connectAbility_test_0600 service request is:' + JSON.stringify(request));
+ console.info('particleAbility_connectAbility_test_0600 options is:' + JSON.stringify(options));
+ console.info('particleAbility_connectAbility_test_0600 data is: ' + JSON.stringify(connection));
+ console.info('particleAbility_connectAbility_test_0600 connection=: ' + connection);
+ sleep(5000);
+ console.info('particleAbility_connectAbility_test_0600 disconnectability start ');
+ var timeOldStamp = getNowTime();
+ particleAbility.disconnectAbility(connection_succeeded).then((data: any) => {
+ var timeNewStamp = getNowTime();
+ getDurationTime('particleAbility_connectAbility_test_0600 disconnectability', timeOldStamp, timeNewStamp);
+ console.info('particleAbility_connectAbility_test_0600 disconnectability succeeded: ' +
+ JSON.stringify(data));
+ }).catch((error: any) =>{
+ console.error('particleAbility_connectAbility_test_0600 disconnectability failed. Cause: ' +
+ JSON.stringify(error));
+ });
+ },
+ onConnect(want) {
+ console.info('ServiceAbility7 onConnect');
+ return new StubTest7("test");
+ },
+ onDisConnect(want) {
+ console.info('ServiceAbility7 onDisConnect');
+ },
+};
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..ffd4ec49bed1ed0a06d1373e4a8d1f19afc51ac8
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,48 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "entry_MainAbility"
+ },
+ {
+ "name": "mainability_description",
+ "value": "eTS_Empty Ability"
+ },
+ {
+ "name": "description_serviceability",
+ "value": "hap sample empty service"
+ },
+ {
+ "name": "description_serviceability2",
+ "value": "hap sample empty service"
+ },
+ {
+ "name": "description_serviceability3",
+ "value": "hap sample empty service"
+ },
+ {
+ "name": "description_serviceability4",
+ "value": "hap sample empty service"
+ },
+ {
+ "name": "description_serviceability5",
+ "value": "hap sample empty service"
+ },
+ {
+ "name": "description_mainability2",
+ "value": "eTS_Empty Ability2"
+ },
+ {
+ "name": "entry_MainAbility2",
+ "value": "MainAbility2"
+ },
+ {
+ "name": "description_serviceability6",
+ "value": "hap sample empty service"
+ },
+ {
+ "name": "description_serviceability7",
+ "value": "hap sample empty service"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/actsabilitymanageretstest/entry/src/main/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/config.json b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..ebcff6d524d771d93a18e206afb0934260198e78
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/config.json
@@ -0,0 +1,57 @@
+{
+ "app": {
+ "bundleName": "com.ohos.acecollaboration",
+ "vendor": "example",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.myapplication1",
+ "name": ".MyApplication",
+ "mainAbility": ".MainAbility",
+ "srcPath": "",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "myapplication1",
+ "moduleType": "feature",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "orientation": "unspecified",
+ "visible": true,
+ "srcPath": "MainAbility",
+ "name": ".MainAbility",
+ "srcLanguage": "ets",
+ "icon": "$media:icon",
+ "description": "$string:description_mainability",
+ "formsEnabled": false,
+ "label": "$string:myapplication1_MainAbility",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "mode": {
+ "syntax": "ets",
+ "type": "pageAbility"
+ },
+ "pages": [
+ "pages/index"
+ ],
+ "name": ".MainAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/app.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/app.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7aa1eae37d7e14260b0f22a90c5a5f7560b8f0f2
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/app.ets
@@ -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('Application onCreate')
+ },
+ onDestroy() {
+ console.info('Application onDestroy')
+ },
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/pages/index.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/pages/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..d39e37aa687879af8aa3ab6021f85353730243fb
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/pages/index.ets
@@ -0,0 +1,57 @@
+/**
+ * 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, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
+import testsuite_app1 from "../test/List.test.ets";
+import featureAbility from "@ohos.ability.featureAbility";
+
+@Entry
+@Component
+struct Index {
+ aboutToAppear() {
+ console.info("start run testcase!!!!")
+ featureAbility.getWant()
+ .then((Want) => {
+ const core = Core.getInstance();
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ });
+ core.addService('expect', expectExtend);
+ const reportExtend = new ReportExtend(file);
+ core.addService('report', reportExtend);
+ core.init();
+ core.subscribeEvent('task', reportExtend);
+ const configService = core.getDefaultService('config');
+ console.info('parameters---->' + JSON.stringify(Want.parameters));
+ configService.setConfig(Want.parameters);
+ testsuite_app1();
+ core.execute();
+ console.info('Operation successful. Data: ' + JSON.stringify(Want));
+ })
+ .catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+ })
+ }
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Text('myapplication1 page')
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/List.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e5bd7d594d190f2b30c723d0f93c439f28d27375
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/List.test.ets
@@ -0,0 +1,21 @@
+/**
+ * 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 getHapModuleInfoJsunit_app1 from './getHapModuleInfoJsunit_app1.test.ets';
+
+export default function testsuite_app1() {
+ getHapModuleInfoJsunit_app1();
+
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/Utils.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/Utils.ets
new file mode 100644
index 0000000000000000000000000000000000000000..58900ffcdfc72e853714250ae84cda913c6c9947
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/Utils.ets
@@ -0,0 +1,42 @@
+/**
+ * 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 class Utils {
+ static sleep(time) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ resolve(reject)
+ }, time)
+ }).then(() => {
+ console.info(`sleep ${time} over...`)
+ })
+ }
+
+ static getNowTime() {
+ return new Date().getTime();
+ }
+
+ static getDurationTime(msg,startTime, endTime) {
+ console.info(msg+'Get Interface startTime: ' + startTime);
+ console.info(msg+'Get Interface endTime: ' + endTime);
+ var duration = (endTime - startTime)
+ console.info(msg+'Get Interface Duration: ' + duration);
+ return duration;
+ }
+}
+
+
+
+
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..685a71d103d5574b438ddfd73b934ec212570fc2
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/ets/MainAbility/test/getHapModuleInfoJsunit_app1.test.ets
@@ -0,0 +1,301 @@
+/**
+ * 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 {describe, it, expect} from "deccjsunit/index.ets";
+import Utils from './Utils';
+import ability_featureAbility from '@ohos.ability.featureAbility';
+
+export default function getHapModuleInfoJsunit() {
+ describe('appInfoTest', function () {
+
+ /**
+ * @tc.number: context_getHapModuleInfo_test_0300
+ * @tc.name: getHapModuleInfo:Obtains the HapModuleInfo object of the application.
+ * @tc.desc: Check the return type of the interface (by Promise)
+ * @tc.level 0
+ */
+ it('context_getHapModuleInfo_test_0300', 0, async function (done) {
+ console.info('[context_getHapModuleInfo_test_0300] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ var context = ability_featureAbility.getContext();
+ context.getHapModuleInfo()
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('context_getHapModuleInfo_test_0300', timeOldStamp, timeNewStamp);
+ console.info('[context_getHapModuleInfo_test_0300] data is:' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ })
+ .catch((error) => {
+ console.error('[context_getHapModuleInfo_test_0300] failed:' + JSON.stringify(error));
+ })
+ var promise = await context.getHapModuleInfo();
+ console.info('---[context_getHapModuleInfo_test_0300] check---');
+ checkHapModuleInfo_app('context_getHapModuleInfo_test_0300', promise);
+ console.info('[context_getHapModuleInfo_test_0300] FINISH');
+ done();
+ });
+
+ function checkHapModuleInfo_app(msg, data) {
+ console.log(msg + "checkHapModuleInfo start " + JSON.stringify(data));
+ console.log(msg + "checkHapModuleInfo name : " + data.name);
+ console.log(msg + "checkHapModuleInfo description : " + data.description);
+ console.log(msg + "checkHapModuleInfo descriptionId : " + data.descriptionId);
+ console.log(msg + "checkHapModuleInfo icon : " + data.icon);
+ console.log(msg + "checkHapModuleInfo label : " + data.label);
+ console.log(msg + "checkHapModuleInfo labelId : " + data.labelId);
+ console.log(msg + "checkHapModuleInfo iconId : " + data.iconId);
+ console.log(msg + "checkHapModuleInfo backgroundImg : " + data.backgroundImg);
+ console.log(msg + "checkHapModuleInfo supportedModes : " + data.supportedModes);
+ console.log(msg + "checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length);
+ for (var j = 0; j < data.reqCapabilities.length; j++) {
+ console.log(msg + "getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]);
+ }
+ console.log(msg + "checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length);
+ for (var k = 0; k < data.deviceTypes.length; k++) {
+ console.log(msg + "getHapModuleInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
+ }
+ console.log(msg + "checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length);
+ console.log(msg + "checkHapModuleInfo moduleName : " + data.moduleName);
+ console.log(msg + "checkHapModuleInfo mainAbilityName : " + data.mainAbilityName);
+ console.log(msg + "checkHapModuleInfo installationFree : " + data.installationFree);
+
+ expect(typeof (data)).assertEqual("object");
+ expect(typeof (data.name)).assertEqual("string");
+ expect(typeof (data.description)).assertEqual("string");
+ expect(typeof (data.descriptionId)).assertEqual("number");
+ expect(typeof (data.icon)).assertEqual("string");
+ expect(typeof (data.label)).assertEqual("string");
+ expect(typeof (data.labelId)).assertEqual("number");
+ expect(typeof (data.iconId)).assertEqual("number");
+ expect(typeof (data.backgroundImg)).assertEqual("string");
+ expect(typeof (data.supportedModes)).assertEqual("number");
+ expect(Array.isArray(data.reqCapabilities)).assertEqual(true);
+ expect(Array.isArray(data.deviceTypes)).assertEqual(true);
+ expect(Array.isArray(data.abilityInfos)).assertEqual(true);
+ expect(typeof (data.moduleName)).assertEqual("string");
+ expect(typeof (data.mainAbilityName)).assertEqual("string");
+ expect(typeof (data.installationFree)).assertEqual("boolean");
+ expect(data.name).assertEqual("com.example.myapplication1");
+ expect(data.description).assertEqual("");
+ expect(data.descriptionId).assertEqual(0);
+ expect(data.icon).assertEqual("$media:icon");
+ expect(data.label).assertEqual("$string:myapplication1_MainAbility");
+ expect(data.labelId).assertEqual(0);
+ expect(data.iconId).assertEqual(0);
+ expect(data.backgroundImg).assertEqual("");
+ expect(data.supportedModes).assertEqual(0);
+
+ expect(data.deviceTypes[0]).assertEqual("phone");
+ checkAbilityInfo(msg,data.abilityInfos[0]);
+
+ expect(data.moduleName).assertEqual("myapplication1")
+ expect(data.mainAbilityName).assertEqual("");
+ expect(data.installationFree).assertEqual(false);
+
+ console.log(msg + "---checkHapModuleInfo End---");
+ }
+
+ function checkAbilityInfo(msg,data) {
+ console.log(msg+ "checkAbilityInfo start " + JSON.stringify(data));
+ console.log(msg+ "checkAbilityInfo bundleName : " + data.bundleName);
+ console.log(msg+ "checkAbilityInfo name : " + data.name);
+ console.log(msg+ "checkAbilityInfo label : " + data.label);
+ console.log(msg+ "checkAbilityInfo description : " + data.description);
+ console.log(msg+ "checkAbilityInfo icon : " + data.icon);
+ console.log(msg+ "checkAbilityInfo descriptionId : " + data.descriptionId);
+ console.log(msg+ "checkAbilityInfo iconId : " + data.iconId);
+ console.log(msg+ "checkAbilityInfo moduleName : " + data.moduleName);
+ console.log(msg+ "checkAbilityInfo process : " + data.process);
+ console.log(msg+ "checkAbilityInfo targetAbility : " + data.targetAbility);
+ console.log(msg+ "checkAbilityInfo backgroundModes : " + data.backgroundModes);
+ console.log(msg+ "checkAbilityInfo isVisible : " + data.isVisible);
+ console.log(msg+ "checkAbilityInfo formEnabled : " + data.formEnabled);
+ console.log(msg+ "checkAbilityInfo type : " + data.type)
+ console.log(msg+ "checkAbilityInfo orientation : " + data.orientation);
+ console.log(msg+ "checkAbilityInfo launchMode : " + data.launchMode);
+ console.log(msg+ "checkAbilityInfo permissions length : " + data.permissions.length);
+ for (var j = 0; j < data.permissions.length; j++) {
+ console.log(msg+ "getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]);
+ }
+ console.log(msg+ "checkAbilityInfo deviceTypes length : " + data.deviceTypes.length);
+ for (var k = 0; k < data.deviceTypes.length; k++) {
+ console.log(msg+ "getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
+ }
+ console.log(msg+ "checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length);
+ for (var i = 0; i < data.deviceCapabilities.length; i++) {
+ console.log(msg+ "getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]);
+ }
+ console.log(msg+ "checkAbilityInfo readPermission : " + data.readPermission);
+ console.log(msg+ "checkAbilityInfo writePermission : " + data.writePermission);
+ console.log(msg+ "checkAbilityInfo formEntity : " + data.formEntity);
+ console.log(msg+ "checkAbilityInfo minFormHeight : " + data.minFormHeight);
+ console.log(msg+ "checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight);
+ console.log(msg+ "checkAbilityInfo minFormWidth : " + data.minFormWidth);
+ console.log(msg+ "checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
+ console.log(msg+ "checkAbilityInfo uri : " + data.uri);
+ console.log(msg+ "checkAbilityInfo labelId : " + data.labelId);
+ console.log(msg+ "checkAbilityInfo subType : " + data.subType);
+ expect(typeof (data)).assertEqual("object");
+ expect(typeof (data.bundleName)).assertEqual("string");
+ expect(typeof (data.name)).assertEqual("string");
+ expect(typeof (data.label)).assertEqual("string");
+ expect(typeof (data.description)).assertEqual("string");
+ expect(typeof (data.icon)).assertEqual("string");
+ expect(typeof (data.labelId)).assertEqual("number");
+ expect(typeof (data.descriptionId)).assertEqual("number");
+ expect(typeof (data.iconId)).assertEqual("number");
+ expect(typeof (data.moduleName)).assertEqual("string");
+ expect(typeof (data.process)).assertEqual("string");
+ expect(typeof (data.targetAbility)).assertEqual("string");
+ expect(typeof (data.backgroundModes)).assertEqual("number");
+ expect(typeof (data.isVisible)).assertEqual("boolean");
+ expect(typeof (data.formEnabled)).assertEqual("boolean");
+ expect(typeof (data.type)).assertEqual("number");
+ expect(typeof (data.subType)).assertEqual("number");
+ expect(typeof (data.orientation)).assertEqual("number");
+ expect(typeof (data.launchMode)).assertEqual("number");
+ expect(Array.isArray(data.permissions)).assertEqual(true);
+ expect(Array.isArray(data.deviceTypes)).assertEqual(true);
+ expect(Array.isArray(data.deviceCapabilities)).assertEqual(true);
+ expect(typeof (data.readPermission)).assertEqual("string");
+ expect(typeof (data.writePermission)).assertEqual("string");
+ expect(typeof (data.applicationInfo)).assertEqual("object");
+ expect(typeof (data.formEntity)).assertEqual("number");
+ expect(typeof (data.minFormHeight)).assertEqual("number");
+ expect(typeof (data.defaultFormHeight)).assertEqual("number");
+ expect(typeof (data.minFormWidth)).assertEqual("number");
+ expect(typeof (data.defaultFormWidth)).assertEqual("number");
+ expect(typeof (data.uri)).assertEqual("string");
+ expect(data.bundleName).assertEqual("com.ohos.acecollaboration");
+ expect(data.name).assertEqual("com.example.myapplication1.MainAbility");
+ expect(data.label).assertEqual("$string:myapplication1_MainAbility");
+ expect(data.description).assertEqual("$string:description_mainability");
+ expect(data.icon).assertEqual("$media:icon");
+ expect(data.descriptionId > 0).assertTrue();
+ expect(data.iconId > 0).assertTrue();
+ expect(data.moduleName).assertEqual("myapplication1");
+ expect(data.process).assertEqual("");
+ expect(data.targetAbility).assertEqual("");
+ expect(data.backgroundModes).assertEqual(0);
+ expect(data.isVisible).assertEqual(true);
+ expect(data.formEnabled).assertEqual(false);
+ expect(data.type).assertEqual(1);
+ expect(data.orientation).assertEqual(0);
+ expect(data.launchMode).assertEqual(1);
+ expect(data.deviceTypes[0]).assertEqual("phone");
+ expect(data.readPermission).assertEqual("");
+ expect(data.writePermission).assertEqual("");
+ checkApplicationInfo(msg,data.applicationInfo);
+ expect(data.formEntity).assertEqual(0);
+ expect(data.minFormHeight).assertEqual(0);
+ expect(data.defaultFormHeight).assertEqual(0);
+ expect(data.minFormWidth).assertEqual(0);
+ expect(data.defaultFormWidth).assertEqual(0);
+ expect(data.uri).assertEqual("");
+ expect(data.labelId > 0).assertTrue();
+ expect(data.subType).assertEqual(0);
+ console.log(msg+ "---checkAbilityInfo End--- ");
+ }
+
+ function checkApplicationInfo(msg,info) {
+ console.log(msg+ "checkApplicationInfo start : " + JSON.stringify(info));
+ console.log(msg+ "checkApplicationInfo name : " + info.name);
+ console.log(msg+ "checkApplicationInfo description : " + info.description);
+ console.log(msg+ "checkApplicationInfo descriptionId : " + info.descriptionId);
+ console.log(msg+ "checkApplicationInfo systemApp : " + info.systemApp);
+ console.log(msg+ "checkApplicationInfo enabled : " + info.enabled);
+ console.log(msg+ "checkApplicationInfo label : " + info.label);
+ console.log(msg+ "checkApplicationInfo labelId : " + info.labelId);
+ console.log(msg+ "checkApplicationInfo icon : " + info.icon);
+ console.log(msg+ "checkApplicationInfo iconId : " + info.iconId);
+ console.log(msg+ "checkApplicationInfo process : " + info.process);
+ console.log(msg+ "checkApplicationInfo supportedModes : " + info.supportedModes);
+ console.log(msg+ "checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
+ for (var j = 0; j < info.moduleSourceDirs.length; j++) {
+ console.log(msg+ "checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
+ }
+ console.log(msg+ "checkApplicationInfo permissions length : " + info.permissions.length);
+ for (var k = 0; k < info.permissions.length; k++) {
+ console.log(msg+ "checkApplicationInfo info.permissions[" + k + "] : " + info.permissions[k]);
+ }
+ console.log(msg+ "checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
+ for (var i = 0; i < info.moduleInfos.length; i++) {
+ console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleName : " + info.moduleInfos[i].moduleName);
+ console.log(msg+ "checkApplicationInfo info.moduleInfos[" + i + "].moduleSourceDir : " + info.moduleInfos[i].moduleSourceDir);
+ }
+ console.log(msg+ "checkApplicationInfo entryDir : " + info.entryDir);
+ expect(typeof (info)).assertEqual("object");
+ expect(typeof (info.name)).assertEqual("string");
+ expect(typeof (info.description)).assertEqual("string");
+ expect(typeof (info.descriptionId)).assertEqual("number");
+ expect(typeof (info.systemApp)).assertEqual("boolean");
+ expect(typeof (info.enabled)).assertEqual("boolean");
+ expect(typeof (info.label)).assertEqual("string");
+ expect(typeof (info.labelId)).assertEqual("string");
+ expect(typeof (info.icon)).assertEqual("string");
+ expect(typeof (info.iconId)).assertEqual("string");
+ expect(typeof (info.process)).assertEqual("string");
+ expect(typeof (info.supportedModes)).assertEqual("number");
+ expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
+ expect(Array.isArray(info.permissions)).assertEqual(true);
+ expect(Array.isArray(info.moduleInfos)).assertEqual(true);
+ expect(typeof (info.entryDir)).assertEqual("string");
+ expect(info.name).assertEqual("com.ohos.acecollaboration");
+ expect(info.description).assertEqual("$string:mainability_description");
+ expect(info.descriptionId > 0).assertTrue();
+ expect(info.systemApp).assertEqual(true);
+ expect(info.enabled).assertEqual(true);
+ expect(info.label).assertEqual("$string:entry_MainAbility");
+ expect(info.icon).assertEqual("$media:icon");
+ expect(info.process).assertEqual("");
+ expect(info.supportedModes).assertEqual(0);
+ if (info.moduleSourceDirs.length == 1){
+ expect(info.moduleInfos[0].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }else if(info.moduleSourceDirs.length == 2) {
+ if (info.moduleInfos[0].moduleName == "myapplication1") {
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication1");
+ expect(info.moduleInfos[1].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }else{
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication2");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication2");
+ expect(info.moduleInfos[1].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }
+ }else {
+ expect(info.moduleInfos[0].moduleName).assertEqual("myapplication1");
+ expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication1");
+ expect(info.moduleInfos[1].moduleName).assertEqual("myapplication2");
+ expect(info.moduleInfos[1].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.example.myapplication2");
+ expect(info.moduleInfos[2].moduleName).assertEqual("entry");
+ expect(info.moduleInfos[2].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ }
+ expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/" +
+ "com.ohos.acecollaboration/com.ohos.acecollaboration");
+ console.log(msg+ "---checkApplicationInfo End--- ");
+ }
+
+ })
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..c69dada1a3f8a111a6cfdb7743f45b8449bee1b2
--- /dev/null
+++ b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "myapplication1_MainAbility",
+ "value": "myapplication1_MainAbility"
+ },
+ {
+ "name": "description_mainability",
+ "value": "eTS_Empty Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/actsabilitymanageretstest/myapplication1/src/main/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/actsabilitymanageretstest/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/actsabilitymanageretstest/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/aafwk/aafwk_standard/actsabilitymanageretstest/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/BUILD.gn b/aafwk/aafwk_standard/amsgetabilityprocessinfo/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..28fe324e3b2dc661f239cc7e9312850902d1a964
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/BUILD.gn
@@ -0,0 +1,21 @@
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+group("amsgetabilityprocessinfo") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "actsprocessmanagejstest:ActsAbilityRunningInfosTest" ]
+ }
+}
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/BUILD.gn b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..3347f21032a6b5c9e05ff8eceb74421932cf094b
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("ActsAbilityRunningInfosTest") {
+ hap_name = "ActsAbilityRunningInfosTest"
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+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/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/Test.json b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..b4c890b9391fe8208e42310ab376b0bda10af6a7
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "120000",
+ "package": "com.example.abilityrunninginfostest",
+ "shell-timeout": "600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsAbilityRunningInfosTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/config.json b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..80c1bad19b4a557e124cdca4920acd08a50aa791
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/config.json
@@ -0,0 +1,107 @@
+{
+ "app": {
+ "bundleName": "com.example.abilityrunninginfostest",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.abilityrunninginfostest",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.example.abilityrunninginfostest.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "singleton",
+ "visible": true
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
+ "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ },
+ {
+ "name":"ohos.permission.REMOVE_CACHE_FILES",
+ "reason":"need use ohos.permission.REMOVE_CACHE_FILES"
+ },
+ {
+ "name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
+ "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
+ },
+ {
+ "name":"ohos.permission.INSTALL_BUNDLE",
+ "reason":"need use ohos.permission.INSTALL_BUNDLE"
+ },
+ {
+ "name":"ohos.permission.MANAGE_MISSIONS",
+ "reason":"need use ohos.permission.MANAGE_MISSIONS"
+ },
+ {
+ "name":"ohos.permission.GET_RUNNING_INFO",
+ "reason":"need use ohos.permission.GET_RUNNING_INFO"
+ },
+ {
+ "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
+ "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
+ },
+ {
+ "name":"ohos.permission.CLEAN_APPLICATION_DATA",
+ "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA"
+ },
+ {
+ "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS",
+ "reason": "need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..042038cfc6360ed972035a85e944904021ffb1d6
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/app.js
@@ -0,0 +1,28 @@
+/*
+ * 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('ActsProcessManageJsTest onCreate');
+ },
+ onDestroy() {
+ console.info('ActsProcessManageJsTest onDestroy');
+ },
+ onShow() {
+ console.info('ActsProcessManageJsTest onShow');
+ },
+ onHide() {
+ console.info('ActsProcessManageJsTest onHide');
+ }
+};
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..cfd4c53e39aecb2d83a0fbdec971eca4041c8a3a
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,14 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
+
+.btn {
+ width: 200px;
+ height: 80px;
+}
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..83c5e0fcabbb1d5df26d69f4a5c2031c1e65b70a
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,6 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
+
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ee3a7077b7d52935d3f70b5cb70e38ea9d0e33f1
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,84 @@
+/*
+ * 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 { Core, ExpectExtend } from 'deccjsunit/index'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: "",
+ testTime: 0
+ },
+ onInit() {
+ console.info('ActsProcessManageJsTest onInit');
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('ActsProcessManageJsTest onShow');
+ console.info('ActsProcessManageJsTest testTime' + this.testTime);
+ if (this.testTime == 0) {
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ core.addService('expect', expectExtend)
+ core.init()
+ const configService = core.getDefaultService('config')
+ this.timeout = 30000;
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ }
+ this.testTime++;
+ },
+ onReady() {
+ console.info('ActsProcessManageJsTest onReady');
+ },
+ onActive() {
+ console.info('ActsProcessManageJsTest onActive');
+ },
+ onInactive() {
+ console.info('ActsProcessManageJsTest onInactive');
+ },
+ onHide() {
+ console.info('ActsProcessManageJsTest onHide');
+ },
+ onDestroy() {
+ console.info('ActsProcessManageJsTest onDestroy');
+ },
+ onBackPress() {
+ console.info('ActsProcessManageJsTest onBackPress');
+ },
+ onNewRequest() {
+ console.info('ActsProcessManageJsTest onNewRequest');
+ },
+ onStartContinuation() {
+ console.info('ActsProcessManageJsTest onStartContinuation');
+ },
+ onSaveData(value) {
+ console.info('ActsProcessManageJsTest onSaveData:' + JSON.stringify(value));
+ },
+ onRestoreData(value) {
+ console.info('ActsProcessManageJsTest onRestoreData:' + JSON.stringify(value));
+ },
+ onCompleteContinuation(code) {
+ console.info('ActsProcessManageJsTest onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ActsProcessManageJsTest onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..03574a36c533357eef7fc0acc5e21af14f4e5f67
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "actsparticleabilitytest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/test/ActsProcessManageJsTest.test.js b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/test/ActsProcessManageJsTest.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e35b0e268777412a295803684ff760f3861a1ca
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/test/ActsProcessManageJsTest.test.js
@@ -0,0 +1,108 @@
+/*
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
+import commonEvent from '@ohos.commonevent'
+import bundle from '@ohos.bundle'
+import missionManager from '@ohos.application.missionManager'
+import abilityManager from '@ohos.application.AbilityManager'
+import featureAbility from '@ohos.ability.featureAbility'
+import appManager from '@ohos.application.AppManager'
+
+describe('ActsAbilityRunningInfosTest', function () {
+
+
+ function checkRunningAbility(name, dataInfo) {
+ for (let i = 0, len = dataInfo.length; i < len; i++) {
+ if (dataInfo[i].ability.abilityName == name) {
+ expect(dataInfo[i].uid).assertLarger(10000);
+ expect(dataInfo[i].pid).assertLarger(500);
+ expect(dataInfo[i].startTime).assertLarger(3000);
+ expect(dataInfo[i].abilityState).assertLarger(0);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ function checkRunningProcess(name, dataInfo) {
+ for (let i = 0, len = dataInfo.length; i < len; i++) {
+ if (dataInfo[i].processName == name) {
+ expect(dataInfo[i].uid).assertLarger(2000);
+ expect(dataInfo[i].pid).assertLarger(500);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * @tc.number: ACTS_getAbilityRunningInfos_0100
+ * @tc.name: Application running ability information query
+ * @tc.desc: Verify applications are started to query getAbilityRunningInfos ability information
+ * (by promise)
+ */
+ it('ACTS_getAbilityRunningInfos_0100', 0, async function (done) {
+ console.log('ACTS_getAbilityRunningInfos_0100==== ACTS_getAbilityRunningInfos_0100 ====>' + JSON.stringify(data))
+ expect(checkRunningAbility('com.ohos.launcher.MainAbility', data)).assertTrue();
+ done();
+ })
+
+ /*
+ * @tc.number: ACTS_getAbilityRunningInfos_0200
+ * @tc.name: Application running ability information query
+ * @tc.desc: Verify applications are started to query getAbilityRunningInfos ability information
+ * (by callback)
+ */
+ it('ACTS_getAbilityRunningInfos_0200', 0, async function (done) {
+ console.log('ACTS_getAbilityRunningInfos_0200===={
+ console.info('====> ACTS_getAbilityRunningInfos_0200 ====>' + JSON.stringify(data))
+ expect(checkRunningAbility('com.ohos.launcher.MainAbility', data)).assertTrue();
+ done();
+ })
+ })
+
+ /*
+ * @tc.number: ACTS_getAbilityRunningInfos_0100
+ * @tc.name: Application running ability information query
+ * @tc.desc: Verify applications are started to query getProcessRunningInfos ability information
+ * (by promise)
+ */
+ it('ACTS_getProcessRunningInfos_0100', 0, async function (done) {
+ console.log('ACTS_getProcessRunningInfos_0100==== ACTS_getProcessRunningInfos_0100 ====>' + JSON.stringify(data))
+ expect(checkRunningProcess('com.ohos.launcher', data)).assertTrue();
+ done();
+ })
+
+ /*
+ * @tc.number: ACTS_getProcessRunningInfos_0200
+ * @tc.name: Application running ability information query
+ * @tc.desc: Verify applications are started to query getProcessRunningInfos ability information
+ * (by callback)
+ */
+ it('ACTS_getProcessRunningInfos_0200', 0, async function (done) {
+ console.log('ACTS_getProcessRunningInfos_0200==== {
+ console.info('====> ACTS_getProcessRunningInfos_0200 ====>' + JSON.stringify(data))
+ expect(checkRunningProcess('com.ohos.launcher', data)).assertTrue();
+ done();
+ })
+ })
+})
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a7c683b3c0d578297e04ff1d997cf048087eec47
--- /dev/null
+++ b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/entry/src/main/js/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+require('./ActsProcessManageJsTest.test.js')
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/amsgetabilityprocessinfo/actsprocessmanagejstest/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/BUILD.gn b/aafwk/aafwk_standard/amsprocessmanageapi7/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..b734289749f59db1a6cabdfbe1b17bb35b9486f3
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/BUILD.gn
@@ -0,0 +1,27 @@
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+group("amsprocessmanageapi7") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [
+ "actsprocessmanagejstest:ActsAmsProcessManageJsTestApi7",
+ "pmsystemappa:ActsAmsProcessManageSystemAppAApi7",
+ "pmsystemappamulti:ActsAmsProcessManageSystemAppAMultiApi7",
+ "pmsystemappb:ActsAmsProcessManageSystemAppBApi7",
+ "pmvendorappa:ActsAmsProcessManageVendorAppAApi7",
+ ]
+ }
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/BUILD.gn b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..8d08bac2de38f6dfab3d9ae8a4f24eb09bcda838
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("ActsAmsProcessManageJsTestApi7") {
+ hap_name = "ActsAmsProcessManageJsTestApi7"
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+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/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/Test.json b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..50d1e3c1426dea433035c4deb62493c82dfc0672
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/Test.json
@@ -0,0 +1,40 @@
+{
+ "description": "Configuration for hjsunit Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "300000",
+ "package": "com.acts.actsprocessmanagejstestapi7",
+ "shell-timeout": "60000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsAmsProcessManageJsTestApi7.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "remount"
+ ]
+ },
+ {
+ "type": "PushKit",
+ "push": [
+ "ActsAmsProcessManageSystemAppAApi7.hap->/data/ActsAmsProcessManageSystemAppAApi7.hap",
+ "ActsAmsProcessManageSystemAppAMultiApi7.hap->/data/ActsAmsProcessManageSystemAppAMultiApi7.hap",
+ "ActsAmsProcessManageSystemAppBApi7.hap->/data/ActsAmsProcessManageSystemAppBApi7.hap",
+ "ActsAmsProcessManageVendorAppAApi7.hap->/data/ActsAmsProcessManageVendorAppAApi7.hap"
+ ]
+
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "chmod 644 /data/*.hap"
+ ]
+ }
+ ]
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/config.json b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..855dbe43597811e92c08dc2ede36c47298350905
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/config.json
@@ -0,0 +1,103 @@
+{
+ "app": {
+ "bundleName": "com.acts.actsprocessmanagejstestapi7",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.acts.actsprocessmanagejstestapi7",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.acts.actsprocessmanagejstestapi7.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "singleton",
+ "visible": true
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
+ "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ },
+ {
+ "name":"ohos.permission.REMOVE_CACHE_FILES",
+ "reason":"need use ohos.permission.REMOVE_CACHE_FILES"
+ },
+ {
+ "name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
+ "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
+ },
+ {
+ "name":"ohos.permission.INSTALL_BUNDLE",
+ "reason":"need use ohos.permission.INSTALL_BUNDLE"
+ },
+ {
+ "name":"ohos.permission.MANAGE_MISSIONS",
+ "reason":"need use ohos.permission.MANAGE_MISSIONS"
+ },
+ {
+ "name":"ohos.permission.GET_RUNNING_INFO",
+ "reason":"need use ohos.permission.GET_RUNNING_INFO"
+ },
+ {
+ "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
+ "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
+ },
+ {
+ "name":"ohos.permission.CLEAN_APPLICATION_DATA",
+ "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..042038cfc6360ed972035a85e944904021ffb1d6
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/app.js
@@ -0,0 +1,28 @@
+/*
+ * 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('ActsProcessManageJsTest onCreate');
+ },
+ onDestroy() {
+ console.info('ActsProcessManageJsTest onDestroy');
+ },
+ onShow() {
+ console.info('ActsProcessManageJsTest onShow');
+ },
+ onHide() {
+ console.info('ActsProcessManageJsTest onHide');
+ }
+};
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..cfd4c53e39aecb2d83a0fbdec971eca4041c8a3a
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,14 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
+
+.btn {
+ width: 200px;
+ height: 80px;
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..83c5e0fcabbb1d5df26d69f4a5c2031c1e65b70a
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,6 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
+
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ee3a7077b7d52935d3f70b5cb70e38ea9d0e33f1
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,84 @@
+/*
+ * 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 { Core, ExpectExtend } from 'deccjsunit/index'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: "",
+ testTime: 0
+ },
+ onInit() {
+ console.info('ActsProcessManageJsTest onInit');
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('ActsProcessManageJsTest onShow');
+ console.info('ActsProcessManageJsTest testTime' + this.testTime);
+ if (this.testTime == 0) {
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ core.addService('expect', expectExtend)
+ core.init()
+ const configService = core.getDefaultService('config')
+ this.timeout = 30000;
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ }
+ this.testTime++;
+ },
+ onReady() {
+ console.info('ActsProcessManageJsTest onReady');
+ },
+ onActive() {
+ console.info('ActsProcessManageJsTest onActive');
+ },
+ onInactive() {
+ console.info('ActsProcessManageJsTest onInactive');
+ },
+ onHide() {
+ console.info('ActsProcessManageJsTest onHide');
+ },
+ onDestroy() {
+ console.info('ActsProcessManageJsTest onDestroy');
+ },
+ onBackPress() {
+ console.info('ActsProcessManageJsTest onBackPress');
+ },
+ onNewRequest() {
+ console.info('ActsProcessManageJsTest onNewRequest');
+ },
+ onStartContinuation() {
+ console.info('ActsProcessManageJsTest onStartContinuation');
+ },
+ onSaveData(value) {
+ console.info('ActsProcessManageJsTest onSaveData:' + JSON.stringify(value));
+ },
+ onRestoreData(value) {
+ console.info('ActsProcessManageJsTest onRestoreData:' + JSON.stringify(value));
+ },
+ onCompleteContinuation(code) {
+ console.info('ActsProcessManageJsTest onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ActsProcessManageJsTest onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..03574a36c533357eef7fc0acc5e21af14f4e5f67
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "actsparticleabilitytest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/test/ActsProcessManageJsTest.test.js b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/test/ActsProcessManageJsTest.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..4b7944c955a3f5b84c82415b7ebb973365ca4cbd
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/test/ActsProcessManageJsTest.test.js
@@ -0,0 +1,1418 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import commonEvent from "@ohos.commonevent"
+import abilitymanager from '@ohos.app.abilitymanager'
+import abilityManager from '@ohos.application.appManager'
+import missionmanager from '@ohos.application.missionManager'
+import featureAbility from '@ohos.ability.featureAbility'
+import file from '@system.file'
+import bundle from '@ohos.bundle'
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
+
+const BUNDLE_PATHS = [['/data/ActsAmsProcessManageSystemAppAApi7.hap',
+ '/data/ActsAmsProcessManageSystemAppAMultiApi7.hap'],
+['/data/ActsAmsProcessManageSystemAppBApi7.hap'],
+['/data/ActsAmsProcessManageVendorAppAApi7.hap']];
+const BUNDLE_NAMES = ['com.acts.pmsystemappaapi7',
+ 'com.acts.pmsystemappbapi7',
+ 'com.acts.pmvendorappaapi7'];
+const PATHS_COUNT = 3;
+const BUNDLE_COUNT = 3;
+
+var subscribeInfo = {
+ events: [
+ "event_from_ProcessManage_SystemAppA",
+ "event_from_ProcessManage_VendorAppA"
+ ],
+};
+var eventFromSystemA = "event_from_ProcessManage_SystemAppA";
+var eventFromVendorA = "event_from_ProcessManage_VendorAppA";
+
+var systemABundleName = "com.acts.pmsystemappaapi7";
+var systemAMultiBundleName = "com.acts.pmsystemappamultiapi7";
+var systemBBundleName = "com.acts.pmsystemappbapi7";
+var vendorABundleName = "com.acts.pmvendorappaapi7";
+var vendorServiceBundleName = "com.acts.pmvendorappserviceapi7";
+var systemAAbilityName = "com.acts.pmsystemappaapi7.MainAbility";
+var systemBAbilityName = "com.acts.pmsystemappbapi7.MainAbility";
+var vendorAAbilityName = "com.acts.pmvendorappaapi7.MainAbility";
+var systemAMultiAbilityName = "com.acts.pmsystemappamultiapi7.MainAbility";
+var vendorServiceAbilityName = "com.acts.pmvendorappserviceapi7.ServiceAbility";
+
+var systemAProcessName = systemABundleName;
+var systemAMultiProcessName = systemAMultiBundleName;
+var systemBProcessName = systemBBundleName;
+var vendorAProcessName = vendorABundleName;
+var uriSystemA = 'internal://cache/../../com.acts.pmsystemappaapi7/';
+var uriSystemB = 'internal://cache/../../com.acts.pmsystemappbapi7/';
+var uriVendorA = 'internal://cache/../../com.acts.pmvendorappaapi7/';
+
+describe('ActsAmsProcessManageJsTestApi7', function () {
+
+ beforeEach(async (done) => {
+ await clearMissionId();
+ setTimeout(async function () {
+ try {
+ let installer = await bundle.getBundleInstaller();
+ console.log('======>ACTS_ProcessManage beforeEach installer<=======' + JSON.stringify(installer));
+ var count = 0;
+ for (let i = 0; i < PATHS_COUNT; i++) {
+ installer.install(BUNDLE_PATHS[i], {
+ userId: 100,
+ installFlag: 1,
+ isKeepData: false
+ }, (err, data) => {
+ count++;
+ console.log('======>ACTS_ProcessManage beforeEach install finish<=======' + err.code);
+ console.log('======>ACTS_ProcessManage beforeEach install finish<=======' + data.status);
+ console.log('======>ACTS_ProcessManage beforeEach install finish<=======' + data.statusMessage);
+ if (count == PATHS_COUNT) {
+ done();
+ }
+ })
+ }
+ } catch (err) {
+ console.log('======>ACTS_ProcessManage beforeEach err<=======' + err);
+ }
+ }, 500);
+ })
+
+ afterEach(async (done) => {
+ setTimeout(async function () {
+ let installer = await bundle.getBundleInstaller();
+ var count = 0;
+ var testMissionId;
+
+ testMissionId = await getMissionId();
+ console.log('======>ACTS_ProcessManage afterEach testMissionId<=======' + testMissionId);
+ await missionmanager.moveMissionToFront(testMissionId);
+
+ for (let i = 0; i < BUNDLE_COUNT; i++) {
+ installer.uninstall(BUNDLE_NAMES[i], {
+ userId: 100,
+ installFlag: 1,
+ isKeepData: false
+ }, (err, data) => {
+ count++;
+ console.log('======>ACTS_ProcessManage afterEach uninstall finish<=======' + err.code);
+ console.log('======>ACTS_ProcessManage afterEach uninstall finish<=======' + data.status);
+ console.log('======>ACTS_ProcessManage afterEach uninstall finish<=======' + data.statusMessage);
+ if (count == BUNDLE_COUNT) {
+ done();
+ }
+ })
+ }
+ }, 500);
+ })
+
+ function getMissionId() {
+ return new Promise(async (resolve, reject) => {
+ var numMax = 1024;
+ var missionId = -1;
+ var missionInfos = await missionmanager.getMissionInfos('', numMax);
+ for (let i = 0; i < missionInfos.length; i++) {
+ console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i]))
+ if ((missionInfos[i].want.abilityName == "com.acts.actsprocessmanagejstestapi7.MainAbility") &&
+ (missionInfos[i].runningState == 0)) {
+ missionId = missionInfos[i].missionId;
+ break;
+ }
+ }
+ console.log('======>getMissionId resolve missionId<=======' + missionId);
+ resolve(missionId);
+ })
+ }
+
+ function clearMissionId() {
+ return new Promise(async (resolve, reject) => {
+ var numMax = 1024;
+ var missionInfos = await missionmanager.getMissionInfos('', numMax);
+ for (let i = 0; i < missionInfos.length; i++) {
+ if ((missionInfos[i].want.bundleName == systemABundleName) ||
+ (missionInfos[i].want.bundleName == systemBBundleName) ||
+ (missionInfos[i].want.bundleName == vendorABundleName) ||
+ (missionInfos[i].want.bundleName == vendorServiceBundleName)) {
+ missionmanager.clearMission(missionInfos[i].missionId, (err, data) => {
+ console.debug("====>ACTS_ProcessManage clearMission id:" + missionInfos[i].missionId);
+ });
+ }
+ }
+ console.log('======>ACTS_ProcessManage clearMission finish<=======');
+ resolve();
+ })
+ }
+
+
+ function checkPromiseExistDelay(processName) {
+ return new Promise(async (resolve, reject) => {
+ setTimeout(async function () {
+ try {
+ var processInfos = await abilitymanager.getActiveProcessInfos();
+ console.debug("====>ACTS_ProcessManage checkPromiseExistDelay processInfos====>"
+ + JSON.stringify(processInfos));
+ resolve(checkProcessExistInInfos(processInfos, processName));
+ } catch (err) {
+ onsole.debug("====>ACTS_ProcessManage checkPromiseExistDelay err====>"
+ + JSON.stringify(err));
+ }
+ }, 2000);
+ });
+ }
+
+ function checkProcessExistInInfos(processInfos, processName) {
+ for (var i = 0; i < processInfos.length; i++) {
+ if (processInfos[i].processName == processName) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ function checkPromiseMissionExistDelay(abilityName) {
+ var numMax = 1024;
+
+ return new Promise(async (resolve, reject) => {
+ try {
+ var missionInfos = await missionmanager.getMissionInfos('', numMax);
+ console.debug("====>ACTS_ProcessManage checkPromiseMissionExistDelay missionInfos====>"
+ + JSON.stringify(missionInfos));
+ resolve(checkMissionExistInInfos(missionInfos, abilityName));
+ } catch (err) {
+ onsole.debug("====>ACTS_ProcessManage checkPromiseMissionExistDelay err====>"
+ + JSON.stringify(err));
+ }
+ });
+ }
+
+ function checkMissionExistInInfos(missionInfos, abilityName) {
+ for (var i = 0; i < missionInfos.length; i++) {
+ if ((missionInfos[i].want.abilityName == abilityName) && (missionInfos[i].runningState == 0)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ function getAppDataPathFileNums(uri, callBack) {
+ setTimeout(async function () {
+
+ file.list({
+ uri: uri,
+ success: function (data) {
+ console.log('====>ActsProcessManageJsTest call list success data ====>' + JSON.stringify(data));
+ callBack(null, data.fileList.length);
+ },
+ fail: function (data, code) {
+ callBack(data, null);
+ console.log('call list failed, code: ' + code + ', data: ' + data);
+ },
+ });
+ }, 2000);
+ }
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_0100
+ * @tc.name: The system application stops itself
+ * @tc.desc: Check the process was killed (by promise)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_0100', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0100 begin');
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "promiseKill",
+ parameters: {
+ testTarget: systemABundleName
+ }
+ },
+ }
+ );
+
+ setTimeout(async function () {
+ var processexist = await checkPromiseExistDelay(systemAProcessName);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0100 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(systemAAbilityName)
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0100 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0100 end');
+ done();
+ }, 4000);
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_0200
+ * @tc.name: The system application stops other system application
+ * @tc.desc: Check the process was killed (by promise)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_0200', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0200 begin');
+ var subscriber;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "promiseKill",
+ parameters: {
+ testTarget: systemBBundleName
+ }
+ },
+ }, (error, data) => {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0200 - startAbility: '
+ + JSON.stringify(error) + ", " + JSON.stringify(data))
+ }
+ );
+ await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0200 Create Subscriber data====>"
+ + data);
+ subscriber = data;
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0200 subscriber====>"
+ + JSON.stringify(subscriber));
+ await commonEvent.subscribe(subscriber, subscribeCallBack);
+ });
+ async function subscribeCallBack(err, data) {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0200 Subscribe CallBack data:====>"
+ + JSON.stringify(data));
+ expect(data.event).assertEqual(eventFromSystemA);
+ expect(data.data).assertEqual('0');
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+
+ }
+ async function unSubscribeCallback() {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0200 UnSubscribe CallBack====>");
+ var processexist = await checkPromiseExistDelay(systemBProcessName);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0200 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(systemBAbilityName)
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0200 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0200 end');
+ done();
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_0300
+ * @tc.name: The system application stops third-party application
+ * @tc.desc: Check the process was killed (by promise)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_0300', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0300 begin');
+ var subscriber;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "promiseKill",
+ parameters: {
+ testTarget: vendorABundleName
+ }
+ },
+ }
+ );
+ await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0300 Create Subscriber data====>"
+ + data);
+ subscriber = data;
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0300 subscriber====>"
+ + JSON.stringify(subscriber));
+ await commonEvent.subscribe(subscriber, subscribeCallBack);
+ });
+ async function subscribeCallBack(err, data) {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0300 Subscribe CallBack data:====>"
+ + JSON.stringify(data));
+ expect(data.event).assertEqual(eventFromSystemA);
+ expect(data.data).assertEqual('0');
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+ }
+
+ async function unSubscribeCallback() {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0300 UnSubscribe CallBack====>");
+ var processexist = await checkPromiseExistDelay(vendorAProcessName);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0300 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(vendorAAbilityName)
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0300 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0300 end');
+ done();
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_0400
+ * @tc.name: The system application stops multiprocess application
+ * @tc.desc: Check the process was killed (by promise)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_0400', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0400 begin');
+ var flagProcessA = 0;
+ var flagProcessAMulti = 0;
+ var flagMissionA = 0;
+ var flagMissionAMulti = 0;
+ var numMax = 1024;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "promiseKill",
+ parameters: {
+ testTarget: systemAMultiAbilityName
+ }
+ },
+ }
+ );
+ setTimeout(async function () {
+
+ var processInfos = await abilitymanager.getActiveProcessInfos();
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0400 processInfos====>"
+ + JSON.stringify(processInfos));
+ for (var i = 0; i < processInfos.length; i++) {
+ if (processInfos[i].processName == systemAProcessName) {
+ flagProcessA++;
+ }
+ if (processInfos[i].processName == systemAMultiProcessName) {
+ flagProcessAMulti++;
+ }
+ }
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0400 flagProcessA====>"
+ + JSON.stringify(flagProcessA));
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0400 flagProcessAMulti====>"
+ + JSON.stringify(flagProcessAMulti));
+ expect(flagProcessA).assertEqual(0);
+ expect(flagProcessAMulti).assertEqual(0);
+
+ var missionInfos = await missionmanager.getMissionInfos('', numMax);
+ console.debug("====>ACTS_ProcessManage checkPromiseMissionExistDelay missionInfos====>"
+ + JSON.stringify(missionInfos));
+ for (var i = 0; i < missionInfos.length; i++) {
+
+ if ((missionInfos[i].want.abilityName == systemAAbilityName)
+ && (missionInfos[i].runningState == 0)) {
+ flagMissionA++;
+ }
+ if ((missionInfos[i].want.abilityName == systemAMultiAbilityName)
+ && (missionInfos[i].runningState == 0)) {
+ flagMissionAMulti++;
+ }
+ }
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0400 flagMissionA====>"
+ + JSON.stringify(flagMissionA));
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0400 flagMissionAMulti====>"
+ + JSON.stringify(flagMissionAMulti));
+ expect(flagMissionA).assertEqual(0);
+ expect(flagMissionAMulti).assertEqual(0);
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0400 end');
+ done();
+ }, 4000);
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_0500
+ * @tc.name: The system application stops itself
+ * @tc.desc: Check the process was killed (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_0500', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0500 begin');
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "asyncKill",
+ parameters: {
+ testTarget: systemABundleName
+ }
+ },
+ }
+ );
+ setTimeout(async function () {
+ var processexist = await checkPromiseExistDelay(systemAProcessName);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0500 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(systemAAbilityName)
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0500 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0500 end');
+ done();
+ }, 4000);
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_0600
+ * @tc.name: The system application stops other system application
+ * @tc.desc: Check the process was killed (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_0600', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0600 begin');
+ var subscriber;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "asyncKill",
+ parameters: {
+ testTarget: systemBBundleName
+ }
+ },
+ }
+ );
+ await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0600 Create Subscriber data====>"
+ + data);
+ subscriber = data;
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0600 subscriber====>"
+ + JSON.stringify(subscriber));
+ await commonEvent.subscribe(subscriber, subscribeCallBack);
+ });
+ async function subscribeCallBack(err, data) {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0600 Subscribe CallBack data:====>"
+ + JSON.stringify(data));
+ expect(data.event).assertEqual(eventFromSystemA);
+ expect(data.data).assertEqual('0');
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+
+ }
+
+ async function unSubscribeCallback() {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0600 UnSubscribe CallBack====>");
+ var processexist = await checkPromiseExistDelay(systemBProcessName);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0600 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(systemBAbilityName)
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0600 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0600 end');
+ done();
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_0700
+ * @tc.name: The system application stops third-party application
+ * @tc.desc: Check the process was killed (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_0700', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0700 begin');
+ var subscriber;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "asyncKill",
+ parameters: {
+ testTarget: vendorABundleName
+ }
+ },
+ }
+ );
+ await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0700 Create Subscriber data====>"
+ + data);
+ subscriber = data;
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0700 subscriber====>"
+ + JSON.stringify(subscriber));
+ await commonEvent.subscribe(subscriber, subscribeCallBack);
+ });
+ async function subscribeCallBack(err, data) {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0700 Subscribe CallBack data:====>"
+ + JSON.stringify(data));
+ expect(data.event).assertEqual(eventFromSystemA);
+ expect(data.data).assertEqual('0');
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+
+ }
+
+ async function unSubscribeCallback() {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0700 UnSubscribe CallBack====>");
+ var processexist = await checkPromiseExistDelay(vendorAProcessName);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0700 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(vendorAAbilityName)
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0700 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0700 end');
+ done();
+
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_0800
+ * @tc.name: The system application stops multiprocess application
+ * @tc.desc: Check the process was killed (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_0800', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0800 begin');
+ var flagProcessA = 0;
+ var flagProcessAMulti = 0;
+ var flagMissionA = 0;
+ var flagMissionAMulti = 0;
+ var numMax = 1024;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "asyncKill",
+ parameters: {
+ testTarget: systemAMultiAbilityName
+ }
+ },
+ }
+ );
+ setTimeout(async function () {
+
+ var processInfos = await abilitymanager.getActiveProcessInfos();
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0800 processInfos====>"
+ + JSON.stringify(processInfos));
+ for (var i = 0; i < processInfos.length; i++) {
+ if (processInfos[i].processName == systemAProcessName) {
+ flagProcessA++;
+ }
+ if (processInfos[i].processName == systemAMultiProcessName) {
+ flagProcessAMulti++;
+ }
+ }
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0800 flagProcessA====>"
+ + JSON.stringify(flagProcessA));
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0800 flagProcessAMulti====>"
+ + JSON.stringify(flagProcessAMulti));
+ expect(flagProcessA).assertEqual(0);
+ expect(flagProcessAMulti).assertEqual(0);
+
+ var missionInfos = await missionmanager.getMissionInfos('', numMax);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0800 missionInfos====>"
+ + JSON.stringify(missionInfos));
+ for (var i = 0; i < missionInfos.length; i++) {
+
+ if ((missionInfos[i].want.abilityName == systemAAbilityName)
+ && (missionInfos[i].runningState == 0)) {
+ flagMissionA++;
+ }
+ if ((missionInfos[i].want.abilityName == systemAMultiAbilityName)
+ && (missionInfos[i].runningState == 0)) {
+ flagMissionAMulti++;
+ }
+ }
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0800 flagMissionA====>"
+ + JSON.stringify(flagMissionA));
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0800 flagMissionAMulti====>"
+ + JSON.stringify(flagMissionAMulti));
+ expect(flagMissionA).assertEqual(0);
+ expect(flagMissionAMulti).assertEqual(0);
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0800 end');
+ done();
+ }, 4000);
+
+ })
+
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_0900
+ * @tc.name: Parameter is null
+ * @tc.desc: Check the result is OK (by promise)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_0900', 0, async function (done) {
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0900 begin');
+ try {
+ var result = await abilityManager.killProcessesByBundleName(null);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0900 null result:====>"
+ + JSON.stringify(result));
+ expect(result == 0).assertEqual(false);
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_0900 end');
+ done();
+ }
+ catch (err) {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_0900 err:====>"
+ + JSON.stringify(err));
+ done();
+ }
+ })
+
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_1000
+ * @tc.name: Parameter is ''
+ * @tc.desc: Check the result is OK (by promise)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_1000', 0, async function (done) {
+
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_1000 begin');
+ try {
+ var result = await abilityManager.killProcessesByBundleName('');
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_1000 '' result:====>"
+ + JSON.stringify(result));
+ expect(result).assertEqual(2097215);
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_1000 end');
+ done();
+ }
+ catch (err) {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_1000 err:====>"
+ + JSON.stringify(err));
+ done();
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_1100
+ * @tc.name: Parameter is undefined
+ * @tc.desc: Check the result is OK (by promise)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_1100', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_1100 begin');
+ try {
+ var result = await abilityManager.killProcessesByBundleName(undefined);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_1100 undefined result:====>"
+ + JSON.stringify(result));
+ expect(result == 0).assertEqual(false);
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_1100 end');
+ done();
+ }
+ catch (err) {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_1100 err:====>"
+ + JSON.stringify(err));
+ done();
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_1200
+ * @tc.name: Stop an application that doesn't exist
+ * @tc.desc: Check the result is OK (by promise)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_1200', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_1200 begin');
+ try {
+ var result = await abilityManager.killProcessesByBundleName("aa.bb.notExist");
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_1200 aa.bb.notExist result:====>"
+ + JSON.stringify(result));
+ expect(result).assertEqual(2097215);
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_1200 end');
+ done();
+ }
+ catch (err) {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_1200 err:====>"
+ + JSON.stringify(err));
+ done();
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_killProcessesByBundleNameFA_1300
+ * @tc.name: Stop an application that exists but is not started
+ * @tc.desc: Check the result is OK (by promise)
+ */
+ it('ACTS_ProcessManage_killProcessesByBundleNameFA_1300', 0, async function (done) {
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_1300 begin');
+ try {
+ var result = await abilityManager.killProcessesByBundleName(systemABundleName);
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_1300 without runnning result:====>"
+ + JSON.stringify(result));
+ expect(result).assertEqual(0);
+ console.log('ACTS_ProcessManage_killProcessesByBundleNameFA_1300 end');
+ done();
+ }
+ catch (err) {
+ console.debug("====>ACTS_ProcessManage_killProcessesByBundleNameFA_1300 err:====>"
+ + JSON.stringify(err));
+ done();
+ }
+ })
+
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_0100
+ * @tc.name: The system application cleans itself
+ * @tc.desc: Check the process was cleaned up (by promise)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_0100', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0100 begin');
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "promiseCleanup",
+ parameters: {
+ testTarget: systemABundleName
+ }
+ },
+ }
+ );
+ setTimeout(async function () {
+ var processexist = await checkPromiseExistDelay(systemAProcessName);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0100 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(systemAAbilityName)
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0100 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ getAppDataPathFileNums(uriSystemA, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0100 getFileNums nums = '
+ + nums);
+ done();
+ });
+ }, 2000);
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_0200
+ * @tc.name: The system application cleans other system application
+ * @tc.desc: Check the process was cleaned up (by promise)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_0200', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0200 begin');
+ var subscriber;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "promiseCleanup",
+ parameters: {
+ testTarget: systemBBundleName
+ }
+ },
+ }
+ );
+ var subscriber = await commonEvent.createSubscriber(subscribeInfo)
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0200 subscriber====>"
+ + JSON.stringify(subscriber));
+ await commonEvent.subscribe(subscriber, subscribeCallBack);
+
+ async function subscribeCallBack(err, data) {
+
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0200 SubscribeCallBack data.event:====>"
+ + JSON.stringify(data.event));
+ expect(data.event).assertEqual(eventFromSystemA);
+ expect(data.data).assertEqual('0');
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+
+ var processexist = await checkPromiseExistDelay(systemBProcessName);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0200 subscribeCallBack processexist:"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+ var missionexist = await checkPromiseMissionExistDelay(systemBAbilityName)
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0200 subscribeCallBack missionexist:"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ getAppDataPathFileNums(uriSystemB, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0200 getFileNums nums = ' + nums);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0200 end');
+ done();
+ });
+ }
+ function unSubscribeCallback() {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0200 UnSubscribe CallBack====>");
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_0300
+ * @tc.name: The system application cleans third-party application
+ * @tc.desc: Check the process was cleaned up (by promise)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_0300', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0300 begin');
+ var subscriber;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "promiseCleanup",
+ parameters: {
+ testTarget: vendorABundleName
+ }
+ },
+ }
+ );
+ var subscriber = await commonEvent.createSubscriber(subscribeInfo)
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0300 subscriber====>"
+ + JSON.stringify(subscriber));
+ await commonEvent.subscribe(subscriber, subscribeCallBack);
+
+ async function subscribeCallBack(err, data) {
+
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0300 SubscribeCallBack data.event:====>"
+ + JSON.stringify(data));
+ expect(data.event).assertEqual(eventFromSystemA);
+ expect(data.data).assertEqual('0');
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+ setTimeout(async function () {
+ var processexist = await checkPromiseExistDelay(vendorAProcessName);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0300 subscribeCallBack processexist:"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+ var missionexist = await checkPromiseMissionExistDelay(vendorAAbilityName)
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0300 subscribeCallBack missionexist:"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+ getAppDataPathFileNums(uriVendorA, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0300 getFileNums nums = ' + nums);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0300 end');
+ done();
+ });
+ }, 6000);
+ }
+ function unSubscribeCallback() {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0300 UnSubscribe CallBack====>");
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_0400
+ * @tc.name: The system application cleans multiprocess application
+ * @tc.desc: Check the process was cleaned up (by promise)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_0400', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0400 begin');
+ var flagProcessA = 0;
+ var flagProcessAMulti = 0;
+ var flagMissionA = 0;
+ var flagMissionAMulti = 0;
+ var numMax = 1024;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "promiseCleanup",
+ parameters: {
+ testTarget: systemAMultiAbilityName
+ }
+ },
+ }
+ );
+ setTimeout(async function () {
+
+ var processInfos = await abilitymanager.getActiveProcessInfos();
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0400 processInfos====>"
+ + JSON.stringify(processInfos));
+ for (var i = 0; i < processInfos.length; i++) {
+ if (processInfos[i].processName == systemAProcessName) {
+ flagProcessA++;
+ }
+ if (processInfos[i].processName == systemAMultiProcessName) {
+ flagProcessAMulti++;
+ }
+ }
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0400 flagProcessA====>"
+ + JSON.stringify(flagProcessA));
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0400 flagProcessAMulti====>"
+ + JSON.stringify(flagProcessAMulti));
+ expect(flagProcessA).assertEqual(0);
+ expect(flagProcessAMulti).assertEqual(0);
+
+ var missionInfos = await missionmanager.getMissionInfos('', numMax);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0400 missionInfos====>"
+ + JSON.stringify(missionInfos));
+ for (var i = 0; i < missionInfos.length; i++) {
+ if ((missionInfos[i].want.abilityName == systemAAbilityName)
+ && (missionInfos[i].runningState == 0)) {
+ flagMissionA++;
+ }
+ if ((missionInfos[i].want.abilityName == systemAMultiAbilityName)
+ && (missionInfos[i].runningState == 0)) {
+ flagMissionAMulti++;
+ }
+ }
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0400 flagMissionA====>"
+ + JSON.stringify(flagMissionA));
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0400 flagMissionAMulti====>"
+ + JSON.stringify(flagMissionAMulti));
+ expect(flagMissionA).assertEqual(0);
+ expect(flagMissionAMulti).assertEqual(0);
+
+ getAppDataPathFileNums(uriSystemA, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0400 getFileNums nums = '
+ + nums);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0400 end');
+ done();
+ });
+ }, 6000);
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_0500
+ * @tc.name: The system application cleans itself
+ * @tc.desc: Check the process was cleaned up (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_0500', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0500 begin');
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "asyncCleanup",
+ parameters: {
+ testTarget: systemABundleName
+ }
+ },
+ }
+ );
+ setTimeout(async function () {
+ var processexist = await checkPromiseExistDelay(systemAProcessName);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0500 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(systemAAbilityName)
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0500 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ getAppDataPathFileNums(uriSystemA, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0500 getFileNums nums = '
+ + nums);
+ done();
+ });
+ }, 6000);
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_0600
+ * @tc.name: The system application cleans other system application
+ * @tc.desc: Check the process was cleaned up (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_0600', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0600 begin');
+ var subscriber;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "asyncCleanup",
+ parameters: {
+ testTarget: systemBBundleName
+ }
+ },
+ }
+ );
+ await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0600 Create Subscriber data====>"
+ + data);
+ subscriber = data;
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0600 subscriber====>"
+ + JSON.stringify(subscriber));
+ await commonEvent.subscribe(subscriber, subscribeCallBack);
+ });
+ async function subscribeCallBack(err, data) {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0600 SubscribeCallBack data:====>"
+ + JSON.stringify(data));
+ expect(data.event).assertEqual(eventFromSystemA);
+ expect(data.data).assertEqual('0');
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+ setTimeout(async function () {
+ var processexist = await checkPromiseExistDelay(systemBProcessName);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0600 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(systemBAbilityName)
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0600 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ getAppDataPathFileNums(uriSystemB, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0600 getFileNums nums = ' + nums);
+
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0600 end');
+ done();
+ });
+ }, 6000);
+ }
+ function unSubscribeCallback() {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0600 UnSubscribe CallBack====>");
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_0700
+ * @tc.name: The system application cleans third-party application
+ * @tc.desc: Check the process was cleaned up (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_0700', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0700 begin');
+ var subscriber;
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "asyncCleanup",
+ parameters: {
+ testTarget: vendorABundleName
+ }
+ },
+ }
+ );
+ await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 Create Subscriber data====>"
+ + data);
+ subscriber = data;
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 subscriber====>"
+ + JSON.stringify(subscriber));
+ await commonEvent.subscribe(subscriber, subscribeCallBack);
+ });
+ async function subscribeCallBack(err, data) {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 SubscribeCallBack data:====>"
+ + JSON.stringify(data));
+ expect(data.event).assertEqual(eventFromSystemA);
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+ setTimeout(async function () {
+ var processexist = await checkPromiseExistDelay(vendorAProcessName);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(vendorAAbilityName)
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+ getAppDataPathFileNums(uriVendorA, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 getFileNums nums = ' + nums);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0700 end');
+ done();
+
+ });
+ }, 6000);
+ }
+ function unSubscribeCallback() {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0700 UnSubscribe CallBack====>");
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_0800
+ * @tc.name: The system application cleans multiprocess application
+ * @tc.desc: Check the process was cleaned up (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_0800', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0800 begin');
+ var flagProcessA = 0;
+ var flagProcessAMulti = 0;
+ var flagMissionA = 0;
+ var flagMissionAMulti = 0;
+ var numMax = 1024;
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "asyncCleanup",
+ parameters: {
+ testTarget: systemAMultiAbilityName
+ }
+ },
+ }
+ );
+ setTimeout(async function () {
+
+ var processInfos = await abilitymanager.getActiveProcessInfos();
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0800 processInfos====>"
+ + JSON.stringify(processInfos));
+ for (var i = 0; i < processInfos.length; i++) {
+ if (processInfos[i].processName == systemAProcessName) {
+ flagProcessA++;
+ }
+ if (processInfos[i].processName == systemAMultiProcessName) {
+ flagProcessAMulti++;
+ }
+ }
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0800 flagProcessA====>"
+ + JSON.stringify(flagProcessA));
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0800 flagProcessAMulti====>"
+ + JSON.stringify(flagProcessAMulti));
+ expect(flagProcessA).assertEqual(0);
+ expect(flagProcessAMulti).assertEqual(0);
+
+ var missionInfos = await missionmanager.getMissionInfos('', numMax);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0800 missionInfos====>"
+ + JSON.stringify(missionInfos));
+ for (var i = 0; i < missionInfos.length; i++) {
+ if ((missionInfos[i].want.abilityName == systemAAbilityName)
+ && (missionInfos[i].runningState == 0)) {
+ flagMissionA++;
+ }
+ if ((missionInfos[i].want.abilityName == systemAMultiAbilityName)
+ && (missionInfos[i].runningState == 0)) {
+ flagMissionAMulti++;
+ }
+ }
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0800 flagMissionA====>"
+ + JSON.stringify(flagMissionA));
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0800 flagMissionAMulti====>"
+ + JSON.stringify(flagMissionAMulti));
+ expect(flagMissionA).assertEqual(0);
+ expect(flagMissionAMulti).assertEqual(0);
+
+ getAppDataPathFileNums(uriSystemA, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_0800 getFileNums nums = '
+ + nums);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0800 end');
+ done();
+ });
+ }, 6000);
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_0900
+ * @tc.name: Parameter is null
+ * @tc.desc: Check the result is OK (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_0900', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0900 begin');
+
+ try {
+ var result = await abilityManager.clearUpApplicationData(null);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0900 null result:====>"
+ + JSON.stringify(result));
+ expect(result == 0).assertEqual(false);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_0900 end');
+ done();
+ }
+ catch (err) {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_0900 err:====>"
+ + JSON.stringify(err));
+ done();
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_1000
+ * @tc.name: Parameter is ''
+ * @tc.desc: Check the result is OK (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_1000', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1000 begin');
+ abilityManager.clearUpApplicationData('', (err, data) => {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1000 '' result:====>"
+ + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1000 end');
+ done();
+ });
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_1100
+ * @tc.name: Parameter is undefined
+ * @tc.desc: Check the result is OK (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_1100', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1100 begin');
+ try {
+ var result = await abilityManager.clearUpApplicationData(undefined);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1100 undefined result:====>"
+ + JSON.stringify(result));
+ expect(result == 0).assertEqual(false);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1100 end');
+ done();
+ }
+ catch (err) {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1100 err:====>"
+ + JSON.stringify(err));
+ done();
+ }
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_1200
+ * @tc.name: Stop an application that doesn't exist
+ * @tc.desc: Check the result is OK (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_1200', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1200 begin');
+ abilityManager.clearUpApplicationData("aa.bb.notExist", (err, data) => {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1200 aa.bb.notExist result:====>"
+ + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1200 end');
+ done();
+ });
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_1300
+ * @tc.name: Stop an application that exists but is not started
+ * @tc.desc: Check the result is OK (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_1300', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1300 begin');
+ abilityManager.clearUpApplicationData(systemABundleName, (err, data) => {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1300 without running result:====>"
+ + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ setTimeout(async function () {
+ getAppDataPathFileNums(uriSystemA, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_1300 getFileNums nums = ' + nums);
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1300 end');
+ done();
+ });
+ }, 4000);
+ });
+ })
+
+ /*
+ * @tc.number: ACTS_ProcessManage_clearUpApplicationDataFA_1400
+ * @tc.name: The system application cleans third-party application for ten times
+ * @tc.desc: Check the process was cleaned up (by AsyncCallback)
+ */
+ it('ACTS_ProcessManage_clearUpApplicationDataFA_1400', 0, async function (done) {
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1400 begin');
+ var subscriber;
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: systemAAbilityName,
+ action: "promiseCleanupTentimes",
+ parameters: {
+ testTarget: vendorABundleName
+ }
+ },
+ }
+ );
+
+ await commonEvent.createSubscriber(subscribeInfo).then(async (data) => {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1400 Create Subscriber data====>"
+ + data);
+ subscriber = data;
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1400 subscriber====>"
+ + JSON.stringify(subscriber));
+ await commonEvent.subscribe(subscriber, subscribeCallBack);
+ });
+
+ async function subscribeCallBack(err, data) {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1400 Subscribe CallBack data:====>"
+ + JSON.stringify(data));
+ expect(data.event).assertEqual(eventFromSystemA);
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+ setTimeout(async function () {
+ var processexist = await checkPromiseExistDelay(vendorAProcessName);
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1400 processexist:====>"
+ + JSON.stringify(processexist));
+ expect(processexist).assertEqual(false);
+
+ var missionexist = await checkPromiseMissionExistDelay(vendorAAbilityName)
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1400 missionexist:====>"
+ + JSON.stringify(missionexist));
+ expect(missionexist).assertEqual(false);
+
+ getAppDataPathFileNums(uriVendorA, async (err, nums) => {
+ expect(err).assertEqual(null);
+ expect(nums).assertEqual(4);
+ console.log('====>ACTS_ProcessManage_clearUpApplicationDataFA_1400 getAppDataPathFileNums nums = '
+ + nums);
+
+ console.log('ACTS_ProcessManage_clearUpApplicationDataFA_1400 end');
+ done();
+ });
+ }, 15000);
+ }
+ function unSubscribeCallback() {
+ console.debug("====>ACTS_ProcessManage_clearUpApplicationDataFA_1400 UnSubscribe CallBack====>");
+ }
+ })
+})
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a7c683b3c0d578297e04ff1d997cf048087eec47
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/entry/src/main/js/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+require('./ActsProcessManageJsTest.test.js')
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/actsprocessmanagejstest/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/BUILD.gn b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..31dc26c90acd3db562c86c8b041347e7bb55f94a
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/BUILD.gn
@@ -0,0 +1,34 @@
+# 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_hap("ActsAmsProcessManageSystemAppAApi7") {
+ hap_name = "ActsAmsProcessManageSystemAppAApi7"
+ hap_profile = "./src/main/config.json"
+ subsystem_name = XTS_SUITENAME
+ final_hap_path =
+ "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
+ testonly = true
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/js/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/config.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..829eb86b1b8e255346717f35efb40221fe93a3df
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/config.json
@@ -0,0 +1,107 @@
+{
+ "app": {
+ "bundleName": "com.acts.pmsystemappaapi7",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {
+ "default": {
+ "process": "com.acts.pmsystemappaapi7"
+ }
+ },
+ "module": {
+ "package": "com.acts.pmsystemappaapi7",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.acts.pmsystemappaapi7.MainAbility",
+ "visible": true,
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
+ "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ },
+ {
+ "name":"ohos.permission.REMOVE_CACHE_FILES",
+ "reason":"need use ohos.permission.REMOVE_CACHE_FILES"
+ },
+ {
+ "name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
+ "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
+ },
+ {
+ "name":"ohos.permission.INSTALL_BUNDLE",
+ "reason":"need use ohos.permission.INSTALL_BUNDLE"
+ },
+ {
+ "name":"ohos.permission.MANAGE_MISSIONS",
+ "reason":"need use ohos.permission.MANAGE_MISSIONS"
+ },
+ {
+ "name":"ohos.permission.GET_RUNNING_INFO",
+ "reason":"need use ohos.permission.GET_RUNNING_INFO"
+ },
+ {
+ "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
+ "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
+ },
+ {
+ "name":"ohos.permission.CLEAN_APPLICATION_DATA",
+ "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/app.js b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cbcbab28325171fef09134ede1173011a95e91d7
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/app.js
@@ -0,0 +1,28 @@
+/*
+ * 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('ProcessManageSystemAppA onCreate');
+ },
+ onDestroy() {
+ console.info('ProcessManageSystemAppA onDestroy');
+ },
+ onShow() {
+ console.info('ProcessManageSystemAppA onShow');
+ },
+ onHide() {
+ console.info('ProcessManageSystemAppA onHide');
+ }
+};
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ac65f898986eb9bc0966f0ab86ca766b8bded579
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/default/pages/index/index.js
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import commonEvent from '@ohos.commonevent'
+import abilityManager from '@ohos.application.appManager'
+import featureAbility from '@ohos.ability.featureability'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+var subscribeInfo = {
+ events: ["event_from_ProcessManage_SystemTest",
+ "event_SystemAppBToSystemAppA",
+ "event_VendorAppAToSystemAppA",
+ "event_SystemAppAMultiToSystemAppA",
+ "event_VendorAppServiceToSystemAppA"
+ ],
+};
+var publishEventName = "event_from_ProcessManage_SystemAppA";
+var eventFromSystemAMulti = "event_SystemAppAMultiToSystemAppA";
+var testAction;
+var testTarget;
+var subscriber;
+var systemABundleName = "com.acts.pmsystemappaapi7";
+var systemBBundleName = "com.acts.pmsystemappbapi7";
+var vendorABundleName = "com.acts.pmvendorappaapi7";
+var systemBAbilityName = "com.acts.pmsystemappbapi7.MainAbility";
+var vendorAAbilityName = "com.acts.pmvendorappaapi7.MainAbility";
+var multiAAbilityName = "com.acts.pmsystemappamultiapi7.MainAbility";
+
+function onReceivedPublishCallBack() {
+ console.log("ACTS_ProcessManage SystemAppA onReceivedPublishCallBack");
+}
+
+function publishResultEvent(testResult) {
+ console.log("ACTS_ProcessManage SystemAppA publishResultEvent testAction:" + testAction);
+ console.log("ACTS_ProcessManage SystemAppA publishResultEvent testTarget:" + testTarget);
+ console.log("ACTS_ProcessManage SystemAppA publishResultEvent testResult:" + testResult);
+ let publishData = { data: testResult.toString() };
+ console.log("ACTS_ProcessManage SystemAppA publishResultEvent publishData:"
+ + JSON.stringify(publishData));
+ commonEvent.publish(publishEventName, publishData, onReceivedPublishCallBack);
+
+}
+function onReceivedHandleCallback(err, data) {
+ publishResultEvent(data);
+ console.log("ACTS_ProcessManage SystemAppA onReceivedHandleCallback data:"
+ + JSON.stringify(data));
+}
+
+async function onShowProcess() {
+
+ var abilityWant = await featureAbility.getWant();
+ console.log("ACTS_ProcessManage SystemAppA onShowProcess abilityWant:"
+ + JSON.stringify(abilityWant));
+ testAction = abilityWant.action;
+ console.log("ACTS_ProcessManage SystemAppA onShowProcess testAction:" + testAction);
+ testTarget = abilityWant.parameters.testTarget;
+ console.log("ACTS_ProcessManage SystemAppA onShowProcess testTarget:" + testTarget);
+
+
+ if (testTarget == systemABundleName) {
+
+ if (testAction == "promiseKill") {
+ console.log("ACTS_ProcessManage SystemAppA onShowProcess testAction:" + testAction);
+ var result = await abilityManager.killProcessesByBundleName(testTarget);
+ console.log("ACTS_ProcessManage SystemAppA onShowProcess result:" + result);
+ publishResultEvent(result);
+ } else if (testAction == "asyncKill") {
+ console.log("ACTS_ProcessManage SystemAppA onShowProcess testAction:" + testAction);
+ abilityManager.killProcessesByBundleName(testTarget, onReceivedHandleCallback);
+ } else if (testAction == "promiseCleanup") {
+ console.log("ACTS_ProcessManage SystemAppA onShowProcess testAction:" + testAction);
+ var result = await abilityManager.clearUpApplicationData(testTarget);
+ console.log("ACTS_ProcessManage SystemAppA onShowProcess result:" + result);
+ publishResultEvent(result);
+ } else if (testAction == "asyncCleanup") {
+ console.log("ACTS_ProcessManage SystemAppA onShowProcess testAction:" + testAction);
+ abilityManager.clearUpApplicationData(testTarget, onReceivedHandleCallback);
+ }
+
+ }
+ else {
+ try {
+ subscriber = await commonEvent.createSubscriber(subscribeInfo)
+ console.debug("ACTS_ProcessManage SystemAppA onShowProcess subscriber:"
+ + JSON.stringify(subscriber));
+ commonEvent.subscribe(subscriber, subscribeCallBack);
+ } catch (err) {
+ console.debug("ACTS_ProcessManage SystemAppA onShowProcess err:" + err);
+ }
+
+ if (testTarget == systemBBundleName) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemBBundleName,
+ abilityName: systemBAbilityName,
+ },
+ }
+ );
+ }
+ else if (testTarget == vendorABundleName) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: vendorABundleName,
+ abilityName: vendorAAbilityName,
+ },
+ }
+ );
+ }
+ else if (testTarget == multiAAbilityName) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ bundleName: systemABundleName,
+ abilityName: multiAAbilityName,
+ },
+ }
+ );
+ }
+ }
+
+ async function subscribeCallBack(err, data) {
+ console.debug("ACTS_ProcessManage SystemAppA subscribeCallBack SubscribeCallBack data:====>"
+ + JSON.stringify(data));
+ console.debug("ACTS_ProcessManage SystemAppA subscribeCallBack SubscribeCallBack data.event:====>"
+ + JSON.stringify(data.event));
+
+ if (data.event == eventFromSystemAMulti) {
+ testTarget = systemABundleName;
+ }
+
+ if (testAction == "promiseKill") {
+ console.log("ACTS_ProcessManage SystemAppA subscribeCallBack testAction:" + testAction);
+ var result = await abilityManager.killProcessesByBundleName(testTarget);
+ console.log("ACTS_ProcessManage SystemAppA subscribeCallBack result:" + result);
+ publishResultEvent(result);
+ } else if (testAction == "asyncKill") {
+ console.log("ACTS_ProcessManage SystemAppA subscribeCallBack testAction:" + testAction);
+ await abilityManager.killProcessesByBundleName(testTarget, onReceivedHandleCallback);
+ } else if (testAction == "promiseCleanup") {
+ console.log("ACTS_ProcessManage SystemAppA subscribeCallBack testAction:" + testAction);
+ var result = await abilityManager.clearUpApplicationData(testTarget);
+ console.log("ACTS_ProcessManage SystemAppA subscribeCallBack result:" + result);
+ publishResultEvent(result);
+ } else if (testAction == "asyncCleanup") {
+ console.log("ACTS_ProcessManage SystemAppA subscribeCallBack testAction:" + testAction);
+ await abilityManager.clearUpApplicationData(testTarget, onReceivedHandleCallback);
+ } else if (testAction == "promiseCleanupTentimes") {
+ for (var i = 0; i < 10; i++) {
+ console.log("ACTS_ProcessManage SystemAppA subscribeCallBack testAction:" + testAction);
+ var result = await abilityManager.clearUpApplicationData(testTarget);
+ console.log("ACTS_ProcessManage SystemAppA subscribeCallBack result:" + result);
+ }
+ publishResultEvent(result);
+ }
+ }
+
+}
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ console.info('ACTS_ProcessManage SystemAppA onInit');
+ this.title = "ProcessManageSystemAppA";
+ },
+ onReady() {
+ console.info('ACTS_ProcessManage SystemAppA onReady');
+ onShowProcess();
+ },
+ onActive() {
+ console.info('ACTS_ProcessManage SystemAppA onActive');
+ },
+ onShow() {
+ console.info('ACTS_ProcessManage SystemAppA onShow');
+
+ },
+ onInactive() {
+ console.info('ACTS_ProcessManage SystemAppA onInactive');
+ },
+ onHide() {
+ console.info('ACTS_ProcessManage SystemAppA onHide');
+ },
+ onDestroy() {
+ console.info('ACTS_ProcessManage SystemAppA onDestroy');
+ },
+ onBackPress() {
+ console.info('ACTS_ProcessManage SystemAppA onBackPress');
+ },
+ onNewRequest() {
+ console.info('ACTS_ProcessManage SystemAppA onNewRequest');
+ },
+ onStartContinuation() {
+ console.info('ACTS_ProcessManage SystemAppA onStartContinuation');
+ },
+ onSaveData(value) {
+ console.info('ACTS_ProcessManage SystemAppA onSaveData:' + JSON.stringify(value));
+ },
+ onRestoreData(value) {
+ console.info('ACTS_ProcessManage SystemAppA onRestoreData:' + JSON.stringify(value));
+ },
+ onCompleteContinuation(code) {
+ console.info('ACTS_ProcessManage SystemAppA onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ACTS_ProcessManage SystemAppA onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..fd60cdefa929070f1798c6e36f0502f1e1e219a4
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "particlestartability"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappa/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/BUILD.gn b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..934d06d652eae1629b8150a3abd120a17391645c
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/BUILD.gn
@@ -0,0 +1,34 @@
+# 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_hap("ActsAmsProcessManageSystemAppAMultiApi7") {
+ hap_name = "ActsAmsProcessManageSystemAppAMultiApi7"
+ hap_profile = "./src/main/config.json"
+ subsystem_name = XTS_SUITENAME
+ final_hap_path =
+ "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
+ testonly = true
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/js/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/config.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..fcc970b486ca7375903bb2b247545043d1d84198
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/config.json
@@ -0,0 +1,107 @@
+{
+ "app": {
+ "bundleName": "com.acts.pmsystemappaapi7",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {
+ "default": {
+ "process": "com.acts.pmsystemappamultiapi7"
+ }
+ },
+ "module": {
+ "package": "com.acts.pmsystemappamultiapi7",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "secondEntry",
+ "moduleType": "feature"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.acts.pmsystemappamultiapi7.MainAbility",
+ "visible": true,
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
+ "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ },
+ {
+ "name":"ohos.permission.REMOVE_CACHE_FILES",
+ "reason":"need use ohos.permission.REMOVE_CACHE_FILES"
+ },
+ {
+ "name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
+ "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
+ },
+ {
+ "name":"ohos.permission.INSTALL_BUNDLE",
+ "reason":"need use ohos.permission.INSTALL_BUNDLE"
+ },
+ {
+ "name":"ohos.permission.MANAGE_MISSIONS",
+ "reason":"need use ohos.permission.MANAGE_MISSIONS"
+ },
+ {
+ "name":"ohos.permission.GET_RUNNING_INFO",
+ "reason":"need use ohos.permission.GET_RUNNING_INFO"
+ },
+ {
+ "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
+ "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
+ },
+ {
+ "name":"ohos.permission.CLEAN_APPLICATION_DATA",
+ "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/app.js b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..5d3012c7d6777f4b04710913de6f1aa718fa8cc9
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/app.js
@@ -0,0 +1,28 @@
+/*
+ * 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('ProcessManageSystemAppB onCreate');
+ },
+ onDestroy() {
+ console.info('ProcessManageSystemAppB onDestroy');
+ },
+ onShow() {
+ console.info('ProcessManageSystemAppB onShow');
+ },
+ onHide() {
+ console.info('ProcessManageSystemAppB onHide');
+ }
+};
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..9420ad20ef1d46228f20092685359f0ff00ac0d4
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/default/pages/index/index.js
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import commonEvent from '@ohos.commonevent'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+var publishEventName = "event_SystemAppAMultiToSystemAppA";
+
+function onReceivedPublishCallBack() {
+ console.log("ACTS_ProcessManage SystemAppAMulti onReceivedPublishCallBack");
+}
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onInit');
+ this.title = "ACTS_ProcessManage SystemAppAMulti";
+ },
+ onReady() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onReady');
+ commonEvent.publish(publishEventName,onReceivedPublishCallBack);
+ },
+ onActive() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onActive');
+ },
+ onShow() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onShow');
+ },
+ onInactive() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onInactive');
+ },
+ onHide() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onHide');
+ },
+ onDestroy() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onDestroy');
+ },
+ onBackPress() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onBackPress');
+ },
+ onNewRequest() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onNewRequest');
+ },
+ onStartContinuation() {
+ console.info('ACTS_ProcessManage SystemAppAMulti onStartContinuation');
+ },
+ onSaveData(value) {
+ console.info('ACTS_ProcessManage SystemAppAMulti onSaveData:' + JSON.stringify(value));
+ },
+ onRestoreData(value) {
+ console.info('ACTS_ProcessManage SystemAppAMulti onRestoreData:' + JSON.stringify(value));
+ },
+ onCompleteContinuation(code) {
+ console.info('ACTS_ProcessManage SystemAppAMulti onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ACTS_ProcessManage SystemAppAMulti onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..fd60cdefa929070f1798c6e36f0502f1e1e219a4
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "particlestartability"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappamulti/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/BUILD.gn b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..8ae53eed564a3118ff804d20485b3c2e6de68813
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/BUILD.gn
@@ -0,0 +1,34 @@
+# 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_hap("ActsAmsProcessManageSystemAppBApi7") {
+ hap_name = "ActsAmsProcessManageSystemAppBApi7"
+ hap_profile = "./src/main/config.json"
+ subsystem_name = XTS_SUITENAME
+ final_hap_path =
+ "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
+ testonly = true
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/js/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/config.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..9cc2e488d8c97b09a51d5cc8939f2fda9784da94
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/config.json
@@ -0,0 +1,87 @@
+{
+ "app": {
+ "bundleName": "com.acts.pmsystemappbapi7",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.acts.pmsystemappbapi7",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.acts.pmsystemappbapi7.MainAbility",
+ "visible": true,
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
+ "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ },
+ {
+ "name":"ohos.permission.REMOVE_CACHE_FILES",
+ "reason":"need use ohos.permission.REMOVE_CACHE_FILES"
+ },
+ {
+ "name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
+ "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
+ },
+ {
+ "name":"ohos.permission.INSTALL_BUNDLE",
+ "reason":"need use ohos.permission.INSTALL_BUNDLE"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/app.js b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..5d3012c7d6777f4b04710913de6f1aa718fa8cc9
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/app.js
@@ -0,0 +1,28 @@
+/*
+ * 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('ProcessManageSystemAppB onCreate');
+ },
+ onDestroy() {
+ console.info('ProcessManageSystemAppB onDestroy');
+ },
+ onShow() {
+ console.info('ProcessManageSystemAppB onShow');
+ },
+ onHide() {
+ console.info('ProcessManageSystemAppB onHide');
+ }
+};
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..afb29461087565d6a77f26ffab84831de1123955
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/default/pages/index/index.js
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import commonEvent from '@ohos.commonevent'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+var publishEventName = "event_SystemAppBToSystemAppA";
+
+function onReceivedPublishCallBack() {
+ console.log("ACTS_ProcessManage SystemAppB onReceivedPublishCallBack");
+}
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ console.info('ACTS_ProcessManage SystemAppB onInit');
+ this.title = "ACTS_ProcessManage SystemAppB";
+ },
+ onReady() {
+ console.info('ACTS_ProcessManage SystemAppB onReady');
+ commonEvent.publish(publishEventName,onReceivedPublishCallBack);
+ },
+ onActive() {
+ console.info('ACTS_ProcessManage SystemAppB onActive');
+ },
+ onShow() {
+ console.info('ACTS_ProcessManage SystemAppB onShow');
+ },
+ onInactive() {
+ console.info('ACTS_ProcessManage SystemAppB onInactive');
+ },
+ onHide() {
+ console.info('ACTS_ProcessManage SystemAppB onHide');
+ },
+ onDestroy() {
+ console.info('ACTS_ProcessManage SystemAppB onDestroy');
+ },
+ onBackPress() {
+ console.info('ACTS_ProcessManage SystemAppB onBackPress');
+ },
+ onNewRequest() {
+ console.info('ACTS_ProcessManage SystemAppB onNewRequest');
+ },
+ onStartContinuation() {
+ console.info('ACTS_ProcessManage SystemAppB onStartContinuation');
+ },
+ onSaveData(value) {
+ console.info('ACTS_ProcessManage SystemAppB onSaveData:' + JSON.stringify(value));
+ },
+ onRestoreData(value) {
+ console.info('ACTS_ProcessManage SystemAppB onRestoreData:' + JSON.stringify(value));
+ },
+ onCompleteContinuation(code) {
+ console.info('ACTS_ProcessManage SystemAppB onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ACTS_ProcessManage SystemAppB onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..fd60cdefa929070f1798c6e36f0502f1e1e219a4
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "particlestartability"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/pmsystemappb/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/BUILD.gn b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..37f7f37103be4789ce3856cb73a6b3778ffab064
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/BUILD.gn
@@ -0,0 +1,34 @@
+# 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_hap("ActsAmsProcessManageVendorAppAApi7") {
+ hap_name = "ActsAmsProcessManageVendorAppAApi7"
+ hap_profile = "./src/main/config.json"
+ subsystem_name = XTS_SUITENAME
+ final_hap_path =
+ "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
+ testonly = true
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/js/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..f06e218defa7f707e22a3890903c574e1c498217
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/config.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..38a8588558fc0b664a90d8a23d9386d87b1d9f93
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/config.json
@@ -0,0 +1,61 @@
+{
+ "app": {
+ "bundleName": "com.acts.pmvendorappaapi7",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.acts.pmvendorappaapi7",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.acts.pmvendorappaapi7.MainAbility",
+ "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/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/app.js b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5cd374c44f4090c18d007979a6fe3b89f229a57
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/app.js
@@ -0,0 +1,28 @@
+/*
+ * 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('ProcessManageVendorAppA onCreate');
+ },
+ onDestroy() {
+ console.info('ProcessManageVendorAppA onDestroy');
+ },
+ onShow() {
+ console.info('ProcessManageVendorAppA onShow');
+ },
+ onHide() {
+ console.info('ProcessManageVendorAppA onHide');
+ }
+};
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..cf78782112855a55f0fd50bc2d7ca055bd6cbdd5
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/default/pages/index/index.js
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import commonEvent from '@ohos.commonevent'
+import abilityManager from '@ohos.application.appManager'
+import featureAbility from '@ohos.ability.featureability'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+var publishEventName = "event_VendorAppAToSystemAppA";
+var publishEventNameVendor = "event_from_ProcessManage_VendorAppA";
+var testAction;
+var testTarget;
+
+function onReceivedPublishCallBack() {
+ console.log("ACTS_ProcessManage VendorAppA onReceivedPublishCallBack");
+}
+
+function onReceivedHandleCallback(err, data) {
+ console.log("ACTS_ProcessManage VendorAppA onReceivedHandleCallback JSON.stringify data:"
+ + JSON.stringify(data));
+ console.log("ACTS_ProcessManage VendorAppA onReceivedHandleCallback data:"
+ + data);
+ console.log("ACTS_ProcessManage VendorAppA onReceivedHandleCallback err:"
+ + err);
+ commonEvent.publish(publishEventNameVendor,onReceivedPublishCallBack);
+}
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ console.info('ACTS_ProcessManage VendorAppA onInit');
+ this.title = "ACTS_ProcessManage VendorAppA";
+ },
+ async onReady() {
+ console.info('ACTS_ProcessManage VendorAppA onReady');
+ var abilityWant = await featureAbility.getWant();
+ console.log("ACTS_ProcessManage VendorAppA onShow abilityWant:"
+ + JSON.stringify(abilityWant));
+ testAction = abilityWant.action;
+ console.log("ACTS_ProcessManage VendorAppA onShow testAction:" + testAction);
+ testTarget = abilityWant.parameters.testTarget;
+ console.log("ACTS_ProcessManage VendorAppA onShow testTarget:" + testTarget);
+ if (testAction == 'thirdpartykill') {
+ console.log("ACTS_ProcessManage VendorAppA onForeground testAction:" + testAction);
+ appManager.killProcessesByBundleName(testTarget, onReceivedHandleCallback);
+ }
+ if (testAction == 'thirdpartyclear') {
+ console.log("ACTS_ProcessManage VendorAppA onForeground testAction:" + testAction);
+ appManager.clearUpApplicationData(testTarget, onReceivedHandleCallback);
+ }
+ else{
+ commonEvent.publish(publishEventName, onReceivedPublishCallBack);
+ }
+
+ },
+ onActive() {
+ console.info('ACTS_ProcessManage VendorAppA onActive');
+ },
+ onShow() {
+ console.info('ACTS_ProcessManage VendorAppA onShow');
+ },
+ onInactive() {
+ console.info('ACTS_ProcessManage VendorAppA onInactive');
+ },
+ onHide() {
+ console.info('ACTS_ProcessManage VendorAppA onHide');
+ },
+ onDestroy() {
+ console.info('ACTS_ProcessManage VendorAppA onDestroy');
+ },
+ onBackPress() {
+ console.info('ACTS_ProcessManage VendorAppA onBackPress');
+ },
+ onNewRequest() {
+ console.info('ACTS_ProcessManage VendorAppA onNewRequest');
+ },
+ onStartContinuation() {
+ console.info('ACTS_ProcessManage VendorAppA onStartContinuation');
+ },
+ onSaveData(value) {
+ console.info('ACTS_ProcessManage VendorAppA onSaveData:' + JSON.stringify(value));
+ },
+ onRestoreData(value) {
+ console.info('ACTS_ProcessManage VendorAppA onRestoreData:' + JSON.stringify(value));
+ },
+ onCompleteContinuation(code) {
+ console.info('ACTS_ProcessManage VendorAppA onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ACTS_ProcessManage VendorAppA onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..fd60cdefa929070f1798c6e36f0502f1e1e219a4
--- /dev/null
+++ b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "particlestartability"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/amsprocessmanageapi7/pmvendorappa/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/BUILD.gn b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..25a9b80478ab8a52ee65201d7664943b37d3d66f
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/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_hap("ActslanguageconfigAppATest") {
+ hap_name = "ActslanguageconfigAppATest"
+ hap_profile = "./src/main/config.json"
+ subsystem_name = XTS_SUITENAME
+ final_hap_path =
+ "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
+ testonly = true
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/js/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/signature/openharmony_sx.p7b differ
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/config.json b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..2c3e93c92637459c41f4be0798fb65c6b3bae4b1
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/config.json
@@ -0,0 +1,87 @@
+{
+ "app": {
+ "bundleName": "com.example.actslanguageconfigappatest",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.actslanguageconfigappatest",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.example.actslanguageconfigappatest.MainAbility",
+ "visible": true,
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
+ "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ },
+ {
+ "name":"ohos.permission.REMOVE_CACHE_FILES",
+ "reason":"need use ohos.permission.REMOVE_CACHE_FILES"
+ },
+ {
+ "name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
+ "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
+ },
+ {
+ "name":"ohos.permission.INSTALL_BUNDLE",
+ "reason":"need use ohos.permission.INSTALL_BUNDLE"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/app.js b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..5d3012c7d6777f4b04710913de6f1aa718fa8cc9
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/app.js
@@ -0,0 +1,28 @@
+/*
+ * 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('ProcessManageSystemAppB onCreate');
+ },
+ onDestroy() {
+ console.info('ProcessManageSystemAppB onDestroy');
+ },
+ onShow() {
+ console.info('ProcessManageSystemAppB onShow');
+ },
+ onHide() {
+ console.info('ProcessManageSystemAppB onHide');
+ }
+};
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e91d102285d362b9d01077e065ed95986f0fb531
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/default/pages/index/index.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import commonEvent from '@ohos.commonevent'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+function onReceivedPublishCallBack(){
+ console.log("========Publish CallBack UpdateLanguageFinish========");
+}
+
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ console.info('ACTS_ProcessManage SystemAppB onInit');
+ this.title = "ACTS_ProcessManage SystemAppB";
+ },
+ onReady() {
+ console.info('ACTS_ProcessManage SystemAppB onReady');
+ commonEvent.publish('UpdateLanguageFinish',onReceivedPublishCallBack);
+ },
+ onActive() {
+ console.info('ACTS_ProcessManage SystemAppB onActive');
+ },
+ onShow() {
+ console.info('ACTS_ProcessManage SystemAppB onShow');
+ },
+
+ onDestroy() {
+ console.info('ACTS_ProcessManage SystemAppB onDestroy');
+ },
+ onConfigurationUpdated(config) {
+ console.log("Acts_LanguageConfigAppA onConfigurationUpdated called" + JSON.stringify(config));
+ console.log("Acts_LanguageConfigAppA configuration:" +
+ JSON.stringify(globalThis.abilityContext.configuration));
+
+ },
+ onCompleteContinuation(code) {
+ console.info('ACTS_ProcessManage SystemAppB onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ACTS_ProcessManage SystemAppB onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..fd60cdefa929070f1798c6e36f0502f1e1e219a4
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "particlestartability"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/lanuageConfigapi7/ActslanguageconfigAppATest/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/BUILD.gn b/aafwk/aafwk_standard/lanuageConfigapi7/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..a53cd4af2267fa3b0168b41e7235996cba09e800
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/BUILD.gn
@@ -0,0 +1,24 @@
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+group("lanuageConfigapi7") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [
+ "ActslanguageconfigAppATest:ActslanguageconfigAppATest",
+ "LanguageConfigTestApi7:LanguageConfigTestApi7",
+ ]
+ }
+}
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/BUILD.gn b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..624e5f61383e7dde82af2ba9be53e958e2aafc9c
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("LanguageConfigTestApi7") {
+ hap_name = "LanguageConfigTestApi7"
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+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/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/Test.json b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..8a59d111e65dda5a65a836160e5a3a70b1e8fb03
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/Test.json
@@ -0,0 +1,38 @@
+
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "120000",
+ "package": "com.example.languageconfigtestapi7",
+ "shell-timeout": "60000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "LanguageConfigTestApi7.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "remount",
+ "mkdir /data/test"
+ ]
+ },
+ {
+ "type": "PushKit",
+ "push": [
+ "ActslanguageconfigAppATest.hap->/data/test/ActslanguageconfigAppATest.hap"]
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "chmod 777 /data/test/*.hap"
+ ]
+ }
+ ]
+}
+
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/config.json b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..8e9b5b2a5a2fef425fe191a4bb191db69249c5f7
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/config.json
@@ -0,0 +1,87 @@
+{
+ "app": {
+ "bundleName": "com.example.languageconfigtestapi7",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.languageconfigtestapi7",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.example.languageconfigtestapi7.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "singleton",
+ "visible": true
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
+ "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ },
+ {
+ "name":"ohos.permission.REMOVE_CACHE_FILES",
+ "reason":"need use ohos.permission.REMOVE_CACHE_FILES"
+ },
+ {
+ "name":"ohos.permission.LISTEN_BUNDLE_CHANGE",
+ "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
+ },
+ {
+ "name":"ohos.permission.INSTALL_BUNDLE",
+ "reason":"need use ohos.permission.INSTALL_BUNDLE"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..042038cfc6360ed972035a85e944904021ffb1d6
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/app.js
@@ -0,0 +1,28 @@
+/*
+ * 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('ActsProcessManageJsTest onCreate');
+ },
+ onDestroy() {
+ console.info('ActsProcessManageJsTest onDestroy');
+ },
+ onShow() {
+ console.info('ActsProcessManageJsTest onShow');
+ },
+ onHide() {
+ console.info('ActsProcessManageJsTest onHide');
+ }
+};
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..18463feca0a77306fe28b9bcecdfe733ac5b3418
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+ .container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
+
+.btn {
+ width: 200px;
+ height: 80px;
+}
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..5b17eddbc838bd39d96337c68ddb86c3383d804e
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
+
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ee3a7077b7d52935d3f70b5cb70e38ea9d0e33f1
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,84 @@
+/*
+ * 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 { Core, ExpectExtend } from 'deccjsunit/index'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: "",
+ testTime: 0
+ },
+ onInit() {
+ console.info('ActsProcessManageJsTest onInit');
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('ActsProcessManageJsTest onShow');
+ console.info('ActsProcessManageJsTest testTime' + this.testTime);
+ if (this.testTime == 0) {
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ core.addService('expect', expectExtend)
+ core.init()
+ const configService = core.getDefaultService('config')
+ this.timeout = 30000;
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ }
+ this.testTime++;
+ },
+ onReady() {
+ console.info('ActsProcessManageJsTest onReady');
+ },
+ onActive() {
+ console.info('ActsProcessManageJsTest onActive');
+ },
+ onInactive() {
+ console.info('ActsProcessManageJsTest onInactive');
+ },
+ onHide() {
+ console.info('ActsProcessManageJsTest onHide');
+ },
+ onDestroy() {
+ console.info('ActsProcessManageJsTest onDestroy');
+ },
+ onBackPress() {
+ console.info('ActsProcessManageJsTest onBackPress');
+ },
+ onNewRequest() {
+ console.info('ActsProcessManageJsTest onNewRequest');
+ },
+ onStartContinuation() {
+ console.info('ActsProcessManageJsTest onStartContinuation');
+ },
+ onSaveData(value) {
+ console.info('ActsProcessManageJsTest onSaveData:' + JSON.stringify(value));
+ },
+ onRestoreData(value) {
+ console.info('ActsProcessManageJsTest onRestoreData:' + JSON.stringify(value));
+ },
+ onCompleteContinuation(code) {
+ console.info('ActsProcessManageJsTest onCompleteContinuation:' + JSON.stringify(code));
+ },
+ onConfigurationUpdated(configuration) {
+ console.info('ActsProcessManageJsTest onConfigurationUpdated:' + JSON.stringify(configuration));
+ }
+}
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..03574a36c533357eef7fc0acc5e21af14f4e5f67
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "actsparticleabilitytest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/resources/base/media/icon.png differ
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..3fe0750522ac92a3e9feb711aeaeee21ffd18b48
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+require('./lanuageConfigapi7.test.js')
\ No newline at end of file
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/test/lanuageConfigapi7.test.js b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/test/lanuageConfigapi7.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..6a6de95cbdfb28b3fc34e469139d546441041831
--- /dev/null
+++ b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/entry/src/main/js/test/lanuageConfigapi7.test.js
@@ -0,0 +1,161 @@
+/*
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
+import commonEvent from '@ohos.commonevent'
+import bundle from '@ohos.bundle'
+import missionManager from '@ohos.application.missionManager'
+import abilityManager from '@ohos.application.abilityManager'
+import featureAbility from '@ohos.ability.featureability'
+
+var subscriberInfoMultiInstance = {
+ events: ["UpdateLanguageFinish"]
+};
+const BUNDLE_PATHS = [['/data/test/ActslanguageconfigAppATest.hap']];
+const BUNDLE_NAMES = ['com.example.actslanguageconfigappatest'];
+const BUNDLE_COUNT = 1;
+const START_ABILITY_TIMEOUT = 5000;
+const MAX_MISSION_NUM = 1024;
+
+async function startAbilityProcess(parameters) {
+ let bundleName;
+ let abilityName;
+
+ let idx = parameters.nextStep;
+ switch (parameters.step[idx]) {
+ case "StartA1":
+ bundleName = "com.example.actslanguageconfigappatest";
+ abilityName = "com.example.actslanguageconfigappatest.MainAbility";
+ break;
+
+ default:
+ break;
+ }
+ parameters.nextStep = ++idx;
+ await featureAbility.startAbility({
+ want: {
+ bundleName: bundleName,
+ abilityName: abilityName,
+ parameters: parameters
+ }
+
+ })
+}
+
+
+function getMissionId() {
+ return new Promise(async (resolve, reject) => {
+ var missionId = -1;
+ var missionInfos = await missionManager.getMissionInfos('', MAX_MISSION_NUM);
+ for (let i = 0; i < missionInfos.length; i++) {
+ console.log('getMissionId result: ' + i + '= ' + JSON.stringify(missionInfos[i]))
+ if ((missionInfos[i].want.abilityName == "com.example.languageconfigtestapi7.MainAbility") &&
+ (missionInfos[i].runningState == 0)) {
+ missionId = missionInfos[i].missionId;
+ break;
+ }
+ }
+ console.log('======>Acts_getMissionId resolve missionId<=======' + missionId);
+ resolve(missionId);
+ })
+}
+
+describe('ActsAbilityTest', function () {
+ beforeEach(async (done) => {
+ console.log('======>Acts_beforeEach ininin<=======');
+ let installer = await bundle.getBundleInstaller();
+ var count = 0;
+
+ for (let i = 0; i < BUNDLE_COUNT; i++) {
+ installer.install(BUNDLE_PATHS[i], {
+ userId: 100,
+ installFlag: 1,
+ isKeepData: false
+ }, (err, data) => {
+ count++;
+ console.log('======>Acts_beforeEach install finish <=======' + err.code);
+ console.log('======>Acts_beforeEach install finish <=======' + data.status);
+ console.log('======>Acts_beforeEach install finish <=======' + data.statusMessage);
+ if (count == BUNDLE_COUNT) {
+ setTimeout(() => {
+ done();
+ }, 1000)
+ }
+ })
+ }
+ })
+
+ /*
+ * @tc.number: Acts_UpdateConfigurationFA_0100
+ * @tc.name: Connects a service ability, which is used to start a cloned page ability.
+ * @tc.desc: Check the event data of executor page ability publishes
+ */
+ it('Acts_UpdateConfigurationFA_0100', 0, async function (done) {
+ console.log('Acts_UpdateConfigurationFA_0100====Acts_Subscribe CallBack data:====>" + JSON.stringify(data));
+
+ expect(data.event).assertEqual("UpdateLanguageFinish");
+ clearTimeout(id);
+ console.log('Acts_UpdateConfigurationFA_0100 start set lang');
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+ }
+
+ commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => {
+ console.debug("Acts_====>Create Subscriber====>");
+ subscriber = data;
+ commonEvent.subscribe(subscriber, subscribeCallBack);
+ })
+
+ function unSubscribeCallback() {
+
+ setTimeout( function () {
+ console.debug("Acts_====>UnSubscribe CallBack====>");
+ done();
+ }, 2000);
+
+ }
+
+ function timeout() {
+ expect().assertFail();
+ console.log('Acts_StartLanguageConfigTester timeout');
+ commonEvent.unsubscribe(subscriber, unSubscribeCallback);
+ }
+
+ id = setTimeout(timeout, START_ABILITY_TIMEOUT);
+ console.log('Acts_Start LanguageConfigTester Acts_UpdateConfigurationFA_0100 timer id : ' + id);
+
+ console.log('Acts_LanguageConfigTester Acts_UpdateConfigurationFA_0100 start Ability');
+ startAbilityProcess({
+ startId: 0,
+ stepNum: 1,
+ nextStep: 0,
+ step: ["StartA1"]
+ });
+ })
+
+
+})
diff --git a/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6
Binary files /dev/null and b/aafwk/aafwk_standard/lanuageConfigapi7/LanguageConfigTestApi7/signature/openharmony_sx.p7b differ
diff --git a/ace/ace_ets_component/entry/src/main/config.json b/ace/ace_ets_component/entry/src/main/config.json
index 4878724bd5455603505d9149f1c5016ef618eb11..dc5e271720ed24c3679bf173c93189f943dbfb50 100755
--- a/ace/ace_ets_component/entry/src/main/config.json
+++ b/ace/ace_ets_component/entry/src/main/config.json
@@ -59,6 +59,7 @@
},
"pages": [
"pages/index",
+ "pages/toggle",
"pages/actionSheet",
"pages/gauge",
"pages/ellipse",
@@ -66,7 +67,6 @@
"pages/systemRouterB",
"pages/marquee",
"pages/stepper",
- "pages/gridContainer",
"pages/list",
"pages/general-properties/sizeSetting",
"pages/general-properties/positionSetting",
@@ -94,6 +94,7 @@
"pages/general-properties/flex",
"pages/swiper",
"pages/gridPage",
+ "pages/span",
"pages/text",
"pages/badge",
"pages/canvas",
@@ -110,7 +111,49 @@
"pages/tabs",
"pages/tapGesture",
"pages/progress",
- "pages/animate"
+ "pages/animate",
+ "pages/column",
+ "pages/rating",
+ "pages/canvas2",
+ "pages/shape",
+ "pages/motionPath",
+ "pages/scrollCode",
+ "pages/transition",
+ "pages/priorityGesture",
+ "pages/parallelGesture",
+ "pages/alertDialog",
+ "pages/blank",
+ "pages/sharedTransition",
+ "pages/sharedTransition2",
+ "pages/alphabetIndexer",
+ "pages/line",
+ "pages/circle",
+ "pages/aboutToDisappear",
+ "pages/timeStamp",
+ "pages/bindMenu",
+ "pages/bindPopup",
+ "pages/gridContainer",
+ "pages/direction",
+ "pages/divider",
+ "pages/listItem",
+ "pages/systemPrompt",
+ "pages/configuration",
+ "pages/sourceType",
+ "pages/NavigatorBackCode",
+ "pages/NavigatorCode",
+ "pages/NavigatorDetailCode",
+ "pages/PieceCode",
+ "pages/sourceType",
+ "pages/pageTransition",
+ "pages/pageTransition2",
+ "pages/scrollBar",
+ "pages/search",
+ "pages/pageTransition2",
+ "pages/lifecycle",
+ "pages/pageTransition2",
+ "pages/navigation",
+ "pages/stateStyle",
+ "pages/focus"
],
"name": ".MainAbility",
"window": {
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorBackCode.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorBackCode.ets
new file mode 100755
index 0000000000000000000000000000000000000000..d7f919aab16c828ac3e34739966660d952cdee8d
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorBackCode.ets
@@ -0,0 +1,27 @@
+// @ts-nocheck
+/**
+ * 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.
+ */
+
+@Entry
+@Component
+struct NavigatorBackCode {
+ build() {
+ Column() {
+ Navigator({ target: 'pages/NavigatorCode', type: NavigationType.Back }) {
+ Text('Return to Navigator Page').width('100%').textAlign(TextAlign.Center)
+ }
+ }.width('100%').height(200).padding({ left: 35, right: 35, top: 35 })
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorCode.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorCode.ets
new file mode 100755
index 0000000000000000000000000000000000000000..c5ea4fbe4ec02b71a035b9719f5c8b9a1afa8881
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorCode.ets
@@ -0,0 +1,69 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+
+@Entry
+@Component
+struct NavigatorCode {
+ @State active: boolean = false;
+ @State Text: string = 'news';
+ @State typeValue: NavigationType = NavigationType.Back;
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ var navigationTypeValue = eventData.data.typeValue;
+ console.info("navigationTypeValue:" + navigationTypeValue);
+ if (navigationTypeValue != null) {
+ this.typeValue = navigationTypeValue;
+ console.info("this.typeValue:" + this.typeValue);
+ } else {
+ console.info("navigationTypeValue is null or empty " + NavigatorCode);
+ }
+ } else {
+ console.info("NavigatorCode page color not change called:" + JSON.stringify(eventData));
+ }
+ }
+
+ onPageShow() {
+ console.info('navigatorCode page show called');
+ var stateChangeEvent = {
+ eventId: 90,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+
+ var stateChangeEvent = {
+ eventId: 101,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack)
+ }
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
+ Navigator({ target: 'pages/NavigatorDetailCode', type: NavigationType.Push }) {
+ Text('Go to ' + this.Text + ' page').width('100%').textAlign(TextAlign.Center)
+ }.params({ text: this.Text }).key('button')
+
+ Navigator() {
+ Text('Back to previous page').width('100%').textAlign(TextAlign.Center)
+ }.active(this.active)
+ .onClick(() => {
+ this.active = true
+ })
+ }.height(150).width(350).padding(35)
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorDetailCode.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorDetailCode.ets
new file mode 100755
index 0000000000000000000000000000000000000000..013b1f4fe4ab8ae7b1fd5b59c596113698523c4a
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/NavigatorDetailCode.ets
@@ -0,0 +1,34 @@
+// @ts-nocheck
+/**
+ * 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 router from '@system.router'
+
+@Entry
+@Component
+struct NavigatorDetailCode {
+ @State text: string = router.getParams().text
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
+ Navigator({ target: 'pages/NavigatorBackCode', type: NavigationType.Push }) {
+ Text('Go to back page').width('100%').height(20)
+ }
+
+ Text('This is ' + this.text + ' page').width('100%').textAlign(TextAlign.Center)
+ }
+ .width('100%').height(200).padding({ left: 35, right: 35, top: 35 })
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/PieceCode.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/PieceCode.ets
new file mode 100755
index 0000000000000000000000000000000000000000..d81f866408ca1d08cf61b014b69c8caa27ef7e71
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/PieceCode.ets
@@ -0,0 +1,37 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+
+@Entry
+@Component
+struct PieceCode {
+ @State fontColor: Color = "#FF008000";
+
+ onPageShow() {
+ }
+
+ build() {
+ Column() {
+ Piece({ content: "piece" , icon: "1" })
+ .iconPosition(IconPosition.End)
+ .fontColor(this.Color)
+ .fontStyle(FontStyle.Italic)
+ .key("piece")
+ }.width('100%').margin({ top: 300 })
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/aboutToDisappear.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/aboutToDisappear.ets
new file mode 100755
index 0000000000000000000000000000000000000000..f31e5203b873dc73d5fc01dee05591cfaa29bd93
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/aboutToDisappear.ets
@@ -0,0 +1,80 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct ParentComp {
+ @State isCountDown: boolean = true
+ build() {
+ Column() {
+ Text(this.isCountDown ? 'Count Down' : 'Stopwatch')
+ if (this.isCountDown) {
+ Image($rawfile('ic_health_heart.png')).width(50).height(50)
+ TimerComponent({counter: 10, changePerSec: -1, showInColor: Color.Red})
+ } else {
+ Image($rawfile('ic_health_heart.png')).width(150).height(150)
+ TimerComponent({counter: 0, changePerSec: +1, showInColor: Color.Black })
+ }
+ Button(this.isCountDown ? 'Swtich to Stopwatch' : 'Switch to Count Down')
+ .onClick(() => {
+ this.isCountDown = !this.isCountDown
+ })
+ .key('button1')
+ }
+ }
+}
+
+@Component
+struct TimerComponent {
+ @State counter: number = 0
+ private changePerSec: number = -1
+ private showInColor: Color = Color.Black
+ private timerId : number = -1
+ @State onActionCalled :boolean = false
+
+ build() {
+ Text(`${this.counter}sec`)
+ .fontColor(this.showInColor)
+ }
+
+ aboutToAppear() {
+ this.timerId = setInterval(() => {this.counter += this.changePerSec}, 1000)
+ }
+
+ aboutToDisappear() {
+ if (this.timerId > 0) {
+ clearTimeout(this.timerId)
+ console.info('ting--1');
+ try {
+ var backData = {
+ data: {
+ "ACTION": this.onActionCalled,
+ }
+ }
+ var backEvent = {
+ eventId: 160,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("button1 start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("button1 emit action state err: " + JSON.stringify(err.message))
+ }
+ this.timerId = -1
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alertDialog.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alertDialog.ets
new file mode 100755
index 0000000000000000000000000000000000000000..0d0cfc240010f38d605247dc712351c1550d0471
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alertDialog.ets
@@ -0,0 +1,66 @@
+// @ts-nocheck
+/**
+ * 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.
+ */
+@Entry
+@Component
+struct AlertDialogExample {
+ build() {
+ Column({ space: 5 }) {
+ Button('one button dialog')
+ .onClick(() => {
+ AlertDialog.show(
+ {
+ title: 'title',
+ message: 'text',
+ confirm: {
+ value: 'button',
+ action: () => {
+ console.info('Button-clicking callback')
+ }
+ },
+ cancel: () => {
+ console.info('Closed callbacks')
+ }
+ }
+ )
+ })
+ .backgroundColor(0x317aff)
+ Button('two button dialog')
+ .onClick(() => {
+ AlertDialog.show(
+ {
+ title: 'title',
+ message: 'text',
+ primaryButton: {
+ value: 'cancel',
+ action: () => {
+ console.info('Callback when the first button is clicked')
+ }
+ },
+ secondaryButton: {
+ value: 'ok',
+ action: () => {
+ console.info('Callback when the second button is clicked')
+ }
+ },
+ cancel: () => {
+ console.info('Closed callbacks')
+ }
+ }
+ )
+ }).backgroundColor(0x317aff)
+ }.width('100%').margin({ top: 5 })
+ }
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets
new file mode 100755
index 0000000000000000000000000000000000000000..3ea261f9be96a17bef12e9eefa3b1342c75fff38
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets
@@ -0,0 +1,67 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+@Entry
+@Component
+struct AlphabetIndexerSample {
+ private value: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
+ 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
+ @State color: Color = Color.Red;
+ @State fontSize: string = 20;
+ @State fontWeight: FontWeight = FontWeight.Bolder;
+ @State fontFamily: string = 'sans-serif';
+ @State fontStyle: FontStyle = FontStyle.Italic;
+
+ build() {
+ AlphabetIndexer({ arrayValue: this.value, selected: 0 })
+ .selectedColor(0xffffff)
+ .popupColor(0xFFFAF0)
+ .selectedBackgroundColor(0xCCCCCC)
+ .popupBackground(0xD2B48C)
+ .usingPopup(true)
+ .selectedFont({ size: 16, weight: FontWeight.Bolder })
+ .popupFont({ size: 30, weight: FontWeight.Bolder })
+ .itemSize(28)
+ .alignStyle(IndexerAlign.Left)
+ .onSelected((index: number) => {
+ console.info(this.value[index] + '被选中了');
+ })
+ .margin({ left: 50 })
+ .font({size: this.fontSize, weight: this.fontWeight, family: this.fontFamily, style: this.fontStyle })
+ .color(this.color)
+ .key('alphabetIndexer')
+ }
+ onPageShow() {
+ console.info('alphabetIndexer page show called');
+ var stateChangeEvent = {
+ eventId: 71,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+ }
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("alphabetIndexer page state change called:" + JSON.stringify(eventData));
+ let font = JSON.parse(eventData.data.font);
+ if(font) {
+ this.fontSize = font.size;
+ this.fontWeight = font.weight;
+ this.fontFamily = font.family;
+ this.fontStyle = font.style;
+ }
+ }
+ }
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/badge.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/badge.ets
index 3cdb575b2d8d586acc7597199167ef5116925378..f31804155647dc2492686f610b1cf630b3e7eb14 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/badge.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/badge.ets
@@ -18,16 +18,23 @@ import events_emitter from '@ohos.emitter';
@Entry
@Component
struct BadgeExample {
- @State counts: number = 1
- @State message: string = 'new'
+ @State counts: number = 1;
+ @State message: string = 'new';
@State fontSizeValue: number = 20;
+ @State colorValue: Color = Color.Red;
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("Badge page state change called:" + JSON.stringify(eventData));
- if(eventData.data.fontSizeValue != null) {
+ if (eventData.data.fontSizeValue != null) {
this.fontSizeValue = eventData.data.fontSizeValue;
}
+ if (eventData.data.colorValue != null) {
+ this.colorValue = eventData.data.colorValue;
+ }
+ if (eventData.data.message != null) {
+ this.message = eventData.data.message;
+ }
}
}
@@ -45,7 +52,7 @@ struct BadgeExample {
Badge({
count: this.counts,
maxCount: 99,
- style: { color: 0xFFFFFF, fontSize: this.fontSizeValue, badgeSize: 50, badgeColor: Color.Red }
+ style: { color: this.colorValue, fontSize: this.fontSizeValue, badgeSize: 50, badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
@@ -53,6 +60,26 @@ struct BadgeExample {
})
.width(200).height(100).backgroundColor(0x317aff).fontSize(20)
}.width(100).height(50).key('badge')
+
+ Badge({
+ value: this.message,
+ style: { color: this.colorValue, fontSize: 9, badgeSize: 20, badgeColor: Color.Red }
+ }) {
+ Text('message')
+ .width(80).height(50).fontSize(16).lineHeight(37)
+ .borderRadius(10).textAlign(TextAlign.Center).backgroundColor(0xF3F4ED)
+ }.width(80).height(50).key('badge2')
+
+ Badge({
+ value: '',
+ position: 1,
+ style: { badgeSize: 6, badgeColor: Color.Red }
+ }) {
+ Text('message')
+ .width(90).height(50).fontSize(16).lineHeight(37)
+ .borderRadius(10).textAlign(TextAlign.Center).backgroundColor(0xF3F4ED)
+ }.width(90).height(50)
+
}.width('100%').margin({ top: 5 })
}
}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindMenu.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindMenu.ets
new file mode 100755
index 0000000000000000000000000000000000000000..3ce33b16bcd2193f38bcb614c7894d597c924757
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindMenu.ets
@@ -0,0 +1,71 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct MenuExample {
+ @State onActionCalled: boolean = true
+ @Builder MenuBuilder() {
+ Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
+ Text('text1')
+ .fontSize(20)
+ .width(100)
+ .height(50)
+ .textAlign(TextAlign.Center)
+ Divider().height(10)
+ Text('text2')
+ .fontSize(20)
+ .width(100)
+ .height(50)
+ .textAlign(TextAlign.Center)
+ Divider().height(10)
+ Button('button')
+ .key('button')
+ .fontSize(20)
+ .width(100)
+ .height(50)
+ .onClick(() => {
+ console.info("bindMenu button START")
+ try {
+ var backData = {
+ data: {
+ "ACTION": this.onActionCalled,
+ }
+ }
+ var backEvent = {
+ eventId: 123,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("bindMenuTest_0100 start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("bindMenuTest_0100 emit action state err: " + JSON.stringify(err.message))
+ }
+ })
+ }.width(100)
+ }
+
+ build() {
+ Column() {
+ Text('click for menu')
+ .key('text')
+ }
+ .width('100%')
+ .margin({ top: 5 })
+ .bindMenu(this.MenuBuilder)
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindPopup.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindPopup.ets
new file mode 100755
index 0000000000000000000000000000000000000000..be2fc5fee5906e7c6e765d641c63a4a8c943151e
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/bindPopup.ets
@@ -0,0 +1,148 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct PopupExample {
+ @State noHandlePopup: boolean = false
+ @State handlePopup: boolean = false
+ @State customPopup: boolean = false
+ @State maskColor: string = 0x33000000
+ @State enableArrow: boolean = true
+ @State placementOnTop: boolean = false
+
+ @Builder popupBuilder() {
+ Row({ space: 2 }) {
+ Image($rawfile('ic_health_heart.png')).width(24).height(24).margin({ left: -5 }).key('image')
+ Text('Custom Popup').fontSize(12).key('text')
+ }.width(100).height(50).backgroundColor(Color.White)
+ }
+
+ build() {
+ Flex({ direction: FlexDirection.Column }) {
+ Button('no handle popup')
+ .key('button2')
+ .onClick(() => {
+ this.noHandlePopup = !this.noHandlePopup
+ try {
+ var backData = {
+ data: {
+ "placementOnTop": this.placementOnTop,
+ }
+ }
+ var backEvent = {
+ eventId: 238,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("button2 start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("button2 emit action state err: " + JSON.stringify(err.message))
+ }
+ })
+ .bindPopup(this.noHandlePopup, {
+ message: 'content1 content1',
+ placementOnTop: this.placementOnTop,
+ onStateChange: (e) => {
+ console.info(e.isVisible.toString())
+ if (!e.isVisible) {
+ this.noHandlePopup = false
+ }
+ }
+ })
+ .position({ x: 100, y: 50 })
+
+ Button('custom popup 1')
+ .key('button1')
+ .onClick(() => {
+ try {
+ var backData = {
+ data: {
+ "maskColor": this.maskColor,
+ "enableArrow": this.enableArrow
+ }
+ }
+ var backEvent = {
+ eventId: 237,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("button1 start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("button1 emit action state err: " + JSON.stringify(err.message))
+ }
+ })
+ .position({ x: 100, y: 200 })
+
+ Button('custom popup')
+ .key('button')
+ .onClick(() => {
+ this.customPopup = !this.customPopup
+ try {
+ var backData = {
+ data: {
+ "maskColor": this.maskColor,
+ "enableArrow": this.enableArrow
+ }
+ }
+ var backEvent = {
+ eventId: 236,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("button start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("button emit action state err: " + JSON.stringify(err.message))
+ }
+ })
+ .bindPopup(this.customPopup, {
+ builder: this.popupBuilder,
+ placement: Placement.Bottom,
+ maskColor: this.maskColor,
+ popupColor: Color.White,
+ enableArrow: this.enableArrow,
+ onStateChange: (e) => {
+ if (!e.isVisible) {
+ this.customPopup = false
+ }
+ }
+ })
+ .position({ x: 100, y: 350 })
+ }.width('100%').padding({ top: 5 })
+ }
+
+ onPageShow() {
+ console.info('customPopupOption page show called');
+ var stateChangeEvent = {
+ eventId: 126,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack)
+ }
+
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("customPopupOption page state change called:" + JSON.stringify(eventData));
+ if (eventData.data.enableArrow != null) {
+ this.enableArrow = eventData.data.enableArrow;
+ }
+ if (eventData.data.maskColor != null) {
+ this.maskColor = eventData.data.maskColor;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/blank.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/blank.ets
new file mode 100755
index 0000000000000000000000000000000000000000..387be78fa07140e635c94d6c32c501802cc59d01
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/blank.ets
@@ -0,0 +1,50 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+
+@Entry
+@Component
+struct BlankExample {
+ @State colorValue: Color = Color.Blue;
+
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("Blank page state change called:" + JSON.stringify(eventData));
+ if (eventData.data.colorValue != null) {
+ this.colorValue = eventData.data.colorValue;
+ }
+ }
+ }
+
+ onPageShow() {
+ console.info('Blank page show called');
+ var stateChangeEvent = {
+ eventId: 90,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+ }
+
+ build() {
+ Column() {
+ Row() {
+ Text('Bluetooth').fontSize(18)
+ Blank().color(this.colorValue).key('blank')
+ Toggle({ type: ToggleType.Switch })
+ }.width('100%').backgroundColor(0xFFFFFF).borderRadius(15).padding({ left: 12 })
+ }.backgroundColor(0xEFEFEF).padding(20)
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets
index f19739b63aebec767d8488758b7928b834a3c4bf..1a8039df3b1a89ea3c9f93a1f7d3af7601f1c22e 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets
@@ -81,6 +81,7 @@ struct CanvasExample {
this.fill();
this.textMetrics();
this.getBitImageSize();
+ this.rotate();
})
.key('canvas1')
}.width('100%').height('350%')
@@ -319,7 +320,8 @@ struct CanvasExample {
}
rotate() {
this.context.rotate(45 * Math.PI / 180);
- this.context.fillRect(70, 20, 50, 50);
+ this.context.fillRect(180, 20, 50, 50);
+ this.context.rotate(-45 * Math.PI / 180);
}
transform() {
this.context.fillStyle = 'rgb(0,0,0)';
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas3.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas3.ets
deleted file mode 100755
index cd17f181004621ff1aa4b1433767d0951e97c311..0000000000000000000000000000000000000000
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas3.ets
+++ /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 events_emitter from '@ohos.emitter'
-
-@Entry
-@Component
-struct Canvas3Example {
- private settings: RenderingContextSettings = new RenderingContextSettings(true);
- private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
-
- build() {
- Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) {
- Column() {
- Canvas(this.context)
- .width('100%')
- .height('100%')
- .backgroundColor('#ffff00')
- .onReady(() => {
- this.rotate();
- })
- .key('canvas3')
- }.width('100%').height('100%')
- }
- .width('100%')
- .height('100%')
- }
- onPageShow() {
- }
- rotate() {
- this.context.rotate(45 * Math.PI / 180);
- this.context.fillRect(200, 20, 100, 100);
- }
-}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/circle.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/circle.ets
new file mode 100755
index 0000000000000000000000000000000000000000..418fc3c6f15ab00ccdb8ff16b2df78590b315878
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/circle.ets
@@ -0,0 +1,52 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+@Entry
+@Component
+struct CircleExample {
+ @State width: string = "450px";
+ @State height: string = "450px";
+ onPageShow() {
+ console.info('[circle] page show called');
+ var stateChangeEvent = {
+ eventId: 455,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info('[circle] page show calledA');
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+ }
+ private stateChangCallBack = (eventData) => {
+ console.info("[circle] page stateChangCallBack");
+ if (eventData != null) {
+ console.info("[circle] page state change called:" + JSON.stringify(eventData));
+ if(eventData.data.width != null) {
+ this.width = eventData.data.width;
+ }
+ if(eventData.data.height != null) {
+ this.height = eventData.data.height;
+ }
+ }
+ }
+ build() {
+ Flex({ justifyContent: FlexAlign.SpaceAround }) {
+ Circle({ width: 150, height: 150 })
+ Circle()
+ .width(`${this.width}`)
+ .height(`${this.height}`)
+ .key('circle')
+ }.width('100%').height('100%').margin({ top: 5 })
+ }
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/configuration.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/configuration.ets
new file mode 100755
index 0000000000000000000000000000000000000000..c34f4b9600740a2e55c731714d4ec78e884f7b66
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/configuration.ets
@@ -0,0 +1,52 @@
+// @ts-nocheck
+/**
+ * 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 Configuration from '@system.configuration';
+import events_emitter from '@ohos.emitter';
+@Entry
+@Component
+struct promptExample {
+ build(){
+ Column(){
+ Button('click')
+ .key('button')
+ .backgroundColor('#FF0B8FE2')
+ .fontSize(20)
+ .margin({top: 20})
+ .onClick(()=>{
+ console.info('button is start');
+ let localeInfo = Configuration.getLocale();
+ console.info('localeInfo result is' + JSON.stringify(localeInfo));
+ try{
+ var backData = {
+ data: {
+ "COUNTRY": localeInfo.countryOrRegion,
+ "DIR":localeInfo.dir
+ }
+ }
+ console.log("backData is" + JSON.stringify(backData.data));
+ var backEvent = {
+ eventId: 36,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("confituration start to emit action state");
+ events_emitter.emit(backEvent, backData);
+ }catch{
+ console.info("confituration emit action state err: " + JSON.stringify(err.message));
+ }
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/direction.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/direction.ets
new file mode 100755
index 0000000000000000000000000000000000000000..0511f6585555230106e2990a1c34f6bd0f0fcb0e
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/direction.ets
@@ -0,0 +1,55 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+
+@Entry
+@Component
+struct Index {
+ @State direction:FlexDirection = FlexDirection.Column
+ build() {
+ Flex({ direction: this.direction, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Text('Hello World')
+ .fontSize(60)
+ .fontWeight(500)
+ Button('Next')
+ .fontSize(40)
+ .fontWeight(500)
+ .width(280)
+ .height(60)
+ }
+ .key('direction')
+ .width('100%')
+ .height('100%')
+ }
+
+ onPageShow() {
+ console.info('direction page show called');
+ var stateChangeEvent = {
+ eventId: 985,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack)
+ }
+
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("direction page state change called:" + JSON.stringify(eventData));
+ if (eventData.data.direction != null) {
+ this.direction = eventData.data.direction;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/divider.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/divider.ets
new file mode 100755
index 0000000000000000000000000000000000000000..9478afdcfa8bcdf456f4c2604a932714d8cd8508
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/divider.ets
@@ -0,0 +1,67 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+@Entry
+@Component
+struct DividerExample {
+ @State color: Color = 0xCCCCCC
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
+ Text('Horizontal divider').fontSize(9).fontColor(0xCCCCCC)
+ Row().width('100%').height(40).backgroundColor(0xF1F3F5)
+ Divider()
+ Row().width('100%').height(40).backgroundColor(0xF1F3F5)
+
+ Text('Vertical divider').fontSize(9).fontColor(0xCCCCCC)
+ Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.Wrap }) {
+ Text('bravery')
+ Divider().vertical(true).margin(20).height(15)
+ Text('effort')
+ Divider().vertical(true).margin(20).height(15)
+ Text('upward')
+ }.width(250)
+
+ Text('Custom Styles').fontSize(9).fontColor(0xCCCCCC)
+ Row().width('100%').height(40).backgroundColor(0xF1F3F5)
+ Divider()
+ .key('Divider')
+ .vertical(false)
+ .strokeWidth(5)
+ .color(this.color)
+ .lineCap(LineCapStyle.Round)
+ Row().width('100%').height(40).backgroundColor(0xF1F3F5)
+ }
+ .width('100%').height(350).padding({ left: 35, right: 35, top: 35 })
+ }
+
+ onPageShow() {
+ console.info('divider page show called');
+ var stateChangeEvent = {
+ eventId: 917,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack)
+ }
+
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("divider page state change called:" + JSON.stringify(eventData));
+ if (eventData.data.color != null) {
+ this.color = eventData.data.color;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/focus.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/focus.ets
new file mode 100755
index 0000000000000000000000000000000000000000..1af4c04f9cfd1febb9546f6a14861e0727982f61
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/focus.ets
@@ -0,0 +1,67 @@
+// @ts-nocheck
+/**
+ * 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.
+ */
+
+@Entry
+@Component
+struct FocusableExample {
+ @State textOne: string = ''
+ @State textTwo: string = ''
+ @State textThree: string = 'The third button cannot be focused'
+ @State oneButtonColor: string = '#FF0000'
+ @State twoButtonColor: string = '#FFC0CB'
+ @State threeButtonColor: string = '#87CEFA'
+
+ build() {
+ Column({ space:20 }){
+ Button(this.textOne)
+ .backgroundColor(this.oneButtonColor)
+ .width(300).height(70).fontColor(Color.Black)
+ .focusable(true)
+ .onFocus(() => {
+ this.textOne = 'First Button onFocus'
+ this.oneButtonColor = '#AFEEEE'
+ })
+ .onBlur(() => {
+ this.textOne = 'First Button onBlur'
+ this.oneButtonColor = '#FFC0CB'
+ })
+ Button(this.textTwo)
+ .backgroundColor(this.twoButtonColor)
+ .width(300).height(70).fontColor(Color.Black)
+ .focusable(true)
+ .onFocus(() => {
+ this.textTwo = 'Second Button onFocus'
+ this.twoButtonColor = '#AFEEEE'
+ })
+ .onBlur(() => {
+ this.textTwo = 'Second Button onBlur'
+ this.twoButtonColor = '#FFC0CB'
+ })
+ Button(this.textThree)
+ .backgroundColor(this.threeButtonColor)
+ .width(300).height(70).fontColor(Color.Black)
+ .focusable(false)
+ .onFocus(() => {
+ this.textThree = 'Third Button onFocus'
+ this.threeButtonColor = '#AFEEEE'
+ })
+ .onBlur(() => {
+ this.textThree = 'Third Button onBlur'
+ this.threeButtonColor = '#FFC0CB'
+ })
+ }.width('100%').margin({ top:20 })
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/flex.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/flex.ets
index d23fefc9f2e4403654b894e5e49a543f372093cd..a003153a0da4c27904465834eab0cd20695f64de 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/flex.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/flex.ets
@@ -18,7 +18,7 @@ import events_emitter from '@ohos.emitter'
@Entry
@Component
struct FlexExample {
-
+ @State direction: FlexDirection = FlexDirection.Row
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("Flex page state change called:" + JSON.stringify(eventData));
@@ -117,7 +117,7 @@ struct FlexExample {
.backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('no alignSelf,height:100').width('34%').height(100)
.backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
- }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
+ }.key('flex').width('90%').height(120).padding(10).backgroundColor(0xAFEEEE)
}.width('100%').margin({ top: 5 })
}
}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridContainer.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridContainer.ets
index 246648a0a186388880b77725dbba6b250649fd71..7d9ff8456fd8f5959886d0e317ee5cad157184b0 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridContainer.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/gridContainer.ets
@@ -98,6 +98,7 @@ struct GridContainerExample {
md: { span: 2, offset: 10 },
lg: { span: 6, offset: 6 }
})
+
.height(50)
.backgroundColor(0x00BFFF)
.textAlign(TextAlign.Center)
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/lifecycle.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/lifecycle.ets
new file mode 100755
index 0000000000000000000000000000000000000000..8d8f1ea1e5fce57dceb5fa620ff3e280e29ece18
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/lifecycle.ets
@@ -0,0 +1,134 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+
+@Entry
+@Component
+struct EllipseExample {
+
+ onActive(){
+ console.log("lifecycle-->onActive")
+ }
+ onInactive(){
+ console.log("lifecycle-->onInactive")
+ }
+ onShow(){
+ console.log("lifecycle-->onShow")
+ }
+ onCastTempToNormal(){
+ console.log("lifecycle-->onCastTempToNormal")
+ }
+ onVisibilityChanged(){
+ console.log("lifecycle-->onVisibilityChanged")
+ }
+ onTriggerEvent(){
+ console.log("lifecycle-->onTriggerEvent")
+ }
+ onDelete(){
+ console.log("lifecycle-->onDelete")
+ }
+ onAcquireFormState(){
+ console.log("lifecycle-->onAcquireFormState")
+ }
+ onHide(){
+ console.log("lifecycle-->onHide")
+ }
+ onWindowDisplayModeChanged(){
+ console.log("lifecycle-->onWindowDisplayModeChanged")
+ }
+ onStartContinuation(){
+ console.log("lifecycle-->onStartContinuation")
+ }
+ onSaveData(){
+ console.log("lifecycle-->onSaveData")
+ }
+ onCompleteContinuation(){
+ console.log("lifecycle-->onCompleteContinuation")
+ }
+ onRestoreData(){
+ console.log("lifecycle-->onRestoreData")
+ }
+ onRemoteTerminated(){
+ console.log("lifecycle-->onRemoteTerminated")
+ }
+ onSaveAbilityState(){
+ console.log("lifecycle-->onSaveAbilityState")
+ }
+ onRestoreAbilityState(){
+ console.log("lifecycle-->onRestoreAbilityState")
+ }
+ onInactive(){
+ console.log("lifecycle-->onInactive")
+ }
+ onActive(){
+ console.log("lifecycle-->onActive")
+ }
+ onNewWant(){
+ console.log("lifecycle-->onNewWant")
+ }
+ onMemoryLevel(){
+ console.log("lifecycle-->onMemoryLevel")
+ }
+ onCommand(){
+ console.log("lifecycle-->onCommand")
+ }
+ onStop(){
+ console.log("lifecycle-->onStop")
+ }
+ onConnect(){
+ console.log("lifecycle-->onConnect")
+ }
+ onDisconnect(){
+ console.log("lifecycle-->onDisconnect")
+ }
+ onReconnect(){
+ console.log("lifecycle-->onReconnect")
+ }
+ update(){
+ console.log("lifecycle-->update")
+ }
+ normalizeUri(){
+ console.log("lifecycle-->normalizeUri")
+ }
+ batchInsert(){
+ console.log("lifecycle-->batchInsert")
+ }
+ denormalizeUri(){
+ console.log("lifecycle-->denormalizeUri")
+ }
+ openFile(){
+ console.log("lifecycle-->openFile")
+ }
+ getFileTypes(){
+ console.log("lifecycle-->getFileTypes")
+ }
+ onInitialized(){
+ console.log("lifecycle-->onInitialized")
+ }
+ getType(){
+ console.log("lifecycle-->getType")
+ }
+
+ build(){
+ Column(){
+ Button('click')
+ .key('button')
+ .backgroundColor('#FF0B8FE2')
+ .fontSize(20)
+ .margin({top: 20})
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/line.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/line.ets
new file mode 100755
index 0000000000000000000000000000000000000000..0c6a52fb59e298d21a8b6183073ec445b786b3f8
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/line.ets
@@ -0,0 +1,56 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct LineExample {
+ @State startPoint:Point = [0,0]
+ @State endPoint:Point = [50,100]
+ build() {
+ Column() {
+ Line({ width: 50, height: 100 }).startPoint(this.startPoint).endPoint(this.endPoint)
+ .key('line')
+ }.margin({ top: 5 })
+ }
+
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("line page state change called:" + JSON.stringify(eventData));
+ if (eventData.data.startPoint != null) {
+ this.startPoint[0] = eventData.data.startPoint;
+ }
+ if (eventData.data.startPointOne != null) {
+ this.startPoint[1] = eventData.data.startPointOne;
+ }
+ if (eventData.data.endPoint != null) {
+ this.endPoint[0] = eventData.data.endPoint;
+ }
+ if (eventData.data.endPointOne != null) {
+ this.endPoint[1] = eventData.data.endPointOne;
+ }
+ }
+ }
+
+ onPageShow() {
+ console.info('line page show called');
+ var stateChangeEvent = {
+ eventId: 233,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/listItem.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/listItem.ets
new file mode 100755
index 0000000000000000000000000000000000000000..11419b8fe2e873c95d23d36c9766e4c90887c552
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/listItem.ets
@@ -0,0 +1,88 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+
+@Entry
+@Component
+struct ListItemExample {
+ private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+ @State editFlag: boolean = false;
+ @State sticky: Sticky = Sticky.Normal;
+ @State editMode: boolean = true;
+
+ onPageShow() {
+ console.info('[ListItem] page show called');
+ var stateChangeEvent = {
+ eventId: 1015,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+
+ var stateChangeEventOne = {
+ eventId: 1016,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEventOne, this.stateChangCallBack);
+ }
+
+ private stateChangCallBack = (eventData) => {
+ console.info("[ListItem] page stateChangCallBack");
+ if (eventData != null) {
+ console.info("[ListItem] page state change called:" + JSON.stringify(eventData));
+ if(eventData.data.sticky != null) {
+ this.sticky = eventData.data.sticky;
+ }
+ }
+ if (eventData != null) {
+ console.info("[ListItem] page state change called:" + JSON.stringify(eventData));
+ if(eventData.data.editMode != null) {
+ this.editMode = eventData.data.editMode;
+ }
+ }
+ }
+
+ build() {
+ Column() {
+ List({ space: 20, initialIndex: 0 }) {
+ ListItem() {
+ Text('sticky:Normal , click me edit list')
+ .width('100%').height(40).fontSize(12).fontColor(0xFFFFFF)
+ .textAlign(TextAlign.Center).backgroundColor(0x696969)
+ .onClick(() => {
+ this.editFlag = !this.editFlag
+ })
+ }.sticky(this.sticky).key('ListItem')
+
+ ForEach(this.arr, (item) => {
+ ListItem() {
+ Text('' + item)
+ .width('100%').height(100).fontSize(16)
+ .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF)
+ }.editable(this.editFlag)
+ }, item => item)
+ }
+ .key('List')
+ .editMode(this.editMode)
+ .onItemDelete((index: number) => {
+ console.info(this.arr[index - 1] + 'Delete')
+ this.arr.splice(index - 1,1)
+ this.editFlag = false
+ return true
+ })
+ .width('90%')
+ }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/loadingProgress.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/loadingProgress.ets
new file mode 100755
index 0000000000000000000000000000000000000000..0cd364c7b1d17393903a940207444d070dcd03ea
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/loadingProgress.ets
@@ -0,0 +1,28 @@
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct LoadingProgressExample {
+ build() {
+ Column({ space: 5 }) {
+ Text('Orbital LoadingProgress ').fontSize(9).fontColor(0xCCCCCC).width('90%')
+ LoadingProgress()
+ .color(Color.Blue)
+ }.width('100%').margin({ top: 6 })
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/navigation.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/navigation.ets
new file mode 100755
index 0000000000000000000000000000000000000000..b5baf4ae7af4dee36c91dd95ed4838b1bda2bbd8
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/navigation.ets
@@ -0,0 +1,151 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+
+@Entry
+@Component
+struct NavigationExample {
+ private arr: number[] = [0, 1, 2, 3, 4, 5]
+ @State hideBar: boolean = true
+ @State toolBar: boolean = true
+ @State hideToolBar: boolean = false
+ @State hideTitleBar: boolean = false
+ @State hideBackButton: boolean = false
+ @State onActionCalled: boolean = false
+ @State titleMode: NavigationTitleMode = NavigationTitleMode.Free
+
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("tabs page state change called:" + JSON.stringify(eventData));
+ if (eventData.data.vertical != null) {
+ this.titleMode = eventData.data.titleMode;
+ }
+ if (eventData.data.hideToolBar != null) {
+ this.hideToolBar = parseInt(eventData.data.hideToolBar);
+ }
+ if (eventData.data.hideTitleBar != null) {
+ this.hideTitleBar = parseInt(eventData.data.hideTitleBar);
+ }
+ if (eventData.data.hideBackButton != null) {
+ this.hideBackButton = parseInt(eventData.data.hideBackButton);
+ }
+ }
+ }
+
+ onPageShow() {
+ console.info('progress page show called');
+ var stateChangeEvent = {
+ eventId: 555,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack)
+ }
+
+ @Builder NavigationTitle() {
+ Column() {
+ Text('title')
+ .width(80)
+ .height(60)
+ .fontColor(Color.Blue)
+ .fontSize(30)
+ }
+ .onClick(() => {
+ console.log("title")
+ })
+ }
+
+ @Builder NavigationMenus() {
+ Row() {
+ Image('images/add.png')
+ .width(25)
+ .height(25)
+ Image('comment/more.png')
+ .width(25)
+ .height(25)
+ .margin({ left: 30 })
+ }.width(100)
+ }
+
+ build() {
+ Column() {
+ Navigation() {
+ Search({ value: '', placeholder: "" }).width('85%').margin(26)
+ List({ space: 5, initialIndex: 0 }) {
+ ForEach(this.arr, (item) => {
+ ListItem() {
+ Text('' + item)
+ .width('90%')
+ .height(80)
+ .backgroundColor('#3366CC')
+ .borderRadius(15)
+ .fontSize(16)
+ .textAlign(TextAlign.Center)
+ }.editable(true)
+ }, item => item)
+ }
+ .listDirection(Axis.Vertical)
+ .key('Navigation')
+ .height(300)
+ .margin({ top: 10, left: 18 })
+ .width('100%')
+
+ Button(this.hideBar ? "tool bar" : "hide bar")
+ .backgroundColor(0x2788D9).width(200).height(100).fontSize(20)
+ .key('NavigationContent1')
+ .onClick(() => {
+ this.hideBar = !this.hideBar;
+ console.info('navigationContent1 current action state is: ' + this.hideBar);
+ try {
+ var backData = {
+ data: {
+ "ACTION": this.hideBar,
+ }
+ }
+ var backEvent = {
+ eventId: 44,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("navigationContent1 start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("navigationContent1 emit action state err: " + JSON.stringify(err.message))
+ }
+ })
+ .margin({ left: 135, top: 60 })
+ }
+ .title(this.NavigationTitle)
+ .subTitle('subtitle')
+ .menus(this.NavigationMenus)
+ .titleMode(NavigationTitleMode.Free)
+ .hideTitleBar(false)
+ .hideBackButton(false)
+ .onTitleModeChanged((titleModel: NavigationTitleMode) => {
+ console.log('titleMode')
+ })
+ .toolBar({ items: [
+ { value: 'app', icon: 'images/grid.svg', action: () => {
+ console.log("app")
+ } },
+ { value: 'add', icon: 'images/add.svg', action: () => {
+ console.log("add")
+ } },
+ { value: 'collect', icon: 'images/collect.svg', action: () => {
+ console.log("collect")
+ } }] })
+ .hideToolBar(this.hideBar)
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition.ets
new file mode 100755
index 0000000000000000000000000000000000000000..93136f8038977950ddd5800888d14167140c89da
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition.ets
@@ -0,0 +1,94 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter'
+@Entry
+@Component
+struct PageTransitionExample1 {
+ @State scale: number = 1
+ @State opacity: number = 1
+ @State active: boolean = false
+ @State type: RouteType = NavigationType.Push
+
+ build() {
+ Column() {
+ Navigator({ target: 'pages/pageTransition2', type: this.type }) {
+ Image($rawfile('ic_health_heart.png'))
+ .width("100%")
+ .height("100%")
+ }
+ .key('Navigator')
+ .onClick(() => {
+ this.active = true
+ console.info('pageTransition current action state is: ' + this.active);
+ try {
+ var backData = {
+ data: {
+ "scale" : this.scale,
+ "opacity" : this.opacity,
+ }
+ }
+ var backEvent = {
+ eventId: 96,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("pageTransition start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("pageTransition emit action state err: " + JSON.stringify(err.message))
+ }
+ })
+ }.scale({ x: this.scale }).opacity(this.opacity)
+ }
+
+ pageTransition() {
+ PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
+ .onEnter((type: RouteType, progress: number) => {
+ this.scale = 1
+ this.opacity = progress
+ })
+ PageTransitionExit({ duration: 1500, curve: Curve.Ease })
+ .onExit((type: RouteType, progress: number) => {
+ this.scale = 1 - progress
+ this.opacity = 1
+ })
+ }
+
+ onPageShow() {
+ console.info('active page show called');
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack)
+
+ var stateChangeEventOne = {
+ eventId: 95,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEventOne, this.stateChangCallBack)
+ }
+
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("active page state change called:" + JSON.stringify(eventData));
+ if (eventData.data.scale != null) {
+ this.scale = parseInt(eventData.data.scale);
+ }
+ if (eventData.data.opacity != null) {
+ this.opacity = parseInt(eventData.data.opacity);
+ }
+ if (eventData.data.type != null) {
+ this.type = eventData.data.type;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition2.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition2.ets
new file mode 100755
index 0000000000000000000000000000000000000000..e2251bb15b6af9c6c919a43c79b47b00991a917f
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/pageTransition2.ets
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import events_emitter from '@ohos.emitter'
+@Entry
+@Component
+struct AExample {
+ @State scale: number = 1
+ @State opacity: number = 1
+ @State active: boolean = false
+ build() {
+ Column() {
+ Navigator({ target: 'pages/pageTransition' ,type: NavigationType.Push}) {
+ Image($rawfile('ic_health_heart.png')).width("100%").height("100%")
+ }
+ }.height("100%").width("100%").scale({ x: this.scale }).opacity(this.opacity)
+ }
+ pageTransition() {
+ PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
+ .onEnter((type: RouteType, progress: number) => {
+ this.scale = 1
+ this.opacity = progress
+ })
+ PageTransitionExit({ duration: 1500, curve: Curve.Ease })
+ .onExit((type: RouteType, progress: number) => {
+ this.scale = 1 - progress
+ this.opacity = 1
+ })
+ }
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/panel.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/panel.ets
new file mode 100755
index 0000000000000000000000000000000000000000..c52af08b3b02e61895ec5a2cf6b491a04c95c211
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/panel.ets
@@ -0,0 +1,78 @@
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct PanelExample {
+ @State show: boolean = true
+ @State type: PanelType = PanelType.Foldable
+ @State mode: PanelMode = PanelMode.Half
+
+ private stateChangCallBack = (eventData) => {
+ console.info("rating page stateChangCallBack");
+ if (eventData != null) {
+ console.info("rating page state change called:" + JSON.stringify(eventData.data.rating));
+ if(eventData.data.type != null) {
+ this.type = eventData.data.type;
+ }
+ }
+ }
+
+ onPageShow() {
+ console.info('rating page show called');
+ var stateChangeEvent = {
+ eventId: 440,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack)
+ var stateChangeEventTwo = {
+ eventId: 441,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEventTwo, this.stateChangCallBack)
+ var stateChangeEventThree = {
+ eventId: 442,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEventThree, this.stateChangCallBack)
+ }
+
+ build() {
+ Column() {
+ Text('2021-09-30 Today Calendar: 1.afternoon......Click for details')
+ .width('90%').height(50).borderRadius(10)
+ .backgroundColor(0xFF0000).padding({ left: 20 })
+ .onClick(() => {
+ this.show = !this.show
+ })
+ Panel(this.show) {
+ Column() {
+ Text('HAHA')
+ Divider()
+ Text('1. afternoon 4:00 The project meeting')
+ }
+ }
+ .type(this.type).mode(this.mode)
+ .dragBar(true)
+ .halfHeight(500)
+ .key('Panel')
+ .onChange((value: any) => {
+ console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
+ })
+ }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/radio.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/radio.ets
new file mode 100755
index 0000000000000000000000000000000000000000..203a7d86b871bd267aa282625f8908aabc164e74
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/radio.ets
@@ -0,0 +1,52 @@
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct RadioExample {
+ build() {
+ Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
+ Column() {
+ Text('Radio1')
+ Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true)
+ .height(50)
+ .width(50)
+ .onChange((value: boolean) => {
+ console.log('Radio1 status is ' + value)
+ })
+ }
+ Column() {
+ Text('Radio2')
+ Radio({ value: 'Radio2', group: 'radioGroup' }).checked(false)
+ .height(50)
+ .width(50)
+ .onChange((value: boolean) => {
+ console.log('Radio2 status is ' + value)
+ })
+ }
+ Column() {
+ Text('Radio3')
+ Radio({ value: 'Radio3', group: 'radioGroup' }).checked(false)
+ .height(50)
+ .width(49)
+ .onChange((value: boolean) => {
+ console.log('Radio3 status is ' + value)
+ })
+ }
+ }.padding({ top: 30 })
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/row.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/row.ets
new file mode 100755
index 0000000000000000000000000000000000000000..3fd19d9bbd437db5518d2118694fa7a7ac048537
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/row.ets
@@ -0,0 +1,51 @@
+/**
+ * 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.
+ */
+@Entry
+@Component
+struct RowExample {
+ build() {
+ Column({ space: 5 }) {
+ Text('space').fontSize(9).fontColor(0xCCCCCC).width('90%')
+ Row({ space: 5 }) {
+ Row().width('30%').height(50).backgroundColor(0xAFEEEE)
+ Row().width('30%').height(50).backgroundColor(0x00FFFF)
+ }.width('90%').height(107).border({ width: 1 })
+
+ Text('alignItems(Top)').fontSize(9).fontColor(0xCCCCCC).width('90%')
+ Row() {
+ Row().width('30%').height(50).backgroundColor(0xAFEEEE)
+ Row().width('30%').height(50).backgroundColor(0x00FFFF)
+ }.alignItems(VerticalAlign.Top).height('15%').border({ width: 1 })
+
+ Text('alignItems(Center)').fontSize(9).fontColor(0xCCCCCC).width('90%')
+ Row() {
+ Row().width('30%').height(50).backgroundColor(0xAFEEEE)
+ Row().width('30%').height(50).backgroundColor(0x00FFFF)
+ }.alignItems(VerticalAlign.Center).height('15%').border({ width: 1 })
+
+ Text('justifyContent(End)').fontSize(9).fontColor(0xCCCCCC).width('90%')
+ Row() {
+ Row().width('30%').height(50).backgroundColor(0xAFEEEE)
+ Row().width('30%').height(50).backgroundColor(0x00FFFF)
+ }.width('90%').border({ width: 1 }).justifyContent(FlexAlign.End)
+
+ Text('justifyContent(Center)').fontSize(9).fontColor(0xCCCCCC).width('90%')
+ Row() {
+ Row().width('30%').height(50).backgroundColor(0xAFEEEE)
+ Row().width('30%').height(49).backgroundColor(0x00FFFF)
+ }.width('90%').border({ width: 1 }).justifyContent(FlexAlign.Center)
+ }.width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollBar.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollBar.ets
new file mode 100755
index 0000000000000000000000000000000000000000..0e5061d780c975694539a6a50439b227875cf7ff
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollBar.ets
@@ -0,0 +1,88 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+
+@Entry
+@Component
+struct ScrollBarExample {
+ private scroller: Scroller = new Scroller()
+ private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ @State directionValue: ScrollBarDirection = ScrollBarDirection.Vertical;
+ @State stateValue: BarState= BarState.Off;
+
+ private stateChangCallBack = (eventData) => {
+ console.info("scrollBar page state change called:" + JSON.stringify(eventData));
+ if (eventData != null) {
+ if (eventData.data.directionValue != null) {
+ let directionObject = JSON.parse(eventData.data.directionObject);
+ this.directionValue = directionObject.directionValue;
+ }
+ if (eventData.data.stateValue != null) {
+ let stateObject = JSON.parse(eventData.data.stateObject);
+ this.stateValue = stateObject.stateValue;
+ }
+ }
+ }
+
+ onPageShow() {
+ console.info('scrollBar page show called');
+ var stateChangeEvent = {
+ eventId: 80,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+
+ var stateChangeEvent2 = {
+ eventId: 41,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent2, this.stateChangCallBack);
+ }
+
+ build() {
+ Column() {
+ Stack({ alignContent: Alignment.End }) {
+ Scroll(this.scroller) {
+ Flex({ direction: FlexDirection.Column }) {
+ ForEach(this.arr, (item) => {
+ Row() {
+ Text(item.toString())
+ .width('90%')
+ .height(100)
+ .backgroundColor('#3366CC')
+ .borderRadius(15)
+ .fontSize(16)
+ .textAlign(TextAlign.Center)
+ .margin({ top: 5 })
+ }
+ }, item => item)
+ }.margin({ left: 52 })
+ }
+ .scrollBar(BarState.Off)
+ .scrollable(ScrollDirection.Vertical)
+
+ ScrollBar({ scroller: this.scroller, direction: this.directionValue, state: this.stateValue }) {
+ Text()
+ .width(30)
+ .height(100)
+ .borderRadius(10)
+ .backgroundColor('#C0C0C0')
+ }.key('scroll').width(30).backgroundColor('#ededed')
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets
index 8dcfc3e388cb06f03a3be71f4510c6560a93b2ac..2f7c798212ac69d7e178afd453ead5012030fc88 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets
@@ -18,7 +18,7 @@ import events_emitter from '@ohos.emitter';
@Entry
@Component
struct scrollCode {
- @State scrollable: ScrollDirection = ScrollDirection.Vertical;
+ @State scrollable: ScrollDirection = ScrollDirection.None;
@State scrollBar: BarState = BarState.On;
@State scrollBarColor: Color = "#FF0000FF";
@State scrollBarWidth: number = 30;
@@ -120,22 +120,37 @@ struct scrollCode {
.onScrollEnd(() => {
console.info('Scroll Stop')
})
-
Button('scroll 100')
.onClick(() => {
this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100 })
- })
- .margin({ top: 10, left: 20 })
+ }).margin({ top: 170, left: 20 })
Button('back top')
.onClick(() => {
this.scroller.scrollEdge(Edge.Top)
})
- .margin({ top: 60, left: 20 })
- Button('next page')
- .onClick(() => {
+ .margin({ top: 120, left: 20 })
+ Button('next page').backgroundColor(0x2788D9).width(200).height(100).fontSize(20)
+ .onClick((event: ClickEvent) => {
+ this.onClickValue = true;
+ try {
+ var backData = {
+ data: {
+ "scrollToIndex": 10,
+ "ACTION": this.onClickValue,
+ "event": JSON.stringify(event)
+ }
+ }
+ var backEvent = {
+ eventId: 30,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("click to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("click action state err: " + JSON.stringify(err.message))
+ }
this.scroller.scrollPage({ next: true })
- })
- .margin({ top: 110, left: 20 })
+ }).key('button').margin({ top: 10, left: 20 })
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/search.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/search.ets
new file mode 100755
index 0000000000000000000000000000000000000000..3bee1b40fb7e7fe4c877c45063edafda3f61e8fb
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/search.ets
@@ -0,0 +1,58 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct SearchExample {
+ @State textFontValue: number= 10;
+ @State searchButtonValue: string= ''
+ @State caretPositionValue: string= 10
+ private stateChangCallBack = (eventData) => {
+ console.info("search page state change called:" + JSON.stringify(eventData));
+ if (eventData != null) {
+ if (eventData.data.textFontValue != null) {
+ this.textFontValue = eventData.data.textFontValue;
+ }
+ if (eventData.data.searchButtonValue != null) {
+ this.searchButtonValue = eventData.data.searchButtonValue;
+ }
+ if (eventData.data.caretPositionValue != null) {
+ this.caretPositionValue = eventData.data.caretPositionValue;
+ }
+ }
+ }
+
+ onPageShow() {
+ console.info('span page show called');
+ var stateChangeEvent = {
+ eventId: 40,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+ }
+
+ build() {
+ Column() {
+ Navigation() {
+ Search({ value: '', placeholder: "", searchButton: "bbb" }).width('85%').margin(26)
+ .key('search')
+ }
+ }
+ }
+}
+
+
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition.ets
new file mode 100755
index 0000000000000000000000000000000000000000..c2b28f9b4ad3cee9d2518e1507df27bf73bdadf1
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition.ets
@@ -0,0 +1,84 @@
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct SharedTransitionExample {
+ @State scale: number = 1
+ @State opacity: number = 1
+ @State active: boolean = false
+ @State duration: number = 1000
+ @State delay: number = 0
+
+ build() {
+ List() {
+ ListItem() {
+ Row() {
+ Navigator({ target: 'pages/sharedTransition2', type: NavigationType.Push }) {
+ Image($rawfile('ic_health_heart.png')).width(50).height(50)
+ .sharedTransition('sharedImage1', { duration:this.duration , delay: this.delay })
+ }
+ .key('Navigator')
+ .padding({ left: 10 })
+ .onClick(() => {
+ this.active = true
+ console.info('SharedTransition current action state is: ' + this.active);
+ try {
+ var backData = {
+ data: {
+ "duration" : this.duration,
+ "delay" : this.delay,
+ }
+ }
+ var backEvent = {
+ eventId: 556,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("SharedTransition start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("SharedTransition emit action state err: " + JSON.stringify(err.message))
+ }
+ })
+ Text('SharedTransition').width(80).height(80).textAlign(TextAlign.Center)
+ }
+ }
+ }
+ }
+
+ onPageShow() {
+ console.info('sharedTransition page show called');
+ var stateChangeEvent = {
+ eventId: 555,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack)
+ }
+
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("sharedTransition page state change called:" + JSON.stringify(eventData));
+ if (eventData.data.duration != null) {
+ this.duration = eventData.data.duration;
+ }
+ if (eventData.data.delay != null) {
+ this.delay = eventData.data.delay;
+ }
+ }
+ }
+}
+
+
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition2.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition2.ets
new file mode 100755
index 0000000000000000000000000000000000000000..7b2dd8ef9cfdb53fc201e8b8f71e6ba894aa0098
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sharedTransition2.ets
@@ -0,0 +1,27 @@
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct SharedTransition2Example {
+ build() {
+ Stack() {
+ Image($rawfile('ic_health_heart.png')).width(150).height(150).sharedTransition('sharedImage1')
+ }.width('100%').height(400)
+ }
+}
+
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sourceType.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sourceType.ets
new file mode 100755
index 0000000000000000000000000000000000000000..674124c074c3079c7278e063527364138651659e
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/sourceType.ets
@@ -0,0 +1,56 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+
+@Entry
+@Component
+struct ClickExample {
+ @State text: string = '';
+
+ build() {
+ Column() {
+ Button('Touch').backgroundColor(0x2788D9).width(100).height(500).fontSize(20)
+ .onTouch((event: TouchEvent) => {
+ if (event.type === TouchType.Down) {
+ this.eventType = 'Down'
+ }
+ if (event.type === TouchType.Up) {
+ this.eventType = 'Up'
+ }
+ if (event.type === TouchType.Move) {
+ this.eventType = 'Move'
+ }
+ console.info(this.text = 'source:' + event.source);
+ try {
+ var backData = {
+ data: {
+ "event": JSON.stringify(event),
+ }
+ }
+ var backEvent = {
+ eventId: 155,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("sourceTypeTest_0100 start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("sourceTypeTest_0100 emit action state err: " + JSON.stringify(err.message))
+ }
+ }).key('button')
+ Text(this.text).padding(15).fontSize(20).key('text')
+ }.height(350).width('100%').padding(10)
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets
index acae2f9c57b3876a8b39e0c0aa075859ecd3ba8b..e24548fbdf983282630dfee716ae801b58cc842c 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets
@@ -21,6 +21,7 @@ struct SpanExample {
@State decorationValue:object={ type: TextDecorationType.None, color: Color.Red }
@State textCaseValue:TextCase=TextCase.Normal
@State fontSizeValue:number=40
+ @State fontColorValue: Color= 0xCCCCCC
private stateChangCallBack = (eventData) => {
console.info("span page state change called:" + JSON.stringify(eventData));
@@ -31,6 +32,9 @@ struct SpanExample {
if (eventData.data.textCaseValue != null) {
this.textCaseValue = eventData.data.textCaseValue;
}
+ if (eventData.data.fontColorValue != null) {
+ this.fontColorValue = eventData.data.fontColorValue;
+ }
}
}
@@ -47,11 +51,17 @@ struct SpanExample {
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent2, this.stateChangCallBack);
+
+ var stateChangeEvent3 = {
+ eventId: 42,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent3, this.stateChangCallBack);
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
- Text('Basic Usage').fontSize(9).fontColor(0xCCCCCC)
+ Text('Basic Usage').fontSize(9).fontColor(this.fontColorValue).key('fontColor')
Text() {
Span('This is the Span component').fontSize(this.fontSizeValue).textCase(this.textCaseValue)
.decoration(this.decorationValue).key('decoration')
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stateStyle.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stateStyle.ets
new file mode 100755
index 0000000000000000000000000000000000000000..0d0ccea5356cef78e1992c783de4a1c5db8a7f48
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/stateStyle.ets
@@ -0,0 +1,107 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter'
+
+@Entry
+@Component
+struct StyleExample {
+ @State isEnable: boolean = true
+
+ @Styles pressedStyles() {
+ .backgroundColor("#ED6F21")
+ .borderRadius(10)
+ .borderStyle(BorderStyle.Dashed)
+ .borderWidth(2)
+ .borderColor("#33000000")
+ .width(120)
+ .height(30)
+ .opacity(1)
+ }
+
+ @Styles disabledStyles() {
+ .backgroundColor("#E5E5E5")
+ .borderRadius(10)
+ .borderStyle(BorderStyle.Solid)
+ .borderWidth(2)
+ .borderColor("#2a4c1919")
+ .width(90)
+ .height(25)
+ .opacity(1)
+ }
+
+ @Styles normalStyles() {
+ .backgroundColor("#0A59F7")
+ .borderRadius(10)
+ .borderStyle(BorderStyle.Solid)
+ .borderWidth(2)
+ .borderColor("#33000000")
+ .width(100)
+ .height(25)
+ .opacity(1)
+ }
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
+ Text("normal")
+ .fontSize(14)
+ .fontColor(Color.White)
+ .opacity(0.5)
+ .stateStyles({
+ normal: this.normalStyles,
+ })
+ .margin({ bottom: 20 })
+ .textAlign(TextAlign.Center)
+ Text("pressed")
+ .backgroundColor("#0A59F7")
+ .borderRadius(20)
+ .borderStyle(BorderStyle.Dotted)
+ .borderWidth(2)
+ .borderColor(Color.Red)
+ .width(100)
+ .height(25)
+ .opacity(1)
+ .fontSize(14)
+ .fontColor(Color.White)
+ .stateStyles({
+ pressed: this.pressedStyles,
+ })
+ .margin({ bottom: 20 })
+ .textAlign(TextAlign.Center)
+ Text(this.isEnable == true ? "effective" : "disabled")
+ .backgroundColor("#0A59F7")
+ .borderRadius(20)
+ .borderStyle(BorderStyle.Solid)
+ .borderWidth(2)
+ .borderColor(Color.Gray)
+ .width(100)
+ .height(25)
+ .opacity(1)
+ .fontSize(14)
+ .fontColor(Color.White)
+ .enabled(this.isEnable)
+ .stateStyles({
+ disabled: this.disabledStyles,
+ })
+ .textAlign(TextAlign.Center)
+ Text("control disabled")
+ .onClick(() => {
+ this.isEnable = !this.isEnable
+ console.log(`${this.isEnable}`)
+ })
+ }
+ .width(350).height(300)
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemPrompt.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemPrompt.ets
new file mode 100755
index 0000000000000000000000000000000000000000..4e39fb548674a5aae1ab460d227168501b6b803a
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/systemPrompt.ets
@@ -0,0 +1,73 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter';
+import prompt from '@system.prompt';
+
+@Entry
+@Component
+struct promptExample {
+ @State text: string = 'item1'
+ @State color: string = '#000000'
+ build(){
+ Column(){
+ Button('showActionMenu')
+ .key('button1')
+ .backgroundColor('#FF0B8FE2')
+ .fontSize(20)
+ .margin({top: 20})
+ .onClick(()=>{
+ prompt.showActionMenu({
+ title: 'Title Info',
+ buttons: [
+ {
+ text: this.text,
+ color: this.color,
+ },
+ ],
+ success: function(data) {
+ console.log('dialog success callback,click button : ' + data.tapIndex);
+ },
+ fail: function(data) {
+ console.log('dialog fail callback' + data.errMsg);
+ },
+ });
+ })
+ Button('showDialog')
+ .key('button2')
+ .backgroundColor('#FF0B8FE2')
+ .fontSize(20)
+ .margin({top: 20})
+ .onClick(()=> {
+ prompt.showDialog({
+ title: 'Title Info',
+ message: 'Message Info',
+ buttons: [
+ {
+ text: this.text,
+ color: this.color,
+ },
+ ],
+ success: function(data) {
+ console.log('dialog success callback,click button : ' + data.index);
+ },
+ cancel: function() {
+ console.log('dialog cancel callback');
+ },
+ });
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets
index e8c9bca721746cba39b8bfa0464f2a2a17837384..93072d67557c5f2190a41bc3ed734b2e5a6ce957 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets
@@ -17,12 +17,13 @@ import events_emitter from '@ohos.emitter'
@Entry
@Component
struct TextExample {
- @State fontSize: number = 9
+ @State fontSize: number = 9;
+ @State fontColor: string = "0xCCCCCC";
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Text('lineHeight')
.fontSize(this.fontSize)
- .fontColor(0xCCCCCC)
+ .fontColor(this.fontColor)
.key('text')
Image($rawfile('test.png'))
.key('image')
@@ -39,6 +40,12 @@ struct TextExample {
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
+
+ var stateChangeEventOne = {
+ eventId: 198,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEventOne, this.stateChangCallBack)
}
private stateChangCallBack = (eventData) => {
@@ -47,6 +54,9 @@ struct TextExample {
if (eventData.data.fontSize != null) {
this.fontSize = parseInt(eventData.data.fontSize);
}
+ if (eventData.data.fontColor != null) {
+ this.fontColor = eventData.data.fontColor;
+ }
}
}
}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/timeStamp.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/timeStamp.ets
new file mode 100755
index 0000000000000000000000000000000000000000..272156b7d7de2b622c87ff0f80906c3489ac379d
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/timeStamp.ets
@@ -0,0 +1,47 @@
+// @ts-nocheck
+/**
+ * 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 events_emitter from '@ohos.emitter'
+@Entry
+@Component
+struct ClickExample {
+ @State text: string = ''
+ build() {
+ Column() {
+ Button('Click').backgroundColor(0x2788D9)
+ .key('button')
+ .onClick((event: ClickEvent) => {
+ this.text = event.timestamp
+ console.info(this.text)
+ try {
+ var backData = {
+ data: {
+ "Text": this.text,
+ }
+ }
+ var backEvent = {
+ eventId: 235,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("button start to emit action state")
+ events_emitter.emit(backEvent, backData)
+ } catch (err) {
+ console.info("button emit action state err: " + JSON.stringify(err.message))
+ }
+ })
+ Text(this.text).padding(15)
+ }.height(300).width('100%').padding(35)
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets
index 11a755ec98072ee9c4e1ac36e83830405b98f451..4f7ffc0361c22adb17148fea44343e80b8e5dc93 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets
@@ -18,7 +18,7 @@ import events_emitter from '@ohos.emitter';
@Entry
@Component
struct ToggleExample {
- @State selectedColor : color = '#330A59F7';
+ @State selectedColor : Color = '#330A59F7';
@State toggleType : ToggleType = ToggleType.Button;
@State isOn : boolean = false;
@@ -29,6 +29,12 @@ struct ToggleExample {
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+
+ var stateChangeEventOne = {
+ eventId: 1012,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEventOne, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets
index 7bdd4c05b2b2a4cfca3434811353315207b72cd2..da24b523930070b46881be1b69a29d7a4de4a33e 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets
@@ -19,13 +19,14 @@ import events_emitter from '@ohos.emitter'
struct TransitionExample {
@State btn1: boolean = false
@State show: string = "show"
+ @State opacity: number = 1
@State onActionCalled: boolean = false
@State transitionTypeOne: TransitionType = TransitionType.Insert
@State transitionTypeTwo: TransitionType = TransitionType.Delete
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,}) {
- Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:50}).key('button')
+ Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:50}).key('button').opacity(this.opacity)
.onClick(() => {
this.onActionCalled = true;
try {
@@ -54,10 +55,28 @@ struct TransitionExample {
})
if (this.btn1) {
Button() {
- Image($r('app.media.bg')).width("80%").height(300).key('image')
+ Image($rawfile('test.png')).width("80%").height(300).key('image')
}.transition({ type: this.transitionTypeOne, scale: {x:0,y:1.0} }).key('button1')
.transition({ type: this.transitionTypeTwo, scale: { x: 1.0, y: 0.0 } })
}
}.height(400).width("100%").padding({top:100})
}
+
+ onPageShow() {
+ console.info('transition page show called');
+ var stateChangeEvent = {
+ eventId: 112,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(stateChangeEvent, this.stateChangCallBack);
+ }
+
+ private stateChangCallBack = (eventData) => {
+ if (eventData != null) {
+ console.info("transition state change called:" + JSON.stringify(eventData));
+ if (eventData.data.opacity != null) {
+ this.opacity = parseInt(eventData.data.opacity);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AboutToDisappearJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AboutToDisappearJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..315d4ed1cf0f74b75c1783a639f6fc9b514a7d4e
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AboutToDisappearJsunit.test.ets
@@ -0,0 +1,71 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function aboutToDisappearJsunit() {
+ describe('aboutToDisappearTest', function () {
+ beforeEach(async function (done) {
+ console.info("aboutToDisappear beforeEach start");
+ let options = {
+ uri: 'pages/aboutToDisappear',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get aboutToDisappear state pages:" + JSON.stringify(pages));
+ if (!("aboutToDisappear" == pages.name)) {
+ console.info("get aboutToDisappear state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push aboutToDisappear page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push aboutToDisappear page error:" + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("aboutToDisappear after each called");
+ });
+
+ it('aboutToDisappearTest_0100', 0, async function (done) {
+ console.info('aboutToDisappearTest_0100 START');
+ await Utils.sleep(1500);
+ let callback = (indexEvent) => {
+ console.info("aboutToDisappearTest_0100 get state result is: " + JSON.stringify(indexEvent));
+ expect(indexEvent.data.ACTION).assertEqual(false);
+ }
+ let indexEvent = {
+ eventId: 160,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEvent, callback);
+ } catch (err) {
+ console.info("aboutToDisappearTest_0100 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("aboutToDisappearTest_0100 click result is: " + JSON.stringify(sendEventByKey('button1',10,"")));
+ await Utils.sleep(1000);
+ console.info('aboutToDisappearTest_0100 END');
+ done();
+ });
+ })
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AlphabetIndexerJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AlphabetIndexerJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..293156fa7c36c592bfb7102b0531ec5a061ab061
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AlphabetIndexerJsunit.test.ets
@@ -0,0 +1,102 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
+import router from '@system.router';
+import Utils from './Utils';
+import events_emitter from '@ohos.events.emitter';
+
+export default function alphabetIndexerJsunit() {
+ describe('alphabetIndexerTest', function () {
+ beforeEach(async function (done) {
+ console.info("alphabetIndexer beforeEach start");
+ let options = {
+ uri: 'pages/alphabetIndexer',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get alphabetIndexer state pages:" + JSON.stringify(pages));
+ if (!("alphabetIndexer" == pages.name)) {
+ console.info("get alphabetIndexer state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push alphabetIndexer page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push alphabetIndexer page error:" + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("alphabetIndexer after each called");
+ });
+
+ it('testAlphabetIndexer01', 0, async function (done) {
+ console.info('[testAlphabetIndexer01] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('alphabetIndexer');
+ let obj = JSON.parse(strJson);
+ console.info("[testAlphabetIndexer01] alphabetIndexer obj is: " + JSON.stringify(obj));
+ let font = JSON.parse(obj.$attrs.font);
+ console.info("[testAlphabetIndexer01] font: " + JSON.stringify(font));
+ expect(font.size).assertEqual(20);
+ expect(font.weight).assertEqual('FontWeight.Bolder');
+ expect(font.family).assertEqual('sans-serif');
+ expect(font.style).assertEqual('FontStyle.Italic');
+ console.info('testAlphabetIndexer01 END');
+ done();
+ });
+
+ it('testAlphabetIndexer02', 0, async function (done) {
+ console.info('[testAlphabetIndexer02] START');
+ try {
+ let obj = {
+ size: 25,
+ weight: 400,
+ family: 'Arial',
+ style: FontStyle.Normal
+ }
+ let eventData = {
+ data: {
+ "font": JSON.stringify(obj)
+ }
+ }
+ var innerEvent = {
+ eventId: 71,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testAlphabetIndexer02] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testAlphabetIndexer02] change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJsonNew = getInspectorByKey('alphabetIndexer');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("[testAlphabetIndexer02] alphabetIndexer obj is: " + JSON.stringify(objNew));
+ let font = JSON.parse(objNew.$attrs.font);
+ console.info("[testAlphabetIndexer02] font: " + JSON.stringify(font));
+ expect(font.size).assertEqual(25);
+ expect(font.weight).assertEqual("FontWeight.400");
+ expect(font.family).assertEqual('Arial');
+ expect(font.style).assertEqual('FontStyle.Normal');
+ console.info('testAlphabetIndexer02 END');
+ done();
+ });
+ });
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets
index b8a8d83cdfcfe5aa0c610511153a464a109c502d..aca8b7f8a532735fd16b8f81f7396f94adfbd24f 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets
@@ -30,7 +30,7 @@ export default function badgeJsunit() {
router.clear();
let pages = router.getState();
console.info("get badge state pages: " + JSON.stringify(pages));
- if (!("appear" == pages.name)) {
+ if (!("badge" == pages.name)) {
console.info("get badge state pages.name: " + JSON.stringify(pages.name));
result = await router.push(options);
await Utils.sleep(2000);
@@ -168,5 +168,81 @@ export default function badgeJsunit() {
done();
});
+ it('testBadge06', 0, async function (done) {
+ console.info('[testBadge06] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('badge2');
+ let obj = JSON.parse(strJson);
+ console.info("[testBadge06] component obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Badge');
+ expect(obj.$attrs.value).assertEqual('new');
+ done();
+ });
+
+ it('testBadge07', 0, async function (done) {
+ console.info('[testBadge07] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('badge2');
+ let obj = JSON.parse(strJson);
+ console.info("[testBadge07] component obj is: " + JSON.stringify(obj));
+ let style = JSON.parse(obj.$attrs.style);
+ expect(obj.$type).assertEqual('Badge');
+ expect(style.color).assertEqual('#FFFF0000');
+ done();
+ });
+
+ it('testBadge08', 0, async function (done) {
+ console.info('[testBadge08] START');
+ await Utils.sleep(1000);
+ try {
+ var eventData = {
+ data: {
+ "colorValue": Color.Blue,
+ }
+ }
+ var innerEvent = {
+ eventId: 70,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testBadge08] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testBadge08] change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJsonNew = getInspectorByKey('badge2');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("[testBadge08] component objNew is: " + JSON.stringify(objNew));
+ let style = JSON.parse(objNew.$attrs.style);
+ expect(style.color).assertEqual('#FF0000FF');
+ done();
+ });
+
+ it('testBadge09', 0, async function (done) {
+ console.info('[testBadge09] START');
+ await Utils.sleep(1000);
+ try {
+ var eventData = {
+ data: {
+ "message": "test",
+ }
+ }
+ var innerEvent = {
+ eventId: 70,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testBadge09] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testBadge09] change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJsonNew = getInspectorByKey('badge2');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("[testBadge09] component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$attrs.value).assertEqual('test');
+ done();
+ });
+
})
}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindMenuJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindMenuJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..e851d768bfc052223bdcba5a890772d840e40cf4
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindMenuJsunit.test.ets
@@ -0,0 +1,72 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function aboutToDisappearJsunit() {
+ describe('bindMenuTest', function () {
+ beforeEach(async function (done) {
+ console.info("bindMenu beforeEach start");
+ let options = {
+ uri: 'pages/bindMenu',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get bindMenu state pages:" + JSON.stringify(pages));
+ if (!("bindMenu" == pages.name)) {
+ console.info("get bindMenu state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push bindMenu page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push bindMenu page error:" + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("bindMenu after each called");
+ });
+
+ it('bindMenuTest_0100', 0, async function (done) {
+ console.info('bindMenuTest_0100 START');
+ console.info("bindMenuTest_0100 text click result is: " + JSON.stringify(sendEventByKey('text',10,"")));
+ await Utils.sleep(1500);
+ let callback = (indexEvent) => {
+ console.info("bindMenuTest_0100 get state result is: " + JSON.stringify(indexEvent));
+ expect(indexEvent.data.ACTION).assertEqual(true);
+ }
+ let indexEvent = {
+ eventId: 123,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEvent, callback);
+ } catch (err) {
+ console.info("bindMenuTest_0100 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("bindMenuTest_0100 button click result is: " + JSON.stringify(sendEventByKey('button',10,"")));
+ await Utils.sleep(1000);
+ console.info('bindMenuTest_0100 END');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindPopupJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindPopupJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..6ff43845e1c67dfe45354612668d340899e60093
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BindPopupJsunit.test.ets
@@ -0,0 +1,134 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import Utils from './Utils';
+import events_emitter from '@ohos.events.emitter';
+
+export default function customPopupOptionJsunit(){
+ describe('bindPopupTest', function (){
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/bindPopup',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get bindPopup state success " + JSON.stringify(pages));
+ if (!("bindPopup" == pages.name)) {
+ console.info("get bindPopup state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(1000);
+ console.info("push bindPopup page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push bindPopup page error: " + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("bindPopup after each called");
+ });
+
+ it('bindPopupTest_0100', 0, async function (done) {
+ console.info('bindPopupTest_0100 START');
+ await Utils.sleep(1500);
+ let callback = (indexEvent) => {
+ console.info("bindPopupTest_0100 get state result is: " + JSON.stringify(indexEvent));
+ expect(indexEvent.data.enableArrow).assertEqual(true);
+ expect(indexEvent.data.maskColor).assertEqual(0x33000000);
+ }
+ let indexEvent = {
+ eventId: 236,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEvent, callback);
+ } catch (err) {
+ console.info("bindPopupTest_0100 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("bindPopupTest_0100 click result is: " + JSON.stringify(sendEventByKey('button',10,"")));
+ await Utils.sleep(1000);
+ console.info("bindPopupTest_0100 click Two result is: " + JSON.stringify(sendEventByKey('image',10,"")));
+ await Utils.sleep(1000);
+ console.info('bindPopupTest_0100 END');
+ done();
+ });
+
+ it('bindPopupTest_0200', 0, async function (done) {
+ console.info('bindPopupTest_0200 START');
+ try {
+ let eventData = {
+ data: {
+ "enableArrow": false,
+ "maskColor": 0x33000009
+ }
+ }
+ let indexEvent = {
+ eventId: 126,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("bindPopupTest_0200 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("bindPopupTest_0200 change component data error: " + err.message);
+ }
+ await Utils.sleep(1500);
+ let callbackOne = (indexEventOne) => {
+ console.info("bindPopupTest_0200 get state result is: " + JSON.stringify(indexEventOne));
+ expect(indexEventOne.data.enableArrow).assertEqual(false);
+ expect(indexEventOne.data.maskColor).assertEqual(0x33000009);
+ }
+ let indexEventOne = {
+ eventId: 237,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEventOne, callbackOne);
+ } catch (err) {
+ console.info("bindPopupTest_0200 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("bindPopupTest_0200 click result is: " + JSON.stringify(sendEventByKey('button1',10,"")));
+ await Utils.sleep(1000);
+ console.info('bindPopupTest_0200 END');
+ done();
+ });
+
+ it('bindPopupTest_0300', 0, async function (done) {
+ console.info('bindPopupTest_0300 START');
+ await Utils.sleep(1500);
+ let callback = (indexEvent) => {
+ console.info("bindPopupTest_0300 get state result is: " + JSON.stringify(indexEvent));
+ expect(indexEvent.data.placementOnTop).assertEqual(false);
+ }
+ let indexEvent = {
+ eventId: 238,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEvent, callback);
+ } catch (err) {
+ console.info("bindPopupTest_0300 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("bindPopupTest_0300 click result is: " + JSON.stringify(sendEventByKey('button2',10,"")));
+ await Utils.sleep(1000);
+ console.info('bindPopupTest_0300 END');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BlankJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BlankJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..757c4a6c75dd8a36169ef5d3d8e88200ebb0df29
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BlankJsunit.test.ets
@@ -0,0 +1,89 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter'
+import Utils from './Utils';
+
+export default function blankJsunit() {
+ describe('appInfoTest', function () {
+ beforeEach(async function (done) {
+ console.info("blank beforeEach start");
+ let options = {
+ uri: 'pages/blank',
+ }
+ let result;
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get blank state pages: " + JSON.stringify(pages));
+ if (!("blank" == pages.name)) {
+ console.info("get blank state pages.name: " + JSON.stringify(pages.name));
+ result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push blank page result: " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push blank page error: " + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("blank after each called");
+ })
+
+ it('testBlank01', 0, async function (done) {
+ console.info('[testBlank01] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('blank');
+ let obj = JSON.parse(strJson);
+ console.info("[testBlank01] component obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Blank');
+ expect(obj.$attrs.color).assertEqual('#FF0000FF');
+ expect(obj.$attrs.min).assertEqual('0.000000px');
+ done();
+ });
+
+ it('testBlank02', 0, async function (done) {
+ console.info('[testBlank02] START');
+ await Utils.sleep(1000);
+ try {
+ var eventData = {
+ data: {
+ "colorValue": Color.Red,
+ }
+ }
+ var innerEvent = {
+ eventId: 90,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testBlank02] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testBlank02] change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJsonNew = getInspectorByKey('blank');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("[testBlank02] component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$type).assertEqual('Blank');
+ expect(objNew.$attrs.color).assertEqual('#FFFF0000');
+ done();
+ });
+ })
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CircleJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CircleJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..669e5199ce85205de0cbe6d9a6fb199cac3d51ad
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CircleJsunit.test.ets
@@ -0,0 +1,119 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function circleJsunit() {
+ describe('circleTest', function () {
+ beforeEach(async function (done) {
+ console.info("circle beforeEach start");
+ let options = {
+ uri: 'pages/circle',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get circle state pages:" + JSON.stringify(pages));
+ if (!("circle" == pages.name)) {
+ console.info("get circle state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push circle page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push circle page error:" + JSON.stringify(result));
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("circle after each called");
+ });
+
+ it('circleTest_0100', 0, async function (done) {
+ console.info('circleTest_0100 START');
+ let strJson = getInspectorByKey('circle');
+ console.info("circleTest_0100 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("circleTest_0100 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.height).assertEqual('450.00px');
+ expect(obj.$attrs.width).assertEqual('450.00px');
+ done();
+ });
+
+ it('circleTest_0200', 0, async function (done) {
+ console.info('[circleTest_0200] START');
+ try {
+ var eventData = {
+ data: {
+ "width": '500px',
+ "height": '500px',
+ }
+ }
+ console.info('[circleTest_0200] START');
+ var innerEvent = {
+ eventId:455,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[circleTest_0200] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[circleTest_0200] change component data error: " + err.message);
+ }
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('circle');
+ let obj = JSON.parse(strJson);
+ console.info("[circleTest_0200] component objNew is: " + JSON.stringify(obj));
+ expect(obj.$attrs.height).assertEqual('500.00px');
+ expect(obj.$attrs.width).assertEqual('500.00px');
+ console.info('circleTest_0200 END');
+ done();
+ });
+
+ it('circleTest_0300', 0, async function (done) {
+ console.info('[circleTest_0300] START');
+ try {
+ var eventData = {
+ data: {
+ "width": '-a',
+ "height": '-b',
+ }
+ }
+ console.info('[circleTest_0300] START');
+ var innerEvent = {
+ eventId:455,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[circleTest_0300] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[circleTest_0300] change component data error: " + err.message);
+ }
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('circle');
+ let obj = JSON.parse(strJson);
+ console.info("[circleTest_0300] component objNew is: " + JSON.stringify(obj));
+ expect(obj.$attrs.height).assertEqual('0.00px');
+ expect(obj.$attrs.width).assertEqual('0.00px');
+ console.info('circleTest_0300 END');
+ done();
+ });
+
+ })
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ConfigurationJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ConfigurationJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..91157ca6438406fc574bed54f38dc4346aaca1dc
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ConfigurationJsunit.test.ets
@@ -0,0 +1,73 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function transFormJsunit() {
+ describe('appInfoTest', function () {
+ beforeEach(async function (done) {
+ console.info("prompt beforeEach start");
+ let options = {
+ uri: 'pages/configuration',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get prompt state pages:" + JSON.stringify(pages));
+ if (!("prompt " == pages.name)) {
+ console.info("get prompt state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push prompt page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push prompt page error:" + err);
+ }
+ done();
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("prompt each called");
+ });
+ it('configurationTest_0100', 0, async function (done) {
+ console.info('configurationTest_0100 is start');
+ try {
+ let callBackConfiguration = (backData) => {
+ console.info("configurationTest_0100 get configurationEvent result is: " + JSON.stringify(backData));
+ expect(backData.data.COUNTRY).assertEqual('');
+ expect(backData.data.DIR).assertEqual('ltr');
+ }
+ var configurationEvent = {
+ eventId: 36,
+ priority: events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(configurationEvent, callBackConfiguration);
+ } catch (err) {
+ console.info("configurationTest_0100 on configurationEvent err : " + JSON.stringify(err));
+ }
+ console.info("testAppear01 click result is: " + JSON.stringify(sendEventByKey('button', 10, "")));
+ console.info('[configurationTest01] END');
+ done();
+ });
+ })
+}
+
+
+
+
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DirectionJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DirectionJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..33eee8d3fe5d05072fea077a1b44c157b98f5e30
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DirectionJsunit.test.ets
@@ -0,0 +1,110 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import Utils from './Utils';
+import events_emitter from '@ohos.events.emitter';
+
+export default function directionJsunit(){
+ describe('directionTest', function (){
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/direction',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get direction state success " + JSON.stringify(pages));
+ if (!("direction" == pages.name)) {
+ console.info("get direction state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(1000);
+ console.info("push direction page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push direction page error: " + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("direction after each called");
+ });
+
+ it('directionTest_0100', 0, async function (done) {
+ console.info('directionTest_0100 START');
+ let strJson = getInspectorByKey('direction');
+ console.info("directionTest_0100 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("directionTest_0100 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.constructor.direction).assertEqual("FlexDirection.Column");
+ done();
+ });
+
+ it('directionTest_0200', 0, async function (done) {
+ console.info('directionTest_0200 START');
+ try {
+ let eventData = {
+ data: {
+ "direction": FlexDirection.Row,
+ }
+ }
+ let indexEvent = {
+ eventId: 985,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("directionTest_0200 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("directionTest_0200 change component data error: " + err.message);
+ }
+ await Utils.sleep(1000);
+ let strJsonNew = getInspectorByKey('direction');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("directionTest_0200 component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
+ console.info('directionTest_0200 END');
+ done();
+ });
+
+ it('directionTest_0300', 0, async function (done) {
+ console.info('directionTest_0300 START');
+ try {
+ let eventData = {
+ data: {
+ "direction": 666,
+ }
+ }
+ let indexEvent = {
+ eventId: 985,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("directionTest_0300 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("directionTest_0300 change component data error: " + err.message);
+ }
+ await Utils.sleep(1000);
+ let strJsonNew = getInspectorByKey('direction');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("directionTest_0300 component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
+ console.info('directionTest_0300 END');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DividerJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DividerJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..0e981d1ebd7fd6794c3a5937aee087afd0e01388
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/DividerJsunit.test.ets
@@ -0,0 +1,95 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function dividerJsunit() {
+ describe('dividerTest', function () {
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/divider',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get divider state success " + JSON.stringify(pages));
+ if (!("divider" == pages.name)) {
+ console.info("get divider state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(1000);
+ console.info("push divider page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push divider page error: " + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("divider after each called");
+ });
+
+ it('dividerTest_0100', 0, async function (done) {
+ console.info('dividerTest_0100 START');
+ let strJson = getInspectorByKey('Divider');
+ console.info("dividerTest_0100 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("dividerTest_0100 component obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Divider');
+ done();
+ });
+
+ it('dividerTest_0200', 0, async function (done) {
+ console.info('dividerTest_0200 START');
+ let strJson = getInspectorByKey('Divider');
+ console.info("dividerTest_0200 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("dividerTest_0200 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.color).assertEqual('#FFCCCCCC');
+ console.info('dividerTest_0200 END');
+ done();
+ });
+
+ it('dividerTest_0300', 0, async function (done) {
+ console.info('dividerTest_0300 START');
+ try {
+ let eventData = {
+ data: {
+ "color": '#FF000990',
+ }
+ }
+ let indexEvent = {
+ eventId: 917,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("dividerTest_0300 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("dividerTest_0300 change component data error: " + err.message);
+ }
+ await Utils.sleep(3000);
+ let strJsonNew = getInspectorByKey('Divider');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("dividerTest_0300 component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$attrs.color).assertEqual('#FF000990');
+ console.info('dividerTest_0300 END');
+ done();
+ });
+ })
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets
index d51a990aa2fff24ac5618bc00c757fa4b8cb9501..4cd05d34d21e075201dd1ec7d6544a6d53fd1d88 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets
@@ -63,8 +63,7 @@ export default function ellipseJsunit() {
try {
var eventData = {
data: {
- "width": '500px',
- "height": '500px'
+ "width": '100px'
}
}
var innerEvent = {
@@ -80,10 +79,35 @@ export default function ellipseJsunit() {
let strJson = getInspectorByKey('ellipse');
let obj = JSON.parse(strJson);
console.info("[testEllipse02] obj is: " + JSON.stringify(obj));
- expect(obj.$attrs.height).assertEqual('500.000000px');
- expect(obj.$attrs.width).assertEqual('500.000000px');
+ expect(obj.$attrs.width).assertEqual('100.000000px');
console.info('testEllipse02 END');
done();
});
+
+ it('testEllipse03', 0, async function (done) {
+ console.info('[testEllipse03] START');
+ try {
+ var eventData = {
+ data: {
+ "height": '500px'
+ }
+ }
+ var innerEvent = {
+ eventId: 5,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testEllipse03] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testEllipse03] change component data error: " + err.message);
+ }
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('ellipse');
+ let obj = JSON.parse(strJson);
+ console.info("[testEllipse03] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.height).assertEqual('500.000000px');
+ console.info('testEllipse03 END');
+ done();
+ });
})
}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets
index 7546cdd0a664393e00150c33613856dccaea9389..d947353eae68253da34209b3a7c1602f6ad3b6c5 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets
@@ -61,6 +61,7 @@ export default function girdContainerJsunit() {
done();
});
+
it('testGirdContainer02', 0, async function (done) {
console.info('[testEllipse02] START');
try {
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LineJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LineJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..0523b7f8abb99a1dd2568710df4b5b25668b2f6a
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LineJsunit.test.ets
@@ -0,0 +1,204 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import Utils from './Utils';
+import events_emitter from '@ohos.events.emitter';
+
+export default function LineJsunit(){
+ describe('LineTest', function () {
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/line',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get line state success " + JSON.stringify(pages));
+ if (!("line" == pages.name)) {
+ console.info("get line state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(1000);
+ console.info("push line page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push line page error: " + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("line after each called");
+ });
+
+ it('lineTest_0100', 0, async function (done) {
+ console.info('lineTest_0100 START');
+ let strJson = getInspectorByKey('line');
+ console.info("lineTest_0100 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("lineTest_0100 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.startPoint[0]).assertEqual(0);
+ done();
+ });
+
+ it('lineTest_0200', 0, async function (done) {
+ console.info('lineTest_0200 START');
+ let strJson = getInspectorByKey('line');
+ console.info("lineTest_0200 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("lineTest_0200 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.startPoint[1]).assertEqual(0);
+ done();
+ });
+
+ it('lineTest_0300', 0, async function (done) {
+ console.info('lineTest_0300 START');
+ let strJson = getInspectorByKey('line');
+ console.info("lineTest_0300 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("lineTest_0300 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.endPoint[0]).assertEqual(50);
+ done();
+ });
+
+ it('lineTest_0400', 0, async function (done) {
+ console.info('lineTest_0400 START');
+ let strJson = getInspectorByKey('line');
+ console.info("lineTest_0400 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("lineTest_0400 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.endPoint[1]).assertEqual(100);
+ done();
+ });
+
+ it('lineTest_0500', 0, async function (done) {
+ console.info('lineTest_0500 START');
+ await Utils.sleep(1000);
+ try {
+ var eventData = {
+ data: {
+ "startPoint": 50,
+ "startPointOne": 50,
+ }
+ }
+ var innerEvent = {
+ eventId: 233,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("lineTest_0500 start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("lineTest_0500 change component error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ var strJson = getInspectorByKey('line');
+ var obj = JSON.parse(strJson);
+ console.info("lineTest_0500 component obj is: " + JSON.stringify(obj.$attrs.startPoint[0]));
+ console.info("lineTest_0500 component objOne is: " + JSON.stringify(obj.$attrs.startPoint[1]));
+ expect(obj.$attrs.startPoint[0]).assertEqual(50);
+ expect(obj.$attrs.startPoint[1]).assertEqual(50);
+ done();
+ });
+
+ it('lineTest_0600', 0, async function (done) {
+ console.info('lineTest_0600 START');
+ await Utils.sleep(1000);
+ try {
+ var eventData = {
+ data: {
+ "endPoint": 100,
+ "endPointOne": 150,
+ }
+ }
+ var innerEvent = {
+ eventId: 233,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("lineTest_0600 start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("lineTest_0600 change component error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ var strJson = getInspectorByKey('line');
+ var obj = JSON.parse(strJson);
+ console.info("lineTest_0600 component obj is: " + JSON.stringify(obj.$attrs.endPoint[0]));
+ console.info("lineTest_0600 component objOne is: " + JSON.stringify(obj.$attrs.endPoint[1]));
+ expect(obj.$attrs.endPoint[0]).assertEqual(100);
+ expect(obj.$attrs.endPoint[1]).assertEqual(150);
+ done();
+ });
+
+ it('lineTest_0700', 0, async function (done) {
+ console.info('lineTest_0700 START');
+ await Utils.sleep(1000);
+ try {
+ var eventData = {
+ data: {
+ "startPoint": 'A',
+ "startPointOne": 'B',
+ }
+ }
+ var innerEvent = {
+ eventId: 233,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("lineTest_0700 start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("lineTest_0700 change component error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ var strJson = getInspectorByKey('line');
+ var obj = JSON.parse(strJson);
+ console.info("lineTest_0700 component obj is: " + JSON.stringify(obj.$attrs.startPoint[0]));
+ console.info("lineTest_0700 component objOne is: " + JSON.stringify(obj.$attrs.startPoint[1]));
+ expect(obj.$attrs.startPoint[0]).assertEqual(0);
+ expect(obj.$attrs.startPoint[1]).assertEqual(0);
+ done();
+ });
+
+ it('lineTest_0800', 0, async function (done) {
+ console.info('lineTest_0900 START');
+ await Utils.sleep(1000);
+ try {
+ var eventData = {
+ data: {
+ "endPoint": 'A',
+ "endPointOne": 'B',
+ }
+ }
+ var innerEvent = {
+ eventId: 233,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("lineTest_0800 start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("lineTest_0800 change component error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ var strJson = getInspectorByKey('line');
+ var obj = JSON.parse(strJson);
+ console.info("lineTest_0800 component obj is: " + JSON.stringify(obj.$attrs.endPoint[0]));
+ console.info("lineTest_0800 component objOne is: " + JSON.stringify(obj.$attrs.endPoint[1]));
+ expect(obj.$attrs.endPoint[0]).assertEqual(0);
+ expect(obj.$attrs.endPoint[1]).assertEqual(0);
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets
index 6e598a6d05e82f352b0cd523091a05bd6074d283..9e91175ca1b3a3a06f99df3d21714ab978d3d818 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets
@@ -64,10 +64,34 @@ import toggleJsunit from './ToggleJsunit.test.ets';
import shapeJsunit from './ShapeJsunit.test.ets'
import motionPathJsunit from './MotionPathJsunit.test.ets';
import scrollCodeJsunit from './ScrollCodeJsunit.test.ets';
-import canvas3Jsunit from './Canvas3Jsunit.test.ets';
import transitionJsunit from './TransitionJsunit.test.ets';
import priorityGestureJsunit from './PriorityGestureJsunit.test.ets';
import parallelGestureJsunit from './ParallelGestureJsunit.test.ets';
+import blankJsunit from './BlankJsunit.test.ets';
+import sharedTransitionJsunit from './SharedTransitionJsunit.test.ets';
+import alphabetIndexerJsunit from './AlphabetIndexerJsunit.test.ets';
+import lineJsunit from './LineJsunit.test.ets';
+import circleJsunit from './CircleJsunit.test.ets';
+import aboutToDisappearJsunit from './AboutToDisappearJsunit.test.ets';
+import bindMenuJsunit from './BindMenuJsunit.test.ets';
+import bindPopupJsunit from './BindPopupJsunit.test.ets';
+import directionJsunit from './DirectionJsunit.test.ets';
+import timeStampJsunit from './TimeStampJsunit.test.ets';
+import listItemJsunit from './ListItemJsunit.test.ets';
+import navigatorCodeJsunit from './NavigatorCodeJsunit.test.ets';
+import pieceJsunit from './PieceJsunit.test.ets';
+import dividerJsunit from './DividerJsunit.test.ets';
+import systemAppJsunit from './SystemAppJsunit.test.ets';
+import systempromptJsunit from './SystempromptJsunit.test.ets';
+import configurationJsunit from './ConfigurationJsunit.test.ets';
+import sourceTypeJsunit from './SourceTypeJsunit.test.ets';
+import pageTransitionJsunit from './PageTransitionJsunit.test.ets';
+import navigationJsunit from './NavigationJsunit.test.ets';
+import loadingProgressJsunit from './LoadingProgressJsunit.test.ets';
+import radioJsunit from './RadioJsunit.test.ets';
+import rowJsunit from './RowJsunit.test.ets';
+import scrollBarJsunit from './ScrollBarJsunit.test.ets';
+import searchJsunit from './SearchJsunit.test.ets';
export default function testsuite() {
gaugeJsunit();
@@ -105,7 +129,6 @@ export default function testsuite() {
badgeJsunit();
canvasJsunit();
canvas2Jsunit();
- canvas3Jsunit();
longPressGestureJsUnit();
buttonJsunit();
responseRegionJsunit();
@@ -126,4 +149,29 @@ export default function testsuite() {
transitionJsunit();
priorityGestureJsunit();
parallelGestureJsunit();
-}
\ No newline at end of file
+ blankJsunit();
+ sharedTransitionJsunit();
+ alphabetIndexerJsunit();
+ lineJsunit();
+ circleJsunit();
+ aboutToDisappearJsunit();
+ timeStampJsunit();
+ bindMenuJsunit();
+ bindPopupJsunit();
+ directionJsunit();
+ dividerJsunit();
+ systempromptJsunit();
+ configurationJsunit();
+ sourceTypeJsunit();
+ pageTransitionJsunit();
+ navigationJsunit();
+ loadingProgressJsunit();
+ radioJsunit();
+ rowJsunit();
+ listItemJsunit();
+ navigatorCodeJsunit();
+ pieceJsunit();
+ searchJsunit();
+ scrollBarJsunit();
+ systemAppJsunit();
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListItemJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListItemJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..5e8c689f73deb4d3adcfd01f156f80388012a983
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListItemJsunit.test.ets
@@ -0,0 +1,123 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function listItemJsunit() {
+ describe('listItemTest', function () {
+ beforeEach(async function (done) {
+ console.info("listItem beforeEach start");
+ let options = {
+ uri: 'pages/listItem',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get listItem state pages:" + JSON.stringify(pages));
+ if (!("listItem" == pages.name)) {
+ console.info("get listItem state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push listItem page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push listItem page error:" + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("listItem after each called");
+ });
+
+ it('testListItem01', 0, async function (done) {
+ console.info('[testListItem01] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('ListItem');
+ let obj = JSON.parse(strJson);
+ console.info("[testListItem01] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.sticky).assertEqual('Sticky.Normal');
+ console.info('testListItem01 END');
+ done();
+ });
+
+ it('testListItem02', 0, async function (done) {
+ console.info('[testListItem02] START');
+ try {
+ var eventData = {
+ data: {
+ "sticky": Sticky.None
+ }
+ }
+ var innerEvent = {
+ eventId: 1015,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testListItem02] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testListItem02] change component data error: " + err.message);
+ }
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('ListItem');
+ let obj = JSON.parse(strJson);
+ console.info("[testListItem02] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.sticky).assertEqual('Sticky.None');
+ console.info('testListItem02 END');
+ done();
+ });
+
+ it('testListItem03', 0, async function (done) {
+ console.info('[testListItem03] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('List');
+ let obj = JSON.parse(strJson);
+ console.info("[testListItem03] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.editMode).assertEqual('true');
+ console.info('testListItem03 END');
+ done();
+ });
+
+ it('testListItem04', 0, async function (done) {
+ console.info('[testEllipse03] START');
+ try {
+ var eventData = {
+ data: {
+ "editMode": false
+ }
+ }
+ var innerEvent = {
+ eventId: 1016,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testListItem04] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testListItem04] change component data error: " + err.message);
+ }
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('List');
+ let obj = JSON.parse(strJson);
+ console.info("[testListItem04] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.editMode).assertEqual('false');
+ console.info('testListItem04 END');
+ done();
+ });
+ })
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..748f099320e2f5f1f9fdad8e63b7b18dbee13ac3
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LoadingProgressJsunit.test.ets
@@ -0,0 +1,48 @@
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import Utils from './Utils';
+import events_emitter from '@ohos.events.emitter';
+
+export default function loadingProgressJsunit() {
+ describe('loadingProgressTest', function () {
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/loadingProgress',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get loadingProgress state success " + JSON.stringify(pages));
+ if (!("loadingProgress" == pages.name)) {
+ console.info("get loadingProgress state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(4000);
+ console.info("push loadingProgress page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push loadingProgress page error " + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("loadingProgress after each called");
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..e85f4a61d45f8524a7d1af9d27f044555457a081
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets
@@ -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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function navigationJsunit() {
+ describe('appInfoTest', function () {
+ beforeEach(async function (done) {
+ console.info("navigation beforeEach start");
+ let options = {
+ uri: 'pages/navigation',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get navigation state pages:" + JSON.stringify(pages));
+ if (!("navigation" == pages.name)) {
+ console.info("get navigation state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push navigation page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push navigation page error:" + JSON.stringify(err));
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("navigation after each called");
+ });
+
+ it('testNavigation_100', 0, async function (done) {
+ console.info('[testNavigation_100] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('Navigation');
+ let obj = JSON.parse(strJson);
+ console.info("[testNavigation_100] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.width).assertEqual("100.000000%");
+ console.info('[testNavigation_100] END');
+ done();
+ });
+
+ it('testNavigation_200', 0, async function (done) {
+ console.info('testNavigation_200 START');
+ await Utils.sleep(1000);
+ let callback = (indexEvent) => {
+ console.info("testNavigation_200 get state result is: " + JSON.stringify(indexEvent));
+ expect(indexEvent.data.ACTION).assertEqual(false);
+ }
+ let indexEvent = {
+ eventId: 44,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEvent, callback);
+ } catch (err) {
+ console.info("testNavigation_200 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("testNavigation_200 click result is: " + JSON.stringify(sendEventByKey('NavigationContent1',10,"")));
+ await Utils.sleep(2000);
+ console.info('testNavigation_200 END');
+ done();
+ });
+
+ it('testNavigation_300', 0, async function (done) {
+ console.info('[testNavigation_300] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('Navigation');
+ let obj = JSON.parse(strJson);
+ console.info("[testNavigation_300] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.height).assertEqual("300.000000vp");
+ console.info('[testNavigation_300] END');
+ done();
+ });
+
+ it('testNavigation_400', 0, async function (done) {
+ console.info('testNavigation_400 START');
+ await Utils.sleep(1000);
+ let callback = (indexEvent) => {
+ console.info("testNavigation_400 get state result is: " + JSON.stringify(indexEvent));
+ expect(indexEvent.data.ACTION).assertEqual(true);
+ }
+ let indexEvent = {
+ eventId: 44,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEvent, callback);
+ } catch (err) {
+ console.info("testNavigation_400 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("testNavigation_400 click result is: " + JSON.stringify(sendEventByKey('NavigationContent1',10,"")));
+ await Utils.sleep(2000);
+ console.info('testNavigation_400 END');
+ done();
+ });
+
+ it('testNavigation_500', 0, async function (done) {
+ console.info('[testNavigation_500] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('Navigation');
+ let obj = JSON.parse(strJson);
+ console.info("[testNavigation_500] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.align).assertEqual("Alignment.Center");
+ console.info('[testNavigation_500] END');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigatorCodeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigatorCodeJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..d975f481d025014ffe7dac17cdecaa1ea9946e28
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/NavigatorCodeJsunit.test.ets
@@ -0,0 +1,106 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+
+export default function navigatorCodeJsunit() {
+ beforeEach(async function (done) {
+ console.info("NavigatorClick beforeEach start");
+ let options = {
+ uri: 'pages/NavigatorCode',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get NavigatorClick state pages:" + JSON.stringify(pages));
+ if (!("NavigatorClick" == pages.name)) {
+ console.info("get NavigatorClick state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push NavigatorClick page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push NavigatorClick page error:" + JSON.stringify(result));
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("NavigatorClick after each called");
+ });
+
+ it('test_NavigatorClick_001', 0, async function (done) {
+ console.info('[test_NavigatorClick_001] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('NavigatorClick');
+ let obj = JSON.parse(strJson);
+ console.info("[test_NavigatorClick_001] component obj is: " + JSON.stringify(obj));
+ await Utils.sleep(1000);
+ expect(obj.$attrs.active).assertEqual('false');
+ done();
+ });
+
+ it('test_NavigatorClick_004', 0, async function (done) {
+ console.info('[test_NavigatorClick_004] START');
+ await Utils.sleep(1000);
+ try {
+ var eventData = {
+ data: {
+ "typeValue": "NavigationType.Back"
+ }
+ }
+ var innerEvent = {
+ eventId: 101,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[test_NavigatorClick_004] start to publish emit" + JSON.stringify(eventData));
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[test_NavigatorClick_004] change component error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ var strJson = getInspectorByKey('NavigatorType');
+ var obj = JSON.parse(strJson);
+ console.info("[test_NavigatorClick_004] component obj is: " + JSON.stringify(obj.$attrs.type));
+ expect(obj.$attrs.type).assertEqual('NavigationType.Back');
+ done();
+ });
+
+ it('test_NavigatorClick_004', 0, async function (done) {
+ await Utils.sleep(1000)
+ var callback = (eventData) => {
+ console.info("[test_NavigatorClick_004] get event state result is: " + JSON.stringify(eventData));
+ expect(eventData.data.ACTION).assertEqual(10)
+ }
+ var innerEvent = {
+ eventId: 30,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(innerEvent, callback)
+ } catch (err) {
+ console.info("[test_NavigatorClick_004] on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info('[test_NavigatorClick_004] sendEventByKey ' + JSON.stringify(sendEventByKey('button', 10, "")));
+ await Utils.sleep(1000)
+ console.info('[test_NavigatorClick_004] testSendTouchEvent END');
+ done();
+ });
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PageTransitionJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PageTransitionJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..71de5edc0608acd058c41f33ec7e6eab6e88b6a8
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PageTransitionJsunit.test.ets
@@ -0,0 +1,121 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter'
+import Utils from './Utils';
+
+export default function pageTransitionJsunit() {
+ describe('pageTransitionTest', function () {
+ beforeEach(async function (done) {
+ console.info("pageTransition beforeEach start");
+ let options = {
+ uri: 'pages/pageTransition',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get pageTransition state pages:" + JSON.stringify(pages));
+ if (!("pageTransition" == pages.name)) {
+ console.info("get pageTransition state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push pageTransition page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push pageTransition page error:" + JSON.stringify(err));
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("pageTransition after each called");
+ });
+
+ it('pageTransitionTest_0100', 0, async function (done) {
+ console.info('pageTransitionTest_0100 START');
+ let strJson = getInspectorByKey('Navigator');
+ let obj = JSON.parse(strJson);
+ console.info("pageTransitionTest_0100 component obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Navigator');
+ expect(obj.$attrs.target).assertEqual('pages/pageTransition2');
+ console.info('pageTransitionTest_0100 END');
+ done();
+ });
+
+ it('pageTransitionTest_0200', 0, async function (done) {
+ console.info('pageTransitionTest_0200 START');
+ let strJson = getInspectorByKey('Navigator');
+ console.info("pageTransitionTest_0200 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("pageTransitionTest_0200 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.active).assertEqual('false');
+ console.info('pageTransitionTest_0200 END');
+ done();
+ });
+
+ it('pageTransitionTest_0300', 0, async function (done) {
+ console.info('pageTransitionTest_0300 START');
+ let strJson = getInspectorByKey('Navigator');
+ console.info("pageTransitionTest_0300 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("pageTransitionTest_0300 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.type).assertEqual('NavigationType.Push');
+ console.info('pageTransitionTest_0300 END');
+ done();
+ });
+
+ it('pageTransitionTest_0400', 0, async function (done) {
+ console.info('pageTransitionTest_0400 START');
+ try {
+ let eventData = {
+ data: {
+ "scale": 6,
+ "opacity": 5,
+ }
+ }
+ let indexEvent = {
+ eventId: 95,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("pageTransitionTest_0400 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("pageTransitionTest_0400 change component data error: " + err.message);
+ }
+ let callback = (indexEventOne) => {
+ console.info("pageTransitionTest_0400 get state result is: " + JSON.stringify(indexEventOne));
+ expect(indexEventOne.data.scale).assertEqual(6);
+ expect(indexEventOne.data.opacity).assertEqual(5);
+ }
+ let indexEventOne = {
+ eventId: 96,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEventOne, callback);
+ } catch (err) {
+ console.info("pageTransitionTest_0400 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("pageTransitionTest_0400 click result is: " + JSON.stringify(sendEventByKey('Navigator',10,"")));
+ await Utils.sleep(2000);
+ console.info('pageTransitionTest_0400 END');
+ done();
+ });
+ })
+}
+
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PanelJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PanelJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..cb2b8d1467c94be040b00b01b2d295e5af653a91
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PanelJsunit.test.ets
@@ -0,0 +1,174 @@
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import Utils from './Utils';
+import events_emitter from '@ohos.events.emitter';
+
+export default function panelJsunit() {
+ describe('panelTest', function () {
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/panel',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get panel state success " + JSON.stringify(pages));
+ if (!("panel" == pages.name)) {
+ console.info("get panel state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(4000);
+ console.info("push panel page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push panel page error " + JSON.stringify(err));
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("panel after each called");
+ });
+
+ it('testPanel_100', 0, async function (done) {
+ console.info('testPanel_100 START');
+ await Utils.sleep(1000);
+ try {
+ let eventData = {
+ data: {
+ "type": "PanelType.Minibar"
+ }
+ }
+ var innerEvent = {
+ eventId: 440,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("testPanel_100 start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("testPanel_100 change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('Panel');
+ let obj = JSON.parse(strJson);
+ console.info("testPanel_100 component obj is: " + JSON.stringify(obj));
+ await Utils.sleep(2000);
+ expect(obj.$attrs.type).assertEqual("PanelType.Minibar");
+ console.info('testPanel_100 END');
+ done();
+ });
+
+ it('testPanel_200', 0, async function (done) {
+ console.info('testPanel_200 START');
+ await Utils.sleep(1000);
+ try {
+ let eventData = {
+ data: {
+ "mode": "PanelMode.Mini"
+ }
+ }
+ var innerEvent = {
+ eventId: 441,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("testPanel_200 start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("testPanel_200 change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('Panel');
+ let obj = JSON.parse(strJson);
+ console.info("testPanel_200 component obj is: " + JSON.stringify(obj));
+ await Utils.sleep(2000);
+ expect(obj.$attrs.mode).assertEqual("PanelMode.Mini");
+ console.info('testPanel_200 END');
+ done();
+ });
+
+ it('testPanel_300', 0, async function (done) {
+ console.info('testPanel_300 START');
+ await Utils.sleep(1000);
+ try {
+ let eventData = {
+ data: {
+ "show": "true"
+ }
+ }
+ var innerEvent = {
+ eventId: 442,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("testPanel_300 start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("testPanel_300 change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('Panel');
+ let obj = JSON.parse(strJson);
+ console.info("testPanel_300 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.show).assertEqual("true");
+ console.info('testPanel_300 END');
+ done();
+ });
+
+ it('testPanel_400', 0, async function (done) {
+ console.info('testPanel_400 START');
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('Panel');
+ let obj = JSON.parse(strJson);
+ console.info("testPanel_400 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.dragBar).assertEqual("true");
+ console.info('testPanel_400 END');
+ done();
+ });
+
+ it('testPanel_500', 0, async function (done) {
+ console.info('testPanel_500 START');
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('Panel');
+ let obj = JSON.parse(strJson);
+ console.info("testPanel_500 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.fullHeight).assertEqual("0.000000vp");
+ console.info('testPanel_500 END');
+ done();
+ });
+
+ it('testPanel_600', 0, async function (done) {
+ console.info('testPanel_600 START');
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('Panel');
+ let obj = JSON.parse(strJson);
+ console.info("testPanel_600 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.halfHeight).assertEqual("500.000000vp");
+ console.info('testPanel_600 END');
+ done();
+ });
+
+ it('testPanel_700', 0, async function (done) {
+ console.info('testPanel_700 START');
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('Panel');
+ let obj = JSON.parse(strJson);
+ console.info("testPanel_700 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.miniHeight).assertEqual("0.000000vp");
+ console.info('testPanel_700 END');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas3Jsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PieceJsunit.test.ets
similarity index 54%
rename from ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas3Jsunit.test.ets
rename to ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PieceJsunit.test.ets
index 2724ffd468a454b98d54611bc9370fe7ae29aa60..8b1088b0f39f68c59a6e83e04e86004ac23325c4 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas3Jsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PieceJsunit.test.ets
@@ -15,42 +15,45 @@
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
import Utils from './Utils';
-export default function canvasJsunit() {
- describe('canvas3Test', function () {
+export default function pieceJsunit() {
+ describe('appInfoTest', function () {
beforeEach(async function (done) {
- console.info("canvas3 beforeEach start");
let options = {
- uri: 'pages/canvas3',
+ uri: 'pages/PieceCode',
}
try {
router.clear();
let pages = router.getState();
- console.info("get canvas3 state pages:" + JSON.stringify(pages));
- if (!("canvas3" == pages.name)) {
- console.info("get canvas3 state pages.name:" + JSON.stringify(pages.name));
+ console.info("get PieceCode state success " + JSON.stringify(pages));
+ if (!("PieceCode" == pages.name)) {
+ console.info("get PieceCode pages success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
- console.info("push canvas3 page result:" + JSON.stringify(result));
+ console.info("push PieceCode page success " + JSON.stringify(result));
}
} catch (err) {
- console.error("push canvas3 page error:" + err);
+ console.error("push PieceCode page error " + JSON.stringify(err));
}
done()
});
afterEach(async function () {
- await Utils.sleep(1000);
- console.info("canvas3 after each called");
+ await Utils.sleep(2000);
+ console.info("PieceCode after each called");
});
- it('testCanvas01', 0, async function (done) {
- console.info('[testCanvas01] START');
+ it('test_pieceCode_001', 0, async function (done) {
+ console.info('[test_pieceCode_001] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('piece');
+ console.info("[test_pieceCode_001] strJson: " + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("[test_pieceCode_001] component obj is: " + JSON.stringify(obj));
await Utils.sleep(1000);
- console.info('[testCanvas01]----------- START');
- console.info('testCanvas01 END');
done();
});
- });
-}
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..43b78d534502c181e15ce7dfc4e57b0de958a0fc
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RadioJsunit.test.ets
@@ -0,0 +1,59 @@
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import Utils from './Utils';
+import events_emitter from '@ohos.events.emitter';
+
+export default function progressJsunit() {
+ describe('progressTest', function () {
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/progress',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get progress state success " + JSON.stringify(pages));
+ if (!("progress" == pages.name)) {
+ console.info("get progress state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(4000);
+ console.info("push progress page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push progress page error " + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("progress after each called");
+ });
+
+ it('testProgress_600', 0, async function (done) {
+ console.info('[testProgress_600] START');
+ await Utils.sleep(1000);
+ let strJson = getInspectorByKey('CPValue');
+ let obj = JSON.parse(strJson);
+ console.info("testProgress_600 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.width).assertEqual("100.000000vp");
+ console.info('testProgress_600 END');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RowJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RowJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..143557266a27a60e8069273ecb8222d0b2f003ec
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RowJsunit.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import Utils from './Utils';
+import events_emitter from '@ohos.events.emitter';
+
+export default function rowJsunit() {
+ describe('rowTest', function () {
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/row',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get row state success " + JSON.stringify(pages));
+ if (!("row" == pages.name)) {
+ console.info("get row state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(4000);
+ console.info("push row page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push row page error " + JSON.stringify(err));
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("row after each called");
+ });
+
+ it('testRow_100', 0, async function (done) {
+ console.info('testRow_100 START');
+ let strJson1 = getInspectorByKey('LPValue');
+ let objLP = JSON.parse(strJson1);
+ console.info("testRow_100 component objLP is: " + objLP.$attrs.value);
+ await Utils.sleep(1000);
+ try {
+ let eventData = {
+ data: {
+ "value": 100
+ }
+ }
+ var innerEvent = {
+ eventId: 55,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("testRow_100 start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("testRow_100 change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('LPValue');
+ let obj = JSON.parse(strJson);
+ console.info("testRows_100 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.value).assertEqual("100.000000");
+ console.info('testRow_100 END');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollBarJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollBarJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..621c05f410cfd7de724b3a9ba25dbc3c993c60b9
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollBarJsunit.test.ets
@@ -0,0 +1,125 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function scrollBarJsunit() {
+ describe('appInfoTest', function () {
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/scrollBar',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get scrollBar state success " + JSON.stringify(pages));
+ if (!("span" == pages.name)) {
+ console.info("get scrollBar success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push scrollBar page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push scrollBar page error " + JSON.stringify(err));
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(2000);
+ console.info("scrollBar after each called");
+ });
+
+ it('testScrollBar001', 0, async function (done) {
+ console.info('[testScrollBar001] START');
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('scroll');
+ console.info("[testScrollBar001] component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("[testScrollBar001] direction:" + obj.$attrs.direction);
+ expect(obj.$attrs.direction).assertEqual('ScrollBarDirection.Vertical');
+ done();
+ });
+
+ it('testScrollBar002', 0, async function (done) {
+ console.info('[testScrollBar002] START');
+ let object = {
+ "directionValue": ScrollBarDirection.Horizontal
+ };
+ try {
+ var eventData = {
+ data: {
+ "directionObject": JSON.stringify(object)
+ }
+ }
+ var innerEvent = {
+ eventId: 80,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testScrollBar002] start to publish emit:" + JSON.stringify(eventData.data));
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testScrollBar002] change component data error: " + err.message);
+ }
+ await Utils.sleep(4000);
+ let strJson = getInspectorByKey('scroll');
+ let obj = JSON.parse(strJson);
+ console.info("[testScrollBar002] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.direction).assertEqual('ScrollBarDirection.Vertical');
+ console.info('testScrollBar002 END');
+ done();
+ });
+
+ it('testScrollBar003', 0, async function (done) {
+ console.info('[testScrollBar003] START');
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('scroll');
+ console.info("[testScrollBar003] component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("[testScrollBar003] state:" + obj.$attrs.state);
+ expect(obj.$attrs.state).assertEqual('BarState.Off');
+ done();
+ });
+
+ it('testScrollBar004', 0, async function (done) {
+ console.info('[testScrollBar004] START');
+ try {
+ let eventData = {
+ data: {
+ "stateValue":"BarState.On"
+ }
+ }
+ let indexEvent = {
+ eventId: 41,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testScrollBar004] start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("[testScrollBar004] change component data error: " + err.message);
+ }
+ await Utils.sleep(4000);
+ let strJson = getInspectorByKey('scroll');
+ console.info("[testScrollBar004] component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("[testScrollBar004] state:" + obj.$attrs.state);
+ expect(obj.$attrs.state).assertEqual('BarState.Off');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets
index 2030653e1941779a5a62876dbdf2c0156540b3ba..6e42de95abf69852c816f36d9805cf395b210fb7 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets
@@ -35,7 +35,7 @@ export default function scrollCodeJsunit() {
console.info("push ScrollCode page success " + JSON.stringify(result));
}
} catch (err) {
- console.error("push ScrollCode page error: " + err);
+ console.error("push ScrollCode page error " + JSON.stringify(err));
}
done()
});
@@ -52,7 +52,7 @@ export default function scrollCodeJsunit() {
let obj = JSON.parse(strJson);
console.info("[test_scrollCode_001] component obj is: " + JSON.stringify(obj));
await Utils.sleep(1000);
- expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.Vertical');
+ expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.None');
expect(obj.$attrs.scrollBar).assertEqual('BarState.On');
expect(obj.$attrs.scrollBarColor).assertEqual('#FF0000FF');
expect(obj.$attrs.scrollBarWidth).assertEqual('30.000000px');
@@ -163,5 +163,27 @@ export default function scrollCodeJsunit() {
done();
});
+
+ it('test_scrollCode_006', 0, async function (done) {
+ await Utils.sleep(1000)
+ var callback = (eventData) => {
+ console.info("[test_scrollCode_006] get event state result is: " + JSON.stringify(eventData));
+ expect(eventData.data.scrollToIndex).assertEqual(10)
+ }
+ var innerEvent = {
+ eventId: 30,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(innerEvent, callback)
+ } catch (err) {
+ console.info("[test_scrollCode_006] on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info('[test_scrollCode_006] sendEventByKey ' + JSON.stringify(sendEventByKey('button', 10, "")));
+ await Utils.sleep(1000)
+ console.info('[test_scrollCode_006] testSendTouchEvent END');
+ done();
+ });
+
})
}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SearchJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SearchJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..6ddcdd12288164ef8fbb03caafe3043115ea1b05
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SearchJsunit.test.ets
@@ -0,0 +1,84 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function searchJsunit() {
+ describe('appInfoTest', function () {
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/search',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get search state success " + JSON.stringify(pages));
+ if (!("span" == pages.name)) {
+ console.info("get search success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push search page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push search page error " + JSON.stringify(err));
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(2000);
+ console.info("search after each called");
+ });
+
+ it('testSearch001', 0, async function (done) {
+ console.info('[testSearch001] START');
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('search');
+ console.info("[testSearch001] component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ expect(obj.$attrs.searchButton).assertEqual('');
+ done();
+ });
+
+ it('testSearch002', 0, async function (done) {
+ console.info('[testSearch002] START');
+ await Utils.sleep(1000);
+ try {
+ var eventData = {
+ data: {
+ "searchButtonValue": 'abc'
+ }
+ }
+ var innerEvent = {
+ eventId: 40,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testSearch002] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testSearch002] change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJsonNew = getInspectorByKey('search');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("[testSearch002] component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$attrs.searchButton).assertEqual('');
+ done();
+ });
+ })
+}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SharedTransitionJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SharedTransitionJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..5e7d1e6642ea133c15de3d8aa67959015abb40fc
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SharedTransitionJsunit.test.ets
@@ -0,0 +1,121 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import events_emitter from '@ohos.emitter'
+import Utils from './Utils';
+
+export default function sharedTransitionJsunit() {
+ describe('sharedTransitionTest', function () {
+ beforeEach(async function (done) {
+ console.info("sharedTransition beforeEach start");
+ let options = {
+ uri: 'pages/sharedTransition',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get sharedTransition state pages:" + JSON.stringify(pages));
+ if (!("sharedTransition" == pages.name)) {
+ console.info("get sharedTransition state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push sharedTransition page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push sharedTransition page error:" + JSON.stringify(err));
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("sharedTransition after each called");
+ });
+
+ it('sharedTransitionTest_0100', 0, async function (done) {
+ console.info('sharedTransitionTest_0100 START');
+ let strJson = getInspectorByKey('Navigator');
+ let obj = JSON.parse(strJson);
+ console.info("sharedTransitionTest_0100 component obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Navigator')
+ expect(obj.$ID).assertEqual(6)
+ console.info('sharedTransitionTest_0100 END');
+ done();
+ });
+
+ it('sharedTransitionTest_0200', 0, async function (done) {
+ console.info('sharedTransitionTest_0200 START');
+ let strJson = getInspectorByKey('Navigator');
+ let obj = JSON.parse(strJson);
+ console.info("sharedTransitionTest_0200 component obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Navigator')
+ expect(obj.$attrs.target).assertEqual('pages/sharedTransition2')
+ console.info('sharedTransitionTest_0200 END');
+ done();
+ });
+
+ it('sharedTransitionTest_0300', 0, async function (done) {
+ console.info('sharedTransitionTest_0300 START');
+ let strJson = getInspectorByKey('Navigator');
+ let obj = JSON.parse(strJson);
+ console.info("sharedTransitionTest_0300 component obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Navigator')
+ expect(obj.$attrs.active).assertEqual('false')
+ console.info('sharedTransitionTest_0300 END');
+ done();
+ });
+
+ it('sharedTransitionTest_0400', 0, async function (done) {
+ console.info('sharedTransitionTest_0400 START');
+ try {
+ let eventData = {
+ data: {
+ "duration": 2000,
+ "delay": 5,
+ }
+ }
+ let indexEvent = {
+ eventId: 555,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("sharedTransitionTest_0400 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("sharedTransitionTest_0400 change component data error: " + err.message);
+ }
+ let callback = (indexEventOne) => {
+ console.info("sharedTransitionTest_0400 get state result is: " + JSON.stringify(indexEventOne));
+ expect(indexEventOne.data.duration).assertEqual(2000);
+ expect(indexEventOne.data.delay).assertEqual(5);
+ }
+ let indexEventOne = {
+ eventId: 556,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEventOne, callback);
+ } catch (err) {
+ console.info("sharedTransitionTest_0400 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("sharedTransitionTest_0400 click result is: " + JSON.stringify(sendEventByKey('Navigator',10,"")));
+ await Utils.sleep(2000);
+ console.info('sharedTransitionTest_0400 END');
+ done();
+ });
+ })
+}
+
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SourceTypeJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SourceTypeJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..f5e6cf5233e19553c48925fd3e1dccef4534a1d0
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SourceTypeJsunit.test.ets
@@ -0,0 +1,75 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+
+export default function sourceTypeJsunit() {
+ beforeEach(async function (done) {
+ console.info("sourceType beforeEach start");
+ let options = {
+ uri: 'pages/sourceType',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get sourceType state pages:" + JSON.stringify(pages));
+ if (!("sourceType" == pages.name)) {
+ console.info("get sourceType state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push sourceType page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push sourceType page error:" + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("sourceType after each called");
+ });
+
+ it('sourceTypeTest_0100', 0, async function (done) {
+ await Utils.sleep(1000)
+ let rect = await Utils.getComponentRect('button')
+ console.info("sourceTypeTest_0100 rectInfo is " + JSON.stringify(rect));
+ let x_value = rect.left + (rect.right - rect.left) / 2
+ let y_value = rect.top + (rect.bottom - rect.top) / 2
+ console.info("sourceTypeTest_0100 onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
+ let point: TouchObject = { id: 1, x: x_value, y: y_value, type: TouchType.Down}
+ var callback = (eventData) => {
+ console.info("sourceTypeTest_0100 get event state result is: " + JSON.stringify(eventData));
+ let event = JSON.parse(eventData.data.event);
+ expect(event.source).assertEqual(0)
+ }
+ var innerEvent = {
+ eventId: 155,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(innerEvent, callback)
+ } catch (err) {
+ console.info("sourceTypeTest_0100 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info('sourceTypeTest_0100 sendTouchEvent :' + sendTouchEvent(point));
+ await Utils.sleep(1000)
+ console.info('sourceTypeTest_0100 testSendTouchEvent END');
+ done();
+ });
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets
index cbdda33344be98efbd20d5cb54e6c3fd152183bc..c9a459bad0eab0db53012a758ee3cdad08d88157 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets
@@ -35,7 +35,7 @@ export default function spanJsunit() {
console.info("push span page success " + JSON.stringify(result));
}
} catch (err) {
- console.error("push span page error: " + err);
+ console.error("push span page error " + JSON.stringify(err));
}
done()
});
@@ -93,5 +93,42 @@ export default function spanJsunit() {
expect(obj.$attrs.textCase).assertEqual('TextCase.UpperCase');
done();
});
+
+ it('testSpan004', 0, async function (done) {
+ console.info('[testSpan004] START');
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('fontColor');
+ console.info("[testSpan004] component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("[testSpan004] fontColor:" + obj.$attrs.fontColor);
+ expect(obj.$attrs.fontColor).assertEqual('#FF000000');
+ done();
+ });
+
+ it('testSpan005', 0, async function (done) {
+ console.info('[testSpan005] START');
+ try {
+ let eventData = {
+ data: {
+ "fontColorValue": '#FF000990'
+ }
+ }
+ let indexEvent = {
+ eventId: 42,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testSpan005] start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("[testSpan005] change component data error: " + err.message);
+ }
+ await Utils.sleep(4000);
+ let strJson = getInspectorByKey('fontColor');
+ console.info("[testSpan005] component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("[testSpan005] fontColor:" + obj.$attrs.fontColor);
+ expect(obj.$attrs.fontColor).assertEqual('#FF000990');
+ done();
+ });
})
}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemAppJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemAppJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..0b2df393b428ce1c352c4920a87fc21345709c52
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemAppJsunit.test.ets
@@ -0,0 +1,56 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import app from '@system.app';
+
+export default function systemAppJsunit() {
+ describe('appInfoTest', function () {
+ it('systemAppTest_0100', 0, async function (done) {
+ console.info('systemAppTest_0100 START');
+ var a = app.getInfo();
+ console.log('systemAppTest_0100 END' + JSON.stringify(a));
+ expect(a.appID == "com.open.harmony.acetest").assertTrue();
+ console.info('systemAppTest_0100 END');
+ done();
+ });
+
+ it('systemAppTest_0200', 0, async function (done) {
+ console.info('systemAppTest_0200 START');
+ var a = app.getInfo();
+ console.log('systemAppTest_0200 END' + JSON.stringify(a));
+ expect(a.appName == "$string:entry_MainAbility").assertTrue();
+ console.info('systemAppTest_0200 END');
+ done();
+ });
+
+ it('systemAppTest_0300', 0, async function (done) {
+ console.info('systemAppTest_0300 START');
+ var a = app.getInfo();
+ console.log('systemAppTest_0300 END' + JSON.stringify(a));
+ expect(a.versionName == "1.0.0").assertTrue();
+ console.info('systemAppTest_0300 END');
+ done();
+ });
+
+ it('systemAppTest_0400', 0, async function (done) {
+ console.info('systemAppTest_0400 START');
+ app.terminate();
+ console.info('systemAppTest_0400 END');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystempromptJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystempromptJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..f22ec36fc812fdb8619c2eed435c3604d6c94af1
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystempromptJsunit.test.ets
@@ -0,0 +1,69 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils';
+
+export default function transFormJsunit() {
+ describe('appInfoTest', function () {
+ beforeEach(async function (done) {
+ console.info("prompt beforeEach start");
+ let options = {
+ uri: 'pages/systemPrompt',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get prompt state pages:" + JSON.stringify(pages));
+ if (!("prompt " == pages.name)) {
+ console.info("get prompt state pages.name:" + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push prompt page result:" + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push prompt page error:" + err);
+ }
+ done();
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("prompt each called");
+ });
+ it('promptTest_0100', 0, async function (done) {
+ console.info('promptTest_0100 is start');
+ await Utils.sleep(1500);
+ console.info("promptTest_0100 click result is: " + JSON.stringify(sendEventByKey('button1',10,"")));
+ await Utils.sleep(1500);
+ console.info('promptTest_0100 END');
+ done();
+ });
+ it('promptTest_0200', 0, async function (done) {
+ console.info('promptTest_0200 is start');
+ await Utils.sleep(1500);
+ console.info("promptTest_0200 click result is: " + JSON.stringify(sendEventByKey('button2',10,"")));
+ await Utils.sleep(1500);
+ console.info('promptTest_0200 END');
+ done();
+ });
+ })
+}
+
+
+
+
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets
index d59c97c98b62304fedc562d0e84902b97742e491..786d599e9cd11e02b80f4cd59f259f62da08d331 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets
@@ -99,5 +99,43 @@ export default function textJsunit() {
console.info('testText_0300 END');
done();
});
+
+ it('testText_0700', 0, async function (done) {
+ console.info('testText_0700 START');
+ let strJson = getInspectorByKey('text');
+ console.info("testText_0700 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("testText_0700 component obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Text');
+ expect(obj.$attrs.fontColor).assertEqual('#FF000000');
+ console.info('testText_0700 END');
+ done();
+ });
+
+ it('testText_0800', 0, async function (done) {
+ console.info('testText_0800 START');
+ try {
+ let eventData = {
+ data: {
+ "fontColor": "#330A59F7",
+ }
+ }
+ let indexEvent = {
+ eventId: 198,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("testText_0800 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("testText_0800 change component data error: " + err.message);
+ }
+ await Utils.sleep(4000);
+ let strJsonNew = getInspectorByKey('text');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("testText_0800 component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$attrs.fontColor).assertEqual('#330A59F7');
+ console.info('testText_0800 END');
+ done();
+ });
})
}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TimeStampJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TimeStampJsunit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..4e127fdd3419fddef6ecd590e05a4074b0384c6e
--- /dev/null
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TimeStampJsunit.test.ets
@@ -0,0 +1,70 @@
+// @ts-nocheck
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
+import router from '@system.router';
+import Utils from './Utils';
+import events_emitter from '@ohos.events.emitter';
+
+export default function timeStampJsunit(){
+ describe('timeStampTest', function (){
+ beforeEach(async function (done) {
+ let options = {
+ uri: 'pages/timeStamp',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get timeStamp state success " + JSON.stringify(pages));
+ if (!("timeStamp" == pages.name)) {
+ console.info("get timeStamp state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(1000);
+ console.info("push timeStamp page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push timeStamp page error: " + err);
+ }
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(1000);
+ console.info("timeStamp after each called");
+ });
+
+ it('timeStampTest_0100', 0, async function (done) {
+ console.info('timeStampTest_0100 START');
+ await Utils.sleep(1500);
+ let callback = (indexEvent) => {
+ console.info("timeStampTest_0100 get state result is: " + JSON.stringify(indexEvent));
+ expect(indexEvent.data.Text).assertNotEqual(null);
+ }
+ let indexEvent = {
+ eventId: 235,
+ priority: events_emitter.EventPriority.LOW
+ }
+ try {
+ events_emitter.on(indexEvent, callback);
+ } catch (err) {
+ console.info("timeStampTest_0100 on events_emitter err : " + JSON.stringify(err));
+ }
+ console.info("timeStampTest_0100 click result is: " + JSON.stringify(sendEventByKey('button',10,"")));
+ await Utils.sleep(1500);
+ console.info('timeStampTest_0100 END');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets
index 5619c576a50f2a6b695cee7421dc59c4d04ed818..b00bdd94181a44003f850e88d94dbe34859898b8 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets
@@ -52,6 +52,7 @@ export default function ToggleJsunit() {
let strJson = getInspectorByKey('toggle');
let obj = JSON.parse(strJson);
console.info("[testToggle01] obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Toggle');
expect(obj.$attrs.selectedColor).assertEqual('#330A59F7');
console.info('[testToggle01] END');
done();
@@ -104,5 +105,31 @@ export default function ToggleJsunit() {
console.info('testToggle04 END');
done();
});
+
+ it('testToggle05', 0, async function (done) {
+ console.info('testToggle05 START');
+ try {
+ let eventData = {
+ data: {
+ "selectedColor": '#330A59F8',
+ }
+ }
+ let indexEvent = {
+ eventId: 1012,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("testToggle05 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("testToggle05 change component data error: " + err.message);
+ }
+ await Utils.sleep(4000);
+ let strJsonNew = getInspectorByKey('toggle');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("testToggle05 component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$attrs.selectedColor).assertEqual('#330A59F8');
+ console.info('testToggle05 END');
+ done();
+ });
})
}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets
index 48596eee66b76c4f5297604d57590f3b86bcd9fd..875c38a5bbb50c80ab9fde3388a718ffa8427ba2 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets
@@ -79,5 +79,57 @@ export default function transitionJsunit() {
console.info('transitionTest_0200 END');
done();
});
+
+ it('transitionTest_0300', 0, async function (done) {
+ console.info('transitionTest_0300 START');
+ try {
+ let eventData = {
+ data: {
+ "opacity": 2,
+ }
+ }
+ let indexEvent = {
+ eventId: 112,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("transitionTest_0300 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("transitionTest_0300 change component data error: " + err.message);
+ }
+ await Utils.sleep(4000);
+ let strJsonNew = getInspectorByKey('button');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("transitionTest_0300 component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$attrs.opacity).assertEqual(2);
+ console.info('transitionTest_0300 END');
+ done();
+ });
+
+ it('transitionTest_0400', 0, async function (done) {
+ console.info('transitionTest_0400 START');
+ try {
+ let eventData = {
+ data: {
+ "opacity": 'a',
+ }
+ }
+ let indexEvent = {
+ eventId: 112,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("transitionTest_0400 start to publish emit");
+ events_emitter.emit(indexEvent, eventData);
+ } catch (err) {
+ console.log("transitionTest_0400 change component data error: " + err.message);
+ }
+ await Utils.sleep(4000);
+ let strJsonNew = getInspectorByKey('button');
+ let objNew = JSON.parse(strJsonNew);
+ console.info("transitionTest_0400 component objNew is: " + JSON.stringify(objNew));
+ expect(objNew.$attrs.opacity).assertEqual(null);
+ console.info('transitionTest_0400 END');
+ done();
+ });
})
}
\ No newline at end of file
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets
index 1d48e8fdbb6cab4d743e6745578dd1b1140de6b8..9c89b711171ed0962becd89191d481726fcb2764 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets
@@ -82,5 +82,31 @@ export default function enableJsunit() {
console.info('testZIndex02 END');
done();
});
+
+ it('testZIndex03', 0, async function (done) {
+ console.info('[testZIndex03] START');
+ try {
+ var eventData = {
+ data: {
+ "zIndex": -5
+ }
+ }
+ var innerEvent = {
+ eventId: 84,
+ priority: events_emitter.EventPriority.LOW
+ }
+ console.info("[testZIndex03] start to publish emit");
+ events_emitter.emit(innerEvent, eventData);
+ } catch (err) {
+ console.log("[testZIndex03] change component data error: " + err.message);
+ }
+ await Utils.sleep(2000);
+ let strJson = getInspectorByKey('zIndex');
+ let obj = JSON.parse(strJson);
+ console.info("[testZIndex03] obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.zIndex).assertEqual(-5);
+ console.info('testZIndex03 END');
+ done();
+ });
})
}
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ClickEventJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ClickEventJsunit.test.ets
index 5b3356583f3d1a1e7fde126b30938e98547057eb..3d1e14b7de1bac0d8d150fbfbe94feb8c40bfe2d 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ClickEventJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ClickEventJsunit.test.ets
@@ -58,8 +58,8 @@ export default function clickEventJsunit() {
let event = JSON.parse(eventData.data.event);
expect(event.screenX).assertEqual(240)
expect(event.screenY).assertEqual(60)
- expect(event.x).assertEqual(240)
- expect(event.y).assertEqual(60)
+ expect(event.x).assertEqual(100)
+ expect(event.y).assertEqual(50)
}
var innerEvent = {
eventId: 30,
diff --git a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/FlexJsunit.test.ets b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/FlexJsunit.test.ets
index 043edbe0573f4c147c30c9562d15f877171dda17..986491038e2ce2844bd956db5784bb46d43c2e47 100755
--- a/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/FlexJsunit.test.ets
+++ b/ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/FlexJsunit.test.ets
@@ -16,6 +16,7 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@ohos.events.emitter';
import Utils from '../Utils.ets';
+import router from '@system.router';
export default function flexJsunit() {
describe('flexTest', function () {
@@ -93,5 +94,26 @@ export default function flexJsunit() {
console.info('testFlex_0400 END');
done();
});
+
+ it('testFlex_0500', 0, async function (done) {
+ console.info('testFlex_0500 START');
+ let strJson = getInspectorByKey('flex');
+ console.info("testFlex_0500 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("testFlex_0500 component obj is: " + JSON.stringify(obj));
+ expect(obj.$type).assertEqual('Flex');
+ done();
+ });
+
+ it('testFlex_0600', 0, async function (done) {
+ console.info('testFlex_0600 START');
+ let strJson = getInspectorByKey('flex');
+ console.info("testFlex_0600 component strJson:" + strJson);
+ let obj = JSON.parse(strJson);
+ console.info("testFlex_0600 component obj is: " + JSON.stringify(obj));
+ expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row');
+ console.info('testFlex_0600 END');
+ done();
+ });
})
}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/BUILD.gn b/appexecfwk/bundle_standard/bundlemanager/BUILD.gn
index bdf77ff3285e7d4faf1f04ba1db4e9b57c215325..4ca6e4b6d6c9bef3378a584eacf897e1c3acde8d 100644
--- a/appexecfwk/bundle_standard/bundlemanager/BUILD.gn
+++ b/appexecfwk/bundle_standard/bundlemanager/BUILD.gn
@@ -9,7 +9,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.
import("//test/xts/tools/build/suite.gni")
@@ -25,6 +25,7 @@ group("bundlemanager") {
"actsbmskittest:ActsBmsKitTest",
"actsbmsmetadatatest:ActsBmsMetaDataTest",
"actsbmsmoduleusagerecordtest:ActsBmsModuleUsageRecordTest",
+ "actsbundlemanageretstest:ActsBundleManagerEtsTest",
"actsbundlemanagertest:ActsBundleManagerTest",
"actsbundlemanageruninstall:ActsBundleManagerUninstallTest",
"actsbundlemgrmultipleinstalltest:ActsBundleMgrMultipleInstallTest",
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
index d3f886bfe158fdd0f954e64df17fa8b7a78257cd..39053503e73c1e871b79a3bd3a59afca5a72bd5b 100644
--- a/appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js
@@ -15,7 +15,7 @@
import bundle from '@ohos.bundle'
import innerBundleManager from '@ohos.bundle.innerBundleManager'
-import { describe, it, expect } from 'deccjsunit/index'
+import {describe, it, expect} from 'deccjsunit/index'
const STATUS_INSTALL_PERMISSION_DENIED = 0X44;
const STATUS_UNINSTALL_PERMISSION_DENIED = 0X45;
@@ -47,7 +47,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
expect(data.status).assertEqual(STATUS_INSTALL_PERMISSION_DENIED);
expect(data.statusMessage).assertEqual("STATUS_INSTALL_PERMISSION_DENIED");
done();
- };
+ }
});
/*
@@ -69,7 +69,7 @@ describe('ActsBmsJsUnPermissionTest', function () {
expect(data.status).assertEqual(STATUS_UNINSTALL_PERMISSION_DENIED);
expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_PERMISSION_DENIED");
done();
- };
+ }
});
/*
@@ -144,8 +144,8 @@ describe('ActsBmsJsUnPermissionTest', function () {
it('queryAbilityByWantTest_100', 0, async function (done) {
console.debug('queryAbilityByWantTest_100 start');
bundle.queryAbilityByWant({
- bundleName : LAUNCHER_BUNDLE_NAME,
- abilityName : LAUNCHER_MAIN_ABILITY
+ bundleName: LAUNCHER_BUNDLE_NAME,
+ abilityName: LAUNCHER_MAIN_ABILITY
}, DEFAULT_FLAG, DEFAULT_USER_ID).then(data => {
expect().assertFail();
done();
@@ -211,8 +211,8 @@ describe('ActsBmsJsUnPermissionTest', function () {
it('setAbilityEnabledTest_100', 0, async function (done) {
console.debug('setAbilityEnabledTest_100 start');
let abilityInfo = {
- bundleName : LAUNCHER_BUNDLE_NAME,
- name : LAUNCHER_MAIN_ABILITY
+ bundleName: LAUNCHER_BUNDLE_NAME,
+ name: LAUNCHER_MAIN_ABILITY
};
bundle.setAbilityEnabled(abilityInfo, false).then(data => {
expect().assertFail();
@@ -270,4 +270,40 @@ describe('ActsBmsJsUnPermissionTest', function () {
done();
});
});
+
+ /*
+ * @tc.number: getAbilityLabelTest_100
+ * @tc.name: getAbilityLabel : Gets the specified ability label
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('getAbilityLabelTest_100', 0, async function (done) {
+ console.debug('[getAbilityLabelTest_100] promise START');
+ await bundle.getAbilityLabel(LAUNCHER_BUNDLE_NAME, LAUNCHER_MAIN_ABILITY)
+ .then((data) => {
+ expect().assertFail();
+ done();
+ })
+ .catch((error) => {
+ expect(error).assertEqual(INVALID_CODE);
+ done();
+ });
+ });
+
+ /*
+ * @tc.number: getAbilityInfo_100
+ * @tc.name: test getAbilityInfo
+ * @tc.desc: test getAbilityInfo
+ */
+ it('getAbilityInfo_100', 0, async function (done) {
+ console.debug('getAbilityInfo_100 start');
+ bundle.getAbilityInfo(LAUNCHER_BUNDLE_NAME, LAUNCHER_MAIN_ABILITY).then(data => {
+ expect().assertFail();
+ done();
+ }).catch(err => {
+ expect(err).assertEqual(INVALID_CODE);
+ done();
+ });
+ })
+
})
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/BUILD.gn b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..3c80521fd4aee6befa2e06d783ea6a440778f420
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/BUILD.gn
@@ -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.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("ActsBundleManagerEtsTest") {
+ hap_profile = "./entry/src/main/config.json"
+ deps = [
+ ":hjs_demo_ets_assets",
+ ":hjs_demo_ets_resources",
+ ]
+ ets2abc = true
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsBundleManagerEtsTest"
+}
+ohos_js_assets("hjs_demo_ets_assets") {
+ source_dir = "./entry/src/main/ets/MainAbility"
+}
+ohos_resources("hjs_demo_ets_resources") {
+ sources = [ "./entry/src/main/resources" ]
+ hap_profile = "./entry/src/main/config.json"
+}
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..c916382f6a76a6f0191eff83bbc70ee6ed88f308
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for actsbundleetsgetinfotest Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "600000",
+ "package": "com.open.harmony.packagemag",
+ "shell-timeout": "60000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsBundleManagerEtsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..87603be2bc8c1c3e7f9918c6d2e8a83c7a502b17
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/config.json
@@ -0,0 +1,85 @@
+{
+ "app": {
+ "bundleName": "com.open.harmony.packagemag",
+ "vendor": "ohos",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.open.harmony.packagemag",
+ "name": ".MyApplication",
+ "mainAbility": "com.open.harmony.packagemag.MainAbility",
+ "deviceType": [
+ "phone"
+ ],
+ "reqPermissions": [
+ {
+ "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
+ },
+ {
+ "name": "ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
+ }
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "visible": true,
+ "srcPath": "MainAbility",
+ "name": ".MainAbility",
+ "srcLanguage": "ets",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "formsEnabled": false,
+ "label": "$string:entry_MainAbility",
+ "type": "page",
+ "launchType": "standard"
+ },
+ {
+ "srcPath": "ServiceAbility",
+ "name": ".ServiceAbility",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:description_serviceability",
+ "type": "service"
+ }
+ ],
+ "js": [
+ {
+ "mode": {
+ "syntax": "ets",
+ "type": "pageAbility"
+ },
+ "pages": [
+ "pages/index",
+ "pages/second"
+ ],
+ "name": ".MainAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/app.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/app.ets
new file mode 100644
index 0000000000000000000000000000000000000000..6a47e22427b28a7af740c97ab4467f0872c41496
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/app.ets
@@ -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('Application onCreate')
+ },
+ onDestroy() {
+ console.info('Application onDestroy')
+ },
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/index.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e98a1ac989e8e7ca55ae68c551b07e252000e064
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/index.ets
@@ -0,0 +1,83 @@
+/**
+ * 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 router from '@system.router';
+import file from '@system.file';
+import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
+import testsuite from "../test/List.test.ets";
+import featureAbility from "@ohos.ability.featureAbility";
+
+async function routePage() {
+ let options = {
+ uri: 'pages/second'
+ }
+ try {
+ await router.push(options)
+ } catch (err) {
+ console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`)
+ }
+}
+
+@Entry
+@Component
+struct Index {
+
+ aboutToAppear() {
+ console.info("start run testcase!!!!")
+ featureAbility.getWant()
+ .then((Want) => {
+ const core = Core.getInstance();
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ });
+ core.addService('expect', expectExtend);
+ const reportExtend = new ReportExtend(file);
+ core.addService('report', reportExtend);
+ core.init();
+ core.subscribeEvent('task', reportExtend);
+ const configService = core.getDefaultService('config');
+ console.info('parameters---->' + JSON.stringify(Want.parameters));
+ configService.setConfig(Want.parameters);
+ testsuite();
+ core.execute();
+ console.info('Operation successful. Data: ' + JSON.stringify(Want));
+ })
+ .catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+ })
+ }
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Text('Hello World')
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ Button() {
+ Text('ACE ETS TEST 包管理 2 ')
+ .fontSize(25)
+ .fontWeight(FontWeight.Bold)
+ }.type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .onClick(() => {
+ routePage()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/second.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/second.ets
new file mode 100644
index 0000000000000000000000000000000000000000..9002655f12f0ace700bf00ab324320cdd262bfa6
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/second.ets
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import router from '@system.router';
+
+@Entry
+@Component
+struct Second {
+ private content: string = "Second Page"
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Text(`${this.content}`)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ Button() {
+ Text('back to index')
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ }.type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .onClick(() => {
+ router.back()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b6e10c72ef77eeb03dd9325cf3bac456ff49e79b
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
@@ -0,0 +1,248 @@
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index.ets';
+import Utils from './Utils';
+import Bundle from '@ohos.bundle';
+
+const BUNDLE_NAME = 'com.open.harmony.packagemag'
+const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility'
+const SERVICE_ABILITY_NAME = 'com.open.harmony.packagemag.ServiceAbility'
+
+const OTHER_BUNDLE_NAME = 'com.ohos.acepackage'
+const OTHER_ABILITY_NAME = 'com.ohos.acepackage.MainAbility'
+
+const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
+const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility'
+
+export default function getAbilityLabelJsUnit() {
+
+ describe('context_getAbilityLabel_test', function () {
+ beforeEach(async function (done) {
+ console.info('context_getAbilityLabel_test before each called');
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(2000);
+ console.info('context_getAbilityLabel_test after each called');
+ });
+
+ /*
+ * @tc.number: context_getAbilityLabel_test_0100
+ * @tc.name: getAbilityLabel : Gets the specified ability label
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_getAbilityLabel_test_0100', 0, async function (done) {
+ console.info('[context_getAbilityLabel_test_0100] promise START');
+ await Utils.sleep(1000);
+ let mData;
+ var timeOldStamp = await Utils.getNowTime();
+ await Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getAbilityLabel_test_0100]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_getAbilityLabel_test_0100] promise in ');
+ console.info('[context_getAbilityLabel_test_0100] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ console.info('[context_getAbilityLabel_test_0100] promise error is: ' + error);
+ });
+ getAbilityLabelSuccess('[context_getAbilityLabel_test_0100]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_getAbilityLabel_test_0200
+ * @tc.name: getAbilityLabel : Gets the specified ability label
+ * @tc.desc: Check the return value of the interface (by callbac)
+ * @tc.level 0
+ */
+ it('context_getAbilityLabel_test_0200', 0, async function (done) {
+ console.info('[context_getAbilityLabel_test_0200] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ Bundle.getAbilityLabel(BUNDLE_NAME, ABILITY_NAME, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_getAbilityLabel_test_0200] callBack in');
+ console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error);
+ console.info('[context_getAbilityLabel_test_0200] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getAbilityLabelSuccess('[context_getAbilityLabel_test_0200]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_getAbilityLabel_test_0300
+ * @tc.name: getAbilityLabel : Gets the specified ability label
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_getAbilityLabel_test_0300', 0, async function (done) {
+ console.info('[context_getAbilityLabel_test_0300] promise START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mError;
+ await Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp);
+
+ console.info('[context_getAbilityLabel_test_0300] promise in ');
+ console.info('[context_getAbilityLabel_test_0300] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ var timeNewStamp = Utils.getNowTime();
+ mError = error;
+ Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp);
+ console.info('[context_getAbilityLabel_test_0300] promise error is: ' + error);
+ });
+ await Utils.sleep(2000);
+ getAbilityLabelFailure('[context_getAbilityLabel_test_0300]', mError);
+ done();
+ });
+
+ /*
+ * @tc.number: context_getAbilityLabel_test_0400
+ * @tc.name: getAbilityLabel : Gets the specified ability label
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_getAbilityLabel_test_0400', 0, async function (done) {
+ console.info('[context_getAbilityLabel_test_0400] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mError;
+ Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
+ mError = error;
+ console.info('[context_getAbilityLabel_test_0400] callBack in');
+ console.info('[context_getAbilityLabel_test_0400] callBack error: ' + error);
+ console.info('[context_getAbilityLabel_test_0400] callBack data is:' + JSON.stringify(data));
+
+ });
+ await Utils.sleep(2000);
+ getAbilityLabelFailure('[context_getAbilityLabel_test_0400]', mError);
+ done();
+ });
+
+ /*
+ * @tc.number: context_getAbilityLabel_test_0500
+ * @tc.name: getAbilityLabel : Gets the specified ability label
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_getAbilityLabel_test_0500', 0, async function (done) {
+ console.info('[context_getAbilityLabel_test_0500] promise START');
+ await Utils.sleep(1000);
+ let mData;
+ let mError = null;
+ var timeOldStamp = await Utils.getNowTime();
+ await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getAbilityLabel_test_0500]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_getAbilityLabel_test_0500] promise in ');
+ console.info('[context_getAbilityLabel_test_0500] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ mError = error;
+ console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error);
+ });
+ if (mError != null) {
+ getAbilityLabelFailure('[context_getAbilityLabel_test_0500]', mError);
+ } else {
+ getAbilityLabelSuccess('[context_getAbilityLabel_test_0500]', mData);
+ }
+ done();
+ });
+
+ /*
+ * @tc.number: context_getAbilityLabel_test_0600
+ * @tc.name: getAbilityLabel : Gets the specified ability label
+ * @tc.desc: Check the return value of the interface (by callbac)
+ * @tc.level 0
+ */
+ it('context_getAbilityLabel_test_0600', 0, async function (done) {
+ console.info('[context_getAbilityLabel_test_0600] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ let mError = null;
+ Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getAbilityLabel_test_0600]', timeOldStamp, timeNewStamp);
+ mData = data;
+ mError = error;
+ console.info('[context_getAbilityLabel_test_0600] callBack in');
+ console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
+ console.info('[context_getAbilityLabel_test_0600] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ if (mError != null) {
+ getAbilityLabelFailure('[context_getAbilityLabel_test_0600]', mError);
+ } else {
+ getAbilityLabelSuccess('[context_getAbilityLabel_test_0600]', mData);
+ }
+ done();
+ });
+
+
+ /*
+ * @tc.number: context_getAbilityLabel_test_0700
+ * @tc.name: getAbilityLabel : Gets the specified ability label
+ * @tc.desc: Check the return value of the interface (by callbac)
+ * @tc.level 0
+ */
+ it('context_getAbilityLabel_test_0700', 0, async function (done) {
+ console.info('[context_getAbilityLabel_test_0700] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mError;
+ Bundle.getAbilityLabel(BUNDLE_NAME, SERVICE_ABILITY_NAME, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getAbilityLabel_test_0700]', timeOldStamp, timeNewStamp);
+ mError = error;
+ console.info('[context_getAbilityLabel_test_0700] callBack in');
+ console.info('[context_getAbilityLabel_test_0700] callBack error: ' + error);
+ console.info('[context_getAbilityLabel_test_0700] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getAbilityLabelFailure('[context_getAbilityLabel_test_0700]', mError);
+ done();
+ });
+
+ function getAbilityLabelSuccess(msg, data) {
+ console.log(msg + ' start ' + JSON.stringify(data));
+ console.log(msg + ' result ' + data);
+ expect(typeof (data)).assertEqual('string');
+ }
+
+ function getAbilityLabelFailure(msg, error) {
+ console.log(msg + ' Failure ');
+ console.log(msg + ' error ' + JSON.stringify(error));
+ expect(typeof (error)).assertEqual('number');
+ }
+
+ })
+
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetBundleGidsJsUnit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetBundleGidsJsUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..012a6540985127047bc45a335d49918d0c49f3a7
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetBundleGidsJsUnit.test.ets
@@ -0,0 +1,211 @@
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index.ets';
+import Utils from './Utils';
+import Bundle from '@ohos.bundle';
+
+const BUNDLE_NAME = 'com.open.harmony.packagemag'
+const OTHER_BUNDLE_NAME = 'com.ohos.acepackage'
+const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
+
+export default function bundleGidsJsUnit() {
+ describe('context_getBundleGids_test', function () {
+ beforeEach(async function (done) {
+ console.info('context_getBundleGids_test before each called');
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(2000);
+ console.info('context_getBundleGids_test after each called');
+ });
+
+ /*
+ * @tc.number: context_getBundleGids_test_0100
+ * @tc.name: getBundleGids : Gets the lists of bundle with gids
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_getBundleGids_test_0100', 0, async function (done) {
+ console.info('[context_getBundleGids_test_0100] promise START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ await Bundle.getBundleGids(BUNDLE_NAME)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getBundleGids_test_0100]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_getBundleGids_test_0100] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ console.info('[context_getBundleGids_test_0100] promise error is: ' + error);
+ });
+ getGidsSuccess('[context_getBundleGids_test_0100]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_getBundleGids_test_0200
+ * @tc.name: getBundleGids : Gets the lists of bundle with gids
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_getBundleGids_test_0200', 0, async function (done) {
+ console.info('[context_getBundleGids_test_0200] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ Bundle.getBundleGids(BUNDLE_NAME, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getBundleGids_test_0200]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_getBundleGids_test_0200] callBack in');
+ console.info('[context_getBundleGids_test_0200] callBack error: ' + error);
+ console.info('[context_getBundleGids_test_0200] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getGidsSuccess('[context_getBundleGids_test_0200]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_getBundleGids_test_0300
+ * @tc.name: getBundleGids : Gets the lists of bundle with gids
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_getBundleGids_test_0300', 0, async function (done) {
+ console.info('[context_getBundleGids_test_0300] promise START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mError;
+ await Bundle.getBundleGids(BUNDLE_NAME_ERROR)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getBundleGids_test_0300]', timeOldStamp, timeNewStamp);
+ console.info('[context_getBundleGids_test_0300] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ var timeNewStamp = Utils.getNowTime();
+ mError = error;
+ Utils.getDurationTime('[context_getBundleGids_test_0300]', timeOldStamp, timeNewStamp);
+ console.info('[context_getBundleGids_test_0300] promise error is: ' + error);
+ });
+ getGidsFailure('[context_getBundleGids_test_0300]', mError);
+ done();
+ });
+
+ /*
+ * @tc.number: context_getBundleGids_test_0400
+ * @tc.name: getBundleGids : Gets the lists of bundle with gids
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_getBundleGids_test_0400', 0, async function (done) {
+ console.info('[context_getBundleGids_test_0400] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mError;
+ Bundle.getBundleGids(BUNDLE_NAME_ERROR, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getBundleGids_test_0400]', timeOldStamp, timeNewStamp);
+
+ mError = error;
+ console.info('[context_getBundleGids_test_0400] callBack in');
+ console.info('[context_getBundleGids_test_0400] callBack error: ' + error);
+ console.info('[context_getBundleGids_test_0400] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getGidsFailure('[context_getBundleGids_test_0400]', mError);
+ done();
+ });
+
+ /*
+ * @tc.number: context_getBundleGids_test_0500
+ * @tc.name: getBundleGids : Gets the lists of bundle with gids
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_getBundleGids_test_0500', 0, async function (done) {
+ console.info('[context_getBundleGids_test_0500] promise START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ let mError;
+ await Bundle.getBundleGids(OTHER_BUNDLE_NAME)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getBundleGids_test_0500]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_getBundleGids_test_0500] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ mError = error;
+ console.info('[context_getBundleGids_test_0500] promise error is: ' + error);
+ });
+ if (mError != null) {
+ getGidsFailure('[context_getBundleGids_test_0500]', mError);
+ } else {
+ getGidsSuccess('[context_getBundleGids_test_0500]', mData);
+ }
+ done();
+ });
+
+ /*
+ * @tc.number: context_getBundleGids_test_0600
+ * @tc.name: getBundleGids : Gets the lists of bundle with gids
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_getBundleGids_test_0600', 0, async function (done) {
+ console.info('[context_getBundleGids_test_0600] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ let mError = null;
+ Bundle.getBundleGids(OTHER_BUNDLE_NAME, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_getBundleGids_test_0600]', timeOldStamp, timeNewStamp);
+ mData = data;
+ mError = error;
+ console.info('[context_getBundleGids_test_0600] callBack in');
+ console.info('[context_getBundleGids_test_0600] callBack error: ' + error);
+ console.info('[context_getBundleGids_test_0600] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ if (mError != null) {
+ getGidsFailure('[context_getBundleGids_test_0600]', mError);
+ } else {
+ getGidsSuccess('[context_getBundleGids_test_0600]', mData);
+ }
+ done();
+ });
+
+ function getGidsSuccess(msg, data) {
+ console.log(msg + ' start ' + JSON.stringify(data));
+ for (var j = 0; j < data.length; j++) {
+ console.log(msg + 'data[' + j + '] : ' + data[j]);
+ expect((data[j] > 0)).assertEqual(true);
+ }
+ expect(Array.isArray(data)).assertEqual(true);
+ }
+
+ function getGidsFailure(msg, error) {
+ console.log(msg + ' Failure ');
+ expect(typeof (error)).assertEqual('number');
+ }
+ })
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..9a4f4351cc752ae3265159d931d06eb39c503bf1
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
@@ -0,0 +1,470 @@
+/**
+ * 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 {describe, beforeEach, afterEach, it, expect} from 'deccjsunit/index.ets';
+import Utils from './Utils';
+import bundleManager from '@ohos.bundle';
+
+export default function GetabilityInfo() {
+ describe('GetabilityInfo', function () {
+ let bundleName = "com.open.harmony.packagemag";
+ let abilityName = "com.open.harmony.packagemag.MainAbility";
+ let bundleName_other = "com.ohos.acecollaboration";
+ let abilityName_other = "com.ohos.acecollaboration.MainAbility";
+ let bundleName1 = "com.harmony.packagemag";
+ let abilityName1 = "com.harmony.packagemag1.MainAbility";
+
+ beforeEach(async function (done) {
+ console.info('GetabilityInfo before each called');
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(2000);
+ console.info('GetabilityInfo after each called');
+ });
+
+ /*
+ * @tc.number: bundle_getAllApplicationInfo_test_0100
+ * @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('bundle_GetabilityInfo_test_0100', 0, async function (done) {
+ console.info('[bundle_GetabilityInfo_test_0100] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ bundleManager.getAbilityInfo(bundleName, abilityName)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('bundle_GetabilityInfo_test_0100', timeOldStamp, timeNewStamp)
+ console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo in ');
+ console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo promise data is: ' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ }).catch((error) => {
+ console.error('[bundle_GetabilityInfo_test_0100]Operation failed. Cause: ' + JSON.stringify(error));
+ })
+ var promise = await bundleManager.getAbilityInfo(bundleName, abilityName);
+ checkAbilityInfo(promise);
+ done();
+ });
+
+ /*
+ * @tc.number: bundle_getAbilityInfo_test_0200
+ * @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('bundle_GetabilityInfo_test_0200', 0, async function (done) {
+ console.info('[bundle_GetabilityInfo_test_0200] START');
+ await Utils.sleep(1000);
+ let mData;
+ var timeOldStamp = await Utils.getNowTime();
+ await bundleManager.getAbilityInfo(bundleName, abilityName, (err, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('bundle_GetabilityInfo_test_0200', timeOldStamp, timeNewStamp)
+ if (err) {
+ console.error('[bundle_GetabilityInfo_test_0200]Operation failed. Cause: ' + JSON.stringify(err));
+ }
+ console.info('[bundle_GetabilityInfo_test_0200] getApplicationInfo callback data is: ' + JSON.stringify(data));
+ mData = data;
+ })
+ await Utils.sleep(2000);
+ checkAbilityInfo(mData);
+ done();
+ });
+
+ /*
+ * @tc.number: bundle_getAllApplicationInfo_test_0300
+ * @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('bundle_GetabilityInfo_test_0300', 0, async function (done) {
+ console.info('[bundle_GetabilityInfo_test_0300] START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let err = null
+ var mData
+ await bundleManager.getAbilityInfo(bundleName_other, abilityName_other)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('bundle_GetabilityInfo_test_0300',timeOldStamp,timeNewStamp)
+ mData = data
+ console.info('[bundle_GetabilityInfo_test_0300] getApplicationInfo in ');
+ console.info('[bundle_GetabilityInfo_test_0300] getApplicationInfo promise data is: ' + JSON.stringify(data));
+ expect(mData).assertEqual(false);
+ }).catch((error) => {
+ err = error
+ console.error('[bundle_GetabilityInfo_test_0300]Operation failed. Cause: ' + JSON.stringify(error));
+ });
+ if(err != null) {
+ await expect(err).assertEqual(1);
+ }else{
+ checkAbilityInfo_other(mData);
+ }
+ done();
+ });
+
+
+ /*
+ * @tc.number: bundle_getAllApplicationInfo_test_0400
+ * @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('bundle_GetabilityInfo_test_0400', 0, async function (done) {
+ console.info('[bundle_GetabilityInfo_test_0400] START');
+ let error1;
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ bundleManager.getAbilityInfo(bundleName1, abilityName)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('bundle_GetabilityInfo_test_0400', timeOldStamp, timeNewStamp)
+ console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo in ');
+ console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo data is: ' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ }).catch((error) => {
+ console.error('[bundle_GetabilityInfo_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
+ error1 = error;
+ })
+ await Utils.sleep(1000);
+ await expect(error1).assertEqual(1);
+ done();
+ });
+
+ /*
+ * @tc.number: bundle_getAllApplicationInfo_test_0500
+ * @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('bundle_GetabilityInfo_test_0500', 0, async function (done) {
+ console.info('[bundle_GetabilityInfo_test_0500] START');
+ let error
+ await bundleManager.getAbilityInfo(bundleName, abilityName1).then((data) => {
+ console.info('[bundle_GetabilityInfo_test_0500] START' + JSON.stringify(data));
+ }).catch((err) => {
+ console.info('[bundle_GetabilityInfo_test_0500] err = ' + JSON.stringify(err));
+ error = err
+ })
+ expect(error).assertEqual(1);
+ done();
+ console.info('[bundle_GetabilityInfo_test_0500] END');
+ });
+
+ /*
+ * @tc.number: bundle_getAllApplicationInfo_test_0600
+ * @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ let bundleName2 = "";
+ it('bundle_GetabilityInfo_test_0600', 0, async function (done) {
+ console.info('[bundle_GetabilityInfo_test_0600] START');
+ let error1;
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ bundleManager.getAbilityInfo(bundleName2, abilityName)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('bundle_GetabilityInfo_test_0600', timeOldStamp, timeNewStamp)
+ console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo in ');
+ console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo data promise is: ' + JSON.stringify(data));
+ expect(typeof (data)).assertEqual("object");
+ }).catch((error) => {
+ console.error('[bundle_GetabilityInfo_test_0600]Operation failed. Cause: ' + JSON.stringify(error));
+ error1 = error;
+ })
+ await Utils.sleep(1000);
+ await expect(error1).assertEqual(1);
+ done();
+ });
+
+
+ /**
+ * 打印AbilityInfo属性信息
+ * @param data
+ */
+ function checkAbilityInfo(data) {
+ console.log("checkAbilityInfo start " + JSON.stringify(data));
+ console.log("checkAbilityInfo bundleName : " + data.bundleName);
+ console.log("checkAbilityInfo name : " + data.name);
+ console.log("checkAbilityInfo label : " + data.label);
+ console.log("checkAbilityInfo description : " + data.description);
+ console.log("checkAbilityInfo icon : " + data.icon);
+ console.log("checkAbilityInfo descriptionId : " + data.descriptionId);
+ console.log("checkAbilityInfo iconId : " + data.iconId);
+ console.log("checkAbilityInfo moduleName : " + data.moduleName);
+ console.log("checkAbilityInfo process : " + data.process);
+ console.log("checkAbilityInfo targetAbility : " + data.targetAbility);
+ console.log("checkAbilityInfo backgroundModes : " + data.backgroundModes);
+ console.log("checkAbilityInfo isVisible : " + data.isVisible);
+ console.log("checkAbilityInfo formEnabled : " + data.formEnabled);
+ console.log("checkAbilityInfo type : " + data.type)
+ console.log("checkAbilityInfo orientation : " + data.orientation);
+ console.log("checkAbilityInfo launchMode : " + data.launchMode);
+ console.log("checkAbilityInfo permissions length : " + data.permissions.length);
+ for (var j = 0; j < data.permissions.length; j++) {
+ console.log("getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]);
+ }
+ console.log("checkAbilityInfo deviceTypes length : " + data.deviceTypes.length);
+ for (var k = 0; k < data.deviceTypes.length; k++) {
+ console.log("getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
+ }
+ console.log("checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length);
+ for (var i = 0; i < data.deviceCapabilities.length; i++) {
+ console.log("getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]);
+ }
+ console.log("checkAbilityInfo readPermission : " + data.readPermission);
+ console.log("checkAbilityInfo writePermission : " + data.writePermission);
+ console.log("checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
+ console.log("checkAbilityInfo uri : " + data.uri);
+ console.log("checkAbilityInfo labelId : " + data.labelId);
+ console.log("checkAbilityInfo subType : " + data.subType);
+ expect(typeof (data.bundleName)).assertEqual("string");
+ expect(typeof (data.name)).assertEqual("string");
+ expect(data.label).assertEqual("$string:entry_MainAbility");
+ expect(typeof (data.label)).assertEqual("string");
+ expect(data.description).assertEqual("$string:mainability_description");
+ expect(typeof (data.description)).assertEqual("string");
+ expect(data.icon).assertEqual("$media:icon");
+ expect(typeof (data.icon)).assertEqual("string");
+ expect(typeof (data.srcPath)).assertEqual("string");
+ expect(data.srcLanguage).assertEqual("ets");
+ expect(typeof (data.srcLanguage)).assertEqual("string");
+ expect(data.isVisible).assertEqual(true);
+ expect(Array.isArray(data.permissions)).assertEqual(true);
+ expect(Array.isArray(data.deviceCapabilities)).assertEqual(true);
+ expect(data.deviceTypes[0]).assertEqual("phone");
+ expect(typeof (data.process)).assertEqual("string");
+ expect(typeof (data.uri)).assertEqual("string");
+ expect(data.uri).assertEqual("");
+ expect(typeof (data.uri)).assertEqual("string");
+ expect(data.moduleName).assertEqual("entry");
+ expect(typeof (data.moduleName)).assertEqual("string");
+ expect(typeof (data.applicationInfo)).assertEqual("object");
+ expect(data.bundleName).assertEqual("com.open.harmony.packagemag")
+ expect(data.name).assertEqual("com.open.harmony.packagemag.MainAbility");
+ checkApplicationInfo(data.applicationInfo);
+ console.log("---checkAbilityInfo End--- ");
+ }
+
+ /**
+ * 打印ApplicationInfo属性信息
+ * @param data
+ */
+ function checkApplicationInfo(info) {
+ console.log("checkApplicationInfo getApplicationInfo : " + JSON.stringify(info));
+ console.log("checkApplicationInfo name : " + info.name);
+ console.log("checkApplicationInfo description : " + info.description);
+ console.log("checkApplicationInfo descriptionId : " + info.descriptionId);
+ console.log("checkApplicationInfo systemApp : " + info.systemApp);
+ console.log("checkApplicationInfo enabled : " + info.enabled);
+ console.log("checkApplicationInfo label : " + info.label);
+ console.log("checkApplicationInfo labelId : " + info.labelId);
+ console.log("checkApplicationInfo icon : " + info.icon);
+ console.log("checkApplicationInfo process : " + info.process);
+ console.log("checkApplicationInfo supportedModes : " + info.supportedModes);
+ console.log("checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
+ for (var j = 0; j < info.moduleSourceDirs.length; j++) {
+ console.log("checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
+ }
+ console.log("checkApplicationInfo permissions length : " + info.permissions.length);
+ for (var j = 0; j < info.permissions.length; j++) {
+ console.log("checkApplicationInfo info.permissions[" + j + "] : " + info.permissions[j]);
+ }
+ console.log("checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
+ for (var j = 0; j < info.moduleInfos.length; j++) {
+ console.log("checkApplicationInfo info.moduleInfos[" + j + "].moduleName : " + info.moduleInfos[j].moduleName);
+ console.log("checkApplicationInfo info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir);
+ }
+ console.log("checkApplicationInfo entryDir : " + info.entryDir);
+ expect(typeof (info)).assertEqual("object")
+ expect(typeof (info.name)).assertEqual("string")
+ expect(typeof (info.codePath)).assertEqual("string")
+ expect(info.accessTokenId > 0).assertTrue()
+ expect(typeof (info.accessTokenId)).assertEqual("number")
+ expect(typeof (info.description)).assertEqual("string")
+ expect(info.description).assertEqual("$string:mainability_description")
+ expect(info.descriptionId > 0).assertTrue()
+ expect(typeof (info.descriptionId)).assertEqual("number")
+ expect(typeof (info.icon)).assertEqual("string")
+ expect(info.icon).assertEqual("$media:icon")
+ expect(info.iconId > 0).assertTrue()
+ expect(typeof (info.iconId)).assertEqual("number")
+ expect(typeof (info.label)).assertEqual("string")
+ expect(info.label).assertEqual("$string:entry_MainAbility")
+ expect(info.labelId > 0).assertTrue()
+ expect(typeof (info.labelId)).assertEqual("number")
+ expect(info.systemApp).assertEqual(true)
+ expect(typeof (info.entryDir)).assertEqual("string")
+ expect(info.supportedModes).assertEqual(0)
+ expect(typeof (info.supportedModes)).assertEqual("number")
+ expect(typeof (info.process)).assertEqual("string")
+ expect(info.process).assertEqual("")
+ expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
+ expect(info.entryDir)
+ .assertEqual("/data/app/el1/bundle/public/com.open.harmony.packagemag/com.open.harmony.packagemag");
+ expect(Array.isArray(info.permissions)).assertEqual(true);
+ expect(info.codePath).assertEqual("/data/app/el1/bundle/public/com.open.harmony.packagemag");
+ expect(info.moduleSourceDirs[0])
+ .assertEqual("/data/app/el1/bundle/public/com.open.harmony.packagemag/com.open.harmony.packagemag");
+ expect(info.enabled).assertEqual(true);
+ expect(info.flags).assertEqual(0);
+ expect(info.uid > 0).assertTrue()
+ expect(info.entityType).assertEqual("unspecified");
+ expect(info.removable).assertEqual(true);
+ expect(info.accessTokenId > 0).assertTrue()
+ }
+
+ /**
+ * 打印ApplicationInfo属性信息
+ * @param data
+ */
+ function checkAbilityInfo_other(data) {
+ console.log("checkAbilityInfo start " + JSON.stringify(data));
+ console.log("checkAbilityInfo bundleName : " + data.bundleName);
+ console.log("checkAbilityInfo name : " + data.name);
+ console.log("checkAbilityInfo label : " + data.label);
+ console.log("checkAbilityInfo description : " + data.description);
+ console.log("checkAbilityInfo icon : " + data.icon);
+ console.log("checkAbilityInfo descriptionId : " + data.descriptionId);
+ console.log("checkAbilityInfo iconId : " + data.iconId);
+ console.log("checkAbilityInfo moduleName : " + data.moduleName);
+ console.log("checkAbilityInfo process : " + data.process);
+ console.log("checkAbilityInfo targetAbility : " + data.targetAbility);
+ console.log("checkAbilityInfo backgroundModes : " + data.backgroundModes);
+ console.log("checkAbilityInfo isVisible : " + data.isVisible);
+ console.log("checkAbilityInfo formEnabled : " + data.formEnabled);
+ console.log("checkAbilityInfo type : " + data.type)
+ console.log("checkAbilityInfo orientation : " + data.orientation);
+ console.log("checkAbilityInfo launchMode : " + data.launchMode);
+ console.log("checkAbilityInfo permissions length : " + data.permissions.length);
+ for (var j = 0; j < data.permissions.length; j++) {
+ console.log("getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]);
+ }
+ console.log("checkAbilityInfo deviceTypes length : " + data.deviceTypes.length);
+ for (var k = 0; k < data.deviceTypes.length; k++) {
+ console.log("getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
+ }
+ console.log("checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length);
+ for (var i = 0; i < data.deviceCapabilities.length; i++) {
+ console.log("getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]);
+ }
+ console.log("checkAbilityInfo readPermission : " + data.readPermission);
+ console.log("checkAbilityInfo writePermission : " + data.writePermission);
+ console.log("checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
+ console.log("checkAbilityInfo uri : " + data.uri);
+ console.log("checkAbilityInfo labelId : " + data.labelId);
+ console.log("checkAbilityInfo subType : " + data.subType);
+ expect(typeof (data.bundleName)).assertEqual("string");
+ expect(typeof (data.name)).assertEqual("string");
+ expect(data.label).assertEqual("$string:entry_MainAbility");
+ expect(typeof (data.label)).assertEqual("string");
+ expect(data.description).assertEqual("$string:mainability_description");
+ expect(typeof (data.description)).assertEqual("string");
+ expect(data.icon).assertEqual("$media:icon");
+ expect(typeof (data.icon)).assertEqual("string");
+ expect(typeof (data.srcPath)).assertEqual("string");
+ expect(data.srcLanguage).assertEqual("ets");
+ expect(typeof (data.srcLanguage)).assertEqual("string");
+ expect(data.isVisible).assertEqual(true);
+ expect(Array.isArray(data.permissions)).assertEqual(true);
+ expect(Array.isArray(data.deviceCapabilities)).assertEqual(true);
+ expect(data.deviceTypes[0]).assertEqual("phone");
+ expect(typeof (data.process)).assertEqual("string");
+ expect(typeof (data.uri)).assertEqual("string");
+ expect(data.uri).assertEqual("");
+ expect(typeof (data.uri)).assertEqual("string");
+ expect(data.moduleName).assertEqual("entry");
+ expect(typeof (data.moduleName)).assertEqual("string");
+ expect(typeof (data.applicationInfo)).assertEqual("object");
+ expect(data.bundleName).assertEqual("com.ohos.acecollaboration");
+ expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility");
+ checkApplicationInfo_other(data.applicationInfo);
+ console.log("---checkAbilityInfo End--- ");
+ }
+
+ /**
+ * 打印ApplicationInfo属性信息
+ * @param data
+ */
+ function checkApplicationInfo_other(info) {
+ console.log("checkApplicationInfo getApplicationInfo : " + JSON.stringify(info));
+ console.log("checkApplicationInfo name : " + info.name);
+ console.log("checkApplicationInfo description : " + info.description);
+ console.log("checkApplicationInfo descriptionId : " + info.descriptionId);
+ console.log("checkApplicationInfo systemApp : " + info.systemApp);
+ console.log("checkApplicationInfo enabled : " + info.enabled);
+ console.log("checkApplicationInfo label : " + info.label);
+ console.log("checkApplicationInfo labelId : " + info.labelId);
+ console.log("checkApplicationInfo icon : " + info.icon);
+ console.log("checkApplicationInfo process : " + info.process);
+ console.log("checkApplicationInfo supportedModes : " + info.supportedModes);
+ console.log("checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
+ for (var j = 0; j < info.moduleSourceDirs.length; j++) {
+ console.log("checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
+ }
+ console.log("checkApplicationInfo permissions length : " + info.permissions.length);
+ for (var j = 0; j < info.permissions.length; j++) {
+ console.log("checkApplicationInfo info.permissions[" + j + "] : " + info.permissions[j]);
+ }
+ console.log("checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
+ for (var j = 0; j < info.moduleInfos.length; j++) {
+ console.log("checkApplicationInfo info.moduleInfos[" + j + "].moduleName : " + info.moduleInfos[j].moduleName);
+ console.log("checkApplicationInfo info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir);
+ }
+ console.log("checkApplicationInfo entryDir : " + info.entryDir);
+ expect(typeof (info)).assertEqual("object")
+ expect(typeof (info.name)).assertEqual("string")
+ expect(typeof (info.codePath)).assertEqual("string")
+ expect(info.accessTokenId > 0).assertTrue()
+ expect(typeof (info.accessTokenId)).assertEqual("number")
+ expect(typeof (info.description)).assertEqual("string")
+ expect(info.description).assertEqual("$string:mainability_description")
+ expect(info.descriptionId > 0).assertTrue()
+ expect(typeof (info.descriptionId)).assertEqual("number")
+ expect(typeof (info.icon)).assertEqual("string")
+ expect(info.icon).assertEqual("$media:icon")
+ expect(info.iconId > 0).assertTrue()
+ expect(typeof (info.iconId)).assertEqual("number")
+ expect(typeof (info.label)).assertEqual("string")
+ expect(info.label).assertEqual("$string:entry_MainAbility")
+ expect(info.labelId > 0).assertTrue()
+ expect(typeof (info.labelId)).assertEqual("number")
+ expect(info.systemApp).assertEqual(true)
+ expect(typeof (info.entryDir)).assertEqual("string")
+ expect(info.supportedModes).assertEqual(0)
+ expect(typeof (info.supportedModes)).assertEqual("number")
+ expect(typeof (info.process)).assertEqual("string")
+ expect(info.process).assertEqual("")
+ expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
+ expect(info.entryDir)
+ .assertEqual("/data/app/el1/bundle/public/com.ohos.acecollaboration/com.ohos.acecollaboration");
+ expect(Array.isArray(info.permissions)).assertEqual(true);
+ expect(info.codePath).assertEqual("/data/app/el1/bundle/public/com.ohos.acecollaboration");
+ expect(info.moduleSourceDirs[0])
+ .assertEqual("/data/app/el1/bundle/public/com.ohos.acecollaboration/com.ohos.acecollaboration");
+ expect(info.enabled).assertEqual(true);
+ expect(info.flags).assertEqual(0);
+ expect(info.uid > 0).assertTrue()
+ expect(info.entityType).assertEqual("unspecified");
+ expect(info.removable).assertEqual(true);
+ expect(info.accessTokenId > 0).assertTrue()
+ }
+ });
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5a6a21aa24850d74b21efec62c8598221933e526
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets
@@ -0,0 +1,313 @@
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index.ets';
+import Utils from './Utils';
+import Bundle from '@ohos.bundle';
+
+const BUNDLE_NAME = 'com.open.harmony.packagemag'
+const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility'
+
+const ABILITY = {
+ bundleName: BUNDLE_NAME,
+ name: ABILITY_NAME
+}
+
+const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
+const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility'
+
+const ABILITY_ERROR = {
+ bundleName: BUNDLE_NAME_ERROR,
+ name: ABILITY_NAME_ERROR
+}
+
+export default function isAbilityEnabledETSUnit() {
+ describe('context_isAbilityEnabled_test', function () {
+ beforeEach(async function (done) {
+ console.info('context_isAbilityEnabled_test before each called');
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(2000);
+ console.info('context_isAbilityEnabled_test after each called');
+ });
+
+ /*
+ * @tc.number: context_isAbilityEnabled_test_0100
+ * @tc.name: isAbilityEnabled : Get whether to enable a specified ability
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_isAbilityEnabled_test_0100', 0, async function (done) {
+ console.info('[context_isAbilityEnabled_test_0100] promise START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ await Bundle.isAbilityEnabled(ABILITY)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isAbilityEnabled_test_0100] promise in ');
+ console.info('[context_isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ console.info('[context_isAbilityEnabled_test_0100] promise error is: ' + error);
+ });
+ getAbilityEnabledSuccess('[context_isAbilityEnabled_test_0100]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isAbilityEnabled_test_0200
+ * @tc.name: isAbilityEnabled : Get whether to enable a specified ability
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_isAbilityEnabled_test_0200', 0, async function (done) {
+ console.info('[context_isAbilityEnabled_test_0200] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ Bundle.isAbilityEnabled(ABILITY, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isAbilityEnabled_test_0200]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isAbilityEnabled_test_0200] callBack in');
+ console.info('[context_isAbilityEnabled_test_0200] callBack error: ' + error);
+ console.info('[context_isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getAbilityEnabledSuccess('[context_isAbilityEnabled_test_0200]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isAbilityEnabled_test_0300
+ * @tc.name: isAbilityEnabled : Get whether to enable a specified ability
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_isAbilityEnabled_test_0300', 0, async function (done) {
+ console.info('[context_isAbilityEnabled_test_0300] promise START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ await Bundle.isAbilityEnabled(ABILITY_ERROR)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isAbilityEnabled_test_0300] promise in ');
+ console.info('[context_isAbilityEnabled_test_0300] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
+ console.info('[context_isAbilityEnabled_test_0300] promise error is: ' + error);
+ });
+ getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isAbilityEnabled_test_0400
+ * @tc.name: isAbilityEnabled : Get whether to enable a specified ability
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_isAbilityEnabled_test_0400', 0, async function (done) {
+ console.info('[context_isAbilityEnabled_test_0400] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ console.info('[context_isAbilityEnabled_test_0400] start c++ callBack ');
+ Bundle.isAbilityEnabled(ABILITY_ERROR, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
+ console.info('[context_isAbilityEnabled_test_0400] callBack in');
+ mData = data;
+ console.info('[context_isAbilityEnabled_test_0400] callBack error: ' + error);
+ console.info('[context_isAbilityEnabled_test_0400] callBack data is:' + JSON.stringify(data));
+ });
+ console.info('[context_isAbilityEnabled_test_0400] end c++ callBack ');
+ await Utils.sleep(2000);
+ console.info('[context_isAbilityEnabled_test_0400] Failure ');
+ getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
+ done();
+ });
+
+
+ /*
+ * @tc.number: context_isAbilityEnabled_test_0500
+ * @tc.name: isAbilityEnabled : Get whether to enable a specified ability
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_isAbilityEnabled_test_0500', 0, async function (done) {
+ console.info('[context_isAbilityEnabled_test_0500] promise START');
+ await Utils.sleep(1000);
+
+ await Bundle.setAbilityEnabled(ABILITY, true)
+ .then((data) => {
+ console.info('[context_isAbilityEnabled_test_0500] set enable true ');
+ console.info('[context_isAbilityEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
+ }).catch((error) => {
+ console.info('[context_isAbilityEnabled_test_0500] set enable true error is: ' + error);
+ })
+
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ await Bundle.isAbilityEnabled(ABILITY)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isAbilityEnabled_test_0500]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isAbilityEnabled_test_0500] promise in ');
+ console.info('[context_isAbilityEnabled_test_0500] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ console.info('[context_isAbilityEnabled_test_0500] promise error is: ' + error);
+ });
+ getAbilityEnabledTrue('[context_isAbilityEnabled_test_0500]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isAbilityEnabled_test_0600
+ * @tc.name: isAbilityEnabled : Get whether to enable a specified ability
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_isAbilityEnabled_test_0600', 0, async function (done) {
+ console.info('[context_isAbilityEnabled_test_0600] promise START');
+ await Utils.sleep(1000);
+
+ await Bundle.setAbilityEnabled(ABILITY, false)
+ .then((data) => {
+ console.info('[context_isAbilityEnabled_test_0600] set enable false ');
+ console.info('[context_isAbilityEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
+ }).catch((error) => {
+ console.info('[context_isAbilityEnabled_test_0600] set enable false error is: ' + error);
+ })
+
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ await Bundle.isAbilityEnabled(ABILITY)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isAbilityEnabled_test_0600]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isAbilityEnabled_test_0600] promise in ');
+ console.info('[context_isAbilityEnabled_test_0600] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ console.info('[context_isAbilityEnabled_test_0600] promise error is: ' + error);
+ });
+ getAbilityEnabledFalse('[context_isAbilityEnabled_test_0600]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isAbilityEnabled_test_0700
+ * @tc.name: isAbilityEnabled : Get whether to enable a specified ability
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_isAbilityEnabled_test_0700', 0, async function (done) {
+ console.info('[context_isAbilityEnabled_test_0700] callBack START');
+ await Utils.sleep(1000);
+
+ await Bundle.setAbilityEnabled(ABILITY, true)
+ .then((data) => {
+ console.info('[context_isAbilityEnabled_test_0700] set enable true ');
+ console.info('[context_isAbilityEnabled_test_0700] set enable true data is: ' + JSON.stringify(data));
+ }).catch((error) => {
+ console.info('[context_isAbilityEnabled_test_0700] set enable true error is: ' + error);
+ })
+
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ Bundle.isAbilityEnabled(ABILITY, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isAbilityEnabled_test_0700]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isAbilityEnabled_test_0700] callBack in');
+ console.info('[context_isAbilityEnabled_test_0700] callBack error: ' + error);
+ console.info('[context_isAbilityEnabled_test_0700] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getAbilityEnabledTrue('[context_isAbilityEnabled_test_0700]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isAbilityEnabled_test_0800
+ * @tc.name: isAbilityEnabled : Get whether to enable a specified ability
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_isAbilityEnabled_test_0800', 0, async function (done) {
+ console.info('[context_isAbilityEnabled_test_0800] callBack START');
+ await Utils.sleep(1000);
+
+ await Bundle.setAbilityEnabled(ABILITY, false)
+ .then((data) => {
+ console.info('[context_isAbilityEnabled_test_0800] set enable false ');
+ console.info('[context_isAbilityEnabled_test_0800] set enable false data is: ' + JSON.stringify(data));
+ }).catch((error) => {
+ console.info('[context_isAbilityEnabled_test_0800] set enable false error is: ' + error);
+ })
+
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ Bundle.isAbilityEnabled(ABILITY, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isAbilityEnabled_test_0800]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isAbilityEnabled_test_0800] callBack in');
+ console.info('[context_isAbilityEnabled_test_0800] callBack error: ' + error);
+ console.info('[context_isAbilityEnabled_test_0800] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getAbilityEnabledFalse('[context_isAbilityEnabled_test_0800]', mData);
+ done();
+ });
+
+
+ function getAbilityEnabledSuccess(msg, data) {
+ console.log(msg + ' start ' + JSON.stringify(data));
+ console.log(msg + ' data : ' + data);
+ expect(typeof (data)).assertEqual('boolean')
+ }
+
+ function getAbilityEnabledTrue(msg, data) {
+ getAbilityEnabledSuccess(msg, data);
+ expect(data).assertEqual(true);
+ }
+
+ function getAbilityEnabledFalse(msg, data) {
+ getAbilityEnabledSuccess(msg, data);
+ expect(data).assertEqual(false);
+ }
+
+ function getAbilityEnabledFailure(msg, error) {
+ console.log(msg + ' Failure ');
+ console.log(msg + ' error : ' + error);
+ expect(typeof (error)).assertEqual('number')
+ }
+
+ })
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets
new file mode 100644
index 0000000000000000000000000000000000000000..d99b7b821bb0b99381c3dc6e274408932688ee42
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets
@@ -0,0 +1,221 @@
+/**
+ * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index.ets';
+import Utils from './Utils';
+import Bundle from '@ohos.bundle';
+
+const BUNDLE_NAME = 'com.open.harmony.packagemag'
+
+const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'
+
+export default function IsApplicationEnabledETSUnit() {
+ describe('context_isApplicationEnabled_test', function () {
+ beforeEach(async function (done) {
+ console.info('context_isApplicationEnabled_test before each called');
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(2000);
+ console.info('context_isApplicationEnabled_test after each called');
+ });
+
+ /*
+ * @tc.number: context_isApplicationEnabled_test_0100
+ * @tc.name: isApplicationEnabled : Get whether to enable a specified application
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_isApplicationEnabled_test_0100', 0, async function (done) {
+ console.info('[context_isApplicationEnabled_test_0100] promise START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ await Bundle.isApplicationEnabled(BUNDLE_NAME)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isApplicationEnabled_test_0100]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isApplicationEnabled_test_0100] promise in ');
+ console.info('[context_isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ console.info('[context_isApplicationEnabled_test_0100] promise error is: ' + error);
+ });
+ getApplicationEnabledSuccess('[context_isApplicationEnabled_test_0100]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isApplicationEnabled_test_0200
+ * @tc.name: isApplicationEnabled : Get whether to enable a specified application
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_isApplicationEnabled_test_0200', 0, async function (done) {
+ console.info('[context_isApplicationEnabled_test_0200] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isApplicationEnabled_test_0200] callBack in');
+ console.info('[context_isApplicationEnabled_test_0200] callBack error: ' + error);
+ console.info('[context_isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getApplicationEnabledSuccess('[context_isApplicationEnabled_test_0200]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isApplicationEnabled_test_0300
+ * @tc.name: isApplicationEnabled : Get whether to enable a specified application
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_isApplicationEnabled_test_0300', 0, async function (done) {
+ console.info('[context_isApplicationEnabled_test_0300] promise START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ await Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isApplicationEnabled_test_0300] promise in ');
+ console.info('[context_isApplicationEnabled_test_0300] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
+ console.info('[context_isApplicationEnabled_test_0300] promise error is: ' + error);
+ });
+ getApplicationEnabledFalse('[context_isApplicationEnabled_test_0300]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isApplicationEnabled_test_0400
+ * @tc.name: isApplicationEnabled : Get whether to enable a specified application
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_isApplicationEnabled_test_0400', 0, async function (done) {
+ console.info('[context_isApplicationEnabled_test_0400] callBack START');
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ Bundle.isApplicationEnabled(BUNDLE_NAME_ERROR, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isApplicationEnabled_test_0400]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isApplicationEnabled_test_0400] callBack in');
+ console.info('[context_isApplicationEnabled_test_0400] callBack error: ' + error);
+ console.info('[context_isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getApplicationEnabledFalse('[context_isApplicationEnabled_test_0300]', mData);
+ console.info('[context_isApplicationEnabled_test_0400] Failure ');
+ done();
+ });
+
+ /*
+ * @tc.number: context_isApplicationEnabled_test_0500
+ * @tc.name: isApplicationEnabled : Get whether to enable a specified application
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it('context_isApplicationEnabled_test_0500', 0, async function (done) {
+ console.info('[context_isApplicationEnabled_test_0500] promise START');
+
+ await Bundle.setApplicationEnabled(BUNDLE_NAME, true)
+ .then((data) => {
+ console.info('[context_isApplicationEnabled_test_0500] set enable true ');
+ console.info('[context_isApplicationEnabled_test_0500] set enable true data is: ' + JSON.stringify(data));
+ }).catch((error) => {
+ console.info('[context_isApplicationEnabled_test_0500] set enable true error is: ' + error);
+ });
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ await Bundle.isApplicationEnabled(BUNDLE_NAME)
+ .then((data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isApplicationEnabled_test_0500]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isApplicationEnabled_test_0500] promise in ');
+ console.info('[context_isApplicationEnabled_test_0500] promise data is: ' + JSON.stringify(data));
+ })
+ .catch((error) => {
+ console.info('[context_isApplicationEnabled_test_0500] promise error is: ' + error);
+ });
+ getApplicationEnabledTrue('[context_isApplicationEnabled_test_0500]', mData);
+ done();
+ });
+
+ /*
+ * @tc.number: context_isApplicationEnabled_test_0600
+ * @tc.name: isApplicationEnabled : Get whether to enable a specified application
+ * @tc.desc: Check the return value of the interface (by callback)
+ * @tc.level 0
+ */
+ it('context_isApplicationEnabled_test_0600', 0, async function (done) {
+ console.info('[context_isApplicationEnabled_test_0600] callBack START');
+
+ await Bundle.setApplicationEnabled(BUNDLE_NAME, false)
+ .then((data) => {
+ console.info('[context_isApplicationEnabled_test_0600] set enable false ');
+ console.info('[context_isApplicationEnabled_test_0600] set enable false data is: ' + JSON.stringify(data));
+ }).catch((error) => {
+ console.info('[context_isApplicationEnabled_test_0600] set enable false error is: ' + error);
+ });
+
+ await Utils.sleep(1000);
+ var timeOldStamp = await Utils.getNowTime();
+ let mData;
+ Bundle.isApplicationEnabled(BUNDLE_NAME, (error, data) => {
+ var timeNewStamp = Utils.getNowTime();
+ Utils.getDurationTime('[context_isApplicationEnabled_test_0600]', timeOldStamp, timeNewStamp);
+ mData = data;
+ console.info('[context_isApplicationEnabled_test_0600] callBack in');
+ console.info('[context_isApplicationEnabled_test_0600] callBack error: ' + error);
+ console.info('[context_isApplicationEnabled_test_0600] callBack data is:' + JSON.stringify(data));
+ });
+ await Utils.sleep(2000);
+ getApplicationEnabledFalse('[context_isApplicationEnabled_test_0600]', mData);
+ done();
+ });
+
+ function getApplicationEnabledSuccess(msg, data) {
+ console.log(msg + ' start ' + JSON.stringify(data));
+ console.log(msg + ' data : ' + data);
+ expect(typeof (data)).assertEqual('boolean')
+ }
+
+ function getApplicationEnabledTrue(msg, data) {
+ getApplicationEnabledSuccess(msg, data);
+ expect(data).assertEqual(true);
+ }
+
+ function getApplicationEnabledFalse(msg, data) {
+ getApplicationEnabledSuccess(msg, data);
+ expect(data).assertEqual(false);
+ }
+ })
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a962e2f545a3794aabd7f61f090ee348f378d97d
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/List.test.ets
@@ -0,0 +1,33 @@
+/**
+ * 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 getabilityInfo from './GetabilityInfo.test.ets';
+import getApplicationInfoJsunit from './getApplicationInfoJsunit.test.ets';
+import getAllAppInfoJsunit from './getAllApplicationInfoJsunit.test.ets';
+import getAbilityLabelJsUnit from "./GetAbilityLabelJsUnit.test.ets";
+import isAbilityEnableETSUnit from "./IsAbilityEnabledETSUnit.ets";
+import isApplicationEnabledETSUnit from "./IsApplicationEnabledETSUnit.ets";
+
+export default function testsuite() {
+ //RM.007
+ getApplicationInfoJsunit();
+ getAllAppInfoJsunit();
+ //RM.006
+ getabilityInfo();
+ //RM.014
+ getAbilityLabelJsUnit();
+ //RM.017
+ isAbilityEnableETSUnit();
+ isApplicationEnabledETSUnit();
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/Utils.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/Utils.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4d9553a5c660be0a6ae524110f2dd4a6477abfd6
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/Utils.ets
@@ -0,0 +1,130 @@
+// @ts-nocheck
+/**
+ * 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 class Utils {
+ static rect_left;
+ static rect_top;
+ static rect_right;
+ static rect_bottom;
+ static rect_value;
+
+ static sleep(time) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ resolve()
+ }, time)
+ }).then(() => {
+ console.info(`sleep ${time} over...`)
+ })
+ }
+
+ static getComponentRect(key) {
+ let strJson = getInspectorByKey(key);
+ let obj = JSON.parse(strJson);
+ console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
+ let rectInfo = JSON.parse('[' + obj.$rect + ']')
+ console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
+ this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
+ this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
+ this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
+ this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
+ return this.rect_value = {
+ "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
+ }
+ }
+
+ static async swipe(downX, downY, upX, upY, steps) {
+ console.info('start to swipe')
+ this.drags(downX, downY, upX, upY, steps, false)
+ }
+
+ static async drag(downX, downY, upX, upY, steps) {
+ console.info('start to drag')
+ this.drags(downX, downY, upX, upY, steps, true)
+ }
+
+ static async drags(downX, downY, upX, upY, steps, drag) {
+ var xStep;
+ var yStep;
+ var swipeSteps;
+ var ret;
+ xStep = 0;
+ yStep = 0;
+ ret = false;
+ swipeSteps = steps;
+ if (swipeSteps == 0) {
+ swipeSteps = 1;
+ }
+ xStep = (upX - downX) / swipeSteps;
+ yStep = (upY - downY) / swipeSteps;
+ console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
+ var downPonit: TouchObject = {
+ id: 1,
+ x: downX,
+ y: downY,
+ type: TouchType.Down,
+ }
+ console.info('down touch started: ' + JSON.stringify(downPonit))
+ sendTouchEvent(downPonit);
+ console.info('start to move')
+ if (drag) {
+ await this.sleep(500)
+ }
+ for (var i = 1;i <= swipeSteps; i++) {
+ var movePoint: TouchObject = {
+ id: 1,
+ x: downX + (xStep * i),
+ y: downY + (yStep * i),
+ type: TouchType.Move
+ }
+ console.info('move touch started: ' + JSON.stringify(movePoint))
+ ret = sendTouchEvent(movePoint)
+ if (ret == false) {
+ break;
+ }
+ await this.sleep(5)
+ }
+ console.info('start to up')
+ if (drag) {
+ await this.sleep(100)
+ }
+ var upPoint: TouchObject = {
+ id: 1,
+ x: upX,
+ y: upY,
+ type: TouchType.Up,
+ }
+ console.info('up touch started: ' + JSON.stringify(upPoint))
+ sendTouchEvent(upPoint)
+ await this.sleep(500)
+ }
+
+ static getNowTime() {
+ return new Date().getTime();
+ }
+
+ static getDurationTime(log,startTime, endTime) {
+ console.info("Get Interface startTime: " + startTime);
+ console.info("Get Interface endTime: " + endTime);
+ var duration = (endTime - startTime);
+ console.info("Get Interface duration: " + duration);
+ return duration;
+ }
+}
+
+
+
+
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c35fbbc138434cfccc26003a679b291cb5fd66eb
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
@@ -0,0 +1,404 @@
+/**
+ * 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 {describe, beforeEach, afterEach, it, expect} from 'deccjsunit/index.ets';
+import Utils from './Utils';
+import Bundle from '@ohos.bundle';
+
+const TAG_TEST_0100_001 = ' bundle_getAllApplicationInfo_test_0100_001 ';
+const TAG_TEST_0100_002 = ' bundle_getAllApplicationInfo_test_0100_002 ';
+const TAG_TEST_0100_003 = ' bundle_getAllApplicationInfo_test_0100_003 ';
+const TAG_TEST_0200_001 = ' bundle_getAllApplicationInfo_test_0200_004 ';
+const TAG_TEST_0200_002 = ' bundle_getAllApplicationInfo_test_0200_005 ';
+const TAG_TEST_0200_003 = ' bundle_getAllApplicationInfo_test_0200_006 ';
+const TAG_TEST_0300_001 = ' bundle_getAllApplicationInfo_test_0300_007 ';
+const TAG_TEST_0400_001 = ' bundle_getAllApplicationInfo_test_0400_008 ';
+const TAG_TEST_0500_001 = ' bundle_getAllApplicationInfo_test_0500_009 ';
+const TAG_TEST_0500_002 = ' bundle_getAllApplicationInfo_test_0500_0010 ';
+const USER_ID_100 = 100;
+const SLEEP_TIME_1000 = 1000;
+const SLEEP_TIME_2000 = 2000;
+
+export default function applicationBundleJsunit() {
+ describe('appInfoTest', function () {
+ beforeEach(async function (done) {
+ console.info('applicationBundle before each called');
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(SLEEP_TIME_2000);
+ console.info('applicationBundle after each called');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0100_001
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0100_001, 0, async function (done) {
+ console.info(TAG_TEST_0100_001 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100)
+ .catch((error) => {
+ console.info(TAG_TEST_0100_001 + 'UserId promise error is: ' + error);
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0100_001, startTime, endTime);
+ console.info(TAG_TEST_0100_001 + ' UserId promise data is: ' + JSON.stringify(data));
+ commonTest(TAG_TEST_0100_001, data)
+ getApplicationInfoSuccess(TAG_TEST_0100_001, data);
+ done();
+ console.log('------------------ ' + TAG_TEST_0100_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0100_002
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0100_002, 0, async function (done) {
+ console.info(TAG_TEST_0100_002 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
+ .catch((error) => {
+ console.info(TAG_TEST_0100_002 + 'UserId promise error is: ' + error);
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0100_002, startTime, endTime);
+ console.info(TAG_TEST_0100_002 + ' UserId promise data is: ' + JSON.stringify(data));
+ commonTest(TAG_TEST_0100_002, data)
+ getApplicationInfoSuccess(TAG_TEST_0100_002, data);
+ done();
+ console.log('------------------ ' + TAG_TEST_0100_002 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0100_003
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0100_003, 0, async function (done) {
+ console.info(TAG_TEST_0100_003 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, USER_ID_100)
+ .catch((error) => {
+ console.info(TAG_TEST_0100_003 + 'UserId promise error is: ' + error);
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0100_003, startTime, endTime);
+ console.info(TAG_TEST_0100_003 + ' UserId promise data is: ' + JSON.stringify(data));
+ commonTest(TAG_TEST_0100_003, data)
+ getApplicationInfoSuccess(TAG_TEST_0100_003, data);
+ done();
+ console.log('------------------ ' + TAG_TEST_0100_003 + ' end -------------------');
+ });
+
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0200_004
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0200_001, 0, async function (done) {
+ console.info(TAG_TEST_0200_001 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
+ .catch((error) => {
+ console.info(TAG_TEST_0200_001 + 'onUserId promise error is: ' + error);
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0200_001, startTime, endTime);
+ console.info(TAG_TEST_0200_001 + ' onUserId promise data is: ' + JSON.stringify(data));
+ commonTest(TAG_TEST_0200_001, data)
+ getApplicationInfoSuccess(TAG_TEST_0200_001, data);
+ done();
+ console.log('------------------ ' + TAG_TEST_0200_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0200_005
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0200_002, 0, async function (done) {
+ console.info(TAG_TEST_0200_002 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
+ .catch((error) => {
+ console.info(TAG_TEST_0200_002 + 'onUserId promise error is: ' + error);
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0200_002, startTime, endTime);
+ console.info(TAG_TEST_0200_002 + ' onUserId promise data is: ' + JSON.stringify(data));
+ commonTest(TAG_TEST_0200_002, data)
+ getApplicationInfoSuccess(TAG_TEST_0200_002, data);
+ done();
+ console.log('------------------ ' + TAG_TEST_0200_002 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0200_006
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0200_003, 0, async function (done) {
+ console.info(TAG_TEST_0200_003 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
+ .catch((error) => {
+ console.info(TAG_TEST_0200_003 + 'onUserId promise error is: ' + error);
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0200_003, startTime, endTime);
+ console.info(TAG_TEST_0200_003 + ' onUserId promise data is: ' + JSON.stringify(data));
+ commonTest(TAG_TEST_0200_003, data)
+ getApplicationInfoSuccess(TAG_TEST_0200_003, data);
+ done();
+ console.log('------------------ ' + TAG_TEST_0200_003 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0300_007
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by callBack)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0300_001, 0, async function (done) {
+ console.info(TAG_TEST_0300_001 + 'callBack START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let datas;
+ var startTime = await Utils.getNowTime();
+ Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100,
+ (error, data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0300_001, startTime, endTime);
+ console.info(TAG_TEST_0300_001 + 'UserId callBack in');
+ console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
+ console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
+ datas = data;
+ });
+ await Utils.sleep(2000);
+ console.info(TAG_TEST_0300_001 + 'UserId callBack datas is:' + JSON.stringify(datas));
+ commonTest(TAG_TEST_0300_001, datas)
+ getApplicationInfoSuccess(TAG_TEST_0300_001, datas);
+ done();
+ console.log('------------------ ' + TAG_TEST_0300_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0400_008
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by callBack)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0400_001, 0, async function (done) {
+ console.info(TAG_TEST_0400_001 + 'callBack START');
+ let datas;
+ var startTime = await Utils.getNowTime();
+ Bundle.getAllApplicationInfo(Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, (error, data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0400_001, startTime, endTime);
+ console.info(TAG_TEST_0400_001 + 'noUserId callBack in');
+ console.info(TAG_TEST_0400_001 + 'noUserId callBack error: ' + error);
+ console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
+ datas = data;
+ });
+ await Utils.sleep(2000);
+ console.info(TAG_TEST_0400_001 + 'noUserId callBack datas is:' + JSON.stringify(datas));
+ commonTest(TAG_TEST_0400_001, datas)
+ getApplicationInfoSuccess(TAG_TEST_0400_001, datas);
+ done();
+ console.log('------------------ ' + TAG_TEST_0400_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0500_009
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0500_001, 0, async function (done) {
+ console.info(TAG_TEST_0500_001 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getAllApplicationInfo('0')
+ .catch((error) => {
+ console.info(TAG_TEST_0500_001 + 'noUserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime);
+ console.info(TAG_TEST_0500_001 + ' noUserId promise data is: ' + JSON.stringify(data));
+ expect(errors).assertEqual(1);
+ done();
+ console.log('------------------ ' + TAG_TEST_0500_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0500_0010
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0500_002, 0, async function (done) {
+ console.info(TAG_TEST_0500_002 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getAllApplicationInfo('0', USER_ID_100)
+ .catch((error) => {
+ console.info(TAG_TEST_0500_002 + 'UserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
+ console.info(TAG_TEST_0500_002 + ' UserId promise data is: ' + JSON.stringify(data));
+ expect(errors).assertEqual(1);
+ done();
+ console.log('------------------ ' + TAG_TEST_0500_002 + ' end -------------------');
+ });
+
+ /**
+ * 打印单个属性
+ * @param msg log信息
+ * @param data 数据源
+ */
+ function commonTest(msg, data) {
+ console.info(msg + 'commonTest data length [' + data.length + ']');
+ for (var i = 0; i < data.length; i++) {
+ console.info(msg + i + ' [ + data[i] + ] :' + JSON.stringify(data[i]));
+ console.info(msg + '[' + i + '].name:' + data[i].name);
+ console.info(msg + '[' + i + '].codePath:' + data[i].codePath);
+ console.info(msg + '[' + i + '].accessTokenId:' + data[i].accessTokenId);
+ console.info(msg + '[' + i + '].description:' + data[i].description);
+ console.info(msg + '[' + i + '].descriptionId:' + data[i].descriptionId);
+ console.info(msg + '[' + i + '].icon:' + data[i].icon);
+ console.info(msg + '[' + i + '].iconId:' + data[i].iconId);
+ console.info(msg + '[' + i + '].label:' + data[i].label);
+ console.info(msg + '[' + i + '].labelId:' + data[i].labelId);
+ console.info(msg + '[' + i + '].systemApp:' + data[i].systemApp);
+ console.info(msg + '[' + i + '].supportedModes:' + data[i].supportedModes);
+ console.info(msg + '[' + i + '].process:' + data[i].process);
+ console.info(msg + '[' + i + '].entryDir:' + data[i].entryDir);
+ console.info('getAllApplicationInfo Async permissions length [' + data[i].permissions.length + ']');
+ for (var j = 0; j < data[i].permissions.length; j++) {
+ console.info(msg + '[' + i + ']permissions[' + j + ']:' + data[i].permissions[j]);
+ }
+ console.info('getAllApplicationInfo Async moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
+ for (var l = 0; l < data[i].moduleSourceDirs.length; l++) {
+ console.info(msg + '[' + i + ']moduleSourceDirs[' + l + ']:' + data[i].moduleSourceDirs[l]);
+ }
+ console.info('getAllApplicationInfo Async moduleInfos length [' + data[i].moduleInfos.length + ']');
+ for (var k = 0; k < data[i].moduleInfos.length; k++) {
+ console.info(msg + '[' + i + ']moduleInfos[' + k + ']moduleName:' + data[i].moduleInfos[k].moduleName);
+ console.info(msg + '[' + i + ']moduleInfos[' + k + ']moduleSourceDir:' + data[i].moduleInfos[k].moduleSourceDir);
+ }
+ console.info(msg + '[' + i + '].metaData:' + data[i].metaData);
+ console.info(msg + '[' + i + '].metadata:' + data[i].metadata);
+ console.info(msg + '[' + i + '].enabled:' + data[i].enabled);
+ console.info(msg + '[' + i + '].flags:' + data[i].flags);
+ console.info(msg + '[' + i + '].uid:' + data[i].uid);
+ console.info(msg + '[' + i + '].entityType:' + data[i].entityType);
+ console.info(msg + '[' + i + '].removable:' + data[i].removable);
+ }
+ expectData(msg, data);
+ }
+
+ /**
+ * expect属性
+ * @param msg log信息
+ * @param data 数据源
+ */
+ function expectData(msg, data) {
+ console.info(msg + 'commonTest data length [' + data.length + ']');
+ for (var i = 0; i < data.length; i++) {
+ expect(typeof (data)).assertEqual('object');
+ expect(typeof (data[i].name)).assertEqual('string');
+ expect(typeof (data[i].codePath)).assertEqual('string');
+ expect(typeof (data[i].accessTokenId)).assertEqual('number');
+ expect(typeof (data[i].description)).assertEqual('string');
+ expect(typeof (data[i].descriptionId)).assertEqual('number');
+ expect(typeof (data[i].icon)).assertEqual('string');
+ expect(typeof (data[i].iconId)).assertEqual('number');
+ expect(typeof (data[i].label)).assertEqual('string');
+ expect(typeof (data[i].labelId)).assertEqual('number');
+ expect(typeof (data[i].systemApp)).assertEqual('boolean')
+ expect(typeof (data[i].supportedModes)).assertEqual('number');
+ expect(typeof (data[i].entryDir)).assertEqual('string');
+ expect(typeof (data[i].metaData)).assertEqual('object');
+ expect(typeof (data[i].metadata)).assertEqual('object');
+ expect(typeof (data[i].enabled)).assertEqual('boolean');
+ expect(typeof (data[i].flags)).assertEqual('number');
+ expect(typeof (data[i].uid)).assertEqual('number');
+ expect(typeof (data[i].entityType)).assertEqual('string');
+ expect(typeof (data[i].removable)).assertEqual('boolean');
+ expect(Array.isArray(data[i].permissions)).assertEqual(true);
+ expect(Array.isArray(data[i].moduleSourceDirs)).assertEqual(true);
+ expect(Array.isArray(data[i].moduleInfos)).assertEqual(true);
+ }
+ }
+
+ /**
+ * expect指定数据属性值
+ * @param msg log信息
+ * @param data 数据源
+ */
+ function getApplicationInfoSuccess(msg, data) {
+ console.info(msg + 'getApplicationInfoSuccess data length [' + data.length + ']');
+ for (var i = 0; i < data.length; i++) {
+ if (data[i].name === 'com.open.harmony.packagemag' || i === 0 && data[i].name === '') {
+ console.info(msg + JSON.stringify(data[i]));
+ expect(data[i].name).assertEqual('com.open.harmony.packagemag');
+ expect(data[i].codePath).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag');
+ expect(data[i].description).assertEqual('$string:mainability_description');
+ if (data[i].descriptionId !== 0) {
+ expect(data[i].descriptionId > 0).assertEqual(true);
+ }
+ expect(data[i].icon).assertEqual('$media:icon');
+ expect(data[i].iconId > 0).assertEqual(true);
+ expect(data[i].label).assertEqual('$string:entry_MainAbility');
+ if (data[i].label !== 0) {
+ expect(data[i].labelId > 0).assertEqual(true);
+ }
+ expect(data[i].systemApp).assertEqual(true);
+ expect(data[i].supportedModes).assertEqual(0);
+ expect(data[i].entryDir).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag' +
+ '/com.open.harmony.packagemag');
+ expect(data[i].enabled).assertEqual(true);
+ expect(data[i].entityType).assertEqual('unspecified');
+ expect(data[i].removable).assertEqual(true);
+ expect(data[i].moduleInfos[0].moduleName).assertEqual('entry');
+ expect(data[i].moduleInfos[0].moduleSourceDir).assertEqual('/data/app/el1/bundle/public/' +
+ 'com.open.harmony.packagemag/com.open.harmony.packagemag');
+ expect(data[i].moduleSourceDirs[0]).assertEqual('/data/app/el1/bundle/public/' +
+ 'com.open.harmony.packagemag/com.open.harmony.packagemag');
+ }
+ }
+ }
+ });
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7d3193b932deafda6e44cddcf0bf5de6836d87eb
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
@@ -0,0 +1,595 @@
+/**
+ * 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 {describe, beforeEach, afterEach, it, expect} from 'deccjsunit/index.ets';
+import Utils from './Utils';
+import Bundle from '@ohos.bundle';
+
+const TAG_TEST_0100_001 = ' bundle_getApplicationInfo_test_0100_001 ';
+const TAG_TEST_0100_002 = ' bundle_getApplicationInfo_test_0100_002 ';
+const TAG_TEST_0100_003 = ' bundle_getApplicationInfo_test_0100_003 ';
+const TAG_TEST_0200_001 = ' bundle_getApplicationInfo_test_0200_004 ';
+const TAG_TEST_0200_002 = ' bundle_getApplicationInfo_test_0200_005 ';
+const TAG_TEST_0200_003 = ' bundle_getApplicationInfo_test_0200_006 ';
+const TAG_TEST_0300_001 = ' bundle_getApplicationInfo_test_0300_007 ';
+const TAG_TEST_0400_001 = ' bundle_getApplicationInfo_test_0400_008 ';
+const TAG_TEST_0500_001 = ' bundle_getApplicationInfo_test_0500_009 ';
+const TAG_TEST_0500_002 = ' bundle_getApplicationInfo_test_0500_0010 ';
+const TAG_TEST_0600_001 = ' bundle_getApplicationInfo_test_0600_0011 ';
+const TAG_TEST_0600_002 = ' bundle_getApplicationInfo_test_0600_0012 ';
+const TAG_TEST_0600_003 = ' bundle_getApplicationInfo_test_0600_0013 ';
+const BUNDLE_NAME = 'com.open.harmony.packagemag';
+const BUNDLE_NAME_OTHER = 'com.ohos.acepackage';
+const USER_ID_100 = 100;
+const SLEEP_TIME_1000 = 1000;
+const SLEEP_TIME_2000 = 2000;
+
+export default function applicationBundleJsunit() {
+ describe('appInfoTest', function () {
+ beforeEach(async function (done) {
+ console.info('applicationBundle before each called');
+ done()
+ });
+
+ afterEach(async function () {
+ await Utils.sleep(SLEEP_TIME_2000);
+ console.info('applicationBundle after each called');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0100_001
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0100_001, 0, async function (done) {
+ console.info(TAG_TEST_0100_001 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
+ USER_ID_100)
+ .catch((error) => {
+ console.info(TAG_TEST_0100_001 + 'UserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0100_001, startTime, endTime);
+ console.info(TAG_TEST_0100_001 + ' UserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0100_001, data);
+ getApplicationInfoSuccess(TAG_TEST_0100_001, data);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0100_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0100_002
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0100_002, 0, async function (done) {
+ console.info(TAG_TEST_0100_002 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100)
+ .catch((error) => {
+ console.info(TAG_TEST_0100_002 + 'UserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0100_002, startTime, endTime);
+ console.info(TAG_TEST_0100_002 + ' UserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0100_002, data);
+ getApplicationInfoSuccess(TAG_TEST_0100_002, data);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0100_002 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0100_003
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0100_003, 0, async function (done) {
+ console.info(TAG_TEST_0100_003 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE,
+ USER_ID_100)
+ .catch((error) => {
+ console.info(TAG_TEST_0100_003 + 'UserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0100_003, startTime, endTime);
+ console.info(TAG_TEST_0100_003 + ' UserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0100_003, data);
+ if ('' === data.name) {
+ getApplicationInfoFial(TAG_TEST_0100_003, data);
+ } else {
+ getApplicationInfoSuccess(TAG_TEST_0100_003, data);
+ }
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0100_003 + ' end -------------------');
+ });
+
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0200_004
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0200_001, 0, async function (done) {
+ console.info(TAG_TEST_0200_001 + 'promise START');
+ let errors;
+ await Utils.sleep(SLEEP_TIME_1000);
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
+ .catch((error) => {
+ console.info(TAG_TEST_0200_001 + 'onUserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0200_001, startTime, endTime);
+ console.info(TAG_TEST_0200_001 + ' onUserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0200_001, data);
+ getApplicationInfoSuccess(TAG_TEST_0200_001, data);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0200_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0200_005
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0200_002, 0, async function (done) {
+ console.info(TAG_TEST_0200_002 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_ALL_APPLICATION_INFO)
+ .catch((error) => {
+ console.info(TAG_TEST_0200_002 + 'onUserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0200_002, startTime, endTime);
+ console.info(TAG_TEST_0200_002 + ' onUserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0200_002, data);
+ getApplicationInfoSuccess(TAG_TEST_0200_002, data);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0200_002 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0200_006
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0200_003, 0, async function (done) {
+ console.info(TAG_TEST_0200_003 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE)
+ .catch((error) => {
+ console.info(TAG_TEST_0200_003 + 'onUserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0200_003, startTime, endTime);
+ console.info(TAG_TEST_0200_003 + ' onUserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0200_003, data);
+ getApplicationInfoSuccess(TAG_TEST_0200_003, data);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0200_003 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0300_007
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by callBack)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0300_001, 0, async function (done) {
+ console.info(TAG_TEST_0300_001 + 'callBack START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ let datas;
+ var startTime = await Utils.getNowTime();
+ Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
+ USER_ID_100, (error, data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0300_001, startTime, endTime);
+ console.info(TAG_TEST_0300_001 + 'UserId callBack in');
+ console.info(TAG_TEST_0300_001 + 'UserId callBack error: ' + error);
+ errors = error;
+ console.info(TAG_TEST_0300_001 + 'UserId callBack data is:' + JSON.stringify(data));
+ datas = data;
+ });
+ await Utils.sleep(2000);
+ console.info(TAG_TEST_0300_001 + 'UserId callBack data is: ' + JSON.stringify(datas));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0300_001, datas);
+ getApplicationInfoSuccess(TAG_TEST_0300_001, datas);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0300_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0400_008
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by callBack)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0400_001, 0, async function (done) {
+ console.info(TAG_TEST_0400_001 + 'callBack START');
+ let errors;
+ let datas;
+ var startTime = await Utils.getNowTime();
+ Bundle.getApplicationInfo(BUNDLE_NAME, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, (error, data) => {
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0400_001, startTime, endTime);
+ console.info(TAG_TEST_0400_001 + 'noUserId callBack in');
+ console.info(TAG_TEST_0400_001 + 'noUserId callBack error: ' + error);
+ errors = error;
+ console.info(TAG_TEST_0400_001 + 'noUserId callBack data is:' + JSON.stringify(data));
+ datas = data;
+ });
+ await Utils.sleep(2000);
+ console.info(TAG_TEST_0400_001 + 'noUserId callBack data is: ' + JSON.stringify(datas));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0400_001, datas);
+ getApplicationInfoSuccess(TAG_TEST_0400_001, datas);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0400_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0500_009
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0500_001, 0, async function (done) {
+ console.info(TAG_TEST_0500_001 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo('', 0)
+ .catch((error) => {
+ console.info(TAG_TEST_0500_001 + 'noUserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime);
+ console.info(TAG_TEST_0500_001 + ' noUserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0500_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0500_0010
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0500_002, 0, async function (done) {
+ console.info(TAG_TEST_0500_002 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo('', '0', USER_ID_100)
+ .catch((error) => {
+ console.info(TAG_TEST_0500_002 + 'UserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime);
+ console.info(TAG_TEST_0500_002 + ' UserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0500_002 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0600_0011
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0600_001, 0, async function (done) {
+ console.info(TAG_TEST_0600_001 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER,
+ Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION)
+ .catch((error) => {
+ console.info(TAG_TEST_0600_001 + 'other bundleName noUserId promise error is: ' + error);
+ errors = error;
+ });
+ console.info(TAG_TEST_0600_001 + ' other bundleName noUserId promise errors is: ' + JSON.stringify(errors));
+ console.info(TAG_TEST_0600_001 + ' other bundleName noUserId promise data is: ' + JSON.stringify(data));
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0600_001, startTime, endTime);
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0600_001, data);
+ getApplicationInfoOtherSuccess(TAG_TEST_0600_001, data);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0600_001 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0600_0012
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0600_002, 0, async function (done) {
+ console.info(TAG_TEST_0600_002 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data =
+ await Bundle.getApplicationInfo(BUNDLE_NAME_OTHER, Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION,
+ USER_ID_100)
+ .catch((error) => {
+ console.info(TAG_TEST_0600_002 + 'other bundleName UserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0600_002, startTime, endTime);
+ console.info(TAG_TEST_0600_002 + ' other bundleName UserId promise errors is: ' + JSON.stringify(errors));
+ console.info(TAG_TEST_0600_002 + ' other bundleName UserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0600_002, data);
+ getApplicationInfoOtherSuccess(TAG_TEST_0600_002, data);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0600_002 + ' end -------------------');
+ });
+
+ /**
+ * @tc.number: bundle_getApplicationInfo_test_0500_009
+ * @tc.name: getApplicationInfo : Obtains based on a given bundle name.
+ * @tc.desc: Check the return value of the interface (by promise)
+ * @tc.level 0
+ */
+ it(TAG_TEST_0600_003, 0, async function (done) {
+ console.info(TAG_TEST_0600_003 + 'promise START');
+ await Utils.sleep(SLEEP_TIME_1000);
+ let errors;
+ var startTime = await Utils.getNowTime();
+ let data = await Bundle.getApplicationInfo(BUNDLE_NAME, 0)
+ .catch((error) => {
+ console.info(TAG_TEST_0600_003 + 'noUserId promise error is: ' + error);
+ errors = error;
+ });
+ var endTime = Utils.getNowTime();
+ Utils.getDurationTime(TAG_TEST_0600_003, startTime, endTime);
+ console.info(TAG_TEST_0600_003 + ' noUserId promise data is: ' + JSON.stringify(data));
+ if (1 === errors) {
+ expect(errors).assertEqual(1);
+ } else {
+ commonTest(TAG_TEST_0600_003, data);
+ getApplicationInfoSuccess(TAG_TEST_0600_003, data);
+ }
+ done();
+ console.log('------------------ ' + TAG_TEST_0600_003 + ' end -------------------');
+ });
+
+ /**
+ * 打印单和expect个属性
+ * @param msg log信息
+ * @param data 数据源
+ */
+ function commonTest(msg, data) {
+ console.log(msg + ' commonTest start ' + JSON.stringify(data));
+ console.log(msg + ' name : ' + data.name);
+ console.log(msg + ' codePath : ' + data.codePath);
+ console.log(msg + ' accessTokenId : ' + data.accessTokenId);
+ console.log(msg + ' description : ' + data.description);
+ console.log(msg + ' descriptionId : ' + data.descriptionId);
+ console.log(msg + ' icon : ' + data.icon);
+ console.log(msg + ' iconId : ' + data.iconId);
+ console.log(msg + ' label : ' + data.label);
+ console.log(msg + ' labelId : ' + data.labelId);
+ console.log(msg + ' systemApp : ' + data.systemApp);
+ console.log(msg + ' supportedModes : ' + data.supportedModes);
+ console.log(msg + ' entryDir : ' + data.entryDir);
+ console.log(msg + ' metaData : ' + data.metaData);
+ console.log(msg + ' metadata : ' + data.metadata);
+ console.log(msg + ' enabled : ' + data.enabled);
+ console.log(msg + ' flags : ' + data.flags);
+ console.log(msg + ' uid : ' + data.uid);
+ console.log(msg + ' removable : ' + data.removable);
+ console.log(msg + ' permissions length : ' + data.permissions.length);
+ for (var j = 0; j < data.permissions.length; j++) {
+ console.log('getApplicationInfo0001 data.permissions[' + j + '] : ' + data.permissions[j]);
+ }
+ console.log(msg + ' moduleSourceDirs length : ' + data.moduleSourceDirs.length);
+ for (var i = 0; i < data.moduleSourceDirs.length; i++) {
+ console.log('getApplicationInfo0001 data.moduleSourceDirs[' + i + '] : ' + data.moduleSourceDirs[i]);
+ }
+ console.log(msg + ' moduleInfos length : ' + data.moduleInfos.length);
+ for (var k = 0; k < data.moduleInfos.length; k++) {
+ console.log('getApplicationInfo0001 data.moduleInfos[' + k + '] : ' + data.moduleInfos[k].moduleName);
+ console.log('getApplicationInfo0001 data.moduleInfos[' + k + '] : ' + data.moduleInfos[k].moduleSourceDir);
+ }
+ expectData(msg, data);
+ }
+
+ /**
+ * expect属性
+ * @param msg log信息
+ * @param data 数据源
+ */
+ function expectData(msg, data) {
+ expect(typeof (data)).assertEqual('object');
+ expect(typeof (data.name)).assertEqual('string');
+ expect(typeof (data.codePath)).assertEqual('string');
+ expect(typeof (data.accessTokenId)).assertEqual('number');
+ expect(typeof (data.description)).assertEqual('string');
+ expect(typeof (data.descriptionId)).assertEqual('number');
+ expect(typeof (data.icon)).assertEqual('string');
+ expect(typeof (data.iconId)).assertEqual('number');
+ expect(typeof (data.label)).assertEqual('string');
+ expect(typeof (data.labelId)).assertEqual('number');
+ expect(typeof (data.systemApp)).assertEqual('boolean')
+ expect(typeof (data.supportedModes)).assertEqual('number');
+ expect(typeof (data.entryDir)).assertEqual('string');
+ expect(typeof (data.metaData)).assertEqual('object');
+ expect(typeof (data.metadata)).assertEqual('object');
+ expect(typeof (data.enabled)).assertEqual('boolean');
+ expect(typeof (data.flags)).assertEqual('number');
+ expect(typeof (data.uid)).assertEqual('number');
+ expect(typeof (data.entityType)).assertEqual('string');
+ expect(typeof (data.removable)).assertEqual('boolean');
+ expect(Array.isArray(data.permissions)).assertEqual(true);
+ expect(Array.isArray(data.moduleSourceDirs)).assertEqual(true);
+ expect(Array.isArray(data.moduleInfos)).assertEqual(true);
+ }
+
+ /**
+ * expect属性值
+ * @param msg log信息
+ * @param data 数据源
+ */
+ function getApplicationInfoSuccess(msg, data) {
+ expect(data.name).assertEqual('com.open.harmony.packagemag');
+ expect(data.codePath).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag');
+ expect(data.description).assertEqual('$string:mainability_description');
+// expect(data.descriptionId).assertEqual(16777217);
+ expect(data.icon).assertEqual('$media:icon');
+// expect(data.iconId).assertEqual(16777218);
+ expect(data.label).assertEqual('$string:entry_MainAbility');
+// expect(data.labelId).assertEqual(16777216);
+ expect(data.systemApp).assertEqual(true);
+ expect(data.supportedModes).assertEqual(0);
+ expect(data.entryDir).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag' +
+ '/com.open.harmony.packagemag');
+ expect(data.enabled).assertEqual(true);
+ expect(data.entityType).assertEqual('unspecified');
+ expect(data.removable).assertEqual(true);
+ expect(data.moduleInfos[0].moduleName).assertEqual('entry');
+ expect(data.moduleInfos[0].moduleSourceDir).assertEqual('/data/app/el1/bundle/public/' +
+ 'com.open.harmony.packagemag/com.open.harmony.packagemag');
+ expect(data.moduleSourceDirs[0]).assertEqual('/data/app/el1/bundle/public/' +
+ 'com.open.harmony.packagemag/com.open.harmony.packagemag');
+ console.log(msg + ' end ' + JSON.stringify(data));
+ }
+
+ /**
+ * expect属性值
+ * @param msg log信息
+ * @param data 数据源
+ */
+ function getApplicationInfoFial(msg, data) {
+ expect(data.name).assertEqual('');
+ expect(data.codePath).assertEqual('');
+ expect(data.description).assertEqual('');
+ expect(data.descriptionId).assertEqual(0);
+ expect(data.icon).assertEqual('');
+ expect(data.iconId).assertEqual(0);
+ expect(data.label).assertEqual('');
+ expect(data.labelId).assertEqual(0);
+ expect(data.systemApp).assertEqual(false);
+ expect(data.supportedModes).assertEqual(0);
+ expect(data.entryDir).assertEqual('');
+ expect(data.enabled).assertEqual(false);
+ expect(data.entityType).assertEqual('');
+ expect(data.removable).assertEqual(true);
+ console.log(msg + ' end ' + JSON.stringify(data));
+ }
+
+
+ /**
+ * expect属性值
+ * @param msg log信息
+ * @param data 数据源
+ */
+ function getApplicationInfoOtherSuccess(msg, data) {
+ expect(data.name).assertEqual('com.ohos.acepackage');
+ expect(data.codePath).assertEqual('/data/app/el1/bundle/public/com.ohos.acepackage');
+ expect(data.description).assertEqual('$string:description_mainability');
+ expect(data.descriptionId > 0).assertEqual(true);
+ expect(data.icon).assertEqual('$media:icon');
+ expect(data.iconId > 0).assertEqual(true);
+ expect(data.label).assertEqual('$string:entry_MainAbility');
+ expect(data.labelId > 0).assertEqual(true);
+ expect(data.systemApp).assertEqual(true);
+ expect(data.supportedModes).assertEqual(0);
+ expect(data.entryDir).assertEqual('/data/app/el1/bundle/public/com.ohos.acepackage' +
+ '/com.ohos.acepackage');
+ expect(data.enabled).assertEqual(true);
+ expect(data.entityType).assertEqual('unspecified');
+ expect(data.removable).assertEqual(true);
+ expect(data.moduleInfos[0].moduleName).assertEqual('entry');
+ expect(data.moduleInfos[0].moduleSourceDir).assertEqual('/data/app/el1/bundle/public/' +
+ 'com.ohos.acepackage/com.ohos.acepackage');
+ expect(data.moduleSourceDirs[0]).assertEqual('/data/app/el1/bundle/public/' +
+ 'com.ohos.acepackage/com.ohos.acepackage');
+ console.log(msg + ' end ' + JSON.stringify(data));
+ }
+ });
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/ServiceAbility/service.ts b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/ServiceAbility/service.ts
new file mode 100644
index 0000000000000000000000000000000000000000..383f9f0ebefc00d5761c83f88fcd1ba6c9500cd1
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/ServiceAbility/service.ts
@@ -0,0 +1,11 @@
+export default {
+ onStart() {
+ console.info('ServiceAbility onStart');
+ },
+ onStop() {
+ console.info('ServiceAbility onStop');
+ },
+ onCommand(want, startId) {
+ console.info('ServiceAbility onCommand');
+ }
+};
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/resources/base/element/string.json b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..2482e91c015e2e8d68406790782982adc4789b34
--- /dev/null
+++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,20 @@
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "entry_MainAbility"
+ },
+ {
+ "name": "description_mainability",
+ "value": "eTS_Empty Ability"
+ },
+ {
+ "name": "mainability_description",
+ "value": "eTS_Empty Ability"
+ },
+ {
+ "name": "description_serviceability",
+ "value": "hap sample empty service"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/resources/base/media/icon.png b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/resources/base/media/icon.png differ
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/signature/openharmony_sx.p7b b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/signature/openharmony_sx.p7b differ
diff --git a/communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js b/communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
index 86ee62e76d659923eb6ca4e9eb047f4154b7500d..fd574f87c4b18d194c232a5c93864cc519f6d2ab 100644
--- a/communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
+++ b/communication/bluetooth_on/src/main/js/default/test/BluetoothOn.test.js
@@ -121,7 +121,6 @@ describe('bluetoothhostTest', function() {
});
console.info('[bluetooth_js] discovery end');
done();
- await sleep(2000);
})
diff --git a/communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js b/communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js
index e0b02c9c808d206c6cfb58094fd1218b4a14025d..fa7583e1efdf4113a892f06c8b66b8fb704ae56f 100644
--- a/communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js
+++ b/communication/bluetooth_standard/src/main/js/default/test/Bluetooth.test.js
@@ -820,6 +820,7 @@ describe('bluetoothhostTest', function() {
console.info('[bluetooth_js] setLocalName end');
})
+
/**
* @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_SET_LOCAL_NAME_00014
* @tc.name testsetLocalName
@@ -829,7 +830,7 @@ describe('bluetoothhostTest', function() {
* @tc.type Function
* @tc.level Level 2
*/
- it('bluetooth_classic_set_local_name14', 0, async function (done) {
+ it('bluetooth_classic_set_local_name14', 0, function () {
console.info('[bluetooth_js] set localname start');
var name = bluetooth.setLocalName('0123456789012345678901234567890123456789012345678901'
+'23456789012345678901234567890123456789012345678901234567890123456789012345678012'
@@ -838,14 +839,29 @@ describe('bluetoothhostTest', function() {
expect(name).assertTrue();
var localName = bluetooth.getLocalName();
console.info('[bluetooth_js] getLocalName result14 = ' + JSON.stringify(localName));
+ console.info('[bluetooth_js] setLocalName end');
+ })
+
+
+ /**
+ * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_DISABLE_0001
+ * @tc.name testdisablebluetooth
+ * @tc.desc Test disablebluetooth api.
+ * @tc.author zhangyujie zwx1079266
+ * @tc.size MEDIUM
+ * @tc.type Function
+ * @tc.level Level 2
+ */
+
+ it('bluetooth_classic_disable_bluetooth', 0, function () {
+ console.info('[bluetooth_js] disable test start');
let disable = bluetooth.disableBluetooth();
console.info('[bluetooth_js] disable:' + JSON.stringify(disable));
expect(disable).assertTrue();
- await sleep(2000);
- console.info('[bluetooth_js] setLocalName end');
- done();
+ var state = bluetooth.getState();
+ console.info('[bluetooth_js] bt state:' + JSON.stringify(state));
+ console.info('[bluetooth_js] disable end');
})
-
})
diff --git a/communication/wifi_hotspot/src/main/js/default/test/WifiSoftAP.test.js b/communication/wifi_hotspot/src/main/js/default/test/WifiSoftAP.test.js
index bf0012f1496f1e19c59328347dfb05432cc2de73..130eca64741a3be398bffc612f7ad35eae0f132e 100755
--- a/communication/wifi_hotspot/src/main/js/default/test/WifiSoftAP.test.js
+++ b/communication/wifi_hotspot/src/main/js/default/test/WifiSoftAP.test.js
@@ -296,7 +296,7 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
- console.info("preSharedKey: " + config.ssid);
+ console.info("ssid: " + config.ssid);
expect(config.ssid.length).assertEqual(32);
done();
@@ -355,7 +355,7 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
- console.info("preSharedKey: " + config.ssid);
+ console.info("ssid: " + config.ssid);
expect(true).assertEqual(config.ssid==HotspotConfigC.ssid);
})
@@ -440,8 +440,8 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
- console.info("preSharedKey: " + config.ssid);
- expect(config.preSharedKey).assertEqual(3);
+ console.info("ssid: " + config.ssid);
+ expect(config.securityType).assertEqual(3);
console.log("[wifi_test] check the state of Hotspot" );
var isHotspotActive = wifi.isHotspotActive();
console.info("[wifi_test] isHotspotActive -> " + isHotspotActive);
@@ -478,8 +478,8 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] check current hotspot config preSharedKey is 8bit" );
var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
- console.info("preSharedKey: " + config.ssid);
- expect(config.preSharedKey).assertEqual(1);
+ console.info("ssid: " + config.ssid);
+ expect(config.securityType).assertEqual(1);
done();
})
@@ -513,7 +513,7 @@ describe('ACTS_WifiTest', function() {
console.log("[wifi_test] check current hotspot config maxConn is 8 " );
var config = wifi.getHotspotConfig();
console.info("[wifi_test] getHotspotConfig result -> " + JSON.stringify(config));
- console.info("ssid: " + config.maxConn);
+ console.info("maxConn: " + config.maxConn);
expect(config.maxConn).assertEqual(8);
console.log("[wifi_test] set more maxConn invalid hotspot config" );
diff --git a/communication/wifi_standard/src/main/js/default/test/WifiSta.test.js b/communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
index 6c92dcc4235b8c08dabb993ad5521476d5bb65d6..2714f67c6a41f22863cb96e502cb4afd0b6ee0e9 100755
--- a/communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
+++ b/communication/wifi_standard/src/main/js/default/test/WifiSta.test.js
@@ -753,7 +753,6 @@ describe('ACTS_WifiTest', function() {
"staticIp": {"ipAddress": 1284752956,"gateway": 1284752936},
};
var result1 = wifi.connectToDevice(wifiDeviceConfigIp);
- await sleep(2000);
console.log("[wifi_test] wifi connectToDevice result: " + result1);
expect(result1).assertTrue();
console.info("[wifi_test] check isconnected wifi");
diff --git a/graphic/webGL/src/main/js/default/test/webGL.test.js b/graphic/webGL/src/main/js/default/test/webGL.test.js
old mode 100644
new mode 100755
index cc87d052eeb0a53f42c6ecf1d938f565f860c2b9..e9d9adf51f87582e35a39e67120f9a9c93d3d3ab
--- a/graphic/webGL/src/main/js/default/test/webGL.test.js
+++ b/graphic/webGL/src/main/js/default/test/webGL.test.js
@@ -27472,4 +27472,164 @@ describe('webgl1Test', function() {
expect(texParameterValue).assertEqual(gl.COMPARE_REF_TO_TEXTURE);
done();
});
+
+ /**
+ * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_1335
+ * @tc.name testRangeMin
+ * @tc.desc Test RangeMin.
+ */
+ it ('testRangeMin', 0, async function(done) {
+ console.info('jsWebGL testRangeMin test start');
+ gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).rangeMin;
+ gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_INT).rangeMin;
+ const min = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_INT).rangeMin;
+ const max = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).rangeMax;
+ expect(min).assertEqual(24);
+ expect(max).assertEqual(127);
+ done();
+ });
+
+ /**
+ * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_1335
+ * @tc.name testAttributeBae
+ * @tc.desc Test AttributeBae.
+ */
+ it ('testAttributeBae', 0, async function(done) {
+ console.info('jsWebGL testAttributeBae test start');
+ var frameBuffer = gl.createBuffer();
+ gl.bindBuffer(gl.FRAMEBUFFER, frameBuffer);
+ const framebufferParameter = gl.getParameter(gl.FRAMEBUFFER_BINDING);
+ const isFramebuffer = gl.isFramebuffer(framebufferParameter);
+ expect(isFamebuffer).assertEqual(true);
+ done();
+ });
+
+ /**
+ * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_1335
+ * @tc.name testTypeBase
+ * @tc.desc Test TypeBase.
+ */
+ it ('testTypeBase', 0, async function(done) {
+ console.info('jsWebGL testTypeBasetest start');
+ const progamObj = globalFunction();
+ const info = gl.getActiveAttrib(programObj, 0);
+ info.size = 123;
+ info.name = 'name';
+ info.type = Number;
+ const size = info.size;
+ const name = info.name;
+ const type = info.type;
+ expect(size).assertEqual(info.size);
+ expect(name).assertEqual(info.name);
+ expect(type).assertEqual(info.type);
+ done();
+ });
+
+ /**
+ * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_1335
+ * @tc.name testWebGLTypeBase
+ * @tc.desc Test WebGLTypeBase.
+ */
+ it ('testWebGLTypeBase', 0, async function(done) {
+ console.info('jsWebGL testWebGLTypeBase test start');
+ var x =1 ;
+ expect(x).assertEqual(gl.ONE);
+ var x1 = 0x8892;
+ expect(x1).assertEqual(gl.ARRAY_BUFFER);
+ var x2 = 0x0405;
+ expect(x2).assertEqual(gl.BACK);
+ var x3 = 0;
+ expect(x3).assertEqual(gl.NO_ERROR);
+ var x4 = 0x0502;
+ expect(x4).assertEqual(gl.INVALID_OPERATION);
+ var x5 = 0x80AA;
+ expect(x5).assertEqual(gl.SAMPLE_COVERAGE_VALUE);
+ var x6 = 0x80AB;
+ expect(x6).assertEqual(gl.SAMPLE_COVERAGE_INVERT);
+ var x7 = 0x1400;
+ expect(x7).assertEqual(gl.BYTE);
+ var x8 = 0x1404;
+ expect(x8).assertEqual(gl.INT);
+ var x9 = 0x1406;
+ expect(x9).assertEqual(gl.FLOAT);
+ var x10 = 0x1907;
+ expect(x10).assertEqual(gl.RGB);
+ var x11 = 0x8B89;
+ expect(x11).assertEqual(gl.ACTIVE_ATTRIBUTES);
+ var x12 = 0x0DE1;
+ expect(x12).assertEqual(gl.TEXTURE_2D);
+
+ var x13 = 0x1702;
+ expect(x13).assertEqual(gl.TEXTURE);
+
+ var x14 = 0x84C0;
+ expect(x14).assertEqual(gl.TEXTURE0);
+ var x15 = 0x8D40;
+ expect(x15).assertEqual(gl.FRAMEBUFFER);
+ var x16 = 0x8D41;
+ expect(x16).assertEqual(gl.RENDERBUFFER);
+ var x17 = 0x8894;
+ expect(x17).assertEqual(gl.ARRAY_BUFFER);
+ var x18 = 0;
+ expect(x18).assertEqual(gl.NONE);
+ var x19 =0x9242;
+ expect(x19).assertEqual(gl.CONTEXT_LOST_WEBGL);
+ var x20 = 0x8892;
+ expect(x20).assertEqual(gl.ARRAY_BUFFER)
+ done();
+ });
+
+ /**
+ * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_1335
+ * @tc.name testRendingContextBase
+ * @tc.desc Test RendingContextBase.
+ */
+ it ('testRendingContextBase', 0, async function(done) {
+ console.info('jsWebGL testRendingContextBase test start');
+ const buffer = gl.createBuffer();
+ expect(typeof(buffer)).assertEqual('object');
+
+ var x1 = gl2.COLOR;
+ expect(x1).assertEqual(6144);
+
+ var x2 = gl2.STENCIL;
+ expect(x2).assertEqual(6146);
+
+ var x3 = gl2.MIN;
+ expect(x3).assertEqual(32775);
+
+ var x4 = gl2.MAX;
+ expect(x4).assertEqual(32776);
+
+ var x5 = gl2.RG;
+ expect(x5).assertEqual(33319);
+
+ var x6 = gl2.SYNC_CONDITION;
+ expect(x6).assertEqual(37139);
+
+ var x7 = gl2.SYNC_STATUS;
+ expect(x7).assertEqual(37140);
+
+ var x8 = gl2.SYNC_FLAGS;
+ expect(x8).assertEqual(37141);
+
+ done();
+
+ });
+
+ /**
+ * @tc.number GRAPHIC_FUNCTION_JS_WEBGL_TESTWEBGL_1335
+ * @tc.name testAttributeBase
+ * @tc.desc Test testAttributeBase.
+ */
+ it ('testAttributeBase', 0, async function(done) {
+ console.info('jsWebGL testAttributeBase test start');
+ var attribute = gl.getContextAttributes();
+ expect(atttribute.desynchronized).assertEqual(false);
+ expect(atttribute.antialias).assertEqual(true);
+ expect(atttribute.premultipliedAlpha).assertEqual(true);
+ expect(atttribute.preserveDrawingBuffer).assertEqual(false);
+ expect(atttribute.failIfMajorPerformanceCaveat).assertEqual(false);
+ done()
+ });
})
diff --git a/miscservices/BUILD.gn b/miscservices/BUILD.gn
index bf26586acb38e6cedd61629861b87940fa177489..37e6764c288eb082e79df5ae14bc9223b91c07a0 100755
--- a/miscservices/BUILD.gn
+++ b/miscservices/BUILD.gn
@@ -15,6 +15,7 @@ import("//build/ohos_var.gni")
group("miscservices") {
testonly = true
deps = [
+ "PasteBoardTest_js:pasteboard_js_test",
"TimeTest_js:time_js_test",
"TimerTest_js:timer_js_test",
]
diff --git a/miscservices/PasteBoardTest_js/BUILD.gn b/miscservices/PasteBoardTest_js/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..fbb8d7d95a95249659973a9648a80e61bdab1fa0
--- /dev/null
+++ b/miscservices/PasteBoardTest_js/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("pasteboard_js_test") {
+ hap_profile = "./src/main/config.json"
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsPasteBoardJSApiTest"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/miscservices/PasteBoardTest_js/Test.json b/miscservices/PasteBoardTest_js/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..9827a384e6246284b3b81dcffa3fd214e8381a2e
--- /dev/null
+++ b/miscservices/PasteBoardTest_js/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for PasteBoard js api Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "180000",
+ "package": "ohos.acts.miscservices.pasteboard",
+ "shell-timeout": "180000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsPasteBoardJSApiTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/miscservices/PasteBoardTest_js/signature/openharmony_sx.p7b b/miscservices/PasteBoardTest_js/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/miscservices/PasteBoardTest_js/signature/openharmony_sx.p7b differ
diff --git a/miscservices/PasteBoardTest_js/src/main/config.json b/miscservices/PasteBoardTest_js/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..73cba5cfe733c979c711cfc00fcc1ac1f533c999
--- /dev/null
+++ b/miscservices/PasteBoardTest_js/src/main/config.json
@@ -0,0 +1,60 @@
+{
+ "app": {
+ "bundleName": "ohos.acts.miscservices.pasteboard",
+ "vendor": "acts",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.miscservices.pasteboard",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "visible": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "ohos.acts.miscservices.pasteboard.MainAbility",
+ "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
+ }
+ }
+ ]
+ }
+}
diff --git a/miscservices/PasteBoardTest_js/src/main/js/default/app.js b/miscservices/PasteBoardTest_js/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..2b1123aba50aa93c918c68213fb66542e2264948
--- /dev/null
+++ b/miscservices/PasteBoardTest_js/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/miscservices/PasteBoardTest_js/src/main/js/default/i18n/en-US.json b/miscservices/PasteBoardTest_js/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/miscservices/PasteBoardTest_js/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/miscservices/PasteBoardTest_js/src/main/js/default/i18n/zh-CN.json b/miscservices/PasteBoardTest_js/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/miscservices/PasteBoardTest_js/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.css b/miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.hml b/miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+