diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000000000000000000000000000000000..51c63e295e0232f7095a8ee8e03713837e37f419
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,15 @@
+*.tgz filter=lfs diff=lfs merge=lfs -text
+*.trp filter=lfs diff=lfs merge=lfs -text
+*.apk filter=lfs diff=lfs merge=lfs -text
+*.jar filter=lfs diff=lfs merge=lfs -text
+*.mp4 filter=lfs diff=lfs merge=lfs -text
+*.zip filter=lfs diff=lfs merge=lfs -text
+*.asm filter=lfs diff=lfs merge=lfs -text
+*.8svn filter=lfs diff=lfs merge=lfs -text
+*.9svn filter=lfs diff=lfs merge=lfs -text
+*.dylib filter=lfs diff=lfs merge=lfs -text
+*.exe filter=lfs diff=lfs merge=lfs -text
+*.a filter=lfs diff=lfs merge=lfs -text
+*.so filter=lfs diff=lfs merge=lfs -text
+*.bin filter=lfs diff=lfs merge=lfs -text
+*.dll filter=lfs diff=lfs merge=lfs -text
diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md
deleted file mode 100644
index 651e02cef6e623d3385eb4c83d633d73e141cd56..0000000000000000000000000000000000000000
--- a/.gitee/ISSUE_TEMPLATE.zh-CN.md
+++ /dev/null
@@ -1,11 +0,0 @@
-### 该问题是怎么引起的?
-
-
-
-### 重现步骤
-
-
-
-### 报错信息
-
-
diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
deleted file mode 100644
index 1bc27ea0be1312649d1f111e10285f25428ac588..0000000000000000000000000000000000000000
--- a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
+++ /dev/null
@@ -1,13 +0,0 @@
-### 相关的Issue
-
-
-
-### 原因(目的、解决的问题等)
-
-
-### 描述(做了什么,变更了什么)
-
-
-### 测试用例(新增、改动、可能影响的功能)
-
-
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..613cfdfcbbf6176b1bbad8a2ed894309dc2b2ee1
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,30 @@
+# 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("//hit/build/suite.gni")
+import("test_packages.gni")
+ohos_test_suite("acts") {
+ deps = selected_packages
+}
+
+ohos_test_suite("acts_ivi") {
+ deps = selected_packages_ivi
+}
+
+ohos_test_suite("acts_intellitv") {
+ deps = selected_packages_intellitv
+}
+
+ohos_test_suite("acts_wearable") {
+ deps = selected_packages_wearable
+}
diff --git a/LICENSE b/LICENSE
old mode 100755
new mode 100644
diff --git a/OAT.xml b/OAT.xml
new file mode 100755
index 0000000000000000000000000000000000000000..4387f302cb9c119d9e379acad94f513067c2f6f5
--- /dev/null
+++ b/OAT.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
index fc736368afba5c8b58d98e76ca3836c01d1a6593..24396f880e05a6ed78dfcb41c8a78660ad469317 100755
--- a/README.md
+++ b/README.md
@@ -1,17 +1,18 @@
-# X Test Suite
+# XTS
- [Introduction](#section465982318513)
-- [Devices](#section125090457443)
+- [System Types](#section125090457443)
- [Directory Structure](#section161941989596)
- [Constraints](#section119744591305)
- [Usage Guidelines](#section137768191623)
- [Test Case Development Guidelines](#section3695134065513)
- - [C-based Test Case Development and Compilation \(for Mini-System Devices\)](#section1551164914237)
- - [C-based Test Case Execution \(for Mini-System Devices\)](#section10100701294)
- - [C++-based Test Case Development and Compilation \(for Small-, Standard-, and Large-System Devices\)](#section5714177113113)
- - [C++-based Test Case Execution \(for Small-, Standard-, and Large-System Devices\)](#section42281924184)
+ - [C-based Test Case Development and Compilation \(for the Mini System\)](#section198193336544)
+ - [C-based Test Case Execution \(for the Mini System\)](#section13820233175418)
+ - [C++-based Test Case Development and Compilation \(for Standard and Small Systems\)](#section3822123311540)
+ - [C++-based Test Case Execution \(for Standard and Small Systems\)](#section128222336544)
+ - [JavaScript-based Test Case Development \(for the Standard System\)](#section159801435165220)
+ - [JavaScript-based Test Case Packaging \(for the Standard System\)](#section445519106559)
-- [Repositories Involved](#section1371113476307)
## Introduction
@@ -22,26 +23,21 @@ This subsystem contains the ACTS and **tools** software package.
- The **acts** directory stores the source code and configuration files of ACTS test cases. The ACTS helps device vendors detect the software incompatibility as early as possible and ensures that the software is compatible to OpenHarmony during the entire development process.
- The **tools** software package stores the test case development framework related to **acts**.
-## Devices
+## System Types
-OpenHarmony supports the following device types:
+OpenHarmony supports the following system types:
-- **Mini-System Devices \(reference memory ≥ 128 KB\)**
+- Mini system
- Such devices are equipped with MCU processors such as ARM Cortex-M and 32-bit RISC-V. They provide rich short-distance connection and peripheral bus access capabilities. Typical products include LinkIoT module devices and sensors in the smart home field. The LinkIoT module is usually used for smart Internet of Things \(IoT\) devices as the hardware module that implements connectivity functions. In the smart home field, the LinkIoT module is integrated into devices by vendors. For example, a LinkIoT module provides WLAN/Bluetooth access and data connection, and it usually communicates with the chip of smart home devices via a universal asynchronous receiver-transmitter \(UART\) or general-purpose input/output \(GPIO\) interface.
+ A mini system runs on the devices whose memory is greater than or equal to 128 KiB and that are equipped with MCU processors such as ARM Cortex-M and 32-bit RISC-V. This system provides multiple lightweight network protocols and graphics frameworks, and a wide range of read/write components for the IoT bus. Typical products include connection modules, sensors, and wearables for smart home.
-- **Small-System Devices \(reference memory ≥ 1 MB\)**
+- Small system
- Such devices are equipped with application processors such as ARM Cortex-A. They provide higher security capabilities, standard graphics framework, and multimedia capabilities for video encoding and decoding. Typical products include IP cameras, electronic cat eyes, and routers in the smart home field, as well as event data recorders \(EDRs\) in the smart travel field.
+ A small system runs on the devices whose memory is greater than or equal to 1 MiB and that are equipped with application processors such as ARM Cortex-A. This system provides higher security capabilities, standard graphics frameworks, and video encoding and decoding capabilities. Typical products include smart home IP cameras, electronic cat eyes, and routers, and event data recorders \(EDRs\) for smart travel.
+- Standard system
-- **Standard-System Devices \(reference memory ≥ 128 MB\)**
-
- Such devices are equipped with application processors such as ARM Cortex-A. They provide a complete application framework supporting enhanced interaction, 3D GPU, hardware composer, diverse components, and rich animations. Typical products include high-end refrigerator displays.
-
-- **Large-System Devices \(reference memory ≥ 1 GB\)**
-
- Such devices are equipped with application processors such as ARM Cortex-A and provide a complete compatible application framework. Typical products include smart TVs and smart watches.
+ A standard system runs on the devices whose memory is greater than or equal to 128 MiB and that are equipped with application processors such as ARM Cortex-A. This system provides a complete application framework supporting the enhanced interaction, 3D GPU, hardware composer, diverse components, and rich animations. This system applies to high-end refrigerator displays.
## Directory Structure
@@ -49,17 +45,17 @@ OpenHarmony supports the following device types:
```
/test/xts
├── acts # Test code
-│ └── subsystem # Source code of subsystem test cases for large-system devices
-│ └── subsystem_lite # Source code of subsystems test cases for mini- and small-system devices
-│ └── BUILD.gn # Build configuration of test cases for large-system devices
-│ └── build_lite # Build configuration of test cases for mini-and small-system devices
-│ └── build_lite # Build configuration
+│ └── subsystem # Source code of subsystem test cases for the standard system
+│ └── subsystem_lite # Source code of subsystems test cases for mini and small systems
+│ └── BUILD.gn # Build configuration of test cases for the standard system
+│ └── build_lite
+│ └── BUILD.gn # Build configuration of test cases for mini and small systems
└── tools # Test tool code
```
## Constraints
-Test cases for mini system devices must be developed based on C, and those for small system devices must be developed based on C++.
+Test cases for the mini system must be developed based on C, and those for the small system must be developed based on C++.
## Usage Guidelines
@@ -216,12 +212,12 @@ Test cases for mini system devices must be developed based on C, and those for s
## Test Case Development Guidelines
-You should select the appropriate programming language and your target test framework to develop test cases for the devices to test.
+You should select the appropriate programming language and your target test framework to develop test cases.
-**Table 4** Test frameworks and test case languages for different devices
+**Table 4** Test frameworks and test case languages for different systems
-
Device Type
+
System
Test Framework
@@ -229,40 +225,33 @@ You should select the appropriate programming language and your target test fram
-
Mini-system devices
+
Mini
HCTest
C
-
Small-system devices
+
Small
HCPPTest
C++
-
Standard-system devices
-
-
HJUnit and HCPPTest
-
-
Java and C++
-
-
-
Large-system devices
+
Standard
-
HJUnit and HCPPTest
+
HJSUnit and HCPPTest
-
Java and C++
+
JavaScript and C++
-### C-based Test Case Development and Compilation \(for Mini-System Devices\)
+### C-based Test Case Development and Compilation \(for the Mini System\)
-**Developing test cases for mini-system devices**
+**Developing test cases for the mini system**
The HCTest framework is used to support test cases developed with the C language. HCTest is enhanced and adapted based on the open-source test framework Unity.
@@ -323,7 +312,7 @@ The HCTest framework is used to support test cases developed with the C language
3. Create the configuration file \(**BUILD.gn**\) of the test module.
- Create a **BUILD.gn** \(example\) compilation file in each test module directory. Specify the name of the compiled static library and its dependent header file and library in the compilation file. The format is as follows:
+ Create a **BUILD.gn** \(example\) build file in each test module directory. Specify the name of the built static library and its dependent header file and library in the build file. The format is as follows:
```
import("//test/xts/tools/lite/build/suite_lite.gni")
@@ -337,7 +326,7 @@ The HCTest framework is used to support test cases developed with the C language
}
```
-4. Add compilation options to the **BUILD.gn** file in the **acts** directory.
+4. Add build options to the **BUILD.gn** file in the **acts** directory.
You need to add the test module to the **test/xts/acts/build\_lite/BUILD.gn** script in the **acts** directory.
@@ -353,17 +342,17 @@ The HCTest framework is used to support test cases developed with the C language
}
```
-5. Run compilation commands.
+5. Run build commands.
- Test suites are compiled along with version compilation. The ACTS is compiled together with the debug version.
+ Test suites are built along with version build. The ACTS is built together with the debug version.
>![](public_sys-resources/icon-note.gif) **NOTE:**
- >The ACTS compiles middleware as a static library, which will be linked to the image.
+ >The ACTS build middleware is a static library, which will be linked to the image.
-### C-based Test Case Execution \(for Mini-System Devices\)
+### C-based Test Case Execution \(for the Mini System\)
-**Executing test cases for mini-system devices**
+**Executing test cases for the mini system**
Burn the image into the development board.
@@ -378,9 +367,9 @@ View the serial port logs, whose format is as follows:
The log for each test suite starts with **Start to run test suite:** and ends with **xx Tests xx Failures xx Ignored**.
-### C++-based Test Case Development and Compilation \(for Small-, Standard-, and Large-System Devices\)
+### C++-based Test Case Development and Compilation \(for Standard and Small Systems\)
-**Developing test cases for small-system devices**
+**Developing test cases for small-system devices** \(For examples of the standard system, go to the **global/i18n\_standard directory**.\)
The HCPPTest framework is enhanced and adapted based on the open-source framework Googletest.
@@ -446,7 +435,7 @@ The HCPPTest framework is enhanced and adapted based on the open-source framewor
3. Create a configuration file \(**BUILD.gn**\) of the test module.
- Create a **BUILD.gn** compilation file in each test module directory. Specify the name of the compiled static library and its dependent header file and library in the compilation file. Each test module is independently compiled into a **.bin** executable file, which can be directly mounted to the development board for testing.
+ Create a **BUILD.gn** build file in each test module directory. Specify the name of the built static library and its dependent header file and library in the build file. Each test module is independently built into a **.bin** executable file, which can be directly pushed to the development board for testing.
Example:
@@ -467,10 +456,9 @@ The HCPPTest framework is enhanced and adapted based on the open-source framewor
]
cflags = [ "-Wno-error" ]
}
-
```
-4. Add compilation options to the **BUILD.gn** file in the **acts** directory.
+4. Add build options to the **BUILD.gn** file in the **acts** directory.
Add the test module to the **test/xts/acts/build\_lite/BUILD.gn** script in the **acts** directory.
@@ -486,17 +474,17 @@ The HCPPTest framework is enhanced and adapted based on the open-source framewor
}
```
-5. Run compilation commands.
+5. Run build commands.
- Test suites are compiled along with the version compilation. The ACTS is compiled together with the debug version.
+ Test suites are built along with the version build. The ACTS is built together with the debug version.
>![](public_sys-resources/icon-note.gif) **NOTE:**
- >The ACTS for a small system device is independently compiled to an executable file \(.bin\) and archived in the **suites\\acts** directory of the compilation result.
+ >The ACTS for the small system is independently built to an executable file \(.bin\) and archived in the **suites\\acts** directory of the build result.
-### C++-based Test Case Execution \(for Small-, Standard-, and Large-System Devices\)
+### C++-based Test Case Execution \(for Standard and Small Systems\)
-**Executing test cases for small-system devices**
+**Executing test cases for the small system**
Currently, test cases are shared by the NFS and mounted to the development board for execution.
@@ -520,11 +508,141 @@ Currently, test cases are shared by the NFS and mounted to the development board
Execute **ActsDemoTest.bin** to trigger test case execution, and analyze serial port logs generated after the execution is complete.
-## Repositories Involved
+### JavaScript-based Test Case Development \(for the Standard System\)
+
+The HJSUnit framework is used to support automated test of OpenHarmony apps that are developed using the JavaScript language based on the JS application framework.
+
+**Basic syntax of test cases**
+
+The test cases are developed with the JavaScript language and must meet the programming specifications of the language.
+
+**Table 5**
+
+
+
Syntax
+
+
Description
+
+
Mandatory
+
+
+
+
beforeAll
+
+
Presets a test-suite-level action executed only once before all test cases are executed. You can pass the action function as the only parameter.
+
+
No
+
+
+
afterAll
+
+
Presets a test-suite-level clear action executed only once after all test cases are executed. You can pass the clear function as the only parameter.
+
+
No
+
+
+
beforeEach
+
+
Presets a test-case-level action executed before each test case is executed. The number of execution times is the same as the number of test cases defined by it. You can pass the action function as the only parameter.
+
+
No
+
+
+
afterEach
+
+
Presets a test-case-level clear action executed after each test case is executed. The number of execution times is the same as the number of test cases defined by it. You can pass the clear function as the only parameter.
+
+
No
+
+
+
describe
+
+
Defines a test suite. You can pass two parameters: test suite name and test suite function. The describe statement supports nesting. You can use beforeall, beforeEach, afterEach, and afterAll in each describe statement.
+
+
Yes
+
+
+
it
+
+
Defines a test case. You can pass three parameters: test case name, filter parameter, and test case function.
+
Usage of the filter parameter:
+
The value of the filter parameter is a 32-bit integer. Setting different bits to 1 means different configurations:
+
bit 0: whether the filter parameter takes effect. 1 means that the test case is used for the function test and other settings of the parameter do not take effect.
Bits 0-10: test case categories
Bits 16-18: test case scales
Bits 24-28: test levels
+
Test case categories: Bits 0-10 indicate FUNCTION (function test), PERFORMANCE (performance test), POWER (power consumption test), RELIABILITY (reliability test), SECURITY (security compliance test), GLOBAL (integrity test), COMPATIBILITY (compatibility test), USER (user test), STANDARD (standard test), SAFETY (security feature test), and RESILIENCE (resilience test), respectively.
+
Test case scales: Bits 16-18 indicate SMALL (small-scale test), MEDIUM (medium-scale test), and LARGE (large-scale test), respectively.
+
+用例编写语法采用 jasmine 的标准语法,格式支持ES6格式。
+
+1. 规范用例目录:测试用例存储到entry/src/main/js/test目录。
+
+ ```
+ ├── BUILD.gn
+ │ └──entry
+ │ │ └──src
+ │ │ │ └──main
+ │ │ │ │ └──js
+ │ │ │ │ │ └──default
+ │ │ │ │ │ │ └──pages
+ │ │ │ │ │ │ │ └──index
+ │ │ │ │ │ │ │ │ └──index.js # 入口文件
+ │ │ │ │ │ └──test # 测试代码存放目录
+ │ │ │ └── resources # hap资源存放目录
+ │ │ │ └── config.json # hap配置文件
+ ```
+
+2. index.js示例
+
+ ```
+ // 拉起js测试框架,加载测试用例
+ 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() {
+ },
+ }
+ ```
+
+3. 单元测试用例示例
+
+ ```
+ // Example1: 使用HJSUnit进行单元测试
+ describe('appInfoTest', function () {
+ it('app_info_test_001', 0, function () {
+ var info = app.getInfo()
+ expect(info.versionName).assertEqual('1.0')
+ expect(info.versionCode).assertEqual('3')
+ })
+ })
+ ```
+
+
+### JS语言用例编译打包指导(适用于标准系统)
+
+hap包编译请参考[标准系统js应用开发指导](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/build_overview-0000001055075201)。
+
## 相关仓
-[XTS认证子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/XTS%E8%AE%A4%E8%AF%81%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
-**xts\_acts**
+xts\_acts
-[xts\_tools](https://gitee.com/openharmony/xts_tools/blob/master/README_zh.md)
+xts\_tools
diff --git a/account/BUILD.gn b/account/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..23bee6b47551d95607f8428cf58020cd1ee3aa8f
--- /dev/null
+++ b/account/BUILD.gn
@@ -0,0 +1,25 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build/ohos_var.gni")
+group("account") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "OsAccountTest_js:osaccount_js_test" ]
+ } else {
+ deps = [
+ "appaccount:appaccount_hap",
+ "osaccount:osaccount_hap",
+ ]
+ }
+}
diff --git a/account/OsAccountTest_js/BUILD.gn b/account/OsAccountTest_js/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..e045b62eef6ecae760d97a4cde4e49f2205b00f8
--- /dev/null
+++ b/account/OsAccountTest_js/BUILD.gn
@@ -0,0 +1,18 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("osaccount_js_test") {
+ test_hap_name = "OsAccountJSApiTest"
+ hap_source_path = "hap/entry-debug-rich-signed.hap"
+}
diff --git a/account/OsAccountTest_js/Test.json b/account/OsAccountTest_js/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..f34a05a88235c780b01a7c110b543f5fb6ec6ab3
--- /dev/null
+++ b/account/OsAccountTest_js/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for osaccount js api Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "21600000",
+ "package": "ohos.acts.account.osaccount",
+ "shell-timeout": "21600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "OsAccountJSApiTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/account/OsAccountTest_js/hap/entry-debug-rich-signed.hap b/account/OsAccountTest_js/hap/entry-debug-rich-signed.hap
new file mode 100644
index 0000000000000000000000000000000000000000..5944fc0318c01de810ee28c9b2797994dc9e683b
Binary files /dev/null and b/account/OsAccountTest_js/hap/entry-debug-rich-signed.hap differ
diff --git a/account/OsAccountTest_js/project/entry/package.json b/account/OsAccountTest_js/project/entry/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f
--- /dev/null
+++ b/account/OsAccountTest_js/project/entry/package.json
@@ -0,0 +1 @@
+{}
diff --git a/account/OsAccountTest_js/project/entry/src/main/config.json b/account/OsAccountTest_js/project/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..544f61fa18ec370f21f7ba274c6a77f72f4b7968
--- /dev/null
+++ b/account/OsAccountTest_js/project/entry/src/main/config.json
@@ -0,0 +1,59 @@
+{
+ "app": {
+ "bundleName": "ohos.acts.account.osaccount",
+ "vendor": "acts",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.account.osaccount",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "ohos.acts.account.osaccount.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/account/OsAccountTest_js/project/entry/src/main/js/default/app.js b/account/OsAccountTest_js/project/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..363f2555b1badec9fec342a93141db084083fcb8
--- /dev/null
+++ b/account/OsAccountTest_js/project/entry/src/main/js/default/app.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/account/OsAccountTest_js/project/entry/src/main/js/default/i18n/en-US.json b/account/OsAccountTest_js/project/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/account/OsAccountTest_js/project/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/account/OsAccountTest_js/project/entry/src/main/js/default/i18n/zh-CN.json b/account/OsAccountTest_js/project/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/account/OsAccountTest_js/project/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/account/OsAccountTest_js/project/entry/src/main/js/default/pages/index/index.css b/account/OsAccountTest_js/project/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/account/OsAccountTest_js/project/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/account/OsAccountTest_js/project/entry/src/main/js/default/pages/index/index.hml b/account/OsAccountTest_js/project/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/account/OsAccountTest_js/project/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/account/OsAccountTest_js/project/entry/src/main/js/default/pages/index/index.js b/account/OsAccountTest_js/project/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..6367b2fd449b83b5baa752177423dfceeb494451
--- /dev/null
+++ b/account/OsAccountTest_js/project/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import file from '@system.file'
+import app from '@system.app'
+
+//import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
+import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ const reportExtend = new ReportExtend(file)
+ // const instrumentLog = new InstrumentLog({
+ // 'id': 'report'
+ // })
+ core.addService('expect', expectExtend)
+ core.addService('report', reportExtend)
+ // core.addService('report', instrumentLog)
+ core.init()
+ // core.subscribeEvent('spec', instrumentLog)
+ // core.subscribeEvent('suite', instrumentLog)
+ // core.subscribeEvent('task', instrumentLog)
+
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
diff --git a/account/OsAccountTest_js/project/entry/src/main/js/test/List.test.js b/account/OsAccountTest_js/project/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..facd38d5b5e9961a17599ef0c071af933f7a7d2a
--- /dev/null
+++ b/account/OsAccountTest_js/project/entry/src/main/js/test/List.test.js
@@ -0,0 +1,16 @@
+/*
+ * 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('./OsAccount.test.js')
\ No newline at end of file
diff --git a/account/OsAccountTest_js/project/entry/src/main/js/test/OsAccount.test.js b/account/OsAccountTest_js/project/entry/src/main/js/test/OsAccount.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f71892a63a3c5ddac150dacf060abc98b2f790b1
--- /dev/null
+++ b/account/OsAccountTest_js/project/entry/src/main/js/test/OsAccount.test.js
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+
+// @ts-nocheck
+import {describe, beforeEach, afterEach, it, expect} from 'deccjsunit/index'
+import account from '@ohos.account.distributedAccount'
+
+describe('AccountTest', function () {
+ beforeEach(function () {
+ })
+ afterEach(function () {
+ })
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0100
+ * @tc.name Test distributedAccount.getDistributedAccountAbility.
+ * @tc.desc Test distributedAccount.getDistributedAccountAbility API functionality.
+ */
+ it('account_getDistributedAccountAbility_test', 0, function () {
+ var ret = false;
+ const accountAbility = account.getDistributedAccountAbility()
+ if(accountAbility !== null){
+ ret = true;
+ }
+ expect(ret).assertTrue()
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0200
+ * @tc.name Test distributedAccount.queryOsAccountDistributedInfo.
+ * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality.
+ */
+ it('account_queryOsAccountDistributedInfo_test001', 0, function () {
+ const accountAbility = account.getDistributedAccountAbility()
+ accountAbility.queryOsAccountDistributedInfo().then(function (data) {
+ expect(data.name).assertEqual('anonymous')
+ });
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0300
+ * @tc.name Test distributedAccount.queryOsAccountDistributedInfo by callback.
+ * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality by callback.
+ */
+ it('account_queryOsAccountDistributedInfo_test002', 0, function () {
+ const accountAbility = account.getDistributedAccountAbility()
+ accountAbility.queryOsAccountDistributedInfo(function (data) {
+ expect(data.name).assertEqual('anonymous')
+ });
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0400
+ * @tc.name Test distributedAccount.updateOsAccountDistributedInfo.
+ * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality.
+ */
+ it('account_updateOsAccountDistributedInfo_test001', 0, function () {
+ const accountAbility = account.getDistributedAccountAbility()
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGIN'
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
+ expect(result).assertTrue()
+ accountAbility.queryOsAccountDistributedInfo(function (data) {
+ expect(data.name).assertEqual('ZhangSan')
+ expect(data.id).assertEqual('12345')
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGOUT'
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
+ expect(result).assertTrue()
+ });
+ });
+ });
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0500
+ * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
+ * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
+ */
+ it('account_updateOsAccountDistributedInfo_test002', 0, function () {
+ const accountAbility = account.getDistributedAccountAbility()
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGIN'
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj, function (result) {
+ expect(result).assertTrue()
+ accountAbility.queryOsAccountDistributedInfo(function (data) {
+ expect(data.name).assertEqual('ZhangSan')
+ expect(data.id).assertEqual('12345')
+ const accountAbility = account.getDistributedAccountAbility()
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGOUT'
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
+ expect(result).assertTrue()
+ });
+ });
+ });
+ })
+})
\ No newline at end of file
diff --git a/account/OsAccountTest_js/project/entry/src/main/resources/base/element/string.json b/account/OsAccountTest_js/project/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..14f9c3a9210f78b12caf3b945dc2b2c0f63f7d3d
--- /dev/null
+++ b/account/OsAccountTest_js/project/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "OsAccountTest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/account/OsAccountTest_js/project/entry/src/main/resources/base/media/icon.png b/account/OsAccountTest_js/project/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/account/OsAccountTest_js/project/entry/src/main/resources/base/media/icon.png differ
diff --git a/ace/BUILD.gn b/ace/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..5ce5e15cdf5eccda3df63ff73b9863921057fd88
--- /dev/null
+++ b/ace/BUILD.gn
@@ -0,0 +1,19 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+group("ace") {
+ testonly = true
+ deps = [
+ "ace_standard:ace_standard_test",
+ ]
+}
diff --git a/ace/ace_standard/BUILD.gn b/ace/ace_standard/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..b6c20096db782c8297a5a9690b39ad34679aa323
--- /dev/null
+++ b/ace/ace_standard/BUILD.gn
@@ -0,0 +1,19 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("ace_standard_test") {
+ test_hap_name = "ace_standard"
+ hap_source_path = "hap/entry-debug-signed.hap"
+}
diff --git a/ace/ace_standard/Test.json b/ace/ace_standard/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..36002412df1dd989929662c4dd2d4ea3d7394591
--- /dev/null
+++ b/ace/ace_standard/Test.json
@@ -0,0 +1,19 @@
+{
+ "description": "Configuration for aceceshi Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "21600000",
+ "package": "com.example.aceceshi",
+ "abilityName": "decc.testkit.runner.JsEntryAbility",
+ "shell-timeout": "21600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ace_standard.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/ace/ace_standard/hap/entry-debug-signed.hap b/ace/ace_standard/hap/entry-debug-signed.hap
new file mode 100755
index 0000000000000000000000000000000000000000..a0e1f9e9e10fcc48d333831e1df7cc44710c594d
Binary files /dev/null and b/ace/ace_standard/hap/entry-debug-signed.hap differ
diff --git a/ace/ace_standard/project/entry/package.json b/ace/ace_standard/project/entry/package.json
new file mode 100755
index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f
--- /dev/null
+++ b/ace/ace_standard/project/entry/package.json
@@ -0,0 +1 @@
+{}
diff --git a/ace/ace_standard/project/entry/src/main/config.json b/ace/ace_standard/project/entry/src/main/config.json
new file mode 100755
index 0000000000000000000000000000000000000000..281225c4e81150847bf524615d37a422dc835241
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/config.json
@@ -0,0 +1,52 @@
+{
+ "app": {
+ "bundleName": "com.example.aceceshi",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 5,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.aceceshi",
+ "name": "testModule",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry_test",
+ "moduleType": "feature"
+ },
+ "abilities": [
+ {
+ "name": "decc.testkit.runner.JsEntryAbility",
+ "description": "Test Entry Ability",
+ "icon": "$media:icon",
+ "label": "TestAbility",
+ "launchType": "standard",
+ "orientation": "landscape",
+ "visible": true,
+ "type": "page"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 750,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_standard/project/entry/src/main/js/default/app.js b/ace/ace_standard/project/entry/src/main/js/default/app.js
new file mode 100755
index 0000000000000000000000000000000000000000..f6cc8926d94f6e4c3803ae8a7be2f5f08c0f78b5
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/js/default/app.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
diff --git a/ace/ace_standard/project/entry/src/main/js/default/i18n/en-US.json b/ace/ace_standard/project/entry/src/main/js/default/i18n/en-US.json
new file mode 100755
index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_standard/project/entry/src/main/js/default/i18n/zh-CN.json b/ace/ace_standard/project/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100755
index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/ace/ace_standard/project/entry/src/main/js/default/pages/index/index.css b/ace/ace_standard/project/entry/src/main/js/default/pages/index/index.css
new file mode 100755
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ace/ace_standard/project/entry/src/main/js/default/pages/index/index.hml b/ace/ace_standard/project/entry/src/main/js/default/pages/index/index.hml
new file mode 100755
index 0000000000000000000000000000000000000000..1c26cf73deab18390844a53a103458b10ed11e93
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
diff --git a/ace/ace_standard/project/entry/src/main/js/default/pages/index/index.js b/ace/ace_standard/project/entry/src/main/js/default/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..23f18c37e90df5adaa14ad210611ea10f8d0121f
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import file from '@system.file'
+import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ const reportExtend = new ReportExtend(file)
+ core.addService('expect', expectExtend)
+ core.addService('report', reportExtend)
+ core.init()
+
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
diff --git a/ace/ace_standard/project/entry/src/main/js/test/List.test.js b/ace/ace_standard/project/entry/src/main/js/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..499e4fa91a9194df2b3cc109df8fa0b4ae340e66
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/js/test/List.test.js
@@ -0,0 +1,16 @@
+/*
+ * 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('./basicabilityapi.test.js')
diff --git a/ace/ace_standard/project/entry/src/main/js/test/basicabilityapi.test.js b/ace/ace_standard/project/entry/src/main/js/test/basicabilityapi.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..61e1acacc8c608b1e91ae9ee165c47c0eee9effa
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/js/test/basicabilityapi.test.js
@@ -0,0 +1,305 @@
+/*
+ * 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 prompt from '@system.prompt';
+import router from '@system.router';
+
+describe('basicabilityapi', function() {
+ let testResult;
+ let testResultFail;
+ let test;
+ beforeAll(function() {
+ testResult = true;
+ testResultFail = false;
+ test="success"
+ });
+ beforeEach(function() {});
+ afterEach(function() {});
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0100
+ * @tc.name testClearInterval
+ * @tc.desc Cancel the repetitive timing tasks previously set by setInterval.
+ */
+ it('testClearInterval', 0, function() {
+ console.info('testClearInterval START');
+ let intervalID = setInterval(function() {
+ console.info('TEST do very 1s.');
+ }, 1000);
+ clearInterval(intervalID);
+ expect(test).assertEqual('success');
+ console.info('[clearInterval] success');
+ console.info('testClearInterval END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0200
+ * @tc.name testConsole
+ * @tc.desc Print a text message.
+ */
+ it('testConsole', 0, function() {
+ console.info('testConsole START');
+ const versionCode = 1.1;
+ console.info('[console.info] versionCode: ' + versionCode);
+ console.debug('[console.debug] versionCode: ' + versionCode);
+ console.log('[console.log] versionCode: ' + versionCode);
+ console.warn('[console.warn] versionCode: ' + versionCode);
+ console.error('[console.error] versionCode: ' + versionCode);
+ expect(test).assertEqual('success');
+ console.info('testConsole END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0300
+ * @tc.name testRouterPush
+ * @tc.desc Go to the specified page of the application.
+ */
+ it('testRouterPush', 0, function() {
+ router.push({
+ uri:'pages/routePush/index',
+ params: {
+ myData:'this is params data'
+ }
+ });
+ setTimeout(() => {
+ let pages = router.getState();
+ console.info("[router.clear] getState"+JSON.stringify(pages));
+ }, 500);
+ expect(test).assertEqual('success');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0400
+ * @tc.name testRouterReplace
+ * @tc.desc Replace the current page with a page in the application, and destroy the replaced page.
+ */
+ it('testRouterReplace', 0, function() {
+ console.info('testRouterReplace START');
+ router.replace({
+ uri: 'pages/routerReplace/index',
+ params: {
+ data1: 'message',
+ }
+ });
+ expect(test).assertEqual('success');
+ console.info("[router.replace] success");
+ console.info('testRouterReplace END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0500
+ * @tc.name testRouterBack
+ * @tc.desc Return to the previous page or the specified page.
+ */
+ it('testRouterBack', 0, function() {
+ console.info('testRouterBack START');
+ router.push({
+ uri: 'pages/detail/detail'
+ });
+ router.back({
+ path: 'pages/mediaquery/mediaquery'
+ });
+ expect(test).assertEqual('success');
+ console.info('[router.back] success');
+ console.info('testRouterBack END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0600
+ * @tc.name testRouterClear
+ * @tc.desc Clear all historical pages in the page stack, and only keep the current page as the top page.
+ */
+ it('testRouterClear', 0, function() {
+ console.info('testRouterClear START');
+ new Promise(function(resolve, reject) {
+ router.push({
+ uri:'pages/routePush/index',
+ params:{
+ myData:'message'
+ }
+ });
+ setTimeout(()=>{
+ console.info("[router.clear] getLength: " + router.getLength());
+ }, 2000);
+ resolve();
+ }).then(function() {
+ expect(testResult).toBeTrue();
+ }, function() {
+ console.log('[router.clear] fail');
+ expect(testResultFail).toBeTrue();
+ });
+ console.info('testRouterClear END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0700
+ * @tc.name testRouterLength
+ * @tc.desc Get the number of pages currently in the page stack.
+ */
+ it('testRouterLength', 0, function() {
+ router.push({
+ uri: 'pages/dialog/dialog',
+ params: {
+ data1: 'message',
+ data2: {
+ data3: [123, 456, 789],
+ data4: {
+ data5: 'message'
+ }
+ }
+ }
+ });
+ console.info('testRouterLength START');
+ let size = router.getLength();
+ console.info('[router.getLength] pages stack size = ' + size);
+ expect(size).assertEqual('1');
+ console.info('testRouterLength END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0800
+ * @tc.name testRouterGetState
+ * @tc.desc Get the status information of the current page.
+ */
+ it('testRouterGetState', 0, function() {
+ console.info('testRouterGetState START');
+ let page = router.getState();
+ console.info('[router.getState] index: ' + page.index);
+ console.info('[router.getState] name: ' + page.name);
+ console.info('[router.getState] path: ' + page.path);
+ expect(page.index).assertEqual('1');
+ expect(page.name).assertEqual('index');
+ expect(page.path).assertEqual('pages/index/');
+ console.info('testRouterGetState END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0900
+ * @tc.name testPromptShowToast
+ * @tc.desc Show text pop-up window.
+ */
+ it('testPromptShowToast', 0, function() {
+ console.info('testPromptShowToast START');
+ const delay = 5000;
+ prompt.showToast({
+ message:'message',
+ duration:delay,
+ });
+ expect(test).assertEqual('success');
+ console.info('[prompt.showToast] success');
+ console.info('testPromptShowToast END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1000
+ * @tc.name testPromptDialog
+ * @tc.desc Display the dialog box in the page.
+ */
+ it('testPromptDialog', 0, function() {
+ console.info('testPromptDialog START')
+ prompt.showDialog({
+ title: 'dialog showDialog test',
+ message: 'message of dialog',
+ buttons: [
+ {
+ text: 'OK',
+ color: '#0000ff',
+ index: 0
+ }
+ ],
+ success: function(ret) {
+ console.info("[prompt.showDialog] ret.index " + ret.index);
+ expect(testResult).toBeTrue();
+ },
+ cancel: function() {
+ console.log('[prompt.showDialog] dialog cancel callback');
+ expect(testResultFail).toBeTrue();
+ },
+ complete: function() {
+ console.log('[prompt.showDialog] complete');
+ }
+ });
+ console.info('testPromptDialog END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1100
+ * @tc.name testConfigurationGetLocale
+ * @tc.desc Get the current language and region of the app. Synchronize with the language and region.
+ */
+ it('testConfigurationGetLocale', 0, function() {
+ console.info('testConfigurationGetLocale START');
+ const localeInfo = configuration.getLocale();
+ console.info("[configuration.getLocale] language: " + localeInfo.language);
+ console.info("[configuration.getLocale] countryOrRegion: " + localeInfo.countryOrRegion);
+ console.info("[configuration.getLocale] dir: " + localeInfo.dir);
+ expect(localeInfo.language).assertEqual('zh');
+ expect(localeInfo.countryOrRegion).assertEqual('CN');
+ expect(localeInfo.dir).assertEqual('ltr');
+ console.info('testConfigurationGetLocale END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1200
+ * @tc.name testSetTimeout
+ * @tc.desc Set up a timer that executes a function or a specified piece of code after the timer expires.
+ */
+ it('testSetTimeout', 0, function() {
+ console.info('testSetTimeout START');
+ let start_time = new Date().getTime();
+ const delay = 200;
+ console.info("[settimeout] start_time: " + start_time);
+ setTimeout(function(v1,v2) {
+ let end_time = new Date().getTime();
+ console.info('[settimeout] delay: ' + (end_time - start_time) / 1000);
+ console.info('[settimeout] v1: ' + v1);
+ console.info('[settimeout] v2: ' + v2);
+ expect(testResult).toBeTrue();
+ }, delay, 'test', 'message');
+ console.info('testSetTimeout END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1300
+ * @tc.name testClearTimeout
+ * @tc.desc The timer previously established by calling setTimeout() is cancelled.
+ */
+ it('testClearTimeout', 0, function() {
+ console.info('testClearTimeout START');
+ let timeoutID = setTimeout(function() {
+ console.info('delay 1s');
+ }, 1000);
+ clearTimeout(timeoutID);
+ expect(test).assertEqual('success');
+ console.info("[clearTimeout] success");
+ console.info('testClearTimeout END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1400
+ * @tc.name testSetInterval
+ * @tc.desc Call a function or execute a code segment repeatedly, with a fixed time delay between each call.
+ */
+ it('testSetInterval', 0, function() {
+ console.info('testSetInterval START');
+ let intervalID = setInterval(function() {
+ console.log('do very 1s.');
+ expect(testResult).toBeTrue();
+ }, 1000);
+ console.info("[setInterval] intervalID: " + intervalID);
+ console.info('testSetInterval END');
+ });
+});
\ No newline at end of file
diff --git a/ace/ace_standard/project/entry/src/main/resources/base/element/plural.json b/ace/ace_standard/project/entry/src/main/resources/base/element/plural.json
new file mode 100755
index 0000000000000000000000000000000000000000..5df662491e2cba0cc4ca28cb1547351bea8a78f3
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/resources/base/element/plural.json
@@ -0,0 +1,33 @@
+{
+ "plural":[
+ {
+ "name":"plural_name",
+ "value":[
+ {
+ "quantity":"zero",
+ "value":"%d test zero"
+ },
+ {
+ "quantity":"one",
+ "value":"%d test one"
+ },
+ {
+ "quantity":"two",
+ "value":"%d test two"
+ },
+ {
+ "quantity":"few",
+ "value":"%d test few"
+ },
+ {
+ "quantity":"many",
+ "value":"%d test many"
+ },
+ {
+ "quantity":"other",
+ "value":"%d test other"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ace/ace_standard/project/entry/src/main/resources/base/element/strarray.json b/ace/ace_standard/project/entry/src/main/resources/base/element/strarray.json
new file mode 100755
index 0000000000000000000000000000000000000000..31980e251c888917c7cbccbcdfcb900f376f4557
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/resources/base/element/strarray.json
@@ -0,0 +1,21 @@
+{
+ "strarray": [
+ {
+ "name": "sizeList",
+ "value":[
+ {
+ "value":"small"
+ },
+ {
+ "value":"middle"
+ },
+ {
+ "value":"large"
+ },
+ {
+ "value":"extra large"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ace/ace_standard/project/entry/src/main/resources/base/element/string.json b/ace/ace_standard/project/entry/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..2ccebf86f7d0de51b30e05d4c53ea5f660a7b3eb
--- /dev/null
+++ b/ace/ace_standard/project/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "aceceshi"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ }
+ ]
+}
diff --git a/ace/ace_standard/project/entry/src/main/resources/base/media/icon.png b/ace/ace_standard/project/entry/src/main/resources/base/media/icon.png
new file mode 100755
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/ace/ace_standard/project/entry/src/main/resources/base/media/icon.png differ
diff --git a/appexecfwk/BUILD.gn b/appexecfwk/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..d539267c7edac2fa9014c721f64f5421cf3bb2c3
--- /dev/null
+++ b/appexecfwk/BUILD.gn
@@ -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.
+import("//build/ohos_var.gni")
+
+group("appexecfwk") {
+ testonly = true
+ if (is_standard_system) {
+ } else {
+ deps = [
+ ]
+ }
+}
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000000000000000000000000000000000000..532ef03f0a21bfa3590457665a66c72ffe0d51bb
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,120 @@
+#!/bin/bash
+
+# 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.
+
+set -e
+
+usage()
+{
+ echo
+ echo "USAGE"
+ echo " ./build.sh [suite=BUILD_TARGET] [target_os=TARGET_OS] [target_arch=TARGET_ARCH] [variant=BUILD_VARIANT] [target_subsystem=TARGET_SUBSYSTEM]"
+ echo " target_platform : TARGET_PLATFORM the target platform, such as phone or ivi; Default to phone"
+ echo " suite : BUILD_TARGET cts/hit/vts and so on, default value is hit"
+ echo " target_arch : TARGET_ARCH arm64 or arm32, default value is arm64"
+ echo " variant : BUILD_VARIANT release or debug, default value is debug"
+ echo " target_subsystem : TARGET_SUBSYSTEM the target subsystem to build"
+ echo " system_size : SYSTEM_SIZE standard, large and son on, large is for L3-L5, standard is for L2 default value is large"
+ echo " product_name : PRODUCT_NAME the name of product. such as hikey960, Hi3516DV300, and so on."
+ echo
+ exit 1
+}
+
+
+parse_cmdline()
+{
+ BASE_HOME=$(dirname $(cd $(dirname $0); pwd))
+ BASE_HOME=${BASE_HOME}/../..
+ BUILD_TOOLS_DIR=${BASE_HOME}/prebuilts/build-tools/linux-x86/bin
+ OUT_DIR=${BASE_HOME}/out
+ BUILD_SHELL=${BASE_HOME}/build.sh
+ # build all parts for all products by default
+ BUILD_TARGET=""
+ TARGET_PLATFORM=all
+ GN_ARGS="is_dbt_test=true include_all=false"
+ TARGET_ARCH=arm64
+ BUILD_VARIANT=release
+ UPLOAD_API_INFO=False
+ SYSTEM_SIZE=large
+ PRODUCT_NAME=""
+ export PATH=${BASE_HOME}/prebuilts/python/linux-x86/3.8.3/bin:$PATH
+
+ while [ -n "$1" ]
+ do
+ var="$1"
+ OPTIONS=${var%%=*}
+ PARAM=${var#*=}
+ echo "OPTIONS=$OPTIONS"
+ echo "PARAM=$PARAM"
+ echo "-------------------"
+ case "$OPTIONS" in
+ suite) BUILD_TARGET="$PARAM"
+ ;;
+ target_arch) TARGET_ARCH="$PARAM"
+ ;;
+ variant) BUILD_VARIANT="$PARAM"
+ ;;
+ target_platform) TARGET_PLATFORM="$PARAM"
+ ;;
+ target_subsystem) export target_subsystem=${PARAM}
+ ;;
+ system_size) SYSTEM_SIZE="$PARAM"
+ ;;
+ product_name) PRODUCT_NAME="$PARAM"
+ ;;
+ upload_api_info) UPLOAD_API_INFO=$(echo $PARAM |tr [a-z] [A-Z])
+ ;;
+ *) usage
+ break;;
+ esac
+ shift
+ done
+ if [ "$SYSTEM_SIZE" = "standard" ]; then
+ BUILD_TARGET=${BUILD_TARGET:-"acts"}
+ PRODUCT_NAME=${PRODUCT_NAME:-"Hi3516DV300"}
+ else
+ BUILD_TARGET=${BUILD_TARGET:-"acts acts_ivi acts_intellitv acts_wearable"}
+ PRODUCT_NAME=${PRODUCT_NAME:-"arm64"}
+ fi
+}
+
+
+do_make()
+{
+ cd $BASE_HOME
+ ACTS_ROOT="$BASE_HOME/test/xts/acts"
+
+ rm -rf "$BASE_HOME/test/xts/autogen_apiobjs"
+ export XTS_SUITENAME=acts
+ if [ "$SYSTEM_SIZE" = "standard" ]; then
+ ./build.sh --product-name $PRODUCT_NAME --gn-args build_xts=true --build-target $BUILD_TARGET --build-target "deploy_testtools" --gn-args is_standard_system=true
+ else
+ if [ "$BUILD_TARGET" = "acts acts_ivi acts_intellitv acts_wearable" ]; then
+ ./build.sh --product-name $PRODUCT_NAME --gn-args build_xts=true --build-target "acts" --build-target "acts_ivi" --build-target "acts_intellitv" --build-target "acts_wearable" --build-target "deploy_testtools"
+ else
+ ./build.sh --product-name $PRODUCT_NAME --gn-args build_xts=true --build-target $BUILD_TARGET --build-target "deploy_testtools"
+ fi
+ fi
+ ret=$?
+
+ rm -rf "$BASE_HOME/test/xts/autogen_apiobjs"
+ if [ "$ret" != 0 ]; then
+ echo "build error"
+ exit 1
+ fi
+}
+
+parse_cmdline $@
+do_make
+exit 0
diff --git a/demo/BUILD.gn b/demo/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..4493027cbea35f0a9b759ed927fbdd95b92f181a
--- /dev/null
+++ b/demo/BUILD.gn
@@ -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.
+
+import("//build/ohos_var.gni")
+
+group("demo") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [
+ "hjsunit_sample:hjs_demo_test",
+ ]
+ }
+}
diff --git a/demo/hjsunit_sample/BUILD.gn b/demo/hjsunit_sample/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..bb33162e7aa049ed07d0868135b095526ff7287a
--- /dev/null
+++ b/demo/hjsunit_sample/BUILD.gn
@@ -0,0 +1,18 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("hjs_demo_test") {
+ test_hap_name = "Hjsdemotest"
+ hap_source_path = "hap/entry-debug-signed.hap"
+}
diff --git a/demo/hjsunit_sample/Test.json b/demo/hjsunit_sample/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..ca085c99dec389ed19e3ed75b928bc8bc53453b9
--- /dev/null
+++ b/demo/hjsunit_sample/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "21600000",
+ "package": "com.example.myapplication",
+ "shell-timeout": "21600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "Hjsdemotest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/demo/hjsunit_sample/entry/package.json b/demo/hjsunit_sample/entry/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f
--- /dev/null
+++ b/demo/hjsunit_sample/entry/package.json
@@ -0,0 +1 @@
+{}
diff --git a/demo/hjsunit_sample/entry/src/main/config.json b/demo/hjsunit_sample/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..69e91f6f3c092c58389896b409b26353ccf442f1
--- /dev/null
+++ b/demo/hjsunit_sample/entry/src/main/config.json
@@ -0,0 +1,59 @@
+{
+ "app": {
+ "bundleName": "com.example.myapplication",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 4
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.myapplication",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.example.myapplication.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "MyApplication",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
diff --git a/demo/hjsunit_sample/entry/src/main/js/default/app.js b/demo/hjsunit_sample/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..f796f6a0d8dde8b67d055b283776f27d4d06ac0f
--- /dev/null
+++ b/demo/hjsunit_sample/entry/src/main/js/default/app.js
@@ -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 device from '@system.device';
+
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/demo/hjsunit_sample/entry/src/main/js/default/i18n/en-US.json b/demo/hjsunit_sample/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/demo/hjsunit_sample/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/demo/hjsunit_sample/entry/src/main/js/default/i18n/zh-CN.json b/demo/hjsunit_sample/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/demo/hjsunit_sample/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/demo/hjsunit_sample/entry/src/main/js/default/pages/index/index.js b/demo/hjsunit_sample/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..bd751ec7dbbccdac420ee21d0b1b314c836db673
--- /dev/null
+++ b/demo/hjsunit_sample/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import file from '@system.file'
+import app from '@system.app'
+
+//import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
+import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ const reportExtend = new ReportExtend(file)
+// const instrumentLog = new InstrumentLog({
+// 'id': 'report'
+// })
+ core.addService('expect', expectExtend)
+ core.addService('report', reportExtend)
+// core.addService('report', instrumentLog)
+ core.init()
+// core.subscribeEvent('spec', instrumentLog)
+// core.subscribeEvent('suite', instrumentLog)
+// core.subscribeEvent('task', instrumentLog)
+
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
diff --git a/demo/hjsunit_sample/entry/src/main/js/test/ExampleJsunit.test.js b/demo/hjsunit_sample/entry/src/main/js/test/ExampleJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..4fdf2a890581dfe125e8e196149f44118ae94134
--- /dev/null
+++ b/demo/hjsunit_sample/entry/src/main/js/test/ExampleJsunit.test.js
@@ -0,0 +1,54 @@
+/*
+ * 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 app from '@system.app'
+import Context from '@ohos.napi_context'
+
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
+
+describe('appInfoTest', function () {
+ console.log("*************00000000000000000000000*************");
+ it('app_info_test_001', 0, function () {
+ var info = app.getInfo()
+ expect(info.versionName).assertEqual('1.0')
+ expect(info.versionCode).assertEqual('3')
+ })
+ it('app_info_test_002', 0, function () {
+ var info = app.getInfo()
+ expect(info.versionName).assertEqual('1.0')
+ expect(info.versionCode).assertEqual('2')
+ expect(info).assertNull()
+ })
+ it('app_info_test_003', 0, function () {
+ var info = app.getInfo()
+ expect(info.versionName).assertEqual('1.0')
+ expect(info.versionCode).assertEqual('4')
+ })
+ it('app_info_test_004', 0, function () {
+ var info = app.getInfo()
+ expect(info.versionName).assertEqual('1.0')
+ expect(info.versionCode).assertEqual('5')
+ })
+ it('get_process_info_test_001', 0, async function (done) {
+ console.log("111")
+ expect(1).assertLarger(0)
+ Context.getProcessInfo().then(info => {
+ console.log("222");
+ console.log("process_info: " + JSON.stringify(info));
+ expect(info.processName.length).assertLarger(0);
+ expect(info.pid).assertLarger(0);
+ });
+ done()
+ })
+})
diff --git a/demo/hjsunit_sample/entry/src/main/js/test/List.test.js b/demo/hjsunit_sample/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..62e348cb74788587609d9100918745cc71635dc2
--- /dev/null
+++ b/demo/hjsunit_sample/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('./ExampleJsunit.test.js')
diff --git a/demo/hjsunit_sample/hap/entry-debug-signed.hap b/demo/hjsunit_sample/hap/entry-debug-signed.hap
new file mode 100644
index 0000000000000000000000000000000000000000..76b7653122e4d2e26c18bffa99b0a360c8aeda4d
Binary files /dev/null and b/demo/hjsunit_sample/hap/entry-debug-signed.hap differ
diff --git a/developtools/BUILD.gn b/developtools/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..f36cf6c3e3b0a5c37c94a7fe5f978e7f91661bd3
--- /dev/null
+++ b/developtools/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")
+
+import("//build/ohos_var.gni")
+group("developtoolstestacts") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "hiplugintest:hipluginmoduleapitest" ]
+ }
+}
diff --git a/developtools/hiplugintest/BUILD.gn b/developtools/hiplugintest/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..dad1adf39035b2f8c43cad26ed584cd356569f70
--- /dev/null
+++ b/developtools/hiplugintest/BUILD.gn
@@ -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("//build/test.gni")
+import("//test/xts/tools/build/suite.gni")
+import("../../../../../developtools/profiler/device/base/config.gni")
+
+###############################################################################
+config("module_private_config") {
+ visibility = [":*"]
+}
+
+ohos_moduletest_suite("hipluginmoduleapitest") {
+ deps = [
+ "//third_party/googletest:gtest",
+ "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_data_cpp",
+ "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin:memdataplugin",
+ ]
+ include_dirs = [
+ "${OHOS_PROFILER_DIR}/interfaces/kits/",
+ "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin/include",
+ "${OHOS_PROFILER_DIR}/device/plugins/api/include",
+ "${OHOS_PROFILER_DIR}/device/plugins/api/src",
+ "${OHOS_PROFILER_DIR}/device/base/include/",
+ "//third_party/googletest/googletest/include/gtest",
+ ]
+ sources = [
+ "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin/test/unittest/buffer_splitter_unittest.cpp",
+ "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin/test/unittest/memory_data_plugin_unittest.cpp",
+ "hipluginmoduleapitest.cpp",
+ ]
+ cflags = [
+ "-pthread",
+ "-Wno-inconsistent-missing-override",
+ "-Dprivate=public", #allow test code access private members
+ ]
+ external_deps = [
+ "hiviewdfx_hilog_native:libhilog",
+ ]
+ subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
+ defines = [ "HAVE_HILOG", ]
+}
diff --git a/developtools/hiplugintest/Test.json b/developtools/hiplugintest/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..50103b74ca31244829daa0f8435dbfad3a5a05ca
--- /dev/null
+++ b/developtools/hiplugintest/Test.json
@@ -0,0 +1,21 @@
+{
+ "kits": [
+ {
+ "push": [
+ "hipluginmoduleapitest->/data/local/tmp/hipluginmoduleapitest"
+ ],
+ "type": "PushKit",
+ "post-push": [
+ "chmod -R 777 /data/local/tmp/*"
+ ]
+ }
+ ],
+ "driver": {
+ "native-test-timeout": "120000",
+ "type": "CppTest",
+ "module-name": "hipluginmoduleapitest",
+ "runtime-hint": "1s",
+ "native-test-device-path": "/data/local/tmp"
+ },
+ "description": "Configuration for hipluginmoduleapitest Tests"
+}
diff --git a/developtools/hiplugintest/hipluginmoduleapitest.cpp b/developtools/hiplugintest/hipluginmoduleapitest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..456c6f4c665c591c547db433a565d16397a216a4
--- /dev/null
+++ b/developtools/hiplugintest/hipluginmoduleapitest.cpp
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "logging.h"
+#include "memory_plugin_config.pb.h"
+#include "memory_plugin_result.pb.h"
+#include "plugin_module_api.h"
+
+using namespace testing::ext;
+
+#if defined(__i386__) || defined(__x86_64__)
+const std::string LIB_PATH = const_cast("./hos/out/hos-arm/clang_x64/devtools/devtools/libmemdataplugin.z.so");
+#else
+const std::string LIB_PATH = const_cast("/system/lib/libmemdataplugin.z.so");
+#endif
+
+namespace {
+enum NumType {
+ BIT_WIDTH = 35,
+ MS_S = 1000000,
+};
+
+class PluginModuleApiTest : public ::testing::Test {
+protected:
+ static void SetUpTestCase() {}
+ static void TearDownTestCase() {}
+
+ void SetUp() override {}
+ void TearDown() override {}
+
+ bool MatchTail(const std::string& name, const char* str)
+ {
+ int index = name.size() - strlen(str);
+ if (index < 0) {
+ return false;
+ }
+ return strncmp(name.c_str() + index, str, strlen(str)) == 0;
+ }
+
+ bool MemoryPluginTest(MemoryConfig& protoConfig, const std::string libPath)
+ {
+ MemoryData memoryData;
+ PluginModuleStruct* memplugin;
+ void* handle;
+ int cnt = 1;
+ uint8_t* dataBuffer;
+ clock_t clockstart, clockend;
+ struct timeval start, end;
+ int timeuse;
+
+ if (!MatchTail(libPath, ".so")) {
+ printf("libPath=%s\r\n", libPath.c_str());
+ return false;
+ }
+
+ handle = dlopen(libPath.c_str(), RTLD_LAZY);
+ if (handle == nullptr) {
+ HILOG_DEBUG(LOG_CORE, "test:dlopen err:%s.", dlerror());
+ return false;
+ }
+
+ memplugin = (PluginModuleStruct*)dlsym(handle, "g_pluginModule");
+ dataBuffer = (uint8_t*)malloc(memplugin->resultBufferSizeHint);
+
+ int configlength = protoConfig.ByteSizeLong();
+ std::vector config(configlength);
+ protoConfig.SerializeToArray(config.data(), config.size());
+
+ if (memplugin->callbacks->onPluginSessionStart(config.data(), config.size()) < 0) {
+ HILOG_DEBUG(LOG_CORE, "start failed");
+ dlclose(handle);
+ free(dataBuffer);
+ return false;
+ }
+
+ clockstart = clock();
+ gettimeofday(&start, nullptr);
+
+ while (cnt--) {
+ int len = memplugin->callbacks->onPluginReportResult(dataBuffer, memplugin->resultBufferSizeHint);
+ if (len > 0) {
+ memoryData.ParseFromArray(dataBuffer, len);
+ }
+ }
+
+ gettimeofday(&end, nullptr);
+ clockend = clock();
+ timeuse = MS_S * (end.tv_sec - start.tv_sec) + end.tv_usec - start.tv_usec;
+ HILOG_DEBUG(LOG_CORE, "clock time=%.3fs, timeofday=%.3fs", (double)(clockend - clockstart) / CLOCKS_PER_SEC,
+ (double)timeuse / MS_S);
+
+ memplugin->callbacks->onPluginSessionStop();
+
+ memplugin->callbacks->onRegisterWriterStruct(nullptr);
+
+ dlclose(handle);
+ free(dataBuffer);
+ return true;
+ }
+};
+
+HWTEST_F(PluginModuleApiTest, ProtoConfigNullAndInvalidSo, TestSize.Level1)
+{
+ MemoryConfig protoConfig;
+ EXPECT_FALSE(PluginModuleApiTest::MemoryPluginTest(protoConfig, "1111"));
+}
+
+HWTEST_F(PluginModuleApiTest, ProtoConfigNullAndEffectiveSo, TestSize.Level1)
+{
+ MemoryConfig protoConfig;
+ EXPECT_TRUE(PluginModuleApiTest::MemoryPluginTest(protoConfig, LIB_PATH));
+}
+
+HWTEST_F(PluginModuleApiTest, ProtoConfigMemAndInvalidSo, TestSize.Level1)
+{
+ MemoryConfig protoConfig;
+ protoConfig.set_report_process_mem_info(true);
+ EXPECT_FALSE(PluginModuleApiTest::MemoryPluginTest(protoConfig, "1111"));
+}
+
+HWTEST_F(PluginModuleApiTest, ProtoConfigMemAndEffectiveSo, TestSize.Level1)
+{
+ MemoryConfig protoConfig;
+ protoConfig.set_report_process_mem_info(true);
+ EXPECT_TRUE(PluginModuleApiTest::MemoryPluginTest(protoConfig, LIB_PATH));
+}
+
+HWTEST_F(PluginModuleApiTest, ProtoConfigPidAndInvalidSo, TestSize.Level1)
+{
+ MemoryConfig protoConfig;
+ protoConfig.set_report_app_mem_info(true);
+ protoConfig.add_pid(1);
+ EXPECT_FALSE(PluginModuleApiTest::MemoryPluginTest(protoConfig, "1111"));
+}
+
+HWTEST_F(PluginModuleApiTest, ProtoConfigPidAndEffectiveSo, TestSize.Level1)
+{
+ MemoryConfig protoConfig;
+ protoConfig.set_report_app_mem_info(true);
+ protoConfig.add_pid(1);
+ EXPECT_TRUE(PluginModuleApiTest::MemoryPluginTest(protoConfig, LIB_PATH));
+}
+
+HWTEST_F(PluginModuleApiTest, MemoryPluginTreeAndInvalidSo, TestSize.Level1)
+{
+ MemoryConfig protoConfig;
+ protoConfig.set_report_process_tree(true);
+ EXPECT_FALSE(PluginModuleApiTest::MemoryPluginTest(protoConfig, "1111"));
+}
+
+HWTEST_F(PluginModuleApiTest, MemoryPluginTreeAndEffectiveSo, TestSize.Level1)
+{
+ MemoryConfig protoConfig;
+ protoConfig.set_report_process_tree(true);
+ EXPECT_TRUE(PluginModuleApiTest::MemoryPluginTest(protoConfig, LIB_PATH));
+}
+
+HWTEST_F(PluginModuleApiTest, ApiCallInvalidSoAndInvalidStruct, TestSize.Level1)
+{
+ PluginModuleStruct memplugin;
+ ASSERT_EQ(memplugin.callbacks->onPluginSessionStart(nullptr, 0), 0);
+ ASSERT_EQ(memplugin.callbacks->onPluginReportResult(nullptr, 0), 0);
+ ASSERT_EQ(memplugin.callbacks->onPluginSessionStop(), 0);
+ ASSERT_EQ(memplugin.callbacks->onRegisterWriterStruct(nullptr), 0);
+}
+
+HWTEST_F(PluginModuleApiTest, ApiCallEffectiveSoAndInvalidStruct, TestSize.Level1)
+{
+ PluginModuleStruct* memplugin;
+ void* handle = dlopen(LIB_PATH.c_str(), RTLD_LAZY);
+ if (handle == nullptr) {
+ HILOG_DEBUG(LOG_CORE, "test:dlopen err:%s.", dlerror());
+ }
+ memplugin = (PluginModuleStruct*)dlsym(handle, "g_pluginModule");
+ ASSERT_EQ(memplugin->callbacks->onPluginSessionStart(nullptr, 0), 0);
+ ASSERT_EQ(memplugin->callbacks->onPluginReportResult(nullptr, 0), 0);
+ ASSERT_EQ(memplugin->callbacks->onPluginSessionStop(), 0);
+ ASSERT_EQ(memplugin->callbacks->onRegisterWriterStruct(nullptr), 0);
+}
+
+HWTEST_F(PluginModuleApiTest, ApiCallInvalidSoAndEffectiveStruct, TestSize.Level1)
+{
+ PluginModuleStruct memplugin;
+ WriterStruct writer;
+
+ ASSERT_EQ(memplugin.callbacks->onPluginSessionStart(nullptr, 0), 0);
+ ASSERT_EQ(memplugin.callbacks->onPluginSessionStop(), 0);
+ ASSERT_EQ(memplugin.callbacks->onRegisterWriterStruct(&writer), 0);
+}
+
+HWTEST_F(PluginModuleApiTest, ApiCallEffectiveSoAndEffectiveStruct, TestSize.Level1)
+{
+ PluginModuleStruct* memplugin;
+ WriterStruct writer;
+
+ void* handle = dlopen(LIB_PATH.c_str(), RTLD_LAZY);
+ if (handle == nullptr) {
+ HILOG_DEBUG(LOG_CORE, "test:dlopen err:%s.", dlerror());
+ }
+ memplugin = (PluginModuleStruct*)dlsym(handle, "g_pluginModule");
+ ASSERT_EQ(memplugin->callbacks->onPluginSessionStart(nullptr, 0), 0);
+ ASSERT_EQ(memplugin->callbacks->onPluginSessionStop(), 0);
+ ASSERT_EQ(memplugin->callbacks->onRegisterWriterStruct(&writer), 0);
+}
+} // namespace
+
diff --git a/distributeddatamgr/BUILD.gn b/distributeddatamgr/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..5abec885da6193710bd8701c74197b4c4198cf49
--- /dev/null
+++ b/distributeddatamgr/BUILD.gn
@@ -0,0 +1,30 @@
+# 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("distributeddatamgr") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [
+ "appdatamgrjstest/hap:appdatamgr_js_test",
+ "distributedfilejstest:distributedfile_js_test",
+ ]
+ } else {
+ deps = [
+ "appdatamgrtest/hap:appdatamgrfunctest_hap",
+ "distributeddatamgrtest/hap:distributeddatamgrfunctest_hap",
+ "distributedfiletest/hap:distributedfilefunctest_hap",
+ "searchtest/hap:searchfunctest_hap",
+ ]
+ }
+}
diff --git a/distributeddatamgr/appdatamgrjstest/hap/BUILD.gn b/distributeddatamgr/appdatamgrjstest/hap/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..ef77ddc63956d89f311783ea7082ea3daca6a8b9
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/BUILD.gn
@@ -0,0 +1,18 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("appdatamgr_js_test") {
+ test_hap_name = "AppdatamagrJsTest"
+ hap_source_path = "entry-test-signed.hap"
+}
diff --git a/distributeddatamgr/appdatamgrjstest/hap/Test.json b/distributeddatamgr/appdatamgrjstest/hap/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..a941b615b43a204c20648f9e541f344920338f28
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/Test.json
@@ -0,0 +1,19 @@
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "21600000",
+ "package": "com.example.myapplication",
+ "abilityName": "decc.testkit.runner.JsEntryAbility",
+ "shell-timeout": "21600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "AppdatamagrJsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry-test-signed.hap b/distributeddatamgr/appdatamgrjstest/hap/entry-test-signed.hap
new file mode 100755
index 0000000000000000000000000000000000000000..72bb89d604e8363299b174d76c13bcf95729871a
Binary files /dev/null and b/distributeddatamgr/appdatamgrjstest/hap/entry-test-signed.hap differ
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/package.json b/distributeddatamgr/appdatamgrjstest/hap/entry/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..0967ef424bce6791893e9a57bb952f80fd536e93
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/package.json
@@ -0,0 +1 @@
+{}
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/config.json b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/config.json
new file mode 100755
index 0000000000000000000000000000000000000000..d09b7942e10bd4dac3281d51c3151137e62bad19
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/config.json
@@ -0,0 +1,59 @@
+{
+ "app": {
+ "bundleName": "com.example.myapplication",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 4
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.myapplication",
+ "name": ".AppdatamgrJSTest",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "decc.testkit.runner.JsEntryAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "AppdatamgrJSTest",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/app.js b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/app.js
new file mode 100755
index 0000000000000000000000000000000000000000..6a06f7f6cad18519bf28b42a2a171b69d2140f32
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/app.js
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2021 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/i18n/en-US.json b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/i18n/zh-CN.json b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/pages/index/index.css b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/pages/index/index.css
new file mode 100755
index 0000000000000000000000000000000000000000..e19021816bc61bc4cb5128677386b9789132e270
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/pages/index/index.css
@@ -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.
+*/
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/pages/index/index.hml b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..1c26cf73deab18390844a53a103458b10ed11e93
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/pages/index/index.js b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..35ad585911527a3de6225937406f75a6aaa19cde
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2021 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import file from '@system.file'
+
+import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ const reportExtend = new ReportExtend(file)
+
+ core.addService('expect', expectExtend)
+ core.addService('report', reportExtend)
+ core.init()
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/List.test.js b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..7cc4d7759c6510e9967e4cc3612856b5b29e19bb
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/List.test.js
@@ -0,0 +1,18 @@
+/*
+* Copyright (c) 2021 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+require('./StorageHelperJsunit.test.js')
+require('./StorageSyncJsunit.test.js')
+require('./StoragePromiseJsunit.test.js')
+require('./StorageCallBackJsunit.test.js')
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageCallBackJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageCallBackJsunit.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..d5fcad6fb73a34550d725da712b3cae864992c32
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageCallBackJsunit.test.js
@@ -0,0 +1,212 @@
+/*
+* 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 storage from '@ohos.data.storage'
+
+const PATH = '/data/test_storage';
+const KEY_TEST_INT_ELEMENT = 'key_test_int';
+const KEY_TEST_LONG_ELEMENT = 'key_test_long';
+const KEY_TEST_FLOAT_ELEMENT = 'key_test_float';
+const KEY_TEST_BOOLEAN_ELEMENT = 'key_test_boolean';
+const KEY_TEST_STRING_ELEMENT = 'key_test_string';
+var mPref;
+
+describe('storageTest', function () {
+ beforeAll(function () {
+ console.info('beforeAll')
+ mPref = storage.getStorageSync(PATH);
+ })
+
+ afterAll(function () {
+ console.info('afterAll')
+ storage.deleteStorageSync(PATH);
+ })
+
+ /**
+ * @tc.name clear callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0010
+ * @tc.desc clear callback interface test
+ */
+ it('testClear0012', 0, async function (done) {
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
+ mPref.flushSync();
+ await mPref.clear(function (err, ret) {
+ expect("defaultvalue").assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ });
+ done();
+ })
+
+ /**
+ * @tc.name has callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0020
+ * @tc.desc has callback interface test
+ */
+ it('testHasKey0032', 0, async function (done) {
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
+ await mPref.has(KEY_TEST_STRING_ELEMENT, function (err, ret) {
+ expect(true).assertEqual(ret);
+ })
+ done();
+ })
+
+ /**
+ * @tc.name get defaultValue callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0030
+ * @tc.desc get defaultValue callback interface test
+ */
+ it('testGetDefValue0062', 0, async function (done) {
+ mPref.clearSync();
+ await mPref.get(KEY_TEST_STRING_ELEMENT, "defaultValue", function (err, ret) {
+ expect('defaultValue').assertEqual(ret);
+ })
+ done();
+ })
+
+ /**
+ * @tc.name get float callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0040
+ * @tc.desc get float callback interface test
+ */
+ it('testGetFloat0072', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_FLOAT_ELEMENT, 3.0);
+ await mPref.get(KEY_TEST_FLOAT_ELEMENT, 0.0, function (err, ret) {
+ expect(3.0).assertEqual(ret);
+ })
+ done();
+ })
+
+ /**
+ * @tc.name get int callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0050
+ * @tc.desc get int callback interface test
+ */
+ it('testGetInt0082', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_INT_ELEMENT, 3);
+ await mPref.get(KEY_TEST_INT_ELEMENT, 0.0, function (err, ret) {
+ expect(3).assertEqual(ret);
+ })
+ done();
+ })
+
+ /**
+ * @tc.name get long callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0060
+ * @tc.desc get long callback interface test
+ */
+ it('testGetLong0092', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_LONG_ELEMENT, 3);
+ expect(3).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
+ await mPref.get(KEY_TEST_LONG_ELEMENT, 0, function (err, ret) {
+ expect(3).assertEqual(ret);
+ });
+ done();
+ })
+
+ /**
+ * @tc.name get String callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0070
+ * @tc.desc get String callback interface test
+ */
+ it('testGetString102', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
+ mPref.flushSync();
+ await mPref.get(KEY_TEST_STRING_ELEMENT, "defaultvalue", function (err, ret) {
+ expect('test').assertEqual(ret);
+ });
+ done();
+ })
+
+ /**
+ * @tc.name put boolean callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0080
+ * @tc.desc put boolean callback interface test
+ */
+ it('testPutBoolean0122', 0, async function (done) {
+ mPref.clearSync();
+ await mPref.put(KEY_TEST_BOOLEAN_ELEMENT, true, function (err, ret) {
+ expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false));
+ mPref.flushSync();
+ expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false));
+ });
+ done();
+ })
+
+ /**
+ * @tc.name put float callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0090
+ * @tc.desc put float callback interface test
+ */
+ it('testPutFloat0132', 0, async function (done) {
+ mPref.clearSync();
+ await mPref.put(KEY_TEST_FLOAT_ELEMENT, 4.0, function (err, ret) {
+ expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0));
+ mPref.flushSync();
+ expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0));
+ });
+ done();
+ })
+
+ /**
+ * @tc.name put int callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0100
+ * @tc.desc put int callback interface test
+ */
+ it('testPutInt0142', 0, async function (done) {
+ mPref.clearSync();
+ await mPref.put(KEY_TEST_INT_ELEMENT, 4, function (err, ret) {
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0));
+ mPref.flushSync();
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0));
+ });
+ done();
+ })
+
+ /**
+ * @tc.name put long callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0110
+ * @tc.desc put long callback interface test
+ */
+ it('testPutLong0152', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_LONG_ELEMENT, 4);
+ await mPref.put(KEY_TEST_LONG_ELEMENT, 4, function (err, ret) {
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
+ mPref.flushSync();
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
+ });
+ done();
+ })
+
+ /**
+ * @tc.name put String callback interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0120
+ * @tc.desc put String callback interface test
+ */
+ it('testPutString0162', 0, async function (done) {
+ mPref.clearSync();
+ await mPref.put(KEY_TEST_STRING_ELEMENT, "abc", function (err, ret) {
+ mPref.put(KEY_TEST_STRING_ELEMENT, '', function (err, ret) {
+ expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ mPref.flushSync();
+ expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ });
+ });
+ done();
+ })
+})
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageHelperJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageHelperJsunit.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..3585fcd54eb2f4d90cf43e4eac9c2335e6f02788
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageHelperJsunit.test.js
@@ -0,0 +1,127 @@
+/*
+* 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 storage from '@ohos.data.storage'
+
+const PATH = '/data/test_storage';
+var mPref;
+
+describe('storageTest', function () {
+ beforeAll(function () {
+ console.info('beforeAll')
+ mPref = storage.getStorageSync(PATH);
+ })
+
+ afterAll(function () {
+ console.info('afterAll')
+ storage.deleteStorageSync(PATH);
+ })
+
+ /**
+ * @tc.name getStorageSync interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0010
+ * @tc.desc getStorageSync interface test
+ */
+ it('testGetStorageHelper001', 0, function () {
+ mPref = storage.getStorageSync(PATH);
+ mPref.putSync('test', 2);
+ mPref.flushSync();
+ var value = mPref.getSync('test', 0);
+ expect(value).assertEqual(2);
+ })
+
+ /**
+ * @tc.name getStorage interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0020
+ * @tc.desc getStorage interface test
+ */
+ it('testGetStorageHelper002', 0, async function (done) {
+ const promise = storage.getStorage(PATH);
+ promise.then((pref) => {
+ pref.putSync('test', 2);
+ pref.flushSync();
+ var value = mPref.getSync('test', 0);
+ expect(value).assertEqual(2);
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name removeStorageFromCacheSync interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0030
+ * @tc.desc removeStorageFromCacheSync interface test
+ */
+ it('testRemoveStorageFromCache001', 0, function () {
+ let perf = storage.getStorageSync('/data/test_storage1');
+ perf = null;
+ try {
+ storage.removeStorageFromCacheSync('/data/test_storage1');
+ } catch (e) {
+ expect(null).assertFail();
+ }
+ })
+
+ /**
+ * @tc.name removeStorageFromCache interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0040
+ * @tc.desc removeStorageFromCache interface test
+ */
+ it('testRemoveStorageFromCache002', 0, async function (done) {
+ let perf = storage.getStorageSync('/data/test_storage2');
+ perf = null;
+ const promise = storage.removeStorageFromCache('/data/test_storage2');
+ promise.then((pref) => {
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name deleteStorageSync interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0050
+ * @tc.desc deleteStorageSync interface test
+ */
+ it('testDeleteStorageHelper001', 0, function () {
+ let perf = storage.getStorageSync('/data/test_storage3');
+ perf = null;
+ try {
+ storage.deleteStorageSync('/data/test_storage3');
+ } catch (e) {
+ expect(null).assertFail();
+ }
+ })
+
+ /**
+ * @tc.name deleteStorage interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0060
+ * @tc.desc deleteStorage interface test
+ */
+ it('testDeleteStorageHelper002', 0, async function (done) {
+ let perf = storage.getStorageSync('/data/test_storage4');
+ perf = null;
+ const promise = storage.deleteStorage('/data/test_storage4');
+ promise.then((pref) => {
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+})
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StoragePromiseJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StoragePromiseJsunit.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..d7796c2e2d5a1c95ef54e52d2a1af91afb1ed942
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StoragePromiseJsunit.test.js
@@ -0,0 +1,258 @@
+/*
+* 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 storage from '@ohos.data.storage'
+
+const PATH = '/data/test_storage';
+const KEY_TEST_INT_ELEMENT = 'key_test_int';
+const KEY_TEST_LONG_ELEMENT = 'key_test_long';
+const KEY_TEST_FLOAT_ELEMENT = 'key_test_float';
+const KEY_TEST_BOOLEAN_ELEMENT = 'key_test_boolean';
+const KEY_TEST_STRING_ELEMENT = 'key_test_string';
+var mPref;
+
+describe('storageTest', function () {
+ beforeAll(function () {
+ console.info('beforeAll')
+ mPref = storage.getStorageSync(PATH);
+ })
+
+ afterAll(function () {
+ console.info('afterAll')
+ storage.deleteStorageSync(PATH);
+ })
+
+ /**
+ * @tc.name clear promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Promise_0010
+ * @tc.desc clear promise interface test
+ */
+ it('testClear0011', 0, async function (done) {
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
+ mPref.flushSync();
+ const promise = mPref.clear();
+ promise.then((ret) => {
+ expect("defaultvalue").assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name has promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0020
+ * @tc.desc has promise interface test
+ */
+ it('testHasKey0031', 0, async function (done) {
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
+ const promise = mPref.has(KEY_TEST_STRING_ELEMENT);
+ promise.then((ret) => {
+ expect(true).assertEqual(ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name get defalut promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0030
+ * @tc.desc deleteStorage interface test
+ */
+ it('testGetDefValue0061', 0, async function (done) {
+ mPref.clearSync();
+ const promise = mPref.get(KEY_TEST_STRING_ELEMENT, "defaultValue");
+ promise.then((ret) => {
+ expect('defaultValue').assertEqual(ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name get float promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0040
+ * @tc.desc get float promise interface test
+ */
+ it('testGetFloat0071', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_FLOAT_ELEMENT, 3.0);
+ const promise = mPref.get(KEY_TEST_FLOAT_ELEMENT, 0.0);
+ promise.then((ret) => {
+ expect(3.0).assertEqual(ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name get int promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0050
+ * @tc.desc get int promise interface test
+ */
+ it('testGetInt0081', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_INT_ELEMENT, 3);
+ const promise = mPref.get(KEY_TEST_INT_ELEMENT, 0.0);
+ promise.then((ret) => {
+ expect(3).assertEqual(ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name get long promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0060
+ * @tc.desc get long promise interface test
+ */
+ it('testGetLong0091', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_LONG_ELEMENT, 3);
+ const promise = mPref.get(KEY_TEST_LONG_ELEMENT, 0);
+ promise.then((ret) => {
+ expect(3).assertEqual(ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name get String promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0070
+ * @tc.desc get String promise interface test
+ */
+ it('testGetString101', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
+ mPref.flushSync();
+ const promise = mPref.get(KEY_TEST_STRING_ELEMENT, "defaultvalue");
+ promise.then((ret) => {
+ expect('test').assertEqual(ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name get String promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0090
+ * @tc.desc get String promise interface test
+ */
+ it('testPutBoolean0121', 0, async function (done) {
+ mPref.clearSync();
+ const promise = mPref.put(KEY_TEST_BOOLEAN_ELEMENT, true);
+ promise.then((ret) => {
+ expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false));
+ mPref.flushSync();
+ expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false));
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name put float promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0100
+ * @tc.desc put float promise interface test
+ */
+ it('testPutFloat0131', 0, async function (done) {
+ mPref.clearSync();
+ const promise = mPref.put(KEY_TEST_FLOAT_ELEMENT, 4.0);
+ promise.then((ret) => {
+ expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0));
+ mPref.flushSync();
+ expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0));
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name put int promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0110
+ * @tc.desc put int promise interface test
+ */
+ it('testPutInt0141', 0, async function (done) {
+ mPref.clearSync();
+ const promise = mPref.put(KEY_TEST_INT_ELEMENT, 4);
+ promise.then((ret) => {
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0));
+ mPref.flushSync();
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0));
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name put long promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0120
+ * @tc.desc put long promise interface test
+ */
+ it('testPutLong0151', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_LONG_ELEMENT, 4);
+ const promise = mPref.put(KEY_TEST_LONG_ELEMENT, 4);
+ promise.then((ret) => {
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
+ mPref.flushSync();
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+
+ /**
+ * @tc.name put String promise interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0130
+ * @tc.desc put String promise interface test
+ */
+ it('testPutString0161', 0, async function (done) {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "abc");
+ const promise = mPref.put(KEY_TEST_STRING_ELEMENT, '');
+ promise.then((ret) => {
+ expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ mPref.flushSync();
+ expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ }).catch((err) => {
+ expect(null).assertFail();
+ });
+ await promise;
+ done();
+ })
+})
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageSyncJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageSyncJsunit.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..486b00ddc26c3df18df3b4588e149ceac63efd43
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/js/test/StorageSyncJsunit.test.js
@@ -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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
+import storage from '@ohos.data.storage'
+
+const PATH = '/data/test_storage';
+const KEY_TEST_INT_ELEMENT = 'key_test_int';
+const KEY_TEST_LONG_ELEMENT = 'key_test_long';
+const KEY_TEST_FLOAT_ELEMENT = 'key_test_float';
+const KEY_TEST_BOOLEAN_ELEMENT = 'key_test_boolean';
+const KEY_TEST_STRING_ELEMENT = 'key_test_string';
+
+var mPref;
+
+describe('storageTest', function () {
+ beforeAll(function() {
+ console.info('beforeAll')
+ mPref = storage.getStorageSync(PATH);
+ })
+
+ afterAll(function () {
+ console.info('afterAll')
+ storage.deleteStorageSync(PATH);
+ })
+
+ it('testClear001', 0, function () {
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
+ mPref.putSync(KEY_TEST_INT_ELEMENT, 3);
+ mPref.flushSync();
+ mPref.clearSync();
+ expect("defaultvalue").assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ expect(0).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0));
+ })
+
+ /**
+ * @tc.name Constructor test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0010
+ * @tc.desc Constructor test
+ */
+ it('testConstructor002', 0, function () {
+ expect(mPref).assertInstanceOf('Object');
+ })
+
+ /**
+ * @tc.name has sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0020
+ * @tc.desc has sync inteface test
+ */
+ it('testHasKey003', 0, function () {
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
+ expect(true).assertEqual(mPref.hasSync(KEY_TEST_STRING_ELEMENT));
+ })
+
+ /**
+ * @tc.name get boolean sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0030
+ * @tc.desc get boolean sync inteface test
+ */
+ it('testGetBoolean005', 0, function () {
+ mPref.putSync(KEY_TEST_BOOLEAN_ELEMENT, true);
+ expect(true).assertEqual(mPref.hasSync(KEY_TEST_BOOLEAN_ELEMENT));
+ })
+
+ /**
+ * @tc.name get defaltValue sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0040
+ * @tc.desc get defaltValue sync inteface test
+ */
+ it('testGetDefValue006', 0, function () {
+ mPref.clearSync();
+ expect(-1).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, -1));
+ expect(1.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 1.0));
+ expect(10000).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 10000));
+ expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, true));
+ expect('defaultValue').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultValue"));
+ })
+
+ /**
+ * @tc.name get float sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0050
+ * @tc.desc get float sync inteface test
+ */
+ it('testGetFloat007', 0, function () {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_FLOAT_ELEMENT, 3.0);
+ expect(3.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0), 0);
+ expect(0.0).assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, 0.0), 0);
+ })
+
+ /**
+ * @tc.name get int sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0060
+ * @tc.desc get int sync inteface test
+ */
+ it('testGetInt008', 0, function () {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_INT_ELEMENT, 3);
+ expect(3).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0.0), 0);
+ })
+
+ /**
+ * @tc.name get long sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0070
+ * @tc.desc get long sync inteface test
+ */
+ it('testGetLong009', 0, function () {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_LONG_ELEMENT, 3);
+ expect(3).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
+ expect(0).assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, 0));
+ })
+
+ /**
+ * @tc.name get String sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0080
+ * @tc.desc get String sync inteface test
+ */
+ it('testGetString10', 0, function () {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
+ mPref.putSync(KEY_TEST_INT_ELEMENT, 3);
+ mPref.flushSync();
+ expect('test').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ expect('defaultvalue').assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, "defaultvalue"));
+ })
+
+ /**
+ * @tc.name put float sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0090
+ * @tc.desc put float sync inteface test
+ */
+ it('testPutBoolean012', 0, function () {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_BOOLEAN_ELEMENT, true);
+ expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false));
+ mPref.flushSync();
+ expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false));
+ })
+
+ /**
+ * @tc.name put float sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0100
+ * @tc.desc put float sync inteface test
+ */
+ it('testPutFloat013', 0, function () {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_FLOAT_ELEMENT, 4.0);
+ expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0));
+ mPref.flushSync();
+ expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0));
+ })
+
+ /**
+ * @tc.name put int sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0110
+ * @tc.desc put int sync inteface test
+ */
+ it('testPutInt014', 0, function () {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_INT_ELEMENT, 4);
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0));
+ mPref.flushSync();
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0));
+ })
+
+ /**
+ * @tc.name put long sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0120
+ * @tc.desc put long sync inteface test
+ */
+ it('testPutLong015', 0, function () {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_LONG_ELEMENT, 4);
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
+ mPref.flushSync();
+ expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
+ })
+
+ /**
+ * @tc.name put String sync inteface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0130
+ * @tc.desc put String sync inteface test
+ */
+ it('testPutString016', 0, function () {
+ mPref.clearSync();
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "abc");
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, '');
+ expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ mPref.flushSync();
+ expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
+ })
+
+ /**
+ * @tc.name on interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0140
+ * @tc.desc on interface test
+ */
+ it('testRegisterObserver001', 0, function () {
+ mPref.clearSync();
+ var observer = function (key) {
+ expect('abcd').assertEqual(key);
+ };
+ mPref.on('change', observer);
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "abcd");
+ })
+
+ /**
+ * @tc.name repeat on interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0150
+ * @tc.desc repeat on interface test
+ */
+ it('testRegisterObserver002', 0, function () {
+ mPref.clearSync();
+ var observer = function (key) {
+ console.info('testRegisterObserver001 key' + key);
+ expect('abc').assertEqual(key);
+ };
+ mPref.on('change', observer);
+ mPref.on('change', observer);
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "abc");
+ })
+
+ /**
+ * @tc.name off interface test
+ * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0160
+ * @tc.desc off interface test
+ */
+ it('testUnRegisterObserver001', 0, function () {
+ var observer = function (key) {
+ console.info('testUnRegisterObserver001 key' + key);
+ expect('').assertEqual(key);
+ };
+ mPref.on('change', observer);
+ mPref.off('change', observer);
+ mPref.putSync(KEY_TEST_STRING_ELEMENT, "abc");
+ })
+})
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/resources/base/element/string.json b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..4388f588a5a0d0c4870e009ac8757faf51598432
--- /dev/null
+++ b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "MyApplication"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ }
+ ]
+}
diff --git a/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/resources/base/media/icon.png b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/distributeddatamgr/appdatamgrjstest/hap/entry/src/main/resources/base/media/icon.png differ
diff --git a/distributeddatamgr/distributedfilejstest/BUILD.gn b/distributeddatamgr/distributedfilejstest/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..f13847a4a3bf584ba2454a5a0fcb3654559b5aa9
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/BUILD.gn
@@ -0,0 +1,18 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("distributedfile_js_test") {
+ test_hap_name = "DistributedfileJSTest"
+ hap_source_path = "hap/entry-debug-rich-signed.hap"
+}
diff --git a/distributeddatamgr/distributedfilejstest/Test.json b/distributeddatamgr/distributedfilejstest/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..de4c6d3e61b3d856ef5cfd0de5f8c2698e2a93d6
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for distributed file Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "21600000",
+ "package": "ohos.acts.distributeddatamgr.distributedfile",
+ "shell-timeout": "21600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "DistributedfileJSTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/distributeddatamgr/distributedfilejstest/hap/entry-debug-rich-signed.hap b/distributeddatamgr/distributedfilejstest/hap/entry-debug-rich-signed.hap
new file mode 100644
index 0000000000000000000000000000000000000000..6b577198f7e4025425dfa6c7af34434a3956cda2
Binary files /dev/null and b/distributeddatamgr/distributedfilejstest/hap/entry-debug-rich-signed.hap differ
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/package.json b/distributeddatamgr/distributedfilejstest/project/entry/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/package.json
@@ -0,0 +1 @@
+{}
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/config.json b/distributeddatamgr/distributedfilejstest/project/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..21b8cd9b99c2e3997b860c575345162ede8d55be
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/config.json
@@ -0,0 +1,59 @@
+{
+ "app": {
+ "bundleName": "ohos.acts.distributeddatamgr.distributedfile",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 4
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.distributeddatamgr.distributedfile",
+ "name": ".DistributedFileJSTest",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "ohos.acts.distributeddatamgr.distributedfile.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "DistributedFileJSTest",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/app.js b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..2e630f35bd5a9ba035f43c996db3f9a24349448f
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/app.js
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ import device from '@system.device';
+
+export default {
+ onCreate() {
+ console.info('ohos.acts.distributeddatamgr.distributedfile onCreate');
+ },
+ onDestroy() {
+ console.info('ohos.acts.distributeddatamgr.distributedfile onCreate');
+ }
+};
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/i18n/en-US.json b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/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/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/i18n/zh-CN.json b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/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/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/pages/index/index.css b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/pages/index/index.hml b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..1c26cf73deab18390844a53a103458b10ed11e93
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/pages/index/index.js b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..5ccd313b0bbe54a8b8a316fc5509b30a2bbafbd0
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/default/pages/index/index.js
@@ -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 file from '@system.file'
+import app from '@system.app'
+
+import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ const reportExtend = new ReportExtend(file)
+ core.addService('expect', expectExtend)
+ core.addService('report', reportExtend)
+ core.init()
+
+
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
\ No newline at end of file
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/Common.js b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/Common.js
new file mode 100644
index 0000000000000000000000000000000000000000..0da46e3844bcbf5190cdbfcb81b8fe3fafc76437
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/Common.js
@@ -0,0 +1,38 @@
+/*
+ * 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 fileio from '@ohos.fileio'
+
+export const FILE_CONTENT = "hello, world"
+
+export function prepareFile(fpath, content) {
+ try {
+ let fd = fileio.openSync(fpath, 0o102, 0o666)
+ fileio.ftruncateSync(fd)
+ fileio.writeSync(fd, content)
+ fileio.fsyncSync(fd)
+ fileio.closeSync(fd)
+ return true
+ } catch (e) {
+ console.log("Failed to prepareFile for " + e)
+ return false
+ }
+}
+
+var fileSeed = 0
+export function nextFileName(testName) {
+ const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile/cache/"
+ return BASE_PATH + testName + fileSeed++
+}
\ No newline at end of file
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIO.test.js b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIO.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..81c6cd659a51b98db09edf521143d3f270d9b58e
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIO.test.js
@@ -0,0 +1,1000 @@
+/*
+ * 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 fileio from '@ohos.fileio'
+import bundle_mgr from '@ohos.bundle_mgr'
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
+import { FILE_CONTENT, prepareFile, nextFileName } from './Common'
+
+describe('fileIOTest', function () {
+ /**
+ * @tc.number SUB_DF_FileIO_UnlinkSync_0000
+ * @tc.name fileio_test_unlink_sync_000
+ * @tc.desc Test unlinkSync() interface.
+ */
+ it('fileio_test_unlink_sync_000', 0, function () {
+ let fpath = nextFileName('fileIOTest')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_unlink_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_UnlinkSync_0010
+ * @tc.name fileio_test_unlink_sync_001
+ * @tc.desc Test unlinkSync() interface.
+ */
+ it('fileio_test_unlink_sync_001', 0, function () {
+ try {
+ fileio.unlinkSync()
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_UnlinkSync_0020
+ * @tc.name fileio_test_unlink_sync_002
+ * @tc.desc Test unlinkSync() interface.
+ */
+ it('fileio_test_unlink_sync_002', 0, function () {
+ let fpath = nextFileName('fileIOTest')
+
+ try {
+ fileio.unlinkSync(fpath)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_AccessSync_0000
+ * @tc.name fileio_test_access_sync_000
+ * @tc.desc Test accessSync() interface.
+ */
+ it('fileio_test_access_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_access_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ expect(fileio.accessSync(fpath)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_access_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_AccessSync_0010
+ * @tc.name fileio_test_access_sync_001
+ * @tc.desc Test accessSync() interface.
+ */
+ it('fileio_test_access_sync_001', 0, function () {
+ try {
+ fileio.accessSync()
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_AccessSync_0020
+ * @tc.name fileio_test_access_sync_002
+ * @tc.desc Test accessSync() interface.
+ */
+ it('fileio_test_access_sync_002', 0, function () {
+ let fpath = nextFileName('fileIOTest')
+
+ try {
+ fileio.accessSync(fpath)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_OpenCloseSync_0000
+ * @tc.name fileio_test_open_close_sync_000
+ * @tc.desc Test openSync() and closeSync() interfaces.
+ */
+ it('fileio_test_open_close_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_open_close_sync_000')
+
+ try {
+ let fd = fileio.openSync(fpath, 0o102, 0o666)
+ expect(fd).assertInstanceOf('Number')
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_open_close_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_OpenSync_0000
+ * @tc.name fileio_test_open_sync_000
+ * @tc.desc Test openSync() interface.
+ */
+ it('fileio_test_open_sync_000', 0, function () {
+ try {
+ fileio.openSync("/", 0o102, 0o666)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_OpenSync_0010
+ * @tc.name fileio_test_open_sync_001
+ * @tc.desc Test openSync() interface.
+ */
+ it('fileio_test_open_sync_001', 0, function () {
+ let fpath = nextFileName('fileio_test_open_sync_001')
+
+ try {
+ fileio.openSync(fpath, 0o102)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_CloseSync_0000
+ * @tc.name fileio_test_close_sync_000
+ * @tc.desc Test closeSync() interface.
+ */
+ it('fileio_test_close_sync_000', 0, function () {
+ try {
+ fileio.closeSync()
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_CloseSync_0010
+ * @tc.name fileio_test_close_sync_001
+ * @tc.desc Test closeSync() interface.
+ */
+ it('fileio_test_close_sync_001', 0, function () {
+ try {
+ fileio.closeSync(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_WriteSync_0000
+ * @tc.name fileio_test_write_sync_000
+ * @tc.desc Test writeSync() interface.
+ */
+ it('fileio_test_write_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_write_sync_000')
+
+ try {
+ let fd = fileio.openSync(fpath, 0o102, 0o666)
+ expect(fd).assertInstanceOf('Number')
+ expect(fileio.writeSync(fd, FILE_CONTENT)).assertEqual(FILE_CONTENT.length)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_write_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_WriteSync_0010
+ * @tc.name fileio_test_write_sync_001
+ * @tc.desc Test writeSync() interface.
+ */
+ it('fileio_test_write_sync_001', 0, function () {
+ let fpath = nextFileName('fileio_test_write_sync_001')
+
+ try {
+ let fd = fileio.openSync(fpath, 0o102, 0o666)
+ expect(fd).assertInstanceOf('Number')
+ expect(fileio.writeSync(fd, FILE_CONTENT, {
+ encoding: "utf-8",
+ })).assertEqual(FILE_CONTENT.length)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_write_sync_001 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_WriteSync_0020
+ * @tc.name fileio_test_write_sync_002
+ * @tc.desc Test writeSync() interface.
+ */
+ it('fileio_test_write_sync_002', 0, function () {
+ let fpath = nextFileName('fileio_test_write_sync_002')
+
+ try {
+ let fd = fileio.openSync(fpath, 0o102, 0o666)
+ expect(fd).assertInstanceOf('Number')
+ expect(fileio.writeSync(fd, FILE_CONTENT, {
+ offset: 1,
+ })).assertEqual(FILE_CONTENT.length - 1)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_write_sync_002 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_WriteSync_0030
+ * @tc.name fileio_test_write_sync_003
+ * @tc.desc Test writeSync() interface.
+ */
+ it('fileio_test_write_sync_003', 0, function () {
+ let fpath = nextFileName('fileio_test_write_sync_003')
+
+ try {
+ let fd = fileio.openSync(fpath, 0o102, 0o666)
+ expect(fd).assertInstanceOf('Number')
+ expect(fileio.writeSync(fd, FILE_CONTENT, {
+ length: FILE_CONTENT.length - 1,
+ })).assertEqual(FILE_CONTENT.length - 1)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_write_sync_003 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_WriteSync_0040
+ * @tc.name fileio_test_write_sync_004
+ * @tc.desc Test writeSync() interface.
+ */
+ it('fileio_test_write_sync_004', 0, function () {
+ let fpath = nextFileName('fileio_test_write_sync_004')
+
+ try {
+ let fd = fileio.openSync(fpath, 0o102, 0o666)
+ expect(fd).assertInstanceOf('Number')
+ expect(fileio.writeSync(fd, FILE_CONTENT, {
+ offset: 1,
+ length: 1,
+ })).assertEqual(1)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_write_sync_004 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_WriteSync_0050
+ * @tc.name fileio_test_write_sync_005
+ * @tc.desc Test writeSync() interface.
+ */
+ it('fileio_test_write_sync_005', 0, function () {
+ let fpath = nextFileName('fileio_test_write_sync_005')
+ const invalidOffset = 999
+ let fd
+
+ try {
+ fd = fileio.openSync(fpath, 0o102, 0o666)
+ expect(fd).assertInstanceOf('Number')
+ expect(fileio.writeSync(fd, FILE_CONTENT, {
+ offset: invalidOffset,
+ })).assertEqual(1)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_WriteSync_0060
+ * @tc.name fileio_test_write_sync_006
+ * @tc.desc Test writeSync() interface.
+ */
+ it('fileio_test_write_sync_006', 0, function () {
+ let fpath = nextFileName('fileio_test_write_sync_006')
+ const invalidLength = 999
+ let fd
+
+ try {
+ fd = fileio.openSync(fpath, 0o102, 0o666)
+ expect(fd).assertInstanceOf('Number')
+ expect(fileio.writeSync(fd, FILE_CONTENT, {
+ length: invalidLength,
+ })).assertEqual(1)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_WriteSync_0070
+ * @tc.name fileio_test_write_sync_007
+ * @tc.desc Test writeSync() interface.
+ */
+ it('fileio_test_write_sync_007', 0, function () {
+ try {
+ fileio.writeSync()
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_WriteSync_0080
+ * @tc.name fileio_test_write_sync_008
+ * @tc.desc Test writeSync() interface.
+ */
+ it('fileio_test_write_sync_008', 0, function () {
+ try {
+ fileio.writeSync(-1, FILE_CONTENT)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ReadSync_0000
+ * @tc.name fileio_test_read_sync_000
+ * @tc.desc Test readSync() interface.
+ */
+ it('fileio_test_read_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_read_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fd).assertInstanceOf('Number')
+ let len = fileio.readSync(fd, new ArrayBuffer(4096))
+ expect(len).assertEqual(FILE_CONTENT.length)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_read_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ReadSync_0001
+ * @tc.name fileio_test_read_sync_001
+ * @tc.desc Test readSync() interface.
+ */
+ it('fileio_test_read_sync_001', 0, function () {
+ let bufLen = 5
+ expect(FILE_CONTENT.length).assertLarger(bufLen)
+ let fpath = nextFileName('fileio_test_read_sync_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fd).assertInstanceOf('Number')
+ let len = fileio.readSync(fd, new ArrayBuffer(bufLen), {
+ offset: 1,
+ })
+ expect(len).assertEqual(bufLen - 1)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_read_sync_001 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ReadSync_0020
+ * @tc.name fileio_test_read_sync_002
+ * @tc.desc Test readSync() interface.
+ */
+ it('fileio_test_read_sync_002', 0, function () {
+ let fpath = nextFileName('fileio_test_read_sync_002')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fd).assertInstanceOf('Number')
+ let len = fileio.readSync(fd, new ArrayBuffer(4096), {
+ length: 1,
+ })
+ expect(len).assertEqual(1)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_read_sync_002 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ReadSync_0030
+ * @tc.name fileio_test_read_sync_003
+ * @tc.desc Test readSync() interface.
+ */
+ it('fileio_test_read_sync_003', 0, function () {
+ let fd
+ const invalidOffset = 99999
+ let fpath = nextFileName('fileio_test_read_sync_003')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ fd = fileio.openSync(fpath, 0o2)
+ expect(fd).assertInstanceOf('Number')
+ fileio.readSync(fd, new ArrayBuffer(4096), {
+ offset: invalidOffset,
+ })
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ReadSync_0040
+ * @tc.name fileio_test_read_sync_004
+ * @tc.desc Test readSync() interface.
+ */
+ it('fileio_test_read_sync_004', 0, function () {
+ let fd
+ const invalidLength = 9999
+ let fpath = nextFileName('fileio_test_read_sync_004')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ fd = fileio.openSync(fpath, 0o2)
+ expect(fd).assertInstanceOf('Number')
+ fileio.readSync(fd, new ArrayBuffer(4096), {
+ length: invalidLength,
+ })
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ReadSync_0050
+ * @tc.name fileio_test_read_sync_005
+ * @tc.desc Test readSync() interface.
+ */
+ it('fileio_test_read_sync_005', 0, function () {
+ let fpath = nextFileName('fileio_test_read_sync_005')
+ let fd
+
+ try {
+ fileio.readSync(-1, new ArrayBuffer(4096))
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ReadSync_0060
+ * @tc.name fileio_test_read_sync_006
+ * @tc.desc Test readSync() interface.
+ */
+ it('fileio_test_read_sync_006', 0, function () {
+ let fpath = nextFileName('fileio_test_read_sync_006')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fd).assertInstanceOf('Number')
+ let len = fileio.readSync(fd, new ArrayBuffer(4096), {
+ position: 1,
+ })
+ expect(len).assertEqual(FILE_CONTENT.length - 1)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_read_sync_006 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ReadSync_0070
+ * @tc.name fileio_test_read_sync_007
+ * @tc.desc Test readSync() interface.
+ */
+ it('fileio_test_read_sync_007', 0, function () {
+ let fpath = nextFileName('fileio_test_read_sync_007')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fd).assertInstanceOf('Number')
+ let invalidPos = FILE_CONTENT.length + 1
+ let len = fileio.readSync(fd, new ArrayBuffer(4096), {
+ position: invalidPos,
+ })
+ expect(len).assertEqual(0)
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_read_sync_007 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ChmodSync_0000
+ * @tc.name fileio_test_chmod_sync_000
+ * @tc.desc Test chmodSync() interface.
+ */
+ it('fileio_test_chmod_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_chmod_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ expect(fileio.chmodSync(fpath, 0o660)).assertNull()
+ expect(fileio.Stat.statSync(fpath).mode & 0o777).assertEqual(0o660)
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_chmod_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ChmodSync_0010
+ * @tc.name fileio_test_chmod_sync_001
+ * @tc.desc Test chmodSync() interface.
+ */
+ it('fileio_test_chmod_sync_001', 0, function () {
+ let fpath = nextFileName('fileio_test_chmod_sync_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ fileio.chmodSync(fpath)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ChmodSync_0020
+ * @tc.name fileio_test_chmod_sync_002
+ * @tc.desc Test chmodSync() interface.
+ */
+ it('fileio_test_chmod_sync_002', 0, function () {
+ let fpath = nextFileName('fileio_test_chmod_sync_002')
+
+ try {
+ fileio.chmodSync(fpath, 0o660)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_CopyFileSync_0000
+ * @tc.name fileio_test_copy_file_sync_000
+ * @tc.desc Test copyFileSync() interface.
+ */
+ it('fileio_test_copy_file_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_copy_file_sync_000')
+ let fpathTarget = fpath + 'tgt'
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ expect(fileio.copyFileSync(fpath, fpathTarget)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.unlinkSync(fpathTarget)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_copy_file_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_CopyFileSync_0010
+ * @tc.name fileio_test_copy_file_sync_001
+ * @tc.desc Test copyFileSync() interface.
+ */
+ it('fileio_test_copy_file_sync_001', 0, function () {
+ let fpath = nextFileName('fileio_test_copy_file_sync_000')
+ let fpathTarget = fpath + 'tgt'
+
+ try {
+ fileio.copyFileSync(fpath, fpathTarget)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_CopyFileSync_0020
+ * @tc.name fileio_test_copy_file_sync_002
+ * @tc.desc Test copyFileSync() interface.
+ */
+ it('fileio_test_copy_file_sync_002', 0, function () {
+ try {
+ fileio.copyFileSync()
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_TruncateSync_0000
+ * @tc.name fileio_test_truncate_sync_000
+ * @tc.desc Test truncateSync() interface.
+ */
+ it('fileio_test_truncate_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_truncate_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ expect(fileio.truncateSync(fpath)).assertNull()
+ expect(fileio.Stat.statSync(fpath).size).assertEqual(0)
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_truncate_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_TruncateSync_0010
+ * @tc.name fileio_test_truncate_sync_001
+ * @tc.desc Test truncateSync() interface.
+ */
+ it('fileio_test_truncate_sync_001', 0, function () {
+ let fpath = nextFileName('fileio_test_truncate_sync_001')
+
+ try {
+ fileio.truncateSync(fpath)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_TruncateSync_0020
+ * @tc.name fileio_test_truncate_sync_002
+ * @tc.desc Test truncateSync() interface.
+ */
+ it('fileio_test_truncate_sync_002', 0, function () {
+ try {
+ fileio.truncateSync()
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_RenameSync_0000
+ * @tc.name fileio_test_rename_sync_000
+ * @tc.desc Test renameSync() interface.
+ */
+ it('fileio_test_rename_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_rename_sync_000')
+ let fpathTarget = fpath + 'tgt'
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ expect(fileio.renameSync(fpath, fpathTarget)).assertNull()
+ expect(fileio.accessSync(fpathTarget)).assertNull()
+ expect(fileio.unlinkSync(fpathTarget)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_rename_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_RenameSync_0010
+ * @tc.name fileio_test_rename_sync_001
+ * @tc.desc Test renameSync() interface.
+ */
+ it('fileio_test_rename_sync_001', 0, function () {
+ let fpath = nextFileName('fileio_test_rename_sync_001')
+ let fpathTarget = fpath + 'tgt'
+
+ try {
+ fileio.renameSync(fpath, fpathTarget)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_RenameSync_0020
+ * @tc.name fileio_test_rename_sync_002
+ * @tc.desc Test renameSync() interface.
+ */
+ it('fileio_test_rename_sync_002', 0, function () {
+ let fpath = nextFileName('fileio_test_rename_sync_002')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ fileio.renameSync(fpath, "/")
+ } catch (e) {
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_FchmodSync_0000
+ * @tc.name fileio_test_fchmod_sync_000
+ * @tc.desc Test fchmodSync() interface.
+ */
+ it('fileio_test_fchmod_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_fchmod_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fileio.fchmodSync(fd, 0o660)).assertNull()
+ expect(fileio.Stat.statSync(fpath).mode & 0o777).assertEqual(0o660)
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_fchmod_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_FchmodSync_0010
+ * @tc.name fileio_test_fchmod_sync_001
+ * @tc.desc Test fchmodSync() interface.
+ */
+ it('fileio_test_fchmod_sync_001', 0, function () {
+ try {
+ expect(fileio.fchmodSync(-1, 0o660)).assertNull()
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_FtruncateSync_0000
+ * @tc.name fileio_test_ftruncate_sync_000
+ * @tc.desc Test ftruncateSync() interface.
+ */
+ it('fileio_test_ftruncate_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_ftruncate_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fileio.ftruncateSync(fd)).assertNull()
+ expect(fileio.Stat.statSync(fpath).size).assertEqual(0)
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_ftruncate_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_FtruncateSync_0010
+ * @tc.name fileio_test_ftruncate_sync_001
+ * @tc.desc Test ftruncateSync() interface.
+ */
+ it('fileio_test_ftruncate_sync_001', 0, function () {
+ try {
+ fileio.ftruncateSync(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_FsyncSync_0000
+ * @tc.name fileio_test_fsync_sync_000
+ * @tc.desc Test fsyncSync() interface.
+ */
+ it('fileio_test_fsync_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_fsync_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fileio.fsyncSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_fsync_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_FsyncSync_0010
+ * @tc.name fileio_test_fsync_sync_001
+ * @tc.desc Test fsyncSync() interface.
+ */
+ it('fileio_test_fsync_sync_001', 0, function () {
+ try {
+ fileio.fsyncSync(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_MkdirSync_0000
+ * @tc.name fileio_test_mkdir_sync_rmdir_sync_000
+ * @tc.desc Test mkdirSync() interface.
+ */
+ it('fileio_test_mkdir_sync_rmdir_sync_000', 0, function () {
+ let dpath = nextFileName('fileio_test_fsync_sync_000') + 'd'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_mkdir_sync_rmdir_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_MkdirSync_0010
+ * @tc.name fileio_test_mkdir_sync_rmdir_sync_001
+ * @tc.desc Test mkdirSync() interface.
+ */
+ it('fileio_test_mkdir_sync_rmdir_sync_001', 0, function () {
+ try {
+ expect(fileio.mkdirSync("/")).assertNull()
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ChownSync_0000
+ * @tc.name fileio_test_chown_sync_000
+ * @tc.desc Test chownSync() interface.
+ */
+ it('fileio_test_chown_sync_000', 0, async function (done) {
+ let fpath = nextFileName('fileio_test_chown_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let bundleInfo = await bundle_mgr.getBundleInfo("ohos.acts.distributeddatamgr.distributedfile")
+ let UID = bundleInfo.uid
+ let GID = bundleInfo.gid
+
+ try {
+ expect(fileio.chownSync(fpath, UID, GID))
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_chown_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ done()
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ChownSync_0010
+ * @tc.name fileio_test_chown_sync_001
+ * @tc.desc Test chownSync() interface.
+ */
+ it('fileio_test_chown_sync_001', 0, async function (done) {
+ let bundleInfo = await bundle_mgr.getBundleInfo("ohos.acts.distributeddatamgr.distributedfile")
+ let UID = bundleInfo.uid
+ let GID = bundleInfo.gid
+ let fpath = nextFileName('fileio_test_chown_sync_001')
+
+ try {
+ expect(fileio.chownSync(fpath, UID, GID))
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ done()
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_ChownSync_0020
+ * @tc.name fileio_test_chown_sync_002
+ * @tc.desc Test chownSync() interface.
+ */
+ it('fileio_test_chown_sync_002', 0, function () {
+ let fpath = nextFileName('fileio_test_chown_sync_002')
+
+ try {
+ expect(fileio.chownSync(fpath, 0, 0))
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_FchownSync_0000
+ * @tc.name fileio_test_fchown_sync_000
+ * @tc.desc Test fchownSync() interface.
+ */
+ it('fileio_test_fchown_sync_000', 0, async function (done) {
+ let fpath = nextFileName('fileio_test_fchown_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let bundleInfo = await bundle_mgr.getBundleInfo("ohos.acts.distributeddatamgr.distributedfile")
+ let UID = bundleInfo.uid
+ let GID = bundleInfo.gid
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fileio.fchownSync(fd, UID, GID))
+ expect(fd).assertInstanceOf('Number')
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+
+ } catch (e) {
+ console.log("fileio_test_fchown_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ done()
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_FchownSync_0010
+ * @tc.name fileio_test_fchown_sync_001
+ * @tc.desc Test fchownSync() interface.
+ */
+ it('fileio_test_fchown_sync_001', 0, async function (done) {
+ let bundleInfo = await bundle_mgr.getBundleInfo("ohos.acts.distributeddatamgr.distributedfile")
+ let UID = bundleInfo.uid
+ let GID = bundleInfo.gid
+
+ try {
+ expect(fileio.fchownSync(-1, UID, GID))
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ done()
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_FchownSync_0020
+ * @tc.name fileio_test_fchown_sync_002
+ * @tc.desc Test fchownSync() interface.
+ */
+ it('fileio_test_fchown_sync_002', 0, function () {
+ let fd
+ let fpath = nextFileName('fileio_test_fchown_sync_002')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ fd = fileio.openSync(fpath, 0o2)
+ fileio.fchownSync(fd, 0, 0)
+ expect(null).assertFail()
+
+ } catch (e) {
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+})
\ No newline at end of file
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODir.test.js b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODir.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..08b8079b6fd223a8fab7c8181b70c37d9cc98fd6
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODir.test.js
@@ -0,0 +1,118 @@
+/*
+ * 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 fileio from '@ohos.fileio'
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
+import { FILE_CONTENT, prepareFile, nextFileName } from './Common'
+
+describe('fileIOTestDir', function () {
+ /**
+ * @tc.number SUB_DF_FileIO_OpenClosedirSync_0000
+ * @tc.name fileio_test_dir_open_close_sync_000
+ * @tc.desc Test opendirSync() and Dir.closeSync() interfaces.
+ */
+ it('fileio_test_dir_open_close_sync_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dir_open_close_sync_000') + 'd'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dir_open_close_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_OpenClosedirSync_0010
+ * @tc.name fileio_test_dir_open_close_sync_001
+ * @tc.desc Test opendirSync() interface.
+ */
+ it('fileio_test_dir_open_close_sync_001', 0, function () {
+ try {
+ fileio.Dir.opendirSync()
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_OpenClosedirSync_0020
+ * @tc.name fileio_test_dir_open_close_sync_002
+ * @tc.desc Test opendirSync() interface.
+ */
+ it('fileio_test_dir_open_close_sync_002', 0, function () {
+ let dpath = nextFileName('fileio_test_dir_read_sync_000') + 'd'
+
+ try {
+ fileio.Dir.opendirSync(dpath)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_ReadSync_0000
+ * @tc.name fileio_test_dir_read_sync_000
+ * @tc.desc Test Dir.readSync() interface.
+ */
+ it('fileio_test_dir_read_sync_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dir_read_sync_000') + 'd'
+ let fpath = dpath + '/f1'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ expect(dd.readSync() != null).assertTrue()
+ expect(dd.closeSync()).assertNull()
+
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dir_read_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_ReadSync_0010
+ * @tc.name fileio_test_dir_read_sync_001
+ * @tc.desc Test Dir.readSync() interface.
+ */
+ it('fileio_test_dir_read_sync_001', 0, function () {
+ let dpath = nextFileName('fileio_test_dir_read_sync_001') + 'd'
+ let fpath = dpath + '/f1'
+ let dd
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ expect(dd.readSync(-1) != null).assertTrue()
+ expect(null).assertFail()
+ } catch (e) {
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+})
\ No newline at end of file
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODirent.test.js b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODirent.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..349cce9e3c074241182c77aab98b2d796d8ecc8e
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIODirent.test.js
@@ -0,0 +1,411 @@
+/*
+ * 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 fileio from '@ohos.fileio'
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
+import {FILE_CONTENT, prepareFile, nextFileName} from './Common'
+
+describe('fileIOTestDirent', function () {
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_ReadSync_0000
+ * @tc.name fileio_test_dirent_name_000
+ * @tc.desc Test Dir.readSync() interface.
+ */
+ it('fileio_test_dirent_name_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_name_000') + 'd'
+ let fpath = dpath + '/f1'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ expect(dirent.name).assertInstanceOf('String')
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dirent_name_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsBlockDevice_0000
+ * @tc.name fileio_test_dirent_is_block_device_000
+ * @tc.desc Test Dir.isBlockDevice() interface.
+ */
+ it('fileio_test_dirent_is_block_device_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_block_device_000') + 'd'
+ let fpath = dpath + '/f1'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ expect(dirent.isBlockDevice()).assertInstanceOf('Boolean')
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dirent_is_block_device_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsBlockDevice_0010
+ * @tc.name fileio_test_dirent_is_block_device_001
+ * @tc.desc Test Dir.isBlockDevice() interface.
+ */
+ it('fileio_test_dirent_is_block_device_001', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_block_device_001') + 'd'
+ let fpath = dpath + '/f1'
+ let dd
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ dirent.isBlockDevice(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsCharacterDevice_0000
+ * @tc.name fileio_test_dirent_is_character_device_000
+ * @tc.desc Test Dir.isCharacterDevice() interface.
+ */
+ it('fileio_test_dirent_is_character_device_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_character_device_000') + 'd'
+ let fpath = dpath + '/f1'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ expect(dirent.isCharacterDevice()).assertInstanceOf('Boolean')
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dirent_is_character_device_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsCharacterDevice_0010
+ * @tc.name fileio_test_dirent_is_character_device_001
+ * @tc.desc Test Dir.isCharacterDevice() interface.
+ */
+ it('fileio_test_dirent_is_character_device_001', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_character_device_001') + 'd'
+ let fpath = dpath + '/f1'
+ let dd
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ dirent.isCharacterDevice(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsDirectory_0000
+ * @tc.name fileio_test_dirent_is_directory_000
+ * @tc.desc Test Dir.isDirectory() interface.
+ */
+ it('fileio_test_dirent_is_directory_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_directory_000') + 'd'
+ let fpath = dpath + '/f1'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ expect(dirent.isDirectory()).assertInstanceOf('Boolean')
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dirent_is_directory_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsDirectory_0010
+ * @tc.name fileio_test_dirent_is_directory_001
+ * @tc.desc Test Dir.isDirectory() interface.
+ */
+ it('fileio_test_dirent_is_directory_001', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_directory_001') + 'd'
+ let fpath = dpath + '/f1'
+ let dd
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ dirent.isDirectory(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsFIFO_0000
+ * @tc.name fileio_test_dirent_is_fifo_000
+ * @tc.desc Test Dir.isFIFO() interface.
+ */
+ it('fileio_test_dirent_is_fifo_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_fifo_000') + 'd'
+ let fpath = dpath + '/f1'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ expect(dirent.isFIFO()).assertInstanceOf('Boolean')
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dirent_is_fifo_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsFIFO_0010
+ * @tc.name fileio_test_dirent_is_fifo_001
+ * @tc.desc Test Dir.isFIFO() interface.
+ */
+ it('fileio_test_dirent_is_fifo_001', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_fifo_001') + 'd'
+ let fpath = dpath + '/f1'
+ let dd
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ dirent.isFIFO(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsFILE_0000
+ * @tc.name fileio_test_dirent_is_file_000
+ * @tc.desc Test Dir.isFILE() interface.
+ */
+ it('fileio_test_dirent_is_file_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_file_000') + 'd'
+ let fpath = dpath + '/f1'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ expect(dirent.isFile()).assertInstanceOf('Boolean')
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dirent_is_file_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsFILE_0010
+ * @tc.name fileio_test_dirent_is_file_001
+ * @tc.desc Test Dir.isFILE() interface.
+ */
+ it('fileio_test_dirent_is_file_001', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_file_001') + 'd'
+ let fpath = dpath + '/f1'
+ let dd
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ dirent.isFile(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsSocket_0000
+ * @tc.name fileio_test_dirent_is_socket_000
+ * @tc.desc Test Dir.isSocket() interface.
+ */
+ it('fileio_test_dirent_is_socket_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_socket_000') + 'd'
+ let fpath = dpath + '/f1'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ expect(dirent.isSocket()).assertInstanceOf('Boolean')
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dirent_is_socket_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsSocket_0010
+ * @tc.name fileio_test_dirent_is_socket_001
+ * @tc.desc Test Dir.isSocket() interface.
+ */
+ it('fileio_test_dirent_is_socket_001', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_socket_001') + 'd'
+ let fpath = dpath + '/f1'
+ let dd
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ dirent.isSocket(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsSymbolicLink_0000
+ * @tc.name fileio_test_dirent_is_symbolic_link_000
+ * @tc.desc Test Dir.isSymbolicLink() interface.
+ */
+ it('fileio_test_dirent_is_symbolic_link_000', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_symbolic_link_000') + 'd'
+ let fpath = dpath + '/f1'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ let dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ expect(dirent.isSymbolicLink()).assertInstanceOf('Boolean')
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_dirent_is_symbolic_link_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Dir_IsSymbolicLink_0010
+ * @tc.name fileio_test_dirent_is_symbolic_link_001
+ * @tc.desc Test Dir.isSymbolicLink() interface.
+ */
+ it('fileio_test_dirent_is_symbolic_link_001', 0, function () {
+ let dpath = nextFileName('fileio_test_dirent_is_symbolic_link_001') + 'd'
+ let fpath = dpath + '/f1'
+ let dd
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+ dd = fileio.Dir.opendirSync(dpath)
+ expect(dd !== null).assertTrue()
+ let dirent = dd.readSync()
+ expect(dirent !== null).assertTrue()
+ dirent.isSymbolicLink(-1)
+ expect(null).assertFail()
+ } catch (e) {
+ expect(dd.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+})
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStat.test.js b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStat.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..4dd67607d2e89ebacf9de96369e8c2528fb24c52
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStat.test.js
@@ -0,0 +1,749 @@
+/*
+ * 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 fileio from '@ohos.fileio'
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
+import { FILE_CONTENT, prepareFile, nextFileName } from './Common'
+
+describe('fileIOTestStat', function () {
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_FstatSync_0000
+ * @tc.name fileio_test_stat_fstat_sync_000
+ * @tc.desc Test fileio.fstatSync() interface.
+ */
+ it('fileio_test_stat_fstat_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_fstat_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let fd = fileio.openSync(fpath, 0o2)
+ expect(fd).assertInstanceOf('Number')
+ let stat = fileio.fstatSync(fd)
+ expect(stat !== null).assertTrue()
+ expect(fileio.closeSync(fd)).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_stat_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_FstatSync_0010
+ * @tc.name fileio_test_stat_fstat_sync_001
+ * @tc.desc Test fstatSync() interface.
+ */
+ it('fileio_test_stat_fstat_sync_001', 0, function () {
+ try {
+ let invalidFD = -1
+ fileio.fstatSync(invalidFD)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_StatSync_0000
+ * @tc.name fileio_test_stat_stat_sync_000
+ * @tc.desc Test Stat.statSync() interface.
+ */
+ it('fileio_test_stat_stat_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_stat_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat !== null).assertTrue()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_stat_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_StatSync_0010
+ * @tc.name fileio_test_stat_stat_sync_001
+ * @tc.desc Test Stat.statSync() interface.
+ */
+ it('fileio_test_stat_stat_sync_001', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_stat_sync_001')
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Dev_0000
+ * @tc.name fileio_test_stat_dev_000
+ * @tc.desc Test Stat.dev() interface.
+ */
+ it('fileio_test_stat_dev_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_dev_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.dev).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_dev_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Ino_0000
+ * @tc.name fileio_test_stat_ino_000
+ * @tc.desc Test Stat.ino() interface.
+ */
+ it('fileio_test_stat_ino_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_ino_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.ino).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_ino_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Mode_0000
+ * @tc.name fileio_test_stat_mode_000
+ * @tc.desc Test Stat.mode() interface.
+ */
+ it('fileio_test_stat_mode_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_mode_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.mode).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_mode_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Nlink_0000
+ * @tc.name fileio_test_stat_nlink_000
+ * @tc.desc Test Stat.nlink() interface.
+ */
+ it('fileio_test_stat_nlink_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_nlink_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.nlink).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_nlink_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Uid_0000
+ * @tc.name fileio_test_stat_uid_000
+ * @tc.desc Test Stat.uid() interface.
+ */
+ it('fileio_test_stat_uid_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_uid_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.uid).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_uid_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Gid_0000
+ * @tc.name fileio_test_stat_gid_000
+ * @tc.desc Test Stat.gid() interface.
+ */
+ it('fileio_test_stat_gid_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_gid_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.gid).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_gid_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Rdev_0000
+ * @tc.name fileio_test_stat_rdev_000
+ * @tc.desc Test Stat.rdev() interface.
+ */
+ it('fileio_test_stat_rdev_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_rdev_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.rdev).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_rdev_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Size_0000
+ * @tc.name fileio_test_stat_size_000
+ * @tc.desc Test Stat.size() interface.
+ */
+ it('fileio_test_stat_size_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_size_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.size).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_size_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Blocks_0000
+ * @tc.name fileio_test_stat_blocks_000
+ * @tc.desc Test Stat.blocks() interface.
+ */
+ it('fileio_test_stat_blocks_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_blocks_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.blocks).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_blocks_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Atime_0000
+ * @tc.name fileio_test_stat_atime_000
+ * @tc.desc Test Stat.atime() interface.
+ */
+ it('fileio_test_stat_atime_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_atime_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.atime).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_atime_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Mtime_0000
+ * @tc.name fileio_test_stat_mtime_000
+ * @tc.desc Test Stat.mtime() interface.
+ */
+ it('fileio_test_stat_mtime_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_mtime_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.mtime).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_mtime_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_Ctime_0000
+ * @tc.name fileio_test_stat_ctime_000
+ * @tc.desc Test Stat.ctime() interface.
+ */
+ it('fileio_test_stat_ctime_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_ctime_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.ctime).assertInstanceOf('Number')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_ctime_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsBlockDevice_0000
+ * @tc.name fileio_test_stat_is_block_device_000
+ * @tc.desc Test Stat.isBlockDevice() interface.
+ */
+ it('fileio_test_stat_is_block_device_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_block_device_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isBlockDevice()).assertInstanceOf('Boolean')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_block_device_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsBlockDevice_0010
+ * @tc.name fileio_test_stat_is_block_device_001
+ * @tc.desc Test Stat.isBlockDevice() interface.
+ */
+ it('fileio_test_stat_is_block_device_001', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_block_device_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isBlockDevice()).assertFalse()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_block_device_001 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsBlockDevice_0020
+ * @tc.name fileio_test_stat_is_block_device_002
+ * @tc.desc Test Stat.isBlockDevice() interface.
+ */
+ it('fileio_test_stat_is_block_device_002', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_block_device_002')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isBlockDevice(-1)).assertFalse()
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsCharacterDevice_0000
+ * @tc.name fileio_test_stat_is_character_device_000
+ * @tc.desc Test Stat.isCharacterDevice() interface.
+ */
+ it('fileio_test_stat_is_character_device_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_character_device_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isCharacterDevice()).assertInstanceOf('Boolean')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_character_device_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsCharacterDevice_0010
+ * @tc.name fileio_test_stat_is_character_device_001
+ * @tc.desc Test Stat.isCharacterDevice() interface.
+ */
+ it('fileio_test_stat_is_character_device_001', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_character_device_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isCharacterDevice()).assertFalse()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_character_device_001 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsCharacterDevice_0020
+ * @tc.name fileio_test_stat_is_character_device_002
+ * @tc.desc Test Stat.isCharacterDevice() interface.
+ */
+ it('fileio_test_stat_is_character_device_002', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_character_device_002')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isCharacterDevice(-1)).assertFalse()
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsDirectory_0000
+ * @tc.name fileio_test_stat_is_directory_000
+ * @tc.desc Test Stat.isDirectory() interface.
+ */
+ it('fileio_test_stat_is_directory_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_directory_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isDirectory()).assertInstanceOf('Boolean')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_directory_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsDirectory_0010
+ * @tc.name fileio_test_stat_is_directory_001
+ * @tc.desc Test Stat.isDirectory() interface.
+ */
+ it('fileio_test_stat_is_directory_001', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_directory_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isDirectory()).assertFalse()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_directory_001 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsDirectory_0020
+ * @tc.name fileio_test_stat_is_directory_002
+ * @tc.desc Test Stat.isDirectory() interface.
+ */
+ it('fileio_test_stat_is_directory_002', 0, function () {
+ let dpath = nextFileName('fileio_test_stat_is_directory_002') + 'd'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ let stat = fileio.Stat.statSync(dpath)
+ expect(stat.isDirectory()).assertTrue()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_directory_002 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsDirectory_0030
+ * @tc.name fileio_test_stat_is_directory_003
+ * @tc.desc Test Stat.isDirectory() interface.
+ */
+ it('fileio_test_stat_is_directory_003', 0, function () {
+ let dpath = nextFileName('fileio_test_stat_is_directory_003') + 'd'
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ let stat = fileio.Stat.statSync(dpath)
+ expect(stat.isDirectory(-1)).assertTrue()
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsFIFO_0000
+ * @tc.name fileio_test_stat_is_fifo_000
+ * @tc.desc Test Stat.isFIFO() interface.
+ */
+ it('fileio_test_stat_is_fifo_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_fifo_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isFIFO()).assertInstanceOf('Boolean')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_fifo_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsFIFO_0010
+ * @tc.name fileio_test_stat_is_fifo_001
+ * @tc.desc Test Stat.isFIFO() interface.
+ */
+ it('fileio_test_stat_is_fifo_001', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_fifo_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isFIFO()).assertFalse()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_fifo_001 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsFIFO_0020
+ * @tc.name fileio_test_stat_is_fifo_002
+ * @tc.desc Test Stat.isFIFO() interface.
+ */
+ it('fileio_test_stat_is_fifo_002', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_fifo_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isFIFO(-1)).assertFalse()
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsFILE_0000
+ * @tc.name fileio_test_stat_is_file_000
+ * @tc.desc Test Stat.isFile() interface.
+ */
+ it('fileio_test_stat_is_file_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_file_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertInstanceOf('Boolean')
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isFile()).assertInstanceOf('Boolean')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_file_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsFILE_0010
+ * @tc.name fileio_test_stat_is_file_001
+ * @tc.desc Test Stat.isFile() interface.
+ */
+ it('fileio_test_stat_is_file_001', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_file_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertInstanceOf('Boolean')
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isFile()).assertTrue()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_file_001 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsFILE_0020
+ * @tc.name fileio_test_stat_is_file_002
+ * @tc.desc Test Stat.isFile() interface.
+ */
+ it('fileio_test_stat_is_file_002', 0, function () {
+ let dpath = nextFileName('fileio_test_stat_is_file_002')
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ let stat = fileio.Stat.statSync(dpath)
+ expect(stat.isFile()).assertFalse()
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_file_002 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsFILE_0030
+ * @tc.name fileio_test_stat_is_file_003
+ * @tc.desc Test Stat.isFile() interface.
+ */
+ it('fileio_test_stat_is_file_003', 0, function () {
+ let dpath = nextFileName('fileio_test_stat_is_file_003')
+
+ try {
+ expect(fileio.mkdirSync(dpath)).assertNull()
+ let stat = fileio.Stat.statSync(dpath)
+ expect(stat.isFile(-1)).assertFalse()
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.rmdirSync(dpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsSocket_0000
+ * @tc.name fileio_test_stat_is_socket_000
+ * @tc.desc Test Stat.isSocket() interface.
+ */
+ it('fileio_test_stat_is_socket_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_socket_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isSocket()).assertInstanceOf('Boolean')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_socket_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsSocket_0010
+ * @tc.name fileio_test_stat_is_socket_001
+ * @tc.desc Test Stat.isSocket() interface.
+ */
+ it('fileio_test_stat_is_socket_001', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_socket_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isSocket()).assertFalse()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_socket_001 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsSocket_0020
+ * @tc.name fileio_test_stat_is_socket_002
+ * @tc.desc Test Stat.isSocket() interface.
+ */
+ it('fileio_test_stat_is_socket_002', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_socket_002')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isSocket(-1)).assertFalse()
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsSymbolicLink_0000
+ * @tc.name fileio_test_stat_is_symbolic_link_000
+ * @tc.desc Test Stat.isSymbolicLink() interface.
+ */
+ it('fileio_test_stat_is_symbolic_link_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_symbolic_link_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isSymbolicLink()).assertInstanceOf('Boolean')
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_symbolic_link_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsSymbolicLink_0010
+ * @tc.name fileio_test_stat_is_symbolic_link_001
+ * @tc.desc Test Stat.isSymbolicLink() interface.
+ */
+ it('fileio_test_stat_is_symbolic_link_001', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_symbolic_link_001')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isSymbolicLink()).assertFalse()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stat_is_symbolic_link_001 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stat_IsSymbolicLink_0020
+ * @tc.name fileio_test_stat_is_symbolic_link_002
+ * @tc.desc Test Stat.isSymbolicLink() interface.
+ */
+ it('fileio_test_stat_is_symbolic_link_002', 0, function () {
+ let fpath = nextFileName('fileio_test_stat_is_symbolic_link_002')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let stat = fileio.Stat.statSync(fpath)
+ expect(stat.isSymbolicLink(-1)).assertFalse()
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+})
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStream.test.js b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStream.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..174614de1c3e4bb26eb6cb8063e9d06253f48e50
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/FileIOStream.test.js
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import fileio from '@ohos.fileio'
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
+import { FILE_CONTENT, prepareFile, nextFileName } from './Common'
+
+describe('fileIOTestStream', function () {
+ /**
+ * @tc.number SUB_DF_FileIO_Stream_CreateStreamSync_0000
+ * @tc.name fileio_test_stream_create_stream_sync_000
+ * @tc.desc Test Stream.createStreamSync() interface.
+ */
+ it('fileio_test_stream_create_stream_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stream_create_stream_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ var ss = fileio.Stream.createStreamSync(fpath, "r+")
+ expect(ss !== null).assertTrue()
+ expect(ss.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stream_create_stream_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stream_CreateStreamSync_0010
+ * @tc.name fileio_test_stream_create_stream_sync_001
+ * @tc.desc Test Stream.createStreamSync() interface.
+ */
+ it('fileio_test_stream_create_stream_sync_001', 0, function () {
+ let fpath = nextFileName('fileio_test_stream_create_stream_sync_001')
+
+ try {
+ fileio.Stream.createStreamSync(fpath, "r+")
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stream_CreateStreamSync_0020
+ * @tc.name fileio_test_stream_create_stream_sync_002
+ * @tc.desc Test Stream.createStreamSync() interface.
+ */
+ it('fileio_test_stream_create_stream_sync_002', 0, function () {
+ let fpath = nextFileName('fileio_test_stream_create_stream_sync_002')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ fileio.Stream.createStreamSync(fpath, "ohos")
+ expect(null).assertFail()
+ } catch (e) {
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stream_FdopenStreamSync_0000
+ * @tc.name fileio_test_stream_fdopen_stream_sync_000
+ * @tc.desc Test Stream.fdopenStreamSync() interface.
+ */
+ it('fileio_test_stream_fdopen_stream_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ var fd = fileio.openSync(fpath, 0o2)
+ let ss = fileio.Stream.fdopenStreamSync(fd, "r+")
+ expect(ss !== null).assertTrue()
+ expect(ss.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stream_fdopen_stream_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stream_FdopenStreamSync_0010
+ * @tc.name fileio_test_stream_fdopen_stream_sync_001
+ * @tc.desc Test Stream.fdopenStreamSync() interface.
+ */
+ it('fileio_test_stream_fdopen_stream_sync_001', 0, function () {
+ try {
+ let ss = fileio.Stream.fdopenStreamSync(-1, "r+")
+ expect(null).assertFail()
+ } catch (e) {
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stream_ReadSync_0000
+ * @tc.name fileio_test_stream_read_sync_000
+ * @tc.desc Test Stream.readSync() interface.
+ */
+ it('fileio_test_stream_read_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stream_read_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let ss = fileio.Stream.createStreamSync(fpath, "r+")
+ expect(ss !== null).assertTrue()
+ let len = ss.readSync(new ArrayBuffer(4096))
+ expect(len).assertEqual(FILE_CONTENT.length)
+ expect(ss.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stream_read_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stream_WriteSync_0000
+ * @tc.name fileio_test_stream_write_sync_000
+ * @tc.desc Test Stream.writeSync() interface.
+ */
+ it('fileio_test_stream_write_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stream_write_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let ss = fileio.Stream.createStreamSync(fpath, "r+")
+ expect(ss !== null).assertTrue()
+ expect(ss.writeSync(FILE_CONTENT)).assertEqual(FILE_CONTENT.length)
+ expect(ss.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stream_write_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+
+ /**
+ * @tc.number SUB_DF_FileIO_Stream_FlushSync_0000
+ * @tc.name fileio_test_stream_flush_sync_000
+ * @tc.desc Test Stream.flushSync() interface.
+ */
+ it('fileio_test_stream_flush_sync_000', 0, function () {
+ let fpath = nextFileName('fileio_test_stream_flush_sync_000')
+ expect(prepareFile(fpath, FILE_CONTENT)).assertTrue()
+
+ try {
+ let ss = fileio.Stream.createStreamSync(fpath, "r+")
+ expect(ss !== null).assertTrue()
+ expect(ss.writeSync(FILE_CONTENT)).assertEqual(FILE_CONTENT.length)
+ expect(ss.flushSync()).assertNull()
+ expect(ss.closeSync()).assertNull()
+ expect(fileio.unlinkSync(fpath)).assertNull()
+ } catch (e) {
+ console.log("fileio_test_stream_flush_sync_000 has failed for " + e)
+ expect(null).assertFail()
+ }
+ })
+})
\ No newline at end of file
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/List.test.js b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a0313e7c9a62553512b1cd73364c0a41af37714c
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/js/test/List.test.js
@@ -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.
+ */
+
+require('./FileIO.test.js')
+require('./FileIODir.test.js')
+require('./FileIODirent.test.js')
+require('./FileIOStat.test.js')
+require('./FileIOStream.test.js')
\ No newline at end of file
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/resources/base/element/string.json b/distributeddatamgr/distributedfilejstest/project/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..e270bb102c245b6f217a8589954021d89cd9059b
--- /dev/null
+++ b/distributeddatamgr/distributedfilejstest/project/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "DistributedFileJSTest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/distributeddatamgr/distributedfilejstest/project/entry/src/main/resources/base/media/icon.png b/distributeddatamgr/distributedfilejstest/project/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/distributeddatamgr/distributedfilejstest/project/entry/src/main/resources/base/media/icon.png differ
diff --git a/figures/icon-caution.gif b/figures/icon-caution.gif
new file mode 100755
index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571
Binary files /dev/null and b/figures/icon-caution.gif differ
diff --git a/figures/icon-danger.gif b/figures/icon-danger.gif
new file mode 100755
index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571
Binary files /dev/null and b/figures/icon-danger.gif differ
diff --git a/figures/icon-note.gif b/figures/icon-note.gif
new file mode 100755
index 0000000000000000000000000000000000000000..6314297e45c1de184204098efd4814d6dc8b1cda
Binary files /dev/null and b/figures/icon-note.gif differ
diff --git a/figures/icon-notice.gif b/figures/icon-notice.gif
new file mode 100755
index 0000000000000000000000000000000000000000..86024f61b691400bea99e5b1f506d9d9aef36e27
Binary files /dev/null and b/figures/icon-notice.gif differ
diff --git a/figures/icon-tip.gif b/figures/icon-tip.gif
new file mode 100755
index 0000000000000000000000000000000000000000..93aa72053b510e456b149f36a0972703ea9999b7
Binary files /dev/null and b/figures/icon-tip.gif differ
diff --git a/figures/icon-warning.gif b/figures/icon-warning.gif
new file mode 100755
index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571
Binary files /dev/null and b/figures/icon-warning.gif differ
diff --git a/global/BUILD.gn b/global/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..47672c0b9de1438767133ebd6628238aa12b1374
--- /dev/null
+++ b/global/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("//build/ohos_var.gni")
+
+group("global") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [
+ "i18n_standard/intljs:intljs_test",
+ "i18n_standard/zone/src:ZoneUtiltest",
+ "resmgr_standard/resmgrjs:resmgrjs_test",
+ ]
+ } else {
+ deps = [
+ "i18n:i18n_test_hap",
+ "icu:icu_test_hap",
+ "resmgr:resmgr_test_hap",
+ ]
+ }
+}
diff --git a/global/i18n_standard/intljs/BUILD.gn b/global/i18n_standard/intljs/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..e72ce2dc8e2be6aeaac9f260776c36c07a861ec5
--- /dev/null
+++ b/global/i18n_standard/intljs/BUILD.gn
@@ -0,0 +1,19 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("intljs_test") {
+ test_hap_name = "IntlJsTest"
+ hap_source_path = "hap/entry-debug-rich-signed.hap"
+}
diff --git a/global/i18n_standard/intljs/Test.json b/global/i18n_standard/intljs/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..b6390d227479082c4bee8802581eaa7d70076004
--- /dev/null
+++ b/global/i18n_standard/intljs/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for intljs Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "21600000",
+ "package": "ohos.intl.test",
+ "shell-timeout": "21600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "IntlJsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/global/i18n_standard/intljs/hap/entry-debug-rich-signed.hap b/global/i18n_standard/intljs/hap/entry-debug-rich-signed.hap
new file mode 100755
index 0000000000000000000000000000000000000000..f00342864475d6f97fb5ff98ec4b79d671870b8b
Binary files /dev/null and b/global/i18n_standard/intljs/hap/entry-debug-rich-signed.hap differ
diff --git a/global/i18n_standard/intljs/project/.gitignore b/global/i18n_standard/intljs/project/.gitignore
new file mode 100755
index 0000000000000000000000000000000000000000..ebdd23d29a08bffe35d1c4f0a21b058393fd9dba
--- /dev/null
+++ b/global/i18n_standard/intljs/project/.gitignore
@@ -0,0 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
diff --git a/global/i18n_standard/intljs/project/entry/.gitignore b/global/i18n_standard/intljs/project/entry/.gitignore
new file mode 100755
index 0000000000000000000000000000000000000000..3543521e9fef8e7322940a87c2b45dd0061b0f45
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/global/i18n_standard/intljs/project/entry/package.json b/global/i18n_standard/intljs/project/entry/package.json
new file mode 100755
index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/package.json
@@ -0,0 +1 @@
+{}
diff --git a/global/i18n_standard/intljs/project/entry/src/main/config.json b/global/i18n_standard/intljs/project/entry/src/main/config.json
new file mode 100755
index 0000000000000000000000000000000000000000..93b41af1b5ab444551db8a1fa7c535f2d6e3eced
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/src/main/config.json
@@ -0,0 +1,59 @@
+{
+ "app": {
+ "bundleName": "ohos.intl.test",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 4
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.intl.test",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "ohos.intl.test.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "MyApplication",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
diff --git a/global/i18n_standard/intljs/project/entry/src/main/js/default/app.js b/global/i18n_standard/intljs/project/entry/src/main/js/default/app.js
new file mode 100755
index 0000000000000000000000000000000000000000..044bffa75e29d7a5fe32644e19cc1bbbc5e9a7b1
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/src/main/js/default/app.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
diff --git a/global/i18n_standard/intljs/project/entry/src/main/js/default/i18n/en-US.json b/global/i18n_standard/intljs/project/entry/src/main/js/default/i18n/en-US.json
new file mode 100755
index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/project/entry/src/main/js/default/i18n/zh-CN.json b/global/i18n_standard/intljs/project/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100755
index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/project/entry/src/main/js/default/pages/index/index.css b/global/i18n_standard/intljs/project/entry/src/main/js/default/pages/index/index.css
new file mode 100755
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/global/i18n_standard/intljs/project/entry/src/main/js/default/pages/index/index.hml b/global/i18n_standard/intljs/project/entry/src/main/js/default/pages/index/index.hml
new file mode 100755
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/global/i18n_standard/intljs/project/entry/src/main/js/default/pages/index/index.js b/global/i18n_standard/intljs/project/entry/src/main/js/default/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..99b0dfa952b02336bdc6f5c4cdec7c383ddd250b
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import file from '@system.file'
+import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ const reportExtend = new ReportExtend(file)
+ core.addService('expect', expectExtend)
+ core.addService('report', reportExtend)
+ core.init()
+
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+
+ },
+ onReady() {
+ },
+}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/project/entry/src/main/js/test/I18n.test.js b/global/i18n_standard/intljs/project/entry/src/main/js/test/I18n.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..affd08df08afc846dd05e82702e4ea8e9e46ab18
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/src/main/js/test/I18n.test.js
@@ -0,0 +1,86 @@
+/*
+ * 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 Intl from "@ohos.intl"
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
+
+describe('intlTest', function () {
+ console.log("*************00000000000000000000000*************");
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_0100
+ * @tc.name format the language in locale
+ * @tc.desc check the language
+ */
+ it('locale_test_001', 0, function () {
+ var locale = new Intl.Locale("en-Latn-GB");
+ console.log("jessie " + locale.language);
+ expect(locale.language).assertEqual("en");
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_0200
+ * @tc.name format the script in locale
+ * @tc.desc check the script
+ */
+ it('locale_test_002', 0, function () {
+ var locale = new Intl.Locale("en-Latn-GB");
+ console.log("jessie " + locale.script);
+ expect(locale.script).assertEqual("Latn");
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_0300
+ * @tc.name format the region in locale
+ * @tc.desc check the region
+ */
+ it('locale_test_003', 0, function () {
+ var locale = new Intl.Locale("en-Latn-GB");
+ console.log("jessie " + locale.region);
+ expect(locale.region).assertEqual("GB");
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_0400
+ * @tc.name format the basename in locale
+ * @tc.desc check the basename
+ */
+ it('locale_test_004', 0, function () {
+ var locale = new Intl.Locale("en-Latn-GB");
+ console.log("jessie " + locale.baseName);
+ expect(locale.baseName).assertEqual("en-Latn-GB");
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_0500
+ * @tc.name format the datetime with en-GB locale
+ * @tc.desc check the datetime is not null
+ */
+ it('dateTimeFormat_test_001', 0, function () {
+ var datefmt = new Intl.DateTimeFormat("en-GB");
+ expect(datefmt != null).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_0600
+ * @tc.name format the date with en-GB locale
+ * @tc.desc check the date
+ */
+ it('formatDateTimeFormat_test_001', 0, function () {
+ var date = new Date(2021, 11, 17, 3, 24, 0);
+ var datefmt = new Intl.DateTimeFormat("en-GB");
+ expect(datefmt.format(date)).assertEqual('17 Dec 2021');
+ })
+ console.log("*************00000000000000000000000*************");
+})
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/project/entry/src/main/js/test/List.test.js b/global/i18n_standard/intljs/project/entry/src/main/js/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..1b82a01ce4c1af2812b7a7413455ef95e4e589b9
--- /dev/null
+++ b/global/i18n_standard/intljs/project/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('./I18n.test.js')
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/project/entry/src/main/resources/base/element/string.json b/global/i18n_standard/intljs/project/entry/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..fac1f3a7cbdd54561048bb8e4211abd3340efe97
--- /dev/null
+++ b/global/i18n_standard/intljs/project/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "L2Test"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/project/entry/src/main/resources/base/media/icon.png b/global/i18n_standard/intljs/project/entry/src/main/resources/base/media/icon.png
new file mode 100755
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/global/i18n_standard/intljs/project/entry/src/main/resources/base/media/icon.png differ
diff --git a/global/i18n_standard/intljs/project/gradle.properties b/global/i18n_standard/intljs/project/gradle.properties
new file mode 100755
index 0000000000000000000000000000000000000000..c555b4e6a519b939a3e954391a3f0772335ad7cf
--- /dev/null
+++ b/global/i18n_standard/intljs/project/gradle.properties
@@ -0,0 +1,10 @@
+# Project-wide Gradle settings.
+# IDE (e.g. DevEco Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# If the Chinese output is garbled, please configure the following parameter.
+# org.gradle.jvmargs=-Dfile.encoding=GBK
diff --git a/global/i18n_standard/intljs/project/settings.gradle b/global/i18n_standard/intljs/project/settings.gradle
new file mode 100755
index 0000000000000000000000000000000000000000..28d595f2fba0d06b2025da200383d15f87c4e9f0
--- /dev/null
+++ b/global/i18n_standard/intljs/project/settings.gradle
@@ -0,0 +1 @@
+include ':entry'
diff --git a/global/i18n_standard/zone/src/BUILD.gn b/global/i18n_standard/zone/src/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..2d372966c3b019c590f2a7af27d12304096e4986
--- /dev/null
+++ b/global/i18n_standard/zone/src/BUILD.gn
@@ -0,0 +1,56 @@
+# 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")
+
+#SUBSYSTEM_DIR = "//base/global"
+module_output_path = "hit/global"
+
+ohos_moduletest_suite("ZoneUtiltest") {
+ module_out_path = module_output_path
+
+ sources = [
+ "//third_party/googletest/googletest/src/gtest-death-test.cc",
+ "//third_party/googletest/googletest/src/gtest-filepath.cc",
+ "//third_party/googletest/googletest/src/gtest-port.cc",
+ "//third_party/googletest/googletest/src/gtest-printers.cc",
+ "//third_party/googletest/googletest/src/gtest-test-part.cc",
+ "//third_party/googletest/googletest/src/gtest-typed-test.cc",
+ "//third_party/googletest/googletest/src/gtest.cc",
+ "//third_party/googletest/googletest/src/gtest_main.cc",
+ "//third_party/googletest/googletest/src/hwext/gtest-ext.cc",
+ "//third_party/googletest/googletest/src/hwext/gtest-filter.cc",
+ "//third_party/googletest/googletest/src/hwext/gtest-tag.cc",
+ "//third_party/googletest/googletest/src/hwext/gtest-utils.cc",
+ "zone_util_test.cpp",
+ ]
+
+ remove_configs = [ "//build/config/compiler:no_rtti" ]
+ cflags_cc = [ "-frtti" ]
+ include_dirs = [
+ "//third_party/googletest/googletest/include",
+ "//third_party/googletest/googletest",
+ "//base/global/i18n_standard/interfaces/native/innerkits/zone/include",
+ "//third_party/icu/icu4c/source/common/unicode",
+ "//third_party/icu/icu4c/source/common",
+ "//third_party/libphonenumber/cpp/src",
+ "//third_party/protobuf/src",
+ "//third_party/protobuf/src/google",
+ "//third_party/protobuf/src/google/protobuf",
+ ]
+ deps = [
+ "//base/global/i18n_standard/frameworks/zone:zone_util",
+ "//third_party/libphonenumber/cpp:phonenumber_standard",
+ "//utils/native/base:utils",
+ ]
+}
diff --git a/global/i18n_standard/zone/src/Test.json b/global/i18n_standard/zone/src/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..cf093bb1027a42f84d196b29e5e0b03a01e10671
--- /dev/null
+++ b/global/i18n_standard/zone/src/Test.json
@@ -0,0 +1,21 @@
+{
+ "kits": [
+ {
+ "push": [
+ "ZoneUtiltest->/data/local/tmp/ZoneUtiltest"
+ ],
+ "type": "PushKit",
+ "post-push": [
+ "chmod -R 777 /data/local/tmp/*"
+ ]
+ }
+ ],
+ "driver": {
+ "native-test-timeout": "120000",
+ "type": "CppTest",
+ "module-name": "ZoneUtiltest",
+ "runtime-hint": "1s",
+ "native-test-device-path": "/data/local/tmp"
+ },
+ "description": "Configuration for ZoneUtiltest Tests"
+}
\ No newline at end of file
diff --git a/global/i18n_standard/zone/src/zone_util_test.cpp b/global/i18n_standard/zone/src/zone_util_test.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..b253b5780174921e4e91a8352ae18df09e5c4f60
--- /dev/null
+++ b/global/i18n_standard/zone/src/zone_util_test.cpp
@@ -0,0 +1,443 @@
+/*
+ * 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.
+ */
+
+#include
+
+#include "zone_util_test.h"
+#include "zone_util.h"
+
+namespace OHOS {
+using namespace std;
+using namespace testing;
+using namespace testing::ext;
+using namespace OHOS::Global::I18n;
+
+class ZoneUtilTest : public testing::Test {};
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_ONEPARAM_0100
+ * @tc.name the input country code have multiple timezones
+ * @tc.desc Test GetDefaultZone(country) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZoneTest0100, Function | MediumTest | Level3)
+{
+ string expects[] = { "Antarctica/McMurdo", "America/Argentina/Buenos_Aires", "Australia/Sydney", "America/Noronha",
+ "America/St_Johns", "Africa/Kinshasa", "America/Santiago", "Asia/Shanghai", "Asia/Nicosia", "Europe/Berlin",
+ "America/Guayaquil", "Europe/Madrid", "Pacific/Pohnpei", "America/Godthab", "Asia/Jakarta", "Pacific/Tarawa",
+ "Asia/Almaty", "Pacific/Majuro", "Asia/Ulaanbaatar", "America/Mexico_City", "Asia/Kuala_Lumpur", "Pacific/Auckland",
+ "Pacific/Tahiti", "Pacific/Port_Moresby", "Asia/Gaza", "Europe/Lisbon", "Europe/Moscow", "Europe/Kiev",
+ "Pacific/Wake", "America/New_York", "Asia/Tashkent" };
+ string countries[] = { "AQ", "AR", "AU", "BR", "CA", "CD", "CL", "CN", "CY", "DE", "EC", "ES", "FM", "GL", "ID",
+ "KI", "KZ", "MH", "MN", "MX", "MY", "NZ", "PF", "PG", "PS", "PT", "RU", "UA", "UM", "US", "UZ" };
+ int count = size(expects);
+ ZoneUtil util;
+ for (int i = 0; i < count; ++i) {
+ string out = util.GetDefaultZone(countries[i].c_str());
+ EXPECT_EQ(out, expects[i]);
+ }
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_ONEPARAM_0200
+ * @tc.name the input country code have one timezone
+ * @tc.desc Test GetDefaultZone(country) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZoneTest0200, Function | MediumTest | Level1)
+{
+ string expects[] = { "Asia/Kabul", "Europe/Sarajevo", "Africa/Abidjan", "Africa/Lusaka" };
+ string countries[] = { "AF", "BA", "CI", "ZM" };
+ int count = size(expects);
+ ZoneUtil util;
+ for (int i = 0; i < count; ++i) {
+ string out = util.GetDefaultZone(countries[i].c_str());
+ EXPECT_EQ(out, expects[i]);
+ }
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_ONEPARAM_0300
+ * @tc.name the input country code is lowercase style
+ * @tc.desc Test GetDefaultZone(country) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZoneTest0300, Function | MediumTest | Level3)
+{
+ string expects[] = { "Asia/Shanghai", "America/New_York" };
+ string countries[] = { "cn", "us" };
+ int count = size(countries);
+ ZoneUtil util;
+ for (int i = 0; i < count; ++i) {
+ string out = util.GetDefaultZone(countries[i].c_str());
+ EXPECT_EQ(out, expects[i]);
+ }
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_ONEPARAM_0400
+ * @tc.name the input country code not exist
+ * @tc.desc Test GetDefaultZone(country) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZoneTest0400, Function | MediumTest | Level3)
+{
+ ZoneUtil util;
+ string out = util.GetDefaultZone("AAA");
+ EXPECT_EQ(out, "");
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_ONEPARAM_0500
+ * @tc.name the input country code is number
+ * @tc.desc Test GetDefaultZone(country) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZoneTest0500, Function | MediumTest | Level3)
+{
+ ZoneUtil util;
+ string out = util.GetDefaultZone("123");
+ EXPECT_EQ(out, "");
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_ONEPARAM_0600
+ * @tc.name the input country code is null
+ * @tc.desc Test GetDefaultZone(country) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZoneTest0600, Function | MediumTest | Level4)
+{
+ ZoneUtil util;
+ string out = util.GetDefaultZone("");
+ EXPECT_EQ(out, "");
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_TWOPARAM_0100
+ * @tc.name the input country code have multiple timezones,the offerset matches one timezone
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZone2Test0100, Function | MediumTest | Level3)
+{
+ string expects[] = { "Asia/Shanghai", "America/Detroit" };
+ int32_t offsets[] = { 3600 * 1000 * 8, -3600 * 1000 * 5 };
+ string countries[] = { "CN", "US" };
+ int count = size(expects);
+ ZoneUtil util;
+ for (int i = 0; i < count; ++i) {
+ string out = util.GetDefaultZone(countries[i].c_str(), offsets[i]);
+ EXPECT_EQ(out, expects[i]);
+ }
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_TWOPARAM_0200
+ * @tc.name the input country code have multiple timezones,the offerset not matches anyone timezone
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZone2Test0200, Function | MediumTest | Level3)
+{
+ int32_t offsets[] = { 3600 * 1000 * 1, -3600 * 1000 * 1 };
+ string countries[] = { "CN", "US" };
+ int count = size(countries);
+ ZoneUtil util;
+ for (int i = 0; i < count; ++i) {
+ string out = util.GetDefaultZone(countries[i].c_str(), offsets[i]);
+ EXPECT_EQ(out, "");
+ }
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_TWOPARAM_0300
+ * @tc.name the input country code have one timezone,the offerset matches it
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZone2Test0300, Function | MediumTest | Level1)
+{
+ ZoneUtil util;
+ string out = util.GetDefaultZone("AF", 3600 * 1000 * 4.5);
+ EXPECT_EQ(out, "Asia/Kabul");
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_TWOPARAM_0400
+ * @tc.name the input country code have one timezone,the offerset not matches it
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZone2Test0400, Function | MediumTest | Level3)
+{
+ ZoneUtil util;
+ string out = util.GetDefaultZone("AF", 3600 * 1000 * 1);
+ EXPECT_EQ(out, "");
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_TWOPARAM_0500
+ * @tc.name the input country code not exist with offset param in getDefaultZone
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZone2Test0500, Function | MediumTest | Level3)
+{
+ ZoneUtil util;
+ string out = util.GetDefaultZone("AAA", 3600 * 1000 * 8);
+ EXPECT_EQ(out, "");
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_TWOPARAM_0600
+ * @tc.name the input country code is number with offset param in getDefaultZone
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZone2Test0600, Function | MediumTest | Level3)
+{
+ ZoneUtil util;
+ string out = util.GetDefaultZone("123", 3600 * 1000 * 8);
+ EXPECT_EQ(out, "");
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETDEFAULTZONE_TWOPARAM_0700
+ * @tc.name the input country code is null with offset param in getDefaultZone
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetDefaultZone2Test0700, Function | MediumTest | Level3)
+{
+ ZoneUtil util;
+ string out = util.GetDefaultZone("", 3600 * 1000 * 8);
+ EXPECT_EQ(out, "");
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_TWOPARAM_0100
+ * @tc.name the input country code have multiple timezones in getZoneList
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneListTest0100, Function | MediumTest | Level3)
+{
+ vector expects = { "Asia/Shanghai", "Asia/Urumqi" };
+ string country = "CN";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, out);
+ EXPECT_EQ(expects.size(), out.size());
+ if (expects.size() == out.size()) {
+ for (decltype(expects.size()) i = 0; i < expects.size(); ++i) {
+ EXPECT_EQ(expects[i], out[i]);
+ }
+ }
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_TWOPARAM_0200
+ * @tc.name the input country code have one timezone in getZoneList
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneListTest0200, Function | MediumTest | Level1)
+{
+ vector expects = { "Asia/Kabul" };
+ string country = "AF";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, out);
+ EXPECT_EQ(expects.size(), out.size());
+ if (expects.size() == out.size()) {
+ for (decltype(expects.size()) i = 0; i < expects.size(); ++i) {
+ EXPECT_EQ(expects[i], out[i]);
+ }
+ }
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_TWOPARAM_0300
+ * @tc.name the input country code not exist in getZoneList
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneListTest0300, Function | MediumTest | Level3)
+{
+ string country = "AAA";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, out);
+ size_t expect = 0;
+ EXPECT_EQ(expect, out.size());
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_TWOPARAM_0400
+ * @tc.name the input country code is number in getZoneList
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneListTest0400, Function | MediumTest | Level3)
+{
+ string country = "123";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, out);
+ size_t expect = 0;
+ EXPECT_EQ(expect, out.size());
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_TWOPARAM_0500
+ * @tc.name the input country code is null in getZoneList
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneListTest0500, Function | MediumTest | Level3)
+{
+ string country = "";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, out);
+ size_t expect = 0;
+ EXPECT_EQ(expect, out.size());
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_THREEPARAM_0100
+ * @tc.name the input country code have multiple timezones with three params in getZoneList ,the offset matches one
+ * timezone
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneList2Test0100, Function | MediumTest | Level3)
+{
+ vector expects = { "Asia/Shanghai" };
+ string country = "CN";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, 3600 * 1000 * 8, out);
+ EXPECT_EQ(expects.size(), out.size());
+ if (expects.size() == out.size()) {
+ for (decltype(expects.size()) i = 0; i < expects.size(); ++i) {
+ EXPECT_EQ(expects[i], out[i]);
+ }
+ }
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_THREEPARAM_0200
+ * @tc.name the input country code have multiple timezones with three params in getZoneList ,the offset not matches
+ * anyone timezone
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneList2Test0200, Function | MediumTest | Level3)
+{
+ string country = "CN";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, 3600 * 1000 * 1, out);
+ size_t expect = 0;
+ EXPECT_EQ(expect, out.size());
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_THREEPARAM_0300
+ * @tc.name the input country code have one timezone with three params in getZoneList ,the offset matches
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneList2Test0300, Function | MediumTest | Level3)
+{
+ vector expects = { "Europe/London" };
+ string country = "GB";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, 3600 * 1000 * 1, out);
+ EXPECT_EQ(expects.size(), out.size());
+ if (expects.size() == out.size()) {
+ for (decltype(expects.size()) i = 0; i < expects.size(); ++i) {
+ EXPECT_EQ(expects[i], out[i]);
+ }
+ }
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_THREEPARAM_0400
+ * @tc.name the input country code have one timezone with three params in getZoneList ,the offset not match
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneList2Test0400, Function | MediumTest | Level3)
+{
+ string country = "GB";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, 3600 * 1000 * 5, out);
+ size_t expect = 0;
+ EXPECT_EQ(expect, out.size());
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_THREEPARAM_0500
+ * @tc.name the input country code not exist with three params in getZoneList
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneList2Test0500, Function | MediumTest | Level3)
+{
+ string country = "GGG";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, 3600 * 1000 * 5, out);
+ size_t expect = 0;
+ EXPECT_EQ(expect, out.size());
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_THREEPARAM_0600
+ * @tc.name the input country code is number with three params in getZoneList
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneList2Test0600, Function | MediumTest | Level3)
+{
+ string country = "123";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, 3600 * 1000 * 5, out);
+ size_t expect = 0;
+ EXPECT_EQ(expect, out.size());
+}
+
+/* *
+ * @tc.number SUB_GLOBAL_I18N_TIMEZONE_GETZONELIST_THREEPARAM_0700
+ * @tc.name the input country code is null with three params in getZoneList
+ * @tc.desc Test GetDefaultZone(country, offset) function.
+ * @tc.require SR000FK13G
+ */
+HWTEST_F(ZoneUtilTest, GetZoneList2Test0700, Function | MediumTest | Level3)
+{
+ string country = "";
+ vector out;
+ ZoneUtil util;
+ util.GetZoneList(country, 3600 * 1000 * 5, out);
+ size_t expect = 0;
+ EXPECT_EQ(expect, out.size());
+}
+}
diff --git a/global/i18n_standard/zone/src/zone_util_test.h b/global/i18n_standard/zone/src/zone_util_test.h
new file mode 100755
index 0000000000000000000000000000000000000000..b94721c9e0068b78847c48e1b8c0ed9c6db5a216
--- /dev/null
+++ b/global/i18n_standard/zone/src/zone_util_test.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OHOS_GLOBAL_I18N_ZONE_UTIL_TEST_H
+#define OHOS_GLOBAL_I18N_ZONE_UTIL_TEST_H
+
+int GetDefaultZoneTest0100();
+int GetDefaultZoneTest0200();
+int GetDefaultZoneTest0300();
+int GetDefaultZoneTest0400();
+int GetDefaultZoneTest0500();
+int GetDefaultZoneTest0600();
+int GetDefaultZone2Test0100();
+int GetDefaultZone2Test0200();
+int GetDefaultZone2Test0300();
+int GetDefaultZone2Test0400();
+int GetDefaultZone2Test0500();
+int GetDefaultZone2Test0600();
+int GetDefaultZone2Test0700();
+int GetZoneListTest0100();
+int GetZoneListTest0200();
+int GetZoneListTest0300();
+int GetZoneListTest0400();
+int GetZoneListTest0500();
+int GetZoneList2Test0100();
+int GetZoneList2Test0200();
+int GetZoneList2Test0300();
+int GetZoneList2Test0400();
+int GetZoneList2Test0500();
+int GetZoneList2Test0600();
+int GetZoneList2Test0700();
+
+#endif
diff --git a/global/resmgr_standard/resmgrjs/BUILD.gn b/global/resmgr_standard/resmgrjs/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..e1eda731c1aa14553af8bbc900f886652a42e984
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/BUILD.gn
@@ -0,0 +1,19 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("resmgrjs_test") {
+ test_hap_name = "resmgrjs"
+ hap_source_path = "hap/entry-debug-signed.hap"
+}
diff --git a/global/resmgr_standard/resmgrjs/Test.json b/global/resmgr_standard/resmgrjs/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..fe3d2203158fa922495741c6b1af23c5ab27bd58
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for resmgrjs Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "21600000",
+ "package": "ohos.resmgr.test",
+ "shell-timeout": "21600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "resmgrjs.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/global/resmgr_standard/resmgrjs/hap/entry-debug-signed.hap b/global/resmgr_standard/resmgrjs/hap/entry-debug-signed.hap
new file mode 100755
index 0000000000000000000000000000000000000000..f4c080fefc0ad5c3cd3d285722498e0d0552471c
Binary files /dev/null and b/global/resmgr_standard/resmgrjs/hap/entry-debug-signed.hap differ
diff --git a/global/resmgr_standard/resmgrjs/project/.gitignore b/global/resmgr_standard/resmgrjs/project/.gitignore
new file mode 100755
index 0000000000000000000000000000000000000000..ebdd23d29a08bffe35d1c4f0a21b058393fd9dba
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/.gitignore
@@ -0,0 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
diff --git a/global/resmgr_standard/resmgrjs/project/entry/.gitignore b/global/resmgr_standard/resmgrjs/project/entry/.gitignore
new file mode 100755
index 0000000000000000000000000000000000000000..3543521e9fef8e7322940a87c2b45dd0061b0f45
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/global/resmgr_standard/resmgrjs/project/entry/package.json b/global/resmgr_standard/resmgrjs/project/entry/package.json
new file mode 100755
index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/package.json
@@ -0,0 +1 @@
+{}
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/config.json b/global/resmgr_standard/resmgrjs/project/entry/src/main/config.json
new file mode 100755
index 0000000000000000000000000000000000000000..1f9574bd20043477910909860e163fd117b0ed3b
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/src/main/config.json
@@ -0,0 +1,59 @@
+{
+ "app": {
+ "bundleName": "ohos.resmgr.test",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 4
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.resmgr.test",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "ohos.resmgr.test.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "MyApplication",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/app.js b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/app.js
new file mode 100755
index 0000000000000000000000000000000000000000..298a2b862eda6d614cecca0a1647a78434ab8327
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/app.js
@@ -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 device from '@system.device';
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/i18n/en-US.json b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/i18n/en-US.json
new file mode 100755
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/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/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/i18n/zh-CN.json b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100755
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/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/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/pages/index/index.css b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/pages/index/index.css
new file mode 100755
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/pages/index/index.hml b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/pages/index/index.hml
new file mode 100755
index 0000000000000000000000000000000000000000..1c26cf73deab18390844a53a103458b10ed11e93
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/pages/index/index.js b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..23f18c37e90df5adaa14ad210611ea10f8d0121f
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/default/pages/index/index.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import file from '@system.file'
+import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ const reportExtend = new ReportExtend(file)
+ core.addService('expect', expectExtend)
+ core.addService('report', reportExtend)
+ core.init()
+
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/js/test/List.test.js b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..ce1ef0692f7e9d1e3b94a318dd7f39089045357c
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/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('./Resmgr.test.js')
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/js/test/Resmgr.test.js b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/test/Resmgr.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..51f5ed36634e0cd99fa21ba5b0df3888bbf5cf5a
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/src/main/js/test/Resmgr.test.js
@@ -0,0 +1,246 @@
+/*
+ * 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 resmgr from "@ohos.resmgr"
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
+
+describe('resMgrTest', function () {
+ console.log("*************00000000000000000000000*************");
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_0100
+ * @tc.name test getResourceManager method in callback mode
+ * @tc.desc get the resource manager in callback mode
+ */
+ it('getResourceManager_test_001', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ expect(mgr != null).assertTrue();
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_0200
+ * @tc.name test getResourceManager method in callback mode with bundlename
+ * @tc.desc get the resource manager in callback mode with bundlename
+ */
+ it('getResourceManager_test_002', 0, function () {
+ resmgr.getResourceManager("com.ohos.settings", (error, mgr) => {
+ expect(mgr != null).assertTrue();
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_0300
+ * @tc.name test getResourceManager method in promise mode
+ * @tc.desc get the resource manager in promise mode
+ */
+ it('getResourceManager_test_001', 0, function () {
+ resmgr.getResourceManager().then(mgr => {
+ expect(mgr != null).assertTrue();
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_0400
+ * @tc.name test getResourceManager method in promise mode with bundlename
+ * @tc.desc get the resource manager in promise mode with bundlename
+ */
+ it('getResourceManager_test_002', 0, function () {
+ resmgr.getResourceManager("com.ohos.settings").then(mgr => {
+ expect(mgr != null).assertTrue();
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_0500
+ * @tc.name test getString method in callback mode
+ * @tc.desc get the string in callback mode
+ */
+ it('getString_test_001', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getString(0x1000000, (err, value) => {
+ expect(value != null).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_0600
+ * @tc.name test getString method in promise mode
+ * @tc.desc get the string in promise mode
+ */
+ it('getString_test_002', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getString(0x1000000).then(value => {
+ expect(value != null).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_0700
+ * @tc.name test getStringArray method in callback mode
+ * @tc.desc get the string array in callback mode
+ */
+ it('getStringArray_test_001', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getStringArray(0x1000002, (err, value) => {
+ expect(value != null).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_0800
+ * @tc.name test getStringArray method in promise mode
+ * @tc.desc get the string array in promise mode
+ */
+ it('getStringArray_test_002', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getStringArray(0x1000002).then(value => {
+ expect(value != null).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_0900
+ * @tc.name test getMedia method in callback mode
+ * @tc.desc get the media in callback mode
+ */
+ it('getMedia_test_001', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getMedia(0x1000004, (err, value) => {
+ expect(value.length > 0).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_1000
+ * @tc.name test getMedia method in promise mode
+ * @tc.desc get the media in promise mode
+ */
+ it('getMedia_test_002', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getMedia(0x1000004).then(value => {
+ expect(value.length > 0).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_1100
+ * @tc.name test getMediaBase64 method in callback mode
+ * @tc.desc get the media base64 in callback mode
+ */
+ it('getMediaBase64_test_001', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getMediaBase64(0x1000004, (err, value) => {
+ expect(value.length > 0).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_1200
+ * @tc.name test getMediaBase64 method in promise mode
+ * @tc.desc get the media base64 in promise mode
+ */
+ it('getMediaBase64_test_002', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getMediaBase64(0x1000004).then(value => {
+ expect(value.length > 0).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_1300
+ * @tc.name test getConfiguration method in callback mode
+ * @tc.desc get the configuration in callback mode
+ */
+ it('getConfiguration_test_001', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getConfiguration((error, cfg) => {
+ expect(cfg != null).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_1400
+ * @tc.name test getConfiguration method in promise mode
+ * @tc.desc get the configuration in promise mode
+ */
+ it('getConfiguration_test_002', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getConfiguration().then(cfg => {
+ expect(cfg != null).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_1500
+ * @tc.name test getDeviceCapability method in callback mode
+ * @tc.desc get the device capability in callback mode
+ */
+ it('getDeviceCapability_test_001', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getDeviceCapability((error, dc) => {
+ expect(dc != null).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_1600
+ * @tc.name test getDeviceCapability method in promise mode
+ * @tc.desc get the device capability in promise mode
+ */
+ it('getDeviceCapability_test_002', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getDeviceCapability().then(dc => {
+ expect(dc != null).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_1700
+ * @tc.name test getPluralString method in callback mode
+ * @tc.desc get the plural string in callback mode
+ */
+ it('getPluralString_test_001', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getPluralString(0x1000003, 1, (error, value) => {
+ expect(value != null).assertTrue();
+ })
+ })
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_RESMGR_JS_1800
+ * @tc.name test getPluralString method in promise mode
+ * @tc.desc get the plural string in promise mode
+ */
+ it('getPluralString_test_002', 0, function () {
+ resmgr.getResourceManager((error, mgr) => {
+ mgr.getPluralString(0x1000003, 1).then(value => {
+ expect(value != null).assertTrue();
+ })
+ })
+ })
+})
\ No newline at end of file
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/element/plural.json b/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/element/plural.json
new file mode 100755
index 0000000000000000000000000000000000000000..5df662491e2cba0cc4ca28cb1547351bea8a78f3
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/element/plural.json
@@ -0,0 +1,33 @@
+{
+ "plural":[
+ {
+ "name":"plural_name",
+ "value":[
+ {
+ "quantity":"zero",
+ "value":"%d test zero"
+ },
+ {
+ "quantity":"one",
+ "value":"%d test one"
+ },
+ {
+ "quantity":"two",
+ "value":"%d test two"
+ },
+ {
+ "quantity":"few",
+ "value":"%d test few"
+ },
+ {
+ "quantity":"many",
+ "value":"%d test many"
+ },
+ {
+ "quantity":"other",
+ "value":"%d test other"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/element/strarray.json b/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/element/strarray.json
new file mode 100755
index 0000000000000000000000000000000000000000..31980e251c888917c7cbccbcdfcb900f376f4557
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/element/strarray.json
@@ -0,0 +1,21 @@
+{
+ "strarray": [
+ {
+ "name": "sizeList",
+ "value":[
+ {
+ "value":"small"
+ },
+ {
+ "value":"middle"
+ },
+ {
+ "value":"large"
+ },
+ {
+ "value":"extra large"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/element/string.json b/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..fac1f3a7cbdd54561048bb8e4211abd3340efe97
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "L2Test"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/media/icon.png b/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/media/icon.png
new file mode 100755
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/global/resmgr_standard/resmgrjs/project/entry/src/main/resources/base/media/icon.png differ
diff --git a/global/resmgr_standard/resmgrjs/project/gradle.properties b/global/resmgr_standard/resmgrjs/project/gradle.properties
new file mode 100755
index 0000000000000000000000000000000000000000..c555b4e6a519b939a3e954391a3f0772335ad7cf
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/gradle.properties
@@ -0,0 +1,10 @@
+# Project-wide Gradle settings.
+# IDE (e.g. DevEco Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# If the Chinese output is garbled, please configure the following parameter.
+# org.gradle.jvmargs=-Dfile.encoding=GBK
diff --git a/global/resmgr_standard/resmgrjs/project/settings.gradle b/global/resmgr_standard/resmgrjs/project/settings.gradle
new file mode 100755
index 0000000000000000000000000000000000000000..28d595f2fba0d06b2025da200383d15f87c4e9f0
--- /dev/null
+++ b/global/resmgr_standard/resmgrjs/project/settings.gradle
@@ -0,0 +1 @@
+include ':entry'
diff --git a/graphic/BUILD.gn b/graphic/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..286048987a5b6e6fb280c050a37a47e843b75e10
--- /dev/null
+++ b/graphic/BUILD.gn
@@ -0,0 +1,25 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build/ohos_var.gni")
+group("graphic") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "windowstandard:window_hap_test" ]
+ } else {
+ deps = [
+ "appaccount:appaccount_hap",
+ "osaccount:osaccount_hap",
+ ]
+ }
+}
diff --git a/graphic/windowstandard/BUILD.gn b/graphic/windowstandard/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..b5a8b0a78e952096cfcf90498a7c15e8024e4af3
--- /dev/null
+++ b/graphic/windowstandard/BUILD.gn
@@ -0,0 +1,19 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("window_hap_test") {
+ test_hap_name = "windowhaptest"
+ hap_source_path = "hap/entry-debug-rich-signed.hap"
+}
diff --git a/graphic/windowstandard/Test.json b/graphic/windowstandard/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..1c6f1f05debcd3c85ec6e2bdf489b74f1433d55d
--- /dev/null
+++ b/graphic/windowstandard/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "21600000",
+ "package": "com.test.window",
+ "shell-timeout": "21600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "windowhaptest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/graphic/windowstandard/hap/entry-debug-rich-signed.hap b/graphic/windowstandard/hap/entry-debug-rich-signed.hap
new file mode 100644
index 0000000000000000000000000000000000000000..f0d0213060f372198a3cdb793f3ba423914dad3d
Binary files /dev/null and b/graphic/windowstandard/hap/entry-debug-rich-signed.hap differ
diff --git a/graphic/windowstandard/project/.gitignore b/graphic/windowstandard/project/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..82dc42bd41e44f0a17e007c62feabac9a3f35d72
--- /dev/null
+++ b/graphic/windowstandard/project/.gitignore
@@ -0,0 +1,15 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+/entry/.preview
+.cxx
diff --git a/graphic/windowstandard/project/.idea/.gitignore b/graphic/windowstandard/project/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..eaf91e2ac647df635a09f01b8a2a254252aae8d7
--- /dev/null
+++ b/graphic/windowstandard/project/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/graphic/windowstandard/project/.idea/compiler.xml b/graphic/windowstandard/project/.idea/compiler.xml
new file mode 100644
index 0000000000000000000000000000000000000000..245a82c8279131bde0c8c09a1f1791c8b0312984
--- /dev/null
+++ b/graphic/windowstandard/project/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/graphic/windowstandard/project/.idea/gradle.xml b/graphic/windowstandard/project/.idea/gradle.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3c3ca2ca42e21615fa80d3ba2ec90019fd843d3a
--- /dev/null
+++ b/graphic/windowstandard/project/.idea/gradle.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/graphic/windowstandard/project/.idea/jarRepositories.xml b/graphic/windowstandard/project/.idea/jarRepositories.xml
new file mode 100644
index 0000000000000000000000000000000000000000..aa00d771aa98b60cc8db06b5e24919c06b208cda
--- /dev/null
+++ b/graphic/windowstandard/project/.idea/jarRepositories.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/graphic/windowstandard/project/.idea/misc.xml b/graphic/windowstandard/project/.idea/misc.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9883d055f8725da2d0f5c1cecc525b815e5dfcec
--- /dev/null
+++ b/graphic/windowstandard/project/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/graphic/windowstandard/project/.idea/vcs.xml b/graphic/windowstandard/project/.idea/vcs.xml
new file mode 100644
index 0000000000000000000000000000000000000000..851444e0bd79e22cce04abf8482b2c54ebc0121e
--- /dev/null
+++ b/graphic/windowstandard/project/.idea/vcs.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/graphic/windowstandard/project/entry/.gitignore b/graphic/windowstandard/project/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..3543521e9fef8e7322940a87c2b45dd0061b0f45
--- /dev/null
+++ b/graphic/windowstandard/project/entry/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/graphic/windowstandard/project/entry/package.json b/graphic/windowstandard/project/entry/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f
--- /dev/null
+++ b/graphic/windowstandard/project/entry/package.json
@@ -0,0 +1 @@
+{}
diff --git a/graphic/windowstandard/project/entry/src/main/config.json b/graphic/windowstandard/project/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..ffdb5fff55bd401858c0b09bf8095e0ae1332252
--- /dev/null
+++ b/graphic/windowstandard/project/entry/src/main/config.json
@@ -0,0 +1,61 @@
+{
+ "app": {
+ "bundleName": "com.test.window",
+ "vendor": "test",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 5,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.test.window",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "com.test.window.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard",
+ "isVisible": "true"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/graphic/windowstandard/project/entry/src/main/js/default/app.js b/graphic/windowstandard/project/entry/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..1a469fd202c18a1e070e0c088005d5bb68243a13
--- /dev/null
+++ b/graphic/windowstandard/project/entry/src/main/js/default/app.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/graphic/windowstandard/project/entry/src/main/js/default/i18n/en-US.json b/graphic/windowstandard/project/entry/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/graphic/windowstandard/project/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/graphic/windowstandard/project/entry/src/main/js/default/i18n/zh-CN.json b/graphic/windowstandard/project/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/graphic/windowstandard/project/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/graphic/windowstandard/project/entry/src/main/js/default/pages/index/index.css b/graphic/windowstandard/project/entry/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/graphic/windowstandard/project/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/graphic/windowstandard/project/entry/src/main/js/default/pages/index/index.hml b/graphic/windowstandard/project/entry/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/graphic/windowstandard/project/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/graphic/windowstandard/project/entry/src/main/js/default/pages/index/index.js b/graphic/windowstandard/project/entry/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..71ab9571ed503a6e53147fdfb37bc408f774cf6d
--- /dev/null
+++ b/graphic/windowstandard/project/entry/src/main/js/default/pages/index/index.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.
+ */
+import {Core} from 'deccjsunit/lite'
+const core = Core.getInstance()
+core.init()
+require('../../../test/List.test.js')
+core.execute()
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
diff --git a/graphic/windowstandard/project/entry/src/main/js/test/List.test.js b/graphic/windowstandard/project/entry/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a6c2cae20573f0db3c72912d67bf103cedb13e1c
--- /dev/null
+++ b/graphic/windowstandard/project/entry/src/main/js/test/List.test.js
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+require('./ExampleJsunit.test.js')
+require('./window.test.js')
diff --git a/graphic/windowstandard/project/entry/src/main/js/test/window.test.js b/graphic/windowstandard/project/entry/src/main/js/test/window.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..6c8c83851bc1ed1fb8929d554e03fd128fec8e42
--- /dev/null
+++ b/graphic/windowstandard/project/entry/src/main/js/test/window.test.js
@@ -0,0 +1,302 @@
+/*
+ * 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 app from '@system.app'
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
+import window from '@ohos.window'
+
+
+describe('window_test', function(){
+ var wnd;
+ beforeAll(function(){
+ })
+ beforeEach(function(){
+ })
+ afterEach(function(){
+ })
+ afterAll(function(){
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_0100
+ * @tc.name Test getTopWindowTest.
+ * @tc.desc Test window.getTopWindow API function test.
+ */
+ it('getTopWindowTest', 0, function(){
+ console.log('jsunittest getTopWindowTest begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest getTopWindow wnd: ' + wnd)
+ assertTrue(wnd != null)
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_0200
+ * @tc.name Test movetest1.
+ * @tc.desc Test window.moveTo API function test1.
+ */
+ it('moveTest1', 0, function(){
+ console.log('jsunittest movetest1 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest movetest1 getTopWindow wnd: ' + wnd)
+ wnd.moveTo(200, 200).then(()=>{
+ console.log('jsunittest movetest1 wnd.moveTo(200, 200) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_0300
+ * @tc.name Test moveTest2.
+ * @tc.desc Test window.moveTo API function test2.
+ */
+ it('moveTest2', 0, function(){
+ console.log('jsunittest movetest2 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest movetest2 getTopWindow wnd: ' + wnd)
+ wnd.moveTo(100, 100).then(()=>{
+ console.log('jsunittest movetest2 wnd.moveTo(100, 100) success')
+ })
+ wnd.moveTo(0, 0).then(()=>{
+ console.log('jsunittest movetest2 wnd.moveTo(0, 0) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_0400
+ * @tc.name Test moveTest3.
+ * @tc.desc Test window.moveTo API function test3.
+ */
+ it('moveTest3', 0, function(){
+ console.log('jsunittest movetest3 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest movetest3 getTopWindow wnd: ' + wnd)
+ wnd.moveTo(20000, 20000).then(()=>{
+ console.log('jsunittest movetest3 wnd.moveTo(20000, 20000) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_0500
+ * @tc.name Test moveTest4.
+ * @tc.desc Test window.moveTo API function test4.
+ */
+ it('moveTest4', 0, function(){
+ console.log('jsunittest movetest4 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest movetest4 getTopWindow wnd: ' + wnd)
+ wnd.moveTo(-200, -200).then(()=>{
+ console.log('jsunittest movetest4 wnd.moveTo(-200, -200) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_0600
+ * @tc.name Test moveTest5.
+ * @tc.desc Test window.moveTo API function test5.
+ */
+ it('moveTest5', 0, function(){
+ console.log('jsunittest movetest5 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest movetest5 getTopWindow wnd: ' + wnd)
+ for (var i = 1; i <= 5; i++) {
+ wnd.moveTo(100, 100).then(()=>{
+ console.log('jsunittest movetest5 wnd.movetest5(100, 100) success, count:"%d\n"',i)
+ })
+ }
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_0700
+ * @tc.name Test resetSizeTest1.
+ * @tc.desc Test window.resetSize API function test1.
+ */
+ it('resetSizeTest1', 0, function(){
+ console.log('jsunittest resetSizeTest1 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest resetSizeTest1 getTopWindow wnd: ' + wnd)
+ wnd.resetSize(200, 600).then(()=>{
+ console.log('jsunittest resetSizeTest wnd.resetSize(200, 600) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_0800
+ * @tc.name Test resetSizeTest2.
+ * @tc.desc Test window.resetSize API function test2.
+ */
+ it('resetSizeTest2', 0, function(){
+ console.log('jsunittest resetSizeTest2 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest resetSizeTest2 getTopWindow wnd: ' + wnd)
+ wnd.resetSize(20000, 20000).then(()=>{
+ console.log('jsunittest resetSizeTest2 wnd.resetSize(20000, 20000) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_0900
+ * @tc.name Test resetSizeTest3.
+ * @tc.desc Test window.resetSize API function test3.
+ */
+ it('resetSizeTest3', 0, function(){
+ console.log('jsunittest resetSizeTest3 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest resetSizeTest3 getTopWindow wnd: ' + wnd)
+ wnd.resetSize(0, 0).then(()=>{
+ console.log('jsunittest resetSizeTest3 wnd.resetSize(0, 0) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_1000
+ * @tc.name Test resetSizeTest4.
+ * @tc.desc Test window.resetSize API function test4.
+ */
+ it('resetSizeTest4', 0, function(){
+ console.log('jsunittest resetSizeTest4 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest resetSizeTest4 getTopWindow wnd: ' + wnd)
+ wnd.resetSize(-1, -1).then(()=>{
+ console.log('jsunittest resetSizeTest4 wnd.resetSize(-1, -1) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_1100
+ * @tc.name Test resetSizeTest5.
+ * @tc.desc Test window.resetSize API function test5.
+ */
+ it('resetSizeTest5', 0, function(){
+ console.log('jsunittest resetSizeTest5 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest resetSizeTest5 getTopWindow wnd: ' + wnd)
+ for (var i = 1; i <= 5; i++) {
+ wnd.resetSize(100, 100).then(()=>{
+ console.log('jsunittest resetSizeTest5 wnd.resetSize(100, 100) success, count:"%d\n"',i)
+ })
+ }
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_1200
+ * @tc.name Test setWindowTypeTest1.
+ * @tc.desc Test window.setWindowType API function test1.
+ */
+ it('setWindowTypeTest1', 0, function(){
+ console.log('jsunittest setWindowTypeTest1 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest setWindowTypeTest1 getTopWindow wnd: ' + wnd)
+ wnd.setWindowType(0).then(()=>{
+ console.log('jsunittest setWindowTypeTest1 wnd.setWindowType(0) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_1300
+ * @tc.name Test setWindowTypeTest2.
+ * @tc.desc Test window.setWindowType API function test2.
+ */
+ it('setWindowTypeTest2', 0, function(){
+ console.log('jsunittest setWindowTypeTest2 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest setWindowTypeTest2 getTopWindow wnd: ' + wnd)
+ wnd.setWindowType(0).then(()=>{
+ console.log('jsunittest setWindowTypeTest2 wnd.setWindowType(0) success')
+ })
+ wnd.moveTo(200, 200).then(()=>{
+ console.log('jsunittest setWindowType1 wnd.moveTo(200, 200) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_1400
+ * @tc.name Test setWindowTypeTest3.
+ * @tc.desc Test window.setWindowType API function test3.
+ */
+ it('setWindowTypeTest3', 0, function(){
+ console.log('jsunittest setWindowTypeTest3 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest setWindowTypeTest3 getTopWindow wnd: ' + wnd)
+ wnd.setWindowType(0).then(()=>{
+ console.log('jsunittest setWindowTypeTest3 wnd.setWindowType(0) success')
+ })
+ wnd.resetSize(200, 400).then(()=>{
+ console.log('jsunittest setWindowTypeTest3 wnd.resetSize(200, 400) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_1500
+ * @tc.name Test setWindowTypeTest4.
+ * @tc.desc Test window.setWindowType API function test4.
+ */
+ it('setWindowTypeTest4', 0, function(){
+ console.log('jsunittest setWindowTypeTest4 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest setWindowTypeTest4 getTopWindow wnd: ' + wnd)
+ wnd.setWindowType(1).then(()=>{
+ console.log('jsunittest setWindowTypeTest4 wnd.setWindowType(1) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_1600
+ * @tc.name Test setWindowTypeTest5.
+ * @tc.desc Test window.setWindowType API function test5.
+ */
+ it('setWindowTypeTest5', 0, function(){
+ console.log('jsunittest setWindowTypeTest5 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest setWindowTypeTest5 getTopWindow wnd: ' + wnd)
+ wnd.setWindowType(1).then(()=>{
+ console.log('jsunittest setWindowTypeTest5 wnd.setWindowType(1) success')
+ })
+ wnd.moveTo(100, 100).then(()=>{
+ console.log('jsunittest setWindowTypeTest5 wnd.moveTo(100, 100) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_1700
+ * @tc.name Test setWindowTypeTest6.
+ * @tc.desc Test window.setWindowType API function test6.
+ */
+ it('setWindowTypeTest6', 0, function(){
+ console.log('jsunittest setWindowTypeTest6 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest setWindowTypeTest6 getTopWindow wnd: ' + wnd)
+ wnd.setWindowType(1).then(()=>{
+ console.log('jsunittest setWindowTypeTest6 wnd.setWindowType(1) success')
+ })
+ wnd.resetSize(100, 100).then(()=>{
+ console.log('jsunittest setWindowTypeTest6 wnd.resetSize(100, 100) success')
+ })
+ })
+ })
+ /**
+ * @tc.number GRAPHIC_FUNCTION_WINDOW_TESTWINDOW_JSNAPI_1800
+ * @tc.name Test setWindowTypeTest7.
+ * @tc.desc Test window.setWindowType API function test7.
+ */
+ it('setWindowTypeTest7', 0, function(){
+ console.log('jsunittest setWindowTypeTest7 begin')
+ window.getTopWindow().then(wnd => {
+ console.log('jsunittest setWindowTypeTest7 getTopWindow wnd: ' + wnd)
+ wnd.setWindowType(10).then(()=>{
+ console.log('jsunittest setWindowTypeTest7 wnd.setWindowType(10) success')
+ })
+ wnd.resetSize(400, 400).then(()=>{
+ console.log('jsunittest setWindowTypeTest7 wnd.resetSize(400, 400) success')
+ })
+ })
+ })
+})
diff --git a/graphic/windowstandard/project/entry/src/main/resources/base/element/string.json b/graphic/windowstandard/project/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..2e46da39ad65d6de1c46a0778ad2ee055588836c
--- /dev/null
+++ b/graphic/windowstandard/project/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "window"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/graphic/windowstandard/project/entry/src/main/resources/base/media/icon.png b/graphic/windowstandard/project/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/graphic/windowstandard/project/entry/src/main/resources/base/media/icon.png differ
diff --git a/hiviewdfx/BUILD.gn b/hiviewdfx/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..88d467f2b2da48acb0f8a0cf3d04378599f7aca7
--- /dev/null
+++ b/hiviewdfx/BUILD.gn
@@ -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.
+import("//build/ohos_var.gni")
+group("hiviewdfxtestacts") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [
+ "hiappeventtest/hiappeventjstest:hiappeventjstest",
+ "hilogtest/libhilogtest:libhilogtestacts",
+ "hisyseventtest/hisyseventcpptest:HiSysEventCPPTest",
+ ]
+ }
+}
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/BUILD.gn b/hiviewdfx/hiappeventtest/hiappeventjstest/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..3693b1692d7c86d58f48ed2a4effe7310d6470c0
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/BUILD.gn
@@ -0,0 +1,18 @@
+# Copyright (C) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("hiappeventjstest") {
+ test_hap_name = "HiAppeventTest"
+ hap_source_path = "hap/entry-debug-signed.hap"
+}
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/Test.json b/hiviewdfx/hiappeventtest/hiappeventjstest/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..c825fc467eb95aac6faabfc57b4179c218da722a
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/Test.json
@@ -0,0 +1,18 @@
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "21600000",
+ "package": "ohos.acts.hiviewdfx.hilog.function",
+ "shell-timeout": "21600000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "HiAppeventTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/hap/entry-debug-signed.hap b/hiviewdfx/hiappeventtest/hiappeventjstest/hap/entry-debug-signed.hap
new file mode 100755
index 0000000000000000000000000000000000000000..08896af72d658569d477dc4a8c05677c09c79c1f
Binary files /dev/null and b/hiviewdfx/hiappeventtest/hiappeventjstest/hap/entry-debug-signed.hap differ
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/package.json b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/package.json
new file mode 100755
index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/package.json
@@ -0,0 +1 @@
+{}
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/config.json b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/config.json
new file mode 100755
index 0000000000000000000000000000000000000000..a60253424075e894a7ed06b644a0c33e2a5e07f3
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/config.json
@@ -0,0 +1,59 @@
+{
+ "app": {
+ "bundleName": "ohos.acts.hiviewdfx.hilog.function",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.hiviewdfx.hilog.function",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "ohos.acts.hiviewdfx.hilog.function.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "MyApplication",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/app.js b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/app.js
new file mode 100755
index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/app.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/i18n/en-US.json b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/i18n/en-US.json
new file mode 100755
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/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/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/i18n/zh-CN.json b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/i18n/zh-CN.json
new file mode 100755
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/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/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/pages/index/index.css b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/pages/index/index.css
new file mode 100755
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/pages/index/index.hml b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/pages/index/index.hml
new file mode 100755
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/pages/index/index.js b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..7cc3802663eedc672aed532048fd473305a193a0
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/default/pages/index/index.js
@@ -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 file from '@system.file'
+import app from '@system.app'
+import device from '@system.device'
+import router from '@system.router'
+import {Core, ExpectExtend, ReportExtend, Constant} from 'deccjsunit/index'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ const reportExtend = new ReportExtend(file)
+ core.addService('expect', expectExtend)
+ core.addService('report', reportExtend)
+ core.init()
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
\ No newline at end of file
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/test/HiAppEvent.test.js b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/test/HiAppEvent.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..ccfea559c61172cb5921496546d985589a51abce
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/test/HiAppEvent.test.js
@@ -0,0 +1,354 @@
+/*
+ * 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 HiAppEvent from '@ohos.hiappevent'
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
+import Constant from 'deccjsunit/src/Constant'
+
+describe('HiAppEventApiTest', function () {
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0100
+ * @tc.name testHiAppEventApi01
+ * @tc.desc HiAppEvent write interface test.
+ */
+ it('testHiAppEventApi01', Function|MediumTest|Level1, function () {
+ console.info('testHiAppEventApi01 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_int", 100, "key_float", 1.1, "key_string", "demo", "key_bool", true,
+ "key_array_int", [1, 2, 3], "key_array_float", [1.1, 2.2, 3.3], "key_array_str", ["a", "b", "c"], "key_array_bool", [true, false],
+ "key_array_int2", [1, 2, 3], "key_array_float2", [1.1, 2.2, 3.3], "key_array_str2", ["a", "b", "c"], "key_array_bool2", [true, false],
+ (err, value) => {
+ console.log(`HiAppEvent into callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ console.log(`HiAppEvent result=${result}`);
+ expect(result).assertTrue();
+ console.log(`HiAppEvent result123=${result}`);
+
+ });
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0200
+ * @tc.name testHiAppEventApi02
+ * @tc.desc HiAppEvent write json interface test.
+ */
+ it('testHiAppEventApi02', Function|MediumTest|Level1, function () {
+ console.info('testHiAppEventApi02 start')
+ var result = false;
+ HiAppEvent.writeJson("writeJson", HiAppEvent.EventType.FAULT, {"key_int": 100, "key_string": "demo", "key_bool":true, "key_float":1.1
+ ,"key_array_int": [1, 2, 3], "key_array_float": [1.1, 2.2, 3.3], "key_array_str": ["a", "b", "c"], "key_array_bool": [true, false]
+ ,"key_array_int2": [1, 2, 3], "key_arr_float2": [1.1, 2.2, 3.3], "key_arr_str2": ["a", "b", "c"], "key_array_bool2": [true, false]
+ },
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue()
+ });
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0300
+ * @tc.name testHiAppEventApi03
+ * @tc.desc HiAppEvent write EventType of STATISTIC.
+ */
+ it('testHiAppEventApi03', Function|MediumTest|Level2, function () {
+ console.info('testHiAppEventApi03 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.STATISTIC, "key_int", 100, "key_float", 1.1, "key_string", "demo", "key_bool", true,
+ "key_array_int", [1, 2, 3], "key_array_float", [1.1, 2.2, 3.3], "key_array_str", ["a", "b", "c"], "key_array_bool", [true, false],
+ "key_array_int2", [1, 2, 3], "key_array_float2", [1.1, 2.2, 3.3], "key_array_str2", ["a", "b", "c"], "key_array_bool2", [true, false],
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi03 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0400
+ * @tc.name testHiAppEventApi04
+ * @tc.desc HiAppEvent write EventType of SECURITY.
+ */
+ it('testHiAppEventApi04', Function|MediumTest|Level2, function () {
+ console.info('testHiAppEventApi04 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.SECURITY, "key_int", 100, "key_float", 1.1, "key_string", "demo", "key_bool", true,
+ "key_array_int", [1, 2, 3], "key_array_float", [1.1, 2.2, 3.3], "key_array_str", ["a", "b", "c"], "key_array_bool", [true, false],
+ "key_array_int2", [1, 2, 3], "key_array_float2", [1.1, 2.2, 3.3], "key_array_str2", ["a", "b", "c"], "key_array_bool2", [true, false],
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi04 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0500
+ * @tc.name testHiAppEventApi05
+ * @tc.desc HiAppEvent write EventType of BEHAVIOR.
+ */
+ it('testHiAppEventApi05', Function|MediumTest|Level2, function () {
+ console.info('testHiAppEventApi05 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.BEHAVIOR, "key_int", 100, "key_float", 1.1, "key_string", "demo", "key_bool", true,
+ "key_array_int", [1, 2, 3], "key_array_float", [1.1, 2.2, 3.3], "key_array_str", ["a", "b", "c"], "key_array_bool", [true, false],
+ "key_array_int2", [1, 2, 3], "key_array_float2", [1.1, 2.2, 3.3], "key_array_str2", ["a", "b", "c"], "key_array_bool2", [true, false],
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi05 end')
+ })
+
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0600
+ * @tc.name testHiAppEventApi06
+ * @tc.desc HiAppEvent write datatype of int.
+ */
+ it('testHiAppEventApi06', Function|MediumTest|Level2, function () {
+ console.info('testHiAppEventApi06 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_int", 100,
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi06 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0700
+ * @tc.name testHiAppEventApi07
+ * @tc.desc HiAppEvent write datatype of int array.
+ */
+ it('testHiAppEventApi07', Function|MediumTest|Level2, function () {
+ console.info('testHiAppEventApi07 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_int_array", [100, 200],
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi07 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0800
+ * @tc.name testHiAppEventApi08
+ * @tc.desc HiAppEvent write datatype of float.
+ */
+ it('testHiAppEventApi08', Function|MediumTest|Level2, function () {
+ console.info('testHiAppEventApi08 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_float", 1.1,
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi08 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_0900
+ * @tc.name testHiAppEventApi09
+ * @tc.desc HiAppEvent write datatype of float array.
+ */
+ it('testHiAppEventApi09', Function|MediumTest|Level3, function () {
+ console.info('testHiAppEventApi09 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_float_array", [1.1, 1.2],
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi09 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1000
+ * @tc.name testHiAppEventApi10
+ * @tc.desc HiAppEvent write datatype of string.
+ */
+ it('testHiAppEventApi10', Function|MediumTest|Level3, function () {
+ console.info('testHiAppEventApi10 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_string", "hello world",
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi10 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1100
+ * @tc.name testHiAppEventApi11
+ * @tc.desc HiAppEvent write datatype of string array.
+ */
+ it('testHiAppEventApi11', Function|MediumTest|Level3, function () {
+ console.info('testHiAppEventApi11 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_string_array", ["hello world", "hello world2"],
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi11 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1200
+ * @tc.name testHiAppEventApi12
+ * @tc.desc HiAppEvent write datatype of bool with true.
+ */
+ it('testHiAppEventApi12', Function|MediumTest|Level3, function () {
+ console.info('testHiAppEventApi12 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_bool", true,
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi12 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1300
+ * @tc.name testHiAppEventApi13
+ * @tc.desc HiAppEvent write datatype of bool with false.
+ */
+ it('testHiAppEventApi13', Function|MediumTest|Level3, function () {
+ console.info('testHiAppEventApi13 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_bool", false,
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi13 end')
+ })
+
+ /**
+ * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_1400
+ * @tc.name testHiAppEventApi14
+ * @tc.desc HiAppEvent write datatype of bool array.
+ */
+ it('testHiAppEventApi14', Function|MediumTest|Level3, function () {
+ console.info('testHiAppEventApi14 start')
+ var result = false;
+ HiAppEvent.write("write", HiAppEvent.EventType.FAULT, "key_bool_array", [false, true],
+ (err, value) => {
+ console.log(`HiAppEvent into json-callback`);
+ if (err) {
+ console.error(`HiAppEvent json-callback-error code=${err.code}`);
+ result = false;
+ } else {
+ console.log(`HiAppEvent json-callback-success value=${value}`);
+ result = true;
+ }
+ expect(result).assertTrue();
+ });
+ console.info('testHiAppEventApi14 end')
+ })
+})
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/test/List.test.js b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/js/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..c5a9b78240bf9cc566f4c0da0f85201c1545e8f6
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/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('./HiAppEvent.test.js')
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/resources/base/element/string.json b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..ab025e765292c86abf35e594e18f4e4549ed2f06
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "test2demo"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ }
+ ]
+}
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/resources/base/media/icon.png b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/resources/base/media/icon.png
new file mode 100755
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/hiviewdfx/hiappeventtest/hiappeventjstest/project/entry/src/main/resources/base/media/icon.png differ
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/gradle.properties b/hiviewdfx/hiappeventtest/hiappeventjstest/project/gradle.properties
new file mode 100755
index 0000000000000000000000000000000000000000..c555b4e6a519b939a3e954391a3f0772335ad7cf
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/gradle.properties
@@ -0,0 +1,10 @@
+# Project-wide Gradle settings.
+# IDE (e.g. DevEco Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# If the Chinese output is garbled, please configure the following parameter.
+# org.gradle.jvmargs=-Dfile.encoding=GBK
diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/project/settings.gradle b/hiviewdfx/hiappeventtest/hiappeventjstest/project/settings.gradle
new file mode 100755
index 0000000000000000000000000000000000000000..28d595f2fba0d06b2025da200383d15f87c4e9f0
--- /dev/null
+++ b/hiviewdfx/hiappeventtest/hiappeventjstest/project/settings.gradle
@@ -0,0 +1 @@
+include ':entry'
diff --git a/hiviewdfx/hilogtest/libhilogtest/BUILD.gn b/hiviewdfx/hilogtest/libhilogtest/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..f7225b97f2eec1479b024d7ca2e0f31aa5b93eda
--- /dev/null
+++ b/hiviewdfx/hilogtest/libhilogtest/BUILD.gn
@@ -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.
+
+group("libhilogtestacts") {
+ testonly = true
+ deps = [
+ "libhilogCPPtest:LibhilogCPPtest",
+ "libhilogCtest:libhilogCtest",
+ ]
+}
diff --git a/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/BUILD.gn b/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..58764a68fcd3ea61ecf19af7e65cf538f525d935
--- /dev/null
+++ b/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/BUILD.gn
@@ -0,0 +1,38 @@
+# 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")
+module_output_path = "hits/LibhilogCPPtest"
+
+###############################################################################
+config("hilogtest_config") {
+ visibility = [ ":*" ]
+ include_dirs = [
+ "../../../utils/native",
+ "//utils/native/base/include/",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
+ ]
+}
+ohos_moduletest_suite("LibhilogCPPtest") {
+ module_out_path = module_output_path
+ sources = [ "LibhilogCPPtest.cpp" ]
+ deps = [
+ "../../../utils/native:utilskit",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
+ "//third_party/googletest:gtest_main",
+ "//utils/native/base:utils",
+ ]
+
+ #external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
+ configs = [ ":hilogtest_config" ]
+}
diff --git a/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/LibhilogCPPtest.cpp b/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/LibhilogCPPtest.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..74ba370fbb4d41a267ebb3d1f64ac7318f1786d2
--- /dev/null
+++ b/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/LibhilogCPPtest.cpp
@@ -0,0 +1,963 @@
+/*
+ * 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.
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "hilog/log_c.h"
+#include "hilog/log_cpp.h"
+#include
+#include "file_utils.h"
+using namespace OHOS;
+using namespace HiviewDFX;
+using namespace testing::ext;
+#define MAX_LINE ((1024) * (10))
+#define MAXBUFFSIZE 1024
+class LibhilogCPPtest : public testing::Test {
+public:
+ static void SetUpTestCase();
+ static void TearDownTestCase();
+ void SetUp();
+ void TearDown();
+private:
+};
+void LibhilogCPPtest::SetUp()
+{
+ CleanCmd();
+}
+void LibhilogCPPtest::TearDown()
+{
+}
+void LibhilogCPPtest::SetUpTestCase()
+{
+ std::vector cmdret;
+ string cmd = "setprop persist.sys.hilog.debug.on false";
+ ExecCmdWithRet(cmd, cmdret);
+ cmd = "setprop hilog.debug.on false";
+ ExecCmdWithRet(cmd, cmdret);
+}
+void LibhilogCPPtest::TearDownTestCase()
+{
+ std::cout << "TearDownTestCase" << std::endl;
+}
+
+/**
+ * @tc.name Provides user-mode interfaces(CPP)INFO
+ * @tc.number DFX_DFT_HilogCPP_0100
+ * @tc.desc Provides user-mode interfaces(CPP)INFO
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_INFO_CPP, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ int i = 1;
+ HiLog::Info(a, "123456789_1234567890_publicandprivatelogHWTEST_Fis:%{public}d,"
+ "%{private}lf,%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"I 123456789_1234567890_publicandprivatelogHWTEST_Fis:1,,2.33,,"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult);
+ std::cout<<"cmdRunResult = " + cmdRunResult<,2.33,,"};
+ CmdRun("hilog -L D -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult);
+ std::cout<<"cmdRunResult = " + cmdRunResult<,2.33,,"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult);
+ std::cout<<"cmdRunResult = " + cmdRunResult<,2.33,,"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult);
+ std::cout<<"cmdRunResult = " + cmdRunResult<,2.33,,"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $5, $7}'", cmdRunResult);
+ std::cout<<"cmdRunResult = " + cmdRunResult<,1,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log long integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2100
+ * @tc.desc libhilog-log long integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_LONG_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "INTEGER_long:%{private}ld,%{public}ld,%ld;", 2147483647L, 2147483647L, 2147483647L);
+ std::string expected{"INTEGER_long:,2147483647,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log fixed-length integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2110
+ * @tc.desc libhilog-log fixed-length integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_4_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "INTEGER_4:%{private}4d,%{public}4d,%4d;", 2000, 2000, 2000);
+ std::string expected{"INTEGER_4:,2000,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log short integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2120
+ * @tc.desc libhilog-log short integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_SHORT_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "INTEGER_short:%{private}hd,%{public}hd,%hd;", (short)1024, (short)1024, (short)1024);
+ std::string expected{"INTEGER_short:,1024,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log unsigned integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2130
+ * @tc.desc libhilog-log unsigned integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_UN_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "INTEGER_un:%{private}u,%{public}u,%u;", 2147483647u, 2147483647u, 2147483647u);
+ std::string expected{"INTEGER_un:,2147483647,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log unsigned long integer type identifier format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2140
+ * @tc.desc libhilog-log unsigned long integer type identifier format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_LONG_UN_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "INTEGER_long_un:%{private}lu,%{public}lu,%lu;", 7483647ul, 2147483647ul, 2147483647ul);
+ std::string expected{"INTEGER_long_un:,2147483647,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log unsigned fixed-length integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2150
+ * @tc.desc libhilog-log unsigned fixed-length integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_4_UN_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "INTEGER_4_un:%{private}4u,%{public}4u,%4u;", 4000, 4000, 4000);
+ std::string expected{"INTEGER_4_un:,4000,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log unsigned short integer type identifier format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2160
+ * @tc.desc libhilog-log unsigned short integer type identifier format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_INTEGER_SHORT_UN_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "INTEGER_short_un:%{private}hu,%{public}hu,%hu;", (unsigned short)65535,
+ (unsigned short)65535, (unsigned short)65535);
+ std::string expected{"INTEGER_short_un:,65535,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log float type identifier format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2170
+ * @tc.desc libhilog-log float type identifier format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_FLOAT_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "FLOAT:%{private}f,%{public}f,%f;", 1.01, 1.01, 1.01);
+ std::string expected{"FLOAT:,1.010000,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log long float type identifier format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2180
+ * @tc.desc libhilog-log long float type identifier format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_FLOAT_LONG_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "FLOAT_long:%{private}lf,%{public}lf,%lf;", 2.147483647, 2.147483647, 2.147483647);
+ std::string expected{"FLOAT_long:,2.147484,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting of fixed-width floating-point identifiers in
+ * the decimal part of the log ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2190
+ * @tc.desc libhilog-Formatting of fixed-width floating-point identifiers in
+ * the decimal part of the log ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_FLOAT_POINT2_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "FLOAT_.2:%{private}.2f,%{public}.2f,%.2f;", 2.147483647, 2.147483647, 2.147483647);
+ std::string expected{"FLOAT_.2:,2.15,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting of floating-point identifiers for
+ * the decimal part and integer part of the log ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2200
+ * @tc.desc libhilog-Formatting of floating-point identifiers for
+ * the decimal part and integer part of the log ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_FLOAT_3POINT2_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "FLOAT_3.2:%{private}3.2f,%{public}4.1f,%2.6f;", 32.147483647, 321.147483647, 23.147483647);
+ std::string expected{"FLOAT_3.2:,321.1,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting log characters ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2210
+ * @tc.desc libhilog-Formatting log characters ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_CHAR_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "CHAR:%{private}c,%{public}c,%c;", 'a', 'b', 'c');
+ std::string expected{"CHAR:,b,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting log octal identifier ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2250
+ * @tc.desc libhilog-Formatting log octal identifier ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_OCTAL_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "OCTAL:%{private}o,%{public}o,%o;", 15, 16, 17);
+ std::string expected{"OCTAL:,20,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting log long octal identifier ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2260
+ * @tc.desc libhilog-Formatting log long octal identifier ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_OCTAL_LONG_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "OCTAL_long:%{private}lo,%{public}lo,%lo;", 18ul, 19ul, 20ul);
+ std::string expected{"OCTAL_long:,23,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting log hexadecimal identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2270
+ * @tc.desc libhilog-Formatting log hexadecimal identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_HEX_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "HEX:%{private}x,%{public}x,%x;", 15, 16, 17);
+ std::string expected{"HEX:,10,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs with prefixes in hexadecimal format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2280
+ * @tc.desc libhilog-Logs with prefixes in hexadecimal format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_HEX_UPPER_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "HEX_#:%{private}#x,%{public}#x,%#x;", 18, 19, 20);
+ std::string expected{"HEX_#:,0x13,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs are formatted with long hexadecimal identifiers
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2290
+ * @tc.desc libhilog-Logs are formatted with long hexadecimal identifiers
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_HEX_LONG_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "HEX_long:%{private}lx,%{public}lx,%lx;", 21l, 22l, 23l);
+ std::string expected{"HEX_long:,16,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs are formatted with uppercase hexadecimal flags
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2300
+ * @tc.desc libhilog-Logs are formatted with uppercase hexadecimal flags
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_HEX_X_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "HEX_X:%{private}X,%{public}X,%X;", 24u, 25u, 26u);
+ std::string expected{"HEX_X:,19,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs are formatted with uppercase and prefixes in hexadecimal format
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2310
+ * @tc.desc libhilog-Logs are formatted with uppercase and prefixes in hexadecimal format
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_HEX_UPPER_X_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "HEX_#X:%{private}#X,%{public}#X,%#X;", 27, 28, 28);
+ std::string expected{"HEX_#X:,0X1C,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs are formatted with uppercase long hexadecimal identifiers
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2320
+ * @tc.desc libhilog-Logs are formatted with uppercase long hexadecimal identifiers
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_HEX_LONG_UPPER_X_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "HEX_long_X:%{private}lX,%{public}lX,%lX;", 30ul, 31ul, 32ul);
+ std::string expected{"HEX_long_X:,1F,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith string identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2220
+ * @tc.desc libhilog-Formatting Log whith string identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_STR_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "STRING:%{private}s,%{public}s,%s;", "STRING1", "STRING2", "STRING3");
+ std::string expected{"STRING:,STRING2,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith empty string identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2240
+ * @tc.desc libhilog-Formatting Log whith empty string identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_STR_EMPTY_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "STRING_empty:%{private}s,%{public}s,%s;", "", "", "");
+ std::string expected{"STRING_empty:,,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith Chinese identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2230
+ * @tc.desc libhilog-Formatting Log whith Chinese identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_STR_CHINESE_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "STRING_Chinese:%{private}s,%{public}s,%s;", "中文", "中文", "中文");
+ std::string expected{"STRING_Chinese:,中文,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith scientific notation identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2330
+ * @tc.desc libhilog-Formatting Log whith scientific notation identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_E_DOUBLE_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "DOUBLE_e:%{private}e,%{public}e,%e;", 1e-30, 2.231e10, 3.999e-13);
+ std::string expected{"DOUBLE_e:,2.231000e+10,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith scientific notation capitalized identifiers
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2340
+ * @tc.desc libhilog-Formatting Log whith scientific notation capitalized identifiers
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_E_UPPER_DOUBLE_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "DOUBLE_E:%{private}E,%{public}E,%E;", 4.88E2, 5.676767e-2, 6.17E13);
+ std::string expected{"DOUBLE_E:,5.676767E-02,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith scientific notation(%g AUTO) identifiers
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2350
+ * @tc.desc libhilog-Formatting Log whith scientific notation(%g AUTO) identifiers
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_E_AUTO_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "AUTO:%{private}g,%{public}g,%g;", 1e-30, 2.231e10, 3.999e-13);
+ std::string expected{"AUTO:,2.231e+10,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-libhilog-Formatting Log whith scientific notation(%g AUTO) capitalized
+ * identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogCPP_2360
+ * @tc.desc libhilog-libhilog-Formatting Log whith scientific notation(%g AUTO) capitalized
+ * identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_E_UPPER_AUTO_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "AUTO_E:%{private}G,%{public}G,%G;", 4.88E2, 5.676767e-2, 6.17E13);
+ std::string expected{"AUTO_E:,0.0567677,;"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-The {private} flag parameter of mixed log formatting is hidden
+ * @tc.number DFX_DFT_HilogCPP_31
+ * @tc.desc libhilog-The {private} flag parameter of mixed log formatting is hidden
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_PRIVATE_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "private:%{private}d,%{private}lf,%{private}.2f,%{private}s,%{private}c",
+ 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"private:,,,,"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-The parameters identified by {public} in mixed log formatting are displayed
+ * @tc.number DFX_DFT_HilogCPP_31
+ * @tc.desc libhilog-The parameters identified by {public} in mixed log formatting are displayed
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_PUBLIC_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "public:%{public}d,%{public}lf,%{public}.2f,%{public}s,%{public}c",
+ 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"public:1,1.000010,2.33,sse,a"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Parameters without any privacy flag are not displayed in mixed log formatting
+ * @tc.number DFX_DFT_HilogCPP_31
+ * @tc.desc libhilog-Parameters without any privacy flag are not displayed in mixed log formatting
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_NO_SIGN_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "no_sign:%d,%lf,%.2f,%s,%c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"no_sign:,,,,"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Log privacy flags are used together, and parameters are
+ * correctly displayed or hidden
+ * @tc.number DFX_DFT_HilogCPP_31
+ * @tc.desc libhilog-Log privacy flags are used together, and parameters are
+ * correctly displayed or hidden
+ */
+HWTEST_F(LibhilogCPPtest, HILOG_MIX_CPP, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tag = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tag;
+ HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"MIX:1,,2.33,,"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log are not truncated with normal length tag
+ * @tc.number DFX_DFT_HilogCPP_0280
+ * @tc.desc libhilog-log are not truncated with normal length tag
+ */
+HWTEST_F(LibhilogCPPtest, TAG_CHECK_CPP, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tagNormal = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tagNormal;
+ HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST:"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $6}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log are truncated with too long tag
+ * @tc.number DFX_DFT_HilogCPP_0290
+ * @tc.desc libhilog-log are truncated with too long tag
+ */
+HWTEST_F(LibhilogCPPtest, TAG_OVER_CHECK_CPP, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd003200;
+ const char *tagToolong = "HWTEST_Ftag0HWTEST_Ftag0HWTEST_Ftag0HWTEST_Ftag0HWTEST_Ftag0"
+ "HWTEST_Ftag0HWTEST_Ftag0HWTEST_Ftag0HWTEST_Ftag0HWTEST_Ftag0HWTEST_Ftag0HWTEST_Ftag0";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tagToolong;
+ HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST_:"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST_/ | awk '{print $6}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log domain
+ * @tc.number DFX_DFT_HilogCPP_0270
+ * @tc.desc libhilog-log domain
+ */
+HWTEST_F(LibhilogCPPtest, DOMAIN_CHECK_CPP, Function|MediumTest|Level1)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ const unsigned int domain = 0xd001111;
+ const char *tagNormal = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tagNormal;
+ HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"01111/HWTEST_Ftag0HWTEST_Ftag0HWTEST:"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $6}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log LOG_APP type test
+ * @tc.number DFX_DFT_HilogCPP_0280
+ * @tc.desc libhilog-log LOG_APP type test
+ */
+HWTEST_F(LibhilogCPPtest, TYPE_APP_CHECK_CPP, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_APP;
+ const unsigned int domain = 0xd003200;
+ const char *tagNormal = "HWTEST_Ftag0HWTEST_Ftag0HWTEST";
+ HiLogLabel a;
+ a.type = type;
+ a.domain = domain;
+ a.tag = tagNormal;
+ HiLog::Fatal(a, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"03200/HWTEST_Ftag0HWTEST_Ftag0HWTEST:"};
+ CmdRun("hilog -x -M ///HWTEST_Ftag0HWTEST_Ftag0HWTEST/ | awk '{print $6}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
diff --git a/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/Test.json b/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..ae9dea8149381abdd538d43b33c12b12537b1d8f
--- /dev/null
+++ b/hiviewdfx/hilogtest/libhilogtest/libhilogCPPtest/Test.json
@@ -0,0 +1,21 @@
+{
+ "kits": [
+ {
+ "push": [
+ "LibhilogCPPtest->/data/local/tmp/LibhilogCPPtest"
+ ],
+ "type": "PushKit",
+ "post-push": [
+ "chmod -R 777 /data/local/tmp/*"
+ ]
+ }
+ ],
+ "driver": {
+ "native-test-timeout": "120000",
+ "type": "CppTest",
+ "module-name": "LibhilogCPPtest",
+ "runtime-hint": "1s",
+ "native-test-device-path": "/data/local/tmp"
+ },
+ "description": "Configuration for LibhilogCPPtest Tests"
+}
\ No newline at end of file
diff --git a/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/BUILD.gn b/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..3fd4a56acca22b508462d8326dabbd2a2456b836
--- /dev/null
+++ b/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/BUILD.gn
@@ -0,0 +1,38 @@
+# 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")
+module_output_path = "hits/libhilogCtest"
+
+###############################################################################
+config("hilogtest_config") {
+ visibility = [ ":*" ]
+ include_dirs = [
+ "../../../utils/native",
+ "//utils/native/base/include/",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
+ ]
+}
+ohos_moduletest_suite("libhilogCtest") {
+ module_out_path = module_output_path
+ sources = [ "libhilogCtest.cpp" ]
+ deps = [
+ "../../../utils/native:utilskit",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
+ "//third_party/googletest:gtest_main",
+ "//utils/native/base:utils",
+ ]
+
+ #external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
+ configs = [ ":hilogtest_config" ]
+}
diff --git a/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/Test.json b/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/Test.json
new file mode 100755
index 0000000000000000000000000000000000000000..e265eeec1edde6bd1622c140db1e5cbca33651d1
--- /dev/null
+++ b/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/Test.json
@@ -0,0 +1,21 @@
+{
+ "kits": [
+ {
+ "push": [
+ "libhilogCtest->/data/local/tmp/libhilogCtest"
+ ],
+ "type": "PushKit",
+ "post-push": [
+ "chmod -R 777 /data/local/tmp/*"
+ ]
+ }
+ ],
+ "driver": {
+ "native-test-timeout": "120000",
+ "type": "CppTest",
+ "module-name": "libhilogCtest",
+ "runtime-hint": "1s",
+ "native-test-device-path": "/data/local/tmp"
+ },
+ "description": "Configuration for libhilogCtest Tests"
+}
\ No newline at end of file
diff --git a/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/libhilogCtest.cpp b/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/libhilogCtest.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..e8ea4561339f39450e129b91ece6739abea9e671
--- /dev/null
+++ b/hiviewdfx/hilogtest/libhilogtest/libhilogCtest/libhilogCtest.cpp
@@ -0,0 +1,714 @@
+/*
+ * 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.
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "hilog/log_c.h"
+#include "hilog/log_cpp.h"
+#include
+#include "file_utils.h"
+
+#undef LOG_DOMAIN
+#undef LOG_TAG
+#define LOG_DOMAIN 0xD003E00
+#define LOG_TAG "testtag0testtag0testtag0testta"
+using namespace std;
+using namespace testing::ext;
+
+class LibhilogCtest : public testing::Test {
+public:
+ static void SetUpTestCase();
+ static void TearDownTestCase();
+ void SetUp();
+ void TearDown();
+private:
+};
+void LibhilogCtest::SetUp()
+{
+ CleanCmd();
+}
+void LibhilogCtest::TearDown()
+{
+}
+void LibhilogCtest::SetUpTestCase()
+{
+ std::vector cmdret;
+ string cmd = "setprop persist.sys.hilog.debug.on false";
+ ExecCmdWithRet(cmd, cmdret);
+ cmd = "setprop hilog.debug.on false";
+ ExecCmdWithRet(cmd, cmdret);
+}
+void LibhilogCtest::TearDownTestCase()
+{
+ std::cout << "TearDownTestCase" << std::endl;
+}
+
+/**
+ * @tc.name Provides user-mode interfaces(C)INFO
+ * @tc.number DFX_DFT_HilogC_0180
+ * @tc.desc Provides user-mode interfaces(C)INFO
+ */
+HWTEST_F(LibhilogCtest, HILOG_INFO, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ int i = 1;
+ HILOG_INFO(type, "123456789_1234567890_publicandprivatelogtestis:%{public}d,"
+ "%{private}lf,%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"I 123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.desc Provides user-mode interfaces(C)debug
+ * @tc.number DFX_DFT_HilogC_0170
+ * @tc.desc Provides user-mode interfaces(C)debug
+ */
+HWTEST_F(LibhilogCtest, HILOG_DEBUG, Function|MediumTest|Level1)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ int i = 1;
+ HILOG_DEBUG(type, "123456789_1234567890_publicandprivatelogtestis:%{public}d,%{private}lf,"
+ "%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"D 123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name Provides user-mode interfaces(C)warning
+ * @tc.number DFX_DFT_HilogC_0210
+ * @tc.desc Provides user-mode interfaces(C)warning
+ */
+HWTEST_F(LibhilogCtest, HILOG_WARNING, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ int i = 1;
+ HILOG_WARN(type, "123456789_1234567890_publicandprivatelogtestis:%{public}d,"
+ "%{private}lf,%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"W 123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.desc Provides user-mode interfaces(C)error
+ * @tc.number DFX_DFT_HilogC_0190
+ * @tc.desc Provides user-mode interfaces(C)error
+ */
+HWTEST_F(LibhilogCtest, HILOG_ERROR, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ int i = 1;
+ HILOG_ERROR(type, "123456789_1234567890_publicandprivatelogtestis:%{public}d,%{private}lf,"
+ "%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"E 123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name Provides user-mode interfaces(C)fatal
+ * @tc.number DFX_DFT_HilogC_0200
+ * @tc.desc Provides user-mode interfaces(C)fatal
+ */
+HWTEST_F(LibhilogCtest, HILOG_FATAL, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ int i = 1;
+ HILOG_FATAL(type, "123456789_1234567890_publicandprivatelogtestis:%{public}d,%{private}lf,"
+ "%{public}.2f,%s,%{private}c", i, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"F 123456789_1234567890_publicandprivatelogtestis:1,,2.33,,"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $5, $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0360
+ * @tc.desc libhilog-log integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_INTEGER, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "INTEGER:%{private}d,%{public}d,%d;", 1, 1, 1);
+ std::string expected{"INTEGER:,1,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log long integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0370
+ * @tc.desc libhilog-log long integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_INTEGER_LONG, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "INTEGER_long:%{private}ld,%{public}ld,%ld;", 2147483647L, 2147483647L, 2147483647L);
+ std::string expected{"INTEGER_long:,2147483647,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log fixed-length integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0380
+ * @tc.desc libhilog-log fixed-length integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_INTEGER_4, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "INTEGER_4:%{private}4d,%{public}4d,%4d;", 2000, 2000, 2000);
+ std::string expected{"INTEGER_4:,2000,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log short integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0390
+ * @tc.desc libhilog-log short integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_INTEGER_SHORT, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "INTEGER_short:%{private}hd,%{public}hd,%hd;", (short)1024, (short)1024, (short)1024);
+ std::string expected{"INTEGER_short:,1024,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log unsigned integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0400
+ * @tc.desc libhilog-log unsigned integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_INTEGER_UN, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "INTEGER_un:%{private}u,%{public}u,%u;", 2147483647u, 2147483647u, 2147483647u);
+ std::string expected{"INTEGER_un:,2147483647,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log unsigned long integer type identifier format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0410
+ * @tc.desc libhilog-log unsigned long integer type identifier format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_INTEGER_LONG_UN, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "INTEGER_long_un:%{private}lu,%{public}lu,%lu;", 7483647lu, 2147483647lu, 2147483647lu);
+ std::string expected{"INTEGER_long_un:,2147483647,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log unsigned fixed-length integer format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0420
+ * @tc.desc libhilog-log unsigned fixed-length integer format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_INTEGER_4_UN, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "INTEGER_4_un:%{private}4u,%{public}4u,%4u;", 4000u, 4000u, 4000u);
+ std::string expected{"INTEGER_4_un:,4000,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log unsigned short integer type identifier format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0430
+ * @tc.desc libhilog-log unsigned short integer type identifier format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_INTEGER_SHORT_UN, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "INTEGER_short_un:%{private}hu,%{public}hu,%hu;",
+ (unsigned short)65535, (unsigned short)65535, (unsigned short)65535);
+ std::string expected{"INTEGER_short_un:,65535,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log float type identifier format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0440
+ * @tc.desc libhilog-log float type identifier format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_FLOAT, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "FLOAT:%{private}f,%{public}f,%f;", 1.01, 1.01, 1.01);
+ std::string expected{"FLOAT:,1.010000,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log long float type identifier format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0450
+ * @tc.desc libhilog-log long float type identifier format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_FLOAT_LONG, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "FLOAT_long:%{private}lf,%{public}lf,%lf;", 2.147483647, 2.147483647, 2.147483647);
+ std::string expected{"FLOAT_long:,2.147484,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting of fixed-width floating-point identifiers in
+ * the decimal part of the log ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0460
+ * @tc.desc libhilog-Formatting of fixed-width floating-point identifiers in
+ * the decimal part of the log ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_FLOAT_POINT2, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "FLOAT_.2:%{private}.2f,%{public}.2f,%.2f;", 2.147483647, 2.147483647, 2.147483647);
+ std::string expected{"FLOAT_.2:,2.15,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting of floating-point identifiers for
+ * the decimal part and integer part of the log ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0470
+ * @tc.desc libhilog-Formatting of floating-point identifiers for
+ * the decimal part and integer part of the log ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_FLOAT_3POINT2, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "FLOAT_3.2:%{private}3.2f,%{public}4.1f,%2.6f;", 32.147483647, 321.147483647, 23.147483647);
+ std::string expected{"FLOAT_3.2:,321.1,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting log characters ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0480
+ * @tc.desc libhilog-Formatting log characters ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_CHAR, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "CHAR:%{private}c,%{public}c,%c;", 'a', 'b', 'c');
+ std::string expected{"CHAR:,b,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting log octal identifier ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0520
+ * @tc.desc libhilog-Formatting log octal identifier ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_OCTAL, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "OCTAL:%{private}o,%{public}o,%o;", 15, 16, 17);
+ std::string expected{"OCTAL:,20,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting log long octal identifier ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0530
+ * @tc.desc libhilog-Formatting log long octal identifier ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_OCTAL_LONG, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "OCTAL_long:%{private}lo,%{public}lo,%lo;", 022l, 023l, 024l);
+ std::string expected{"OCTAL_long:,23,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting log hexadecimal identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0540
+ * @tc.desc libhilog-Formatting log hexadecimal identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_HEX, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "HEX:%{private}x,%{public}x,%x;", 0x0F, 0x10, 0x11);
+ std::string expected{"HEX:,10,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs with prefixes in hexadecimal format ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0550
+ * @tc.desc libhilog-Logs with prefixes in hexadecimal format ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_HEX_UPPER, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "HEX_#:%{private}#x,%{public}#x,%#x;", 0x12, 0x13, 0x14);
+ std::string expected{"HEX_#:,0x13,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs are formatted with long hexadecimal identifiers
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0560
+ * @tc.desc libhilog-Logs are formatted with long hexadecimal identifiers
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_HEX_LONG, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "HEX_long:%{private}lx,%{public}lx,%lx;", 0x15l, 0x16l, 0x17l);
+ std::string expected{"HEX_long:,16,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs are formatted with uppercase hexadecimal flags
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0570
+ * @tc.desc libhilog-Logs are formatted with uppercase hexadecimal flags
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_HEX_X, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "HEX_X:%{private}X,%{public}X,%X;", 0x18, 0x19, 0x1A);
+ std::string expected{"HEX_X:,19,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs are formatted with uppercase and prefixes in hexadecimal format
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0580
+ * @tc.desc libhilog-Logs are formatted with uppercase and prefixes in hexadecimal format
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_HEX_UPPER_X, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "HEX_#X:%{private}#X,%{public}#X,%#X;", 0x1B, 0x1C, 0x1C);
+ std::string expected{"HEX_#X:,0X1C,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Logs are formatted with uppercase long hexadecimal identifiers
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0590
+ * @tc.desc libhilog-Logs are formatted with uppercase long hexadecimal identifiers
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_HEX_LONG_UPPER_X, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "HEX_long_X:%{private}lX,%{public}lX,%lX;", 0x1El, 0x1Fl, 0x20l);
+ std::string expected{"HEX_long_X:,1F,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith string identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0490
+ * @tc.desc libhilog-Formatting Log whith string identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_STR, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "STRING:%{private}s,%{public}s,%s;", "STRING1", "STRING2", "STRING3");
+ std::string expected{"STRING:,STRING2,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith empty string identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0510
+ * @tc.desc libhilog-Formatting Log whith empty string identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_STR_EMPTY, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "STRING_empty:%{private}s,%{public}s,%s;", "", "", "");
+ std::string expected{"STRING_empty:,,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith Chinese identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0500
+ * @tc.desc libhilog-Formatting Log whith Chinese identifiers ({public}, {private}, no identifier)
+ */
+
+HWTEST_F(LibhilogCtest, HILOG_STR_CHINESE, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "STRING_Chinese:%{private}s,%{public}s,%s;", "中文", "中文", "中文");
+ std::string expected{"STRING_Chinese:,中文,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith scientific notation identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0600
+ * @tc.desc libhilog-Formatting Log whith scientific notation identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_E_DOUBLE, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "DOUBLE_e:%{private}e,%{public}e,%e;", 1e-30, 2.231e10, 3.999e-13);
+ std::string expected{"DOUBLE_e:,2.231000e+10,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith scientific notation capitalized identifiers
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0610
+ * @tc.desc libhilog-Formatting Log whith scientific notation capitalized identifiers
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_E_UPPER_DOUBLE, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "DOUBLE_E:%{private}E,%{public}E,%E;", 4.88E2, 5.676767e-2, 6.17E13);
+ std::string expected{"DOUBLE_E:,5.676767E-02,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Formatting Log whith scientific notation(%g AUTO) identifiers
+ * ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0620
+ * @tc.desc libhilog-Formatting Log whith scientific notation(%g AUTO) identifiers
+ * ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_E_AUTO, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "AUTO:%{private}g,%{public}g,%g;", 1e-30, 2.231e10, 3.999e-13);
+ std::string expected{"AUTO:,2.231e+10,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-libhilog-Formatting Log whith scientific notation(%g AUTO) capitalized
+ * identifiers ({public}, {private}, no identifier)
+ * @tc.number DFX_DFT_HilogC_0630
+ * @tc.desc libhilog-libhilog-Formatting Log whith scientific notation(%g AUTO) capitalized
+ * identifiers ({public}, {private}, no identifier)
+ */
+HWTEST_F(LibhilogCtest, HILOG_E_UPPER_AUTO, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "AUTO_E:%{private}G,%{public}G,%G;", 4.88E2, 5.676767e-2, 6.17E13);
+ std::string expected{"AUTO_E:,0.0567677,;"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-The {private} flag parameter of mixed log formatting is hidden
+ * @tc.number DFX_DFT_HilogC_3100
+ * @tc.desc libhilog-The {private} flag parameter of mixed log formatting is hidden
+ */
+HWTEST_F(LibhilogCtest, HILOG_PRIVATE, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "private:%{private}d,%{private}lf,%{private}.2f,"
+ "%{private}s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"private:,,,,"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-The parameters identified by {public} in mixed log formatting are displayed
+ * @tc.number DFX_DFT_HilogC_3200
+ * @tc.desc libhilog-The parameters identified by {public} in mixed log formatting are displayed
+ */
+HWTEST_F(LibhilogCtest, HILOG_PUBLIC, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "public:%{public}d,%{public}lf,%{public}.2f,%{public}s,%{public}c",
+ 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"public:1,1.000010,2.33,sse,a"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Parameters without any privacy flag are not displayed in mixed log formatting
+ * @tc.number DFX_DFT_HilogC_3300
+ * @tc.desc libhilog-Parameters without any privacy flag are not displayed in mixed log formatting
+ */
+HWTEST_F(LibhilogCtest, HILOG_NO_SIGN, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "no_sign:%d,%lf,%.2f,%s,%c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"no_sign:,,,,"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-Log privacy flags are used together, and parameters are
+ * correctly displayed or hidden
+ * @tc.number DFX_DFT_HilogC_3400
+ * @tc.desc libhilog-Log privacy flags are used together, and parameters are
+ * correctly displayed or hidden
+ */
+HWTEST_F(LibhilogCtest, HILOG_MIX, Function|MediumTest|Level3)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"MIX:1,,2.33,,"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $7}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log are not truncated with normal length tag
+ * @tc.number DFX_DFT_HilogC_0280
+ * @tc.desc libhilog-log are not truncated with normal length tag
+ */
+HWTEST_F(LibhilogCtest, TAG_CHECK, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+ HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"03e00/testtag0testtag0testtag0testta:"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $6}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log are not truncated with normal length tag
+ * @tc.number DFX_DFT_HilogC_0280
+ * @tc.desc libhilog-log are not truncated with normal length tag
+ */
+HWTEST_F(LibhilogCtest, TYPE_APP_CHECK, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_APP;
+ HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"03e00/testtag0testtag0testtag0testta:"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testta/ | awk '{print $6}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log are truncated with too long tag
+ * @tc.number DFX_DFT_HilogC_0290
+ * @tc.desc libhilog-log are truncated with too long tag
+ */
+HWTEST_F(LibhilogCtest, TAG_OVER_CHECK, Function|MediumTest|Level2)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+#undef LOG_TAG
+#define LOG_TAG "testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0testtag0"
+ HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"03e00/testtag0testtag0testtag0testtag:"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testtag/ | awk '{print $6}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
+
+/**
+ * @tc.name libhilog-log domain
+ * @tc.number DFX_DFT_HilogC_0270
+ * @tc.desc libhilog-log domain
+ */
+HWTEST_F(LibhilogCtest, DOMAIN_CHECK, Function|MediumTest|Level1)
+{
+ std::string cmdRunResult;
+ LogType type = LOG_CORE;
+#undef LOG_DOMAIN
+#define LOG_DOMAIN 0xD001111
+ HILOG_FATAL(type, "MIX:%{public}d,%{private}lf,%{public}.2f,%s,%{private}c", 1, 1.00001, 2.333333, "sse", 'a');
+ std::string expected{"01111/testtag0testtag0testtag0testtag:"};
+ CmdRun("hilog -x -M ///testtag0testtag0testtag0testtag/ | awk '{print $6}'", cmdRunResult);
+ EXPECT_EQ(cmdRunResult, expected);
+}
\ No newline at end of file
diff --git a/hiviewdfx/hisyseventtest/hisyseventcpptest/BUILD.gn b/hiviewdfx/hisyseventtest/hisyseventcpptest/BUILD.gn
new file mode 100755
index 0000000000000000000000000000000000000000..1e931ccd083d8d69a23760b9848a8f13c22854b6
--- /dev/null
+++ b/hiviewdfx/hisyseventtest/hisyseventcpptest/BUILD.gn
@@ -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("//test/xts/tools/build/suite.gni")
+
+module_output_path = "hit/HiSysEventCPPTest"
+
+###############################################################################
+config("hilogtest_config") {
+ visibility = [ ":*" ]
+ include_dirs = [
+ "../../utils/native",
+ "//utils/native/base/include/",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
+ "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/include",
+ ]
+}
+ohos_moduletest_suite("HiSysEventCPPTest") {
+ module_out_path = module_output_path
+ sources = [
+ "HiSysEventCPPTest.cpp",
+ ]
+ deps = [
+ "../../utils/native:utilskit",
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
+ "//base/hiviewdfx/hisysevent/interfaces/native/innerkits:libhisysevent",
+ "//third_party/googletest:gtest_main",
+ "//utils/native/base:utils",
+ ]
+ configs = [ ":hilogtest_config" ]
+}
diff --git a/hiviewdfx/hisyseventtest/hisyseventcpptest/HiSysEventCPPTest.cpp b/hiviewdfx/hisyseventtest/hisyseventcpptest/HiSysEventCPPTest.cpp
new file mode 100755
index 0000000000000000000000000000000000000000..7978a88b0115320ea5b5a425c979efb83ae313b2
--- /dev/null
+++ b/hiviewdfx/hisyseventtest/hisyseventcpptest/HiSysEventCPPTest.cpp
@@ -0,0 +1,606 @@
+/*
+ * 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.
+ */
+#include "hilog/log.h"
+#include
+
+#include "file_utils.h"
+#include "hisysevent.h"
+
+using namespace testing;
+using namespace testing::ext;
+using namespace std;
+using namespace OHOS::HiviewDFX;
+namespace {
+string g_key = "key";
+string g_reDiRectTimeout = "5";
+string g_hiLogRedirect = "/data/local/tmp/hilogredirect.log";
+}
+class HiSysEventCPPTest : public testing::Test {
+public:
+ static void SetUpTestCase();
+ static void TearDownTestCase();
+ void SetUp();
+ void TearDown();
+private:
+};
+void HiSysEventCPPTest::SetUp()
+{
+ std::cout << "SetUp" << std::endl;
+ std::vector cmdret;
+ string cmd = "hilog -r";
+ ExecCmdWithRet(cmd, cmdret);
+ cmd = "setprop persist.sys.hilog.debug.on false";
+ ExecCmdWithRet(cmd, cmdret);
+}
+void HiSysEventCPPTest::TearDown()
+{
+ std::cout << "TearDown" << std::endl;
+ std::vector cmdret;
+ string cmd = "rm " + g_hiLogRedirect;
+ ExecCmdWithRet(cmd, cmdret);
+}
+void HiSysEventCPPTest::SetUpTestCase()
+{
+ std::cout << "SetUpTestCase" << std::endl;
+ std::vector cmdret;
+ string cmd = "mkdir /data/local/tmp/";
+ ExecCmdWithRet(cmd, cmdret);
+}
+void HiSysEventCPPTest::TearDownTestCase()
+{
+ std::cout << "TearDownTestCase" << std::endl;
+}
+/**
+* @tc.name HiSysEvent Native Write Interface Test, Reported When the KeyValue Is of the
+* boolean Type and the bool Value Is False
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_0100
+* @tc.desc The keyvalue is of the boolean type and the bool value is false.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0100, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0100 start" << endl;
+ bool result = false;
+ bool param = false;
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo;
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"AAFWK", "eventNameDemo", "\"event_type_\":1", "\"key\":0"};
+ if (!fileinfo.empty()) {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_0100 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0100 end" << endl;
+}
+/**
+* @tc.name HiSysEvent Native Write Interface Test, Reported When the KeyValue Is of
+* the boolean Type and the bool Value Is False
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_0200
+* @tc.desc The keyvalue is of the boolean type and the bool value is true.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0200, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0200 start" << endl;
+ bool result = false;
+ bool param = true;
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::APPEXECFWK;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"APPEXECFWK", "eventNameDemo", "\"event_type_\":1", "\"key\":1"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_0200 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0200 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Keyvalue of the Boolean List Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_0300
+* @tc.desc The value of keyvalue is a boolean list.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0300, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0300 start" << endl;
+ bool result = false;
+ bool param = false;
+ std::vector test;
+ test.push_back(param);
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::ACCOUNT;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"ACCOUNT", "eventNameDemo", "\"event_type_\":1", "\"key\":[0]"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_0300 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0300 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Key Value of the Char Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_0400
+* @tc.desc The keyvalue is of the char type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0400, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0400 start" << endl;
+ bool result = false;
+ char param = 'a';
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::OTHERS;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"OTHERS", "eventNameDemo", "\"event_type_\":1", "\"key\":97"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_0400 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0400 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Keyvalue of the Char List Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_0500
+* @tc.desc keyvalue is of the char list type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0500, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0500 start" << endl;
+ bool result = false;
+ char param = 'a';
+ std::vector test;
+ test.push_back(param);
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::WEARABLE;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"WEARABLE", "eventNameDemo", "\"event_type_\":1", "\"key\":[97]"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_0500 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0500 end" << endl;
+}
+/**
+* @tc.name HiSysEvent Natvie Write Interface Test, Reported When the KeyValue Is of the Double Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_0600
+* @tc.desc The keyvalue is of the double type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0600, Function|MediumTest|Level2)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0600 start" << endl;
+ bool result = false;
+ double param = 30949.374;
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::WEARABLE_HARDWARE;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"WEARABLEHW", "eventNameDemo", "\"event_type_\":1", "\"key\":30949.4"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_0600 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0600 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Keyvalue of the Char List Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_0700
+* @tc.desc keyvalue is of the char list type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0700, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0700 start" << endl;
+ bool result = false;
+ double param = 30949.374;
+ std::vector test;
+ test.push_back(param);
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::USB;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"USB", "eventNameDemo", "\"event_type_\":1", "\"key\":[30949.4]"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_0700 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0700 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Key Value of the Floating Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_0800
+* @tc.desc The keyvalue is of the float type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0800, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0800 start" << endl;
+ bool result = false;
+ float param = 230.47;
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::UPDATE;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"UPDATE", "eventNameDemo", "\"event_type_\":1", "\"key\":230.47"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_0800 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0800 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Keyvalue of the Char List Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_0900
+* @tc.desc keyvalue is of the char list type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_0900, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0900 start" << endl;
+ bool result = false;
+ float param = 230.47;
+ std::vector test;
+ test.push_back(param);
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::TELEPHONY;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"TELEPHONY", "eventNameDemo", "\"event_type_\":1", "\"key\":[230.47]"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_0900 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0900 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Keyvalue of the Int Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_1000
+* @tc.desc The keyvalue is of the int type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1000, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1000 start" << endl;
+ bool result = false;
+ int param = 100;
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::STARTUP;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"STARTUP", "eventNameDemo", "\"event_type_\":1", "\"key\":100"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_1000 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1000 end" << endl;
+}
+/**
+* @tc.name HiSysEvent Natvie Write Interface Test, Reporting of the int List of KeyValues
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_1100
+* @tc.desc keyvalue is of the int list type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1100, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1100 start" << endl;
+ bool result = false;
+ int param = 100;
+ std::vector test;
+ test.push_back(param);
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::SOURCE_CODE_TRANSFORMER;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"SRCTRANSFORMER", "eventNameDemo", "\"event_type_\":1", "\"key\":[100]"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_1100 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1100 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Key Value of the Long Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_1200
+* @tc.desc The keyvalue is of the long type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1200, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1200 start" << endl;
+ bool result = false;
+ long param = 1000000;
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::SENSORS;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"SENSORS", "eventNameDemo", "\"event_type_\":1", "\"key\":1000000"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_1200 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1200 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the List of the Long Key Value
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_1300
+* @tc.desc The keyvalue is of the long list type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1300, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1300 start" << endl;
+ bool result = false;
+ long param = 1000000;
+ std::vector test;
+ test.push_back(param);
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::SECURITY;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"SECURITY", "eventNameDemo", "\"event_type_\":1", "\"key\":[1000000]"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_1300 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1300 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Key Value of the Short Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_1400
+* @tc.desc The keyvalue is of the short type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1400, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_0250 start" << endl;
+ bool result = false;
+ short param = 10;
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::ROUTER;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::FAULT;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"ROUTER", "eventNameDemo", "\"event_type_\":1", "\"key\":10"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_1400 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1400 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the List of Short Key Values
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_1500
+* @tc.desc The keyvalue is of the short list type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1500, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1500 start" << endl;
+ bool result = false;
+ short param = 10;
+ std::vector test;
+ test.push_back(param);
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::POWERMGR;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, test);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"POWERMGR", "eventNameDemo", "\"event_type_\":2", "\"key\":[10]"};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_1500 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1500 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the Key Value of the String Type
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_1600
+* @tc.desc The keyvalue is of the string type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1600, Function|MediumTest|Level2)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1600 start" << endl;
+ bool result = false;
+ string param = "abc";
+ string domain = OHOS::HiviewDFX::HiSysEvent::Domain::NOTIFICATION;
+ OHOS::HiviewDFX::HiSysEvent::EventType eventtype = OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC;
+ OHOS::HiviewDFX::HiSysEvent::Write(domain, "eventNameDemo", eventtype, g_key, param);
+ RedirecthiLog(g_hiLogRedirect, g_reDiRectTimeout);
+ string fileinfo = "";
+ fileinfo = ReadFile(g_hiLogRedirect);
+ std::vector para = {"NOTIFICATION", "eventNameDemo", "\"event_type_\":2", "\"key\":\"abc\""};
+ if (fileinfo != "") {
+ result = CheckInfo(para, fileinfo);
+ } else {
+ std::cout << "DFX_DFT_HiviewKit_HiSysEvent_Native_1600 file error" << std::endl;
+ }
+ ASSERT_TRUE(result);
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1600 end" << endl;
+}
+/**
+* @tc.name Testing the HiSysEvent Natvie Write Interface, Reporting the List of Short Key Values
+* @tc.number DFX_DFT_HiviewKit_HiSysEvent_Native_1700
+* @tc.desc The keyvalue is of the short list type.
+*/
+HWTEST_F(HiSysEventCPPTest, DFX_DFT_HiviewKit_HiSysEvent_Native_1700, Function|MediumTest|Level3)
+{
+ GTEST_LOG_(INFO) << "DFX_DFT_HiviewKit_HiSysEvent_Native_1700 start" << endl;
+ bool result = false;
+ string param = "abc";
+ std::vector