diff --git a/global/BUILD.gn b/global/BUILD.gn
index 6cfac68b0ee8141fe43a155ef413b3e011ff508e..d31c74b03196f0c032bbb86b5611cd75f938fb76 100755
--- a/global/BUILD.gn
+++ b/global/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -17,6 +17,7 @@ group("global") {
testonly = true
if (is_standard_system) {
deps = [
+ "cust/custjs:custjs_test",
"i18n_standard/intljs:intljs_test",
"resmgr_standard/resmgrjs:resmgrjs_test",
]
diff --git a/global/cust/custjs/BUILD.gn b/global/cust/custjs/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..3c890e336af18e5a14ab63f1ba236e5552ab2dd2
--- /dev/null
+++ b/global/cust/custjs/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright (C) 2022 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("custjs_test") {
+ hap_profile = "./src/main/config.json"
+ deps = [
+ ":custjs_assets",
+ ":custjs_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "CustJsApiTest"
+}
+ohos_js_assets("resmgrjs_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("resmgrjs_resources") {
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/global/cust/custjs/Test.json b/global/cust/custjs/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..044ce3c1aea45b019dfdf19b154ac6a361265b18
--- /dev/null
+++ b/global/cust/custjs/Test.json
@@ -0,0 +1,26 @@
+{
+ "description": "Configuration for cust js api Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "300000",
+ "package": "ohos.cust.test",
+ "shell-timeout": "60000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "CustJSApiTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ "run-command": [
+ "mkdir -p /system/etc/custxml/",
+ "mkdir -p /sys-prod/etc/custxml/",
+ "touch /system/etc/custxml/system.xml",
+ "touch /system/etc/custxml/both.xml",
+ "touch /sys-prod/etc/custxml/both.xml",
+ "touch /sys-prod/etc/custxml/user.xml"
+ ]
+ ]
+}
diff --git a/global/cust/custjs/signature/openharmony_sx.p7b b/global/cust/custjs/signature/openharmony_sx.p7b
new file mode 100755
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/global/cust/custjs/signature/openharmony_sx.p7b differ
diff --git a/global/cust/custjs/src/main/config.json b/global/cust/custjs/src/main/config.json
new file mode 100755
index 0000000000000000000000000000000000000000..aed60bfda82821d52ea1610d74ec5d9efc380e0c
--- /dev/null
+++ b/global/cust/custjs/src/main/config.json
@@ -0,0 +1,60 @@
+{
+ "app": {
+ "bundleName": "ohos.cust.test",
+ "vendor": "acts",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.cust.test",
+ "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.cust.test.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/global/cust/custjs/src/main/js/default/app.js b/global/cust/custjs/src/main/js/default/app.js
new file mode 100755
index 0000000000000000000000000000000000000000..4b7e2fa868aa10aafb75128637ee0c2068e402b6
--- /dev/null
+++ b/global/cust/custjs/src/main/js/default/app.js
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import device from '@system.device';
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
diff --git a/global/cust/custjs/src/main/js/default/i18n/en-US.json b/global/cust/custjs/src/main/js/default/i18n/en-US.json
new file mode 100755
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/global/cust/custjs/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/global/cust/custjs/src/main/js/default/i18n/zh-CN.json b/global/cust/custjs/src/main/js/default/i18n/zh-CN.json
new file mode 100755
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/global/cust/custjs/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/global/cust/custjs/src/main/js/default/pages/index/index.css b/global/cust/custjs/src/main/js/default/pages/index/index.css
new file mode 100755
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/global/cust/custjs/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/global/cust/custjs/src/main/js/default/pages/index/index.hml b/global/cust/custjs/src/main/js/default/pages/index/index.hml
new file mode 100755
index 0000000000000000000000000000000000000000..1c26cf73deab18390844a53a103458b10ed11e93
--- /dev/null
+++ b/global/cust/custjs/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
diff --git a/global/cust/custjs/src/main/js/default/pages/index/index.js b/global/cust/custjs/src/main/js/default/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..1f37bf2ade4a59364f9d93c08fbc62b8b3aa8cb3
--- /dev/null
+++ b/global/cust/custjs/src/main/js/default/pages/index/index.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {Core, ExpectExtend} from 'deccjsunit/index'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ core.addService('expect', expectExtend)
+ core.init()
+
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
diff --git a/global/cust/custjs/src/main/js/default/test/Cust.test.js b/global/cust/custjs/src/main/js/default/test/Cust.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..d949ac49b684041f845ab46f975a51e613cb2a65
--- /dev/null
+++ b/global/cust/custjs/src/main/js/default/test/Cust.test.js
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import cust from '@ohos.cust'
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
+
+describe('CustTest', function () {
+ console.log('CustTest**************************start');
+
+ /* *
+ * @tc.number SUB_CUST_JS_0100
+ * @tc.name test getOneCfgFile method in callback mode
+ * @tc.desc get getOneCfgFile in callback mode
+ */
+ it('getOneCfgFile_test_001', 0, async function (done) {
+ cust.getOneCfgFile('custxml/none.xml', (error, value) => {
+ expect(value.length == 0).assertTrue();
+ console.log('CustTest getOneCfgFile_test_001, none.xml:' + value);
+ });
+ cust.getOneCfgFile('custxml/system.xml', (error, value) => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getOneCfgFile_test_001, system.xml:' + value);
+ });
+ cust.getOneCfgFile('custxml/both.xml', (error, value) => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getOneCfgFile_test_001, both.xml:' + value);
+ });
+ cust.getOneCfgFile('custxml/user.xml', (error, value) => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getOneCfgFile_test_001, user.xml:' + value);
+ });
+ done();
+ })
+
+ /* *
+ * @tc.number SUB_CUST_JS_0200
+ * @tc.name test getOneCfgFile method in promise mode
+ * @tc.desc get getOneCfgFile in promise mode
+ */
+ it('getOneCfgFile_test_002', 0, async function (done) {
+ cust.getOneCfgFile('custxml/none.xml').then(value => {
+ expect(value.length == 0).assertTrue();
+ console.log('CustTest getOneCfgFile_test_002, none.xml:' + value);
+ });
+ cust.getOneCfgFile('custxml/system.xml').then(value => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getOneCfgFile_test_002, system.xml:' + value);
+ });
+ cust.getOneCfgFile('custxml/both.xml').then(value => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getOneCfgFile_test_002, both.xml:' + value);
+ });
+ cust.getOneCfgFile('custxml/user.xml').then(value => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getOneCfgFile_test_002, user.xml:' + value);
+ });
+ done();
+ })
+
+ /* *
+ * @tc.number SUB_CUST_JS_0300
+ * @tc.name test getCfgFiles method in callback mode
+ * @tc.desc get getCfgFiles in callback mode
+ */
+ it('getCfgFiles_test_003', 0, async function (done) {
+ cust.getCfgFiles('custxml/none.xml', (error, value) => {
+ expect(value.length == 0).assertTrue();
+ console.log('CustTest getCfgFiles_test_003, none.xml:' + value);
+ });
+ cust.getCfgFiles('custxml/system.xml', (error, value) => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getCfgFiles_test_003, system.xml:' + value);
+ });
+ cust.getCfgFiles('custxml/both.xml', (error, value) => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getCfgFiles_test_003, both.xml:' + value);
+ });
+ cust.getCfgFiles('custxml/user.xml', (error, value) => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getCfgFiles_test_003, user.xml:' + value);
+ });
+ done();
+ })
+
+ /* *
+ * @tc.number SUB_CUST_JS_0400
+ * @tc.name test getCfgFiles method in promise mode
+ * @tc.desc get getCfgFiles in promise mode
+ */
+ it('getCfgFiles_test_004', 0, async function (done) {
+ cust.getCfgFiles('custxml/none.xml').then(value => {
+ expect(value.length == 0).assertTrue();
+ console.log('CustTest getCfgFiles_test_004, none.xml:' + value);
+ });
+ cust.getCfgFiles('custxml/system.xml').then(value => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getCfgFiles_test_004, system.xml:' + value);
+ });
+ cust.getCfgFiles('custxml/both.xml').then(value => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getCfgFiles_test_004, both.xml:' + value);
+ });
+ cust.getCfgFiles('custxml/user.xml').then(value => {
+ expect(value.length != 0).assertTrue();
+ console.log('CustTest getCfgFiles_test_004, user.xml:' + value);
+ });
+ done();
+ })
+
+ /* *
+ * @tc.number SUB_CUST_JS_0500
+ * @tc.name test getCfgDirList method in callback mode
+ * @tc.desc get getCfgDirList in callback mode
+ */
+ it('getCfgDirList_test_005', 0, async function (done) {
+ cust.getCfgDirList((error, value) => {
+ expect(value.length != 0).assertTrue();
+ console.log('getCfgDirList_test_005:' + value);
+ });
+ done();
+ })
+
+ /* *
+ * @tc.number SUB_CUST_JS_060
+ * @tc.name test getCfgDirList method in promise mode
+ * @tc.desc get getCfgDirList in promise mode
+ */
+ it('getCfgDirList_test_006', 0, async function (done) {
+ cust.getCfgDirList().then(value => {
+ expect(value.length != 0).assertTrue();
+ console.log('getCfgDirList_test_006:' + value);
+ });
+ done();
+ })
+
+ console.log('CustTest**************************end');
+})
\ No newline at end of file
diff --git a/global/cust/custjs/src/main/js/default/test/List.test.js b/global/cust/custjs/src/main/js/default/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..bd52eb2d1bff0a0afbeec61d887a5644ce521378
--- /dev/null
+++ b/global/cust/custjs/src/main/js/default/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+require('./Resmgr.test.js')
diff --git a/global/cust/custjs/src/main/resources/base/element/string.json b/global/cust/custjs/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..37ae8fcb0f7a8563639d358b127dfdbaa6b3a750
--- /dev/null
+++ b/global/cust/custjs/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsTimeTest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/global/cust/custjs/src/main/resources/base/media/icon.png b/global/cust/custjs/src/main/resources/base/media/icon.png
new file mode 100755
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/global/cust/custjs/src/main/resources/base/media/icon.png differ