diff --git a/commonlibrary/ets_utils/uri_lib_standard/BUILD.gn b/commonlibrary/ets_utils/uri_lib_standard/BUILD.gn
index fb2825d11c245e0051898b828f7c7f91f5cd4516..ff4a5ffcb7c1d0eaacfd6136472d4519568b0244 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/BUILD.gn
+++ b/commonlibrary/ets_utils/uri_lib_standard/BUILD.gn
@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
-# limitations under the License.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("uri_js_test") {
@@ -31,7 +31,9 @@ ohos_js_hap_suite("uri_js_test") {
# subsystem_name = "xts"
}
ohos_js_assets("uri_js_assets") {
- source_dir = "./src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("uri_resources") {
sources = [ "./src/main/resources" ]
diff --git a/commonlibrary/ets_utils/uri_lib_standard/Test.json b/commonlibrary/ets_utils/uri_lib_standard/Test.json
index 91ecf1df2c08fcf66e7d2fe875c80640bedb58fb..ad36a9e45359156293934d869fdb82ba7397db39 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/Test.json
+++ b/commonlibrary/ets_utils/uri_lib_standard/Test.json
@@ -1,18 +1,19 @@
-{
- "description": "Configuration for startup uri js api Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "800000",
- "package": "com.example.uri",
- "shell-timeout": "90000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsUriJSApiTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
+{
+ "description": "Configuration for startup uri js api Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "800000",
+ "bundle-name": "com.example.uri",
+ "package-name": "com.example.uri",
+ "shell-timeout": "800000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsUriJSApiTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
}
\ No newline at end of file
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/config.json b/commonlibrary/ets_utils/uri_lib_standard/src/main/config.json
index 50c2a4de4a9a93be6998482361c5e0d4c5cad3d1..dac12fb411729a40d910eb18b157882f9a8ef9de 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/src/main/config.json
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/config.json
@@ -1,62 +1,94 @@
-{
- "app": {
- "bundleName": "com.example.uri",
- "vendor": "example",
- "version": {
- "code": 1000000,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.uri",
- "name": ".MyApplication",
- "mainAbility": "com.example.uri.MainAbility",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": false
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "visible": true,
- "name": "com.example.uri.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "standard"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ]
- }
+{
+ "app": {
+ "bundleName": "com.example.uri",
+ "vendor": "example",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.uri",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".MainAbility",
+ "srcLanguage": "js",
+ "srcPath": "MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:MainAbility_desc",
+ "label": "$string:MainAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": true
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ },
+ "srcPath": ""
+}
}
\ No newline at end of file
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/app.js b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/app.js
similarity index 97%
rename from commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/app.js
rename to commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/app.js
index 830070d196d86b127cea947d168bfd116f446205..8fe0b77dcef1db4bb1706399fd481541de8166cd 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/app.js
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/app.js
@@ -1,23 +1,23 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export default {
- onCreate() {
- console.info('AceApplication onCreate');
- },
- onDestroy() {
- console.info('AceApplication onDestroy');
- }
-};
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/sensors/miscdevice_standard/src/main/js/default/i18n/en-US.json b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/i18n/en-US.json
old mode 100755
new mode 100644
similarity index 91%
rename from sensors/miscdevice_standard/src/main/js/default/i18n/en-US.json
rename to commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/i18n/en-US.json
index e63c70d978a3a53be988388c87182f81785e170c..a4c13dcbdc39c537073f638393d7726ac9a5cdc4
--- a/sensors/miscdevice_standard/src/main/js/default/i18n/en-US.json
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/i18n/en-US.json
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
}
\ No newline at end of file
diff --git a/sensors/miscdevice_standard/src/main/js/default/i18n/zh-CN.json b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/i18n/zh-CN.json
old mode 100755
new mode 100644
similarity index 91%
rename from sensors/miscdevice_standard/src/main/js/default/i18n/zh-CN.json
rename to commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/i18n/zh-CN.json
index de6ee5748322f44942c1b003319d8e66c837675f..b1c02368f72f929e4375a43170444de95dcc5984
--- a/sensors/miscdevice_standard/src/main/js/default/i18n/zh-CN.json
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/i18n/zh-CN.json
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
}
\ No newline at end of file
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/pages/index/index.css b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/pages/index/index.css
similarity index 96%
rename from commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/pages/index/index.css
rename to commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/pages/index/index.css
index 5bcfb2e8b6d4da7f7cdefb090c3eeaccd70009c9..273d2a4b0abe82050908791a66299236f5fc1445 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/pages/index/index.css
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/pages/index/index.css
@@ -1,59 +1,59 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the 'License');
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an 'AS IS' BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 40px;
- color: #000000;
- opacity: 0.9;
-}
-
-@media screen and (device-type: tablet) and (orientation: landscape) {
- .title {
- font-size: 100px;
- }
-}
-
-@media screen and (device-type: wearable) {
- .title {
- font-size: 28px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: tv) {
- .container {
- background-image: url("../../common/images/Wallpaper.png");
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center;
- }
-
- .title {
- font-size: 100px;
- color: #FFFFFF;
- }
-}
-
-@media screen and (device-type: phone) and (orientation: landscape) {
- .title {
- font-size: 60px;
- }
-}
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 40px;
+ color: #000000;
+ opacity: 0.9;
+}
+
+@media screen and (device-type: tablet) and (orientation: landscape) {
+ .title {
+ font-size: 100px;
+ }
+}
+
+@media screen and (device-type: wearable) {
+ .title {
+ font-size: 28px;
+ color: #FFFFFF;
+ }
+}
+
+@media screen and (device-type: tv) {
+ .container {
+ background-image: url("../../common/images/Wallpaper.png");
+ background-size: cover;
+ background-repeat: no-repeat;
+ background-position: center;
+ }
+
+ .title {
+ font-size: 100px;
+ color: #FFFFFF;
+ }
+}
+
+@media screen and (device-type: phone) and (orientation: landscape) {
+ .title {
+ font-size: 60px;
+ }
+}
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/pages/index/index.hml b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/pages/index/index.hml
similarity index 97%
rename from commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/pages/index/index.hml
rename to commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/pages/index/index.hml
index a9e4220170a2effe96285d0feda7d698e2035bf3..11e5a3bbe38fe420b3e4a5e8f044f96ef12b92c4 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/pages/index/index.hml
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/pages/index/index.hml
@@ -1,20 +1,20 @@
-
-
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
+
+
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/sensors/miscdevice_standard/src/main/js/default/pages/index/index.js b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/pages/index/index.js
old mode 100755
new mode 100644
similarity index 53%
rename from sensors/miscdevice_standard/src/main/js/default/pages/index/index.js
rename to commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/pages/index/index.js
index 173f299a3b96a91ab293b130a7065f3077e95dbd..13f274085248a1d4c79ee30f9112f79cf3a438a6
--- a/sensors/miscdevice_standard/src/main/js/default/pages/index/index.js
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/MainAbility/pages/index/index.js
@@ -1,46 +1,40 @@
-/*
- * Copyright (C) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-
-export default {
- data: {
- title: ""
- },
- 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')
- this.timeout = 5000
- configService.setConfig(this)
-
- require('../../test/List.test')
- core.execute()
- },
- onReady() {
- },
-}
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../../../test/List.test'
+import app from '@system.app'
+import device from '@system.device'
+import router from '@system.router'
+
+
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onReady() {
+ },
+}
+
diff --git a/sensors/miscdevice_standard/src/main/js/default/app.js b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/app.js
old mode 100755
new mode 100644
similarity index 91%
rename from sensors/miscdevice_standard/src/main/js/default/app.js
rename to commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/app.js
index e423f4bce4698ec1d7dc86c3eea3990a5e7b1085..875191631733a62e2bdff76d6b5a2e2f1b130937
--- a/sensors/miscdevice_standard/src/main/js/default/app.js
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/app.js
@@ -1,23 +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');
- }
-};
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/i18n/en-US.json b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/i18n/zh-CN.json b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/pages/index/index.css b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.container {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ left: 0px;
+ top: 0px;
+ width: 100%;
+ height: 100%;
+}
+
+.title {
+ font-size: 60px;
+ text-align: center;
+ width: 100%;
+ height: 40%;
+ margin: 10px;
+}
+
+@media screen and (device-type: phone) and (orientation: landscape) {
+ .title {
+ font-size: 60px;
+ }
+}
+
+@media screen and (device-type: tablet) and (orientation: landscape) {
+ .title {
+ font-size: 100px;
+ }
+}
\ No newline at end of file
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/pages/index/index.hml b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/sensors/miscdevice_standard/src/main/js/default/test/List.test.js b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/pages/index/index.js
similarity index 73%
rename from sensors/miscdevice_standard/src/main/js/default/test/List.test.js
rename to commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/pages/index/index.js
index ff9a1be24f702141edbadae64154b31daf8576a3..88b083a7f6b979019d6a2c5ad20b19c5fd43286b 100644
--- a/sensors/miscdevice_standard/src/main/js/default/test/List.test.js
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestAbility/pages/index/index.js
@@ -1,17 +1,26 @@
-/*
- * 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('./Vibrator_old.test.js')
-require('./Vibrator_new.test.js')
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511
--- /dev/null
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/test/List.test.js b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/test/List.test.js
index 3c2c1f5d051f0f15a35050cd4d766e35e9587e35..55d5b8c95eb2fd7753b81fe2046a62d3c8983439 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/test/List.test.js
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/test/List.test.js
@@ -1,16 +1,19 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require('./uri.test.js')
\ No newline at end of file
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { UriTest } from './uri.test.js'
+
+export default function testsuite() {
+ UriTest()
+}
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/test/uri.test.js b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/test/uri.test.js
index 56c6c641d7b5b3c7a503b74e9b2b33f282ee1274..adfa37761da812041bd2962089d529e4abf750b6 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/test/uri.test.js
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/js/test/uri.test.js
@@ -1,753 +1,756 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the 'License')
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an 'AS IS' BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-import uri from '@ohos.uri'
-describe('UriTest', function () {
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_001
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_001', 0, function () {
- try {
- let that = new uri.URI('#http://username:password@host:8080/directory/file?foo=1&bar=2');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: #It can't be the first");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_002
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_002', 0, function () {
- try {
- let that = new uri.URI({name: 'gaogao'});
- } catch (err) {
- expect(err.toString()).assertEqual("Error: input type err");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_003
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_003', 0, function () {
- try {
- let that = new uri.URI('ht/tp://username:pas sword@host:8080/directory/file?foo=1&bar=2');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: SpecialPath does not conform to the rule");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_004
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_004', 0, function () {
- try {
- let that = new uri.URI('http://username:password@[::]:8080/directory/file?Query#gaogao faofao');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: Fragment does not conform to the rule");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_005
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_005', 0, function () {
- try {
- let that = new uri.URI('http://username:password@host:8080/directory/file?foo^=1&bar=2#gaogaofaofao');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: Query does not conform to the rule");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_006
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_006', 0, function () {
- try {
- let that = new uri.URI('1http://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: Scheme the first character must be a letter");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_007
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_007', 0, function () {
- try {
- let that = new uri.URI('ht@tp://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: scheme does not conform to the rule");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_008
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_008', 0, function () {
- try {
- let that = new uri.URI('http://username:password@[::]:80r80/directory/file?foo=1&bar=2#gaogaofaofao');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: Prot does not conform to the rule");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_009
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_009', 0, function () {
- try {
- let that = new uri.URI('http://username:password@[::12:55:8080/directory/file?foo=1&bar=2#gaogaofaofao');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: IPv6 is missing a closing bracket");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_010
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_010', 0, function () {
- try {
- let that = new uri.URI('http://username:pa^ssword@[::12:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: userInfo does not conform to the rule");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_011
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_011', 0, function () {
- try {
- let that = new uri.URI('http://username:password@[::1你2:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao');
- } catch (err) {
- expect(err.toString()).assertEqual("Error: ipv6 does not conform to the rule");
- }
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_012
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_012', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@www.baidu.com:99/path/path?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@www.baidu.com:99");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@www.baidu.com:99/path/path?query");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("www.baidu.com");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/path");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: testConstructor013
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor013', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1080::8:800:200C:417A]:99/path/66path1?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@[1080::8:800:200C:417A]:99");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@[1080::8:800:200C:417A]:99/path/66path1?query");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("[1080::8:800:200C:417A]");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/66path1");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_014
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_014', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[::]:88/path/path66?foooo#gaogao');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@[::]:88");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@[::]:88/path/path66?foooo");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("[::]");
- expect(gaogao.port).assertEqual("88");
- expect(gaogao.path).assertEqual("/path/path66");
- expect(gaogao.query).assertEqual("foooo");
- expect(gaogao.fragment).assertEqual("gaogao");
- })
-
- /**
- * @tc.name: testConstructor015
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor015', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66path1?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@[1:0:0:1:2:1:2:1]:99");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66path1?query");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("[1:0:0:1:2:1:2:1]");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/66path1");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_016
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_016', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[::FFFF:129.144.52.38]:99/path/path?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@[::FFFF:129.144.52.38]:99");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@[::FFFF:129.144.52.38]:99/path/path?query");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("[::FFFF:129.144.52.38]");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/path");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: testConstructor017
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor017', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[::192.9.5.5]:99/path/path?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@[::192.9.5.5]:99");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@[::192.9.5.5]:99/path/path?query");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("[::192.9.5.5]");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/path");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: testConstructor018
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor018', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[22::22:2:2%ss]:99/path/path?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@[22::22:2:2%ss]:99");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@[22::22:2:2%ss]:99/path/path?query");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("[22::22:2:2%ss]");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/path");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: testConstructor019
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor019', 0, function () {
- let gaogao =
- new uri.URI('http://gg:gaogao@[fe80:0000:0001:0000:0440:44ff:1233:5678]:99/path/path?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@[fe80:0000:0001:0000:0440:44ff:1233:5678]:99");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@[fe80:0000:0001:0000:0440:44ff:1233:5678]:99/path/path?query");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("[fe80:0000:0001:0000:0440:44ff:1233:5678]");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/path");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: testConstructor020
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor020', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[fe80::0001:0000]:99/path/path?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@[fe80::0001:0000]:99");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@[fe80::0001:0000]:99/path/path?query");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("[fe80::0001:0000]");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/path");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_021
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_021', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@199.98.55.44:99/path/path?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("gg:gaogao@199.98.55.44:99");
- expect(gaogao.ssp).assertEqual("//gg:gaogao@199.98.55.44:99/path/path?query");
- expect(gaogao.userInfo).assertEqual("gg:gaogao");
- expect(gaogao.host).assertEqual("199.98.55.44");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/path");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_022
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_022', 0, function () {
- let gaogao = new uri.URI('http://16.9.5.4:99/path/path?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("16.9.5.4:99");
- expect(gaogao.ssp).assertEqual("//16.9.5.4:99/path/path?query");
- expect(gaogao.userInfo).assertEqual("null");
- expect(gaogao.host).assertEqual("16.9.5.4");
- expect(gaogao.port).assertEqual("99");
- expect(gaogao.path).assertEqual("/path/path");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: testConstructor023
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor023', 0, function () {
- let gaogao = new uri.URI('http://49.99.54.12:50/path/path23?query#fagment');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("49.99.54.12:50");
- expect(gaogao.ssp).assertEqual("//49.99.54.12:50/path/path23?query");
- expect(gaogao.userInfo).assertEqual("null");
- expect(gaogao.host).assertEqual("49.99.54.12");
- expect(gaogao.port).assertEqual("50");
- expect(gaogao.path).assertEqual("/path/path23");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("fagment");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_024
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_024', 0, function () {
- let gaogao = new uri.URI('http://user@49.10pe8.54.12:80/path/path23?query#qwer');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("user@49.10pe8.54.12:80");
- expect(gaogao.ssp).assertEqual("//user@49.10pe8.54.12:80/path/path23?query");
- expect(gaogao.userInfo).assertEqual("null");
- expect(gaogao.host).assertEqual("null");
- expect(gaogao.port).assertEqual("-1");
- expect(gaogao.path).assertEqual("/path/path23");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("qwer");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_025
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_025', 0, function () {
- let gaogao = new uri.URI('http://user@www.baidu.com/path/path23?query#qwer');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("user@www.baidu.com");
- expect(gaogao.ssp).assertEqual("//user@www.baidu.com/path/path23?query");
- expect(gaogao.userInfo).assertEqual("user");
- expect(gaogao.host).assertEqual("www.baidu.com");
- expect(gaogao.port).assertEqual("-1");
- expect(gaogao.path).assertEqual("/path/path23");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("qwer");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_026
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_026', 0, function () {
- let gaogao = new uri.URI('http://user@www.hw.com:77/path/path23?query#qwer');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("user@www.hw.com:77");
- expect(gaogao.ssp).assertEqual("//user@www.hw.com:77/path/path23?query");
- expect(gaogao.userInfo).assertEqual("user");
- expect(gaogao.host).assertEqual("www.hw.com");
- expect(gaogao.port).assertEqual("77");
- expect(gaogao.path).assertEqual("/path/path23");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("qwer");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_027
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_027', 0, function () {
- let gaogao = new uri.URI('ht2tp://user@www.h12343w.com:77/path/path23?query#qwer');
- expect(gaogao.scheme).assertEqual("ht2tp");
- expect(gaogao.authority).assertEqual("user@www.h12343w.com:77");
- expect(gaogao.ssp).assertEqual("//user@www.h12343w.com:77/path/path23?query");
- expect(gaogao.userInfo).assertEqual("user");
- expect(gaogao.host).assertEqual("www.h12343w.com");
- expect(gaogao.port).assertEqual("77");
- expect(gaogao.path).assertEqual("/path/path23");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("qwer");
- })
-
- /**
- * @tc.name: testConstructor028
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor028', 0, function () {
- let gaogao = new uri.URI('ht2tp://user@www.1hw.1com:77/path/path23?query#qwer');
- expect(gaogao.scheme).assertEqual("ht2tp");
- expect(gaogao.authority).assertEqual("user@www.1hw.1com:77");
- expect(gaogao.ssp).assertEqual("//user@www.1hw.1com:77/path/path23?query");
- expect(gaogao.userInfo).assertEqual("null");
- expect(gaogao.host).assertEqual("null");
- expect(gaogao.port).assertEqual("-1");
- expect(gaogao.path).assertEqual("/path/path23");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("qwer");
- })
-
- /**
- * @tc.name: testConstructor029
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor029', 0, function () {
- let gaogao = new uri.URI('http://user@hosthost/path/path23?query#qwer');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("user@hosthost");
- expect(gaogao.ssp).assertEqual("//user@hosthost/path/path23?query");
- expect(gaogao.userInfo).assertEqual("user");
- expect(gaogao.host).assertEqual("hosthost");
- expect(gaogao.port).assertEqual("-1");
- expect(gaogao.path).assertEqual("/path/path23");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("qwer");
- })
-
- /**
- * @tc.name: testConstructor030
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor030', 0, function () {
- let gaogao = new uri.URI('http://user@[::]/path/path23?query#qwer');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("user@[::]");
- expect(gaogao.ssp).assertEqual("//user@[::]/path/path23?query");
- expect(gaogao.userInfo).assertEqual("user");
- expect(gaogao.host).assertEqual("[::]");
- expect(gaogao.port).assertEqual("-1");
- expect(gaogao.path).assertEqual("/path/path23");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("qwer");
- })
-
- /**
- * @tc.name: testConstructor031
- * @tc.desc: Constructs a URI by parsing the given string.
- * @tc.author: zhaoduwei
- */
- it('testConstructor031', 0, function () {
- let gaogao = new uri.URI('http://[::192:0:5]/path/path23?query#qwer');
- expect(gaogao.scheme).assertEqual("http");
- expect(gaogao.authority).assertEqual("[::192:0:5]");
- expect(gaogao.ssp).assertEqual("//[::192:0:5]/path/path23?query");
- expect(gaogao.userInfo).assertEqual("null");
- expect(gaogao.host).assertEqual("[::192:0:5]");
- expect(gaogao.port).assertEqual("-1");
- expect(gaogao.path).assertEqual("/path/path23");
- expect(gaogao.query).assertEqual("query");
- expect(gaogao.fragment).assertEqual("qwer");
- })
-
- /**
- * @tc.name: testEquals001
- * @tc.desc: Tests this URI for equality with another object.
- * @tc.author: zhaoduwei
- */
- it('testEquals001', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
- let gaogao1 = gaogao;
- let res = gaogao.equals(gaogao1);
- expect(res).assertEqual(true);
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_002
- * @tc.desc: Tests this URI for equality with another object.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_002', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
- let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
- let res = gaogao.equals(gaogao1);
- expect(res).assertEqual(true);
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_003
- * @tc.desc: Tests this URI for equality with another object.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_003', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
- let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment123');
- let res = gaogao.equals(gaogao1);
- expect(res).assertEqual(false);
- })
-
- /**
- * @tc.name: testEquals004
- * @tc.desc: Tests this URI for equality with another object.
- * @tc.author: zhaoduwei
- */
- it('testEquals004', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@wwwaaa:99/path1?query#fagment');
- let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment123');
- let res = gaogao.equals(gaogao1);
- expect(res).assertEqual(false);
- })
-
- /**
- * @tc.name: testEquals005
- * @tc.desc: Tests this URI for equality with another object.
- * @tc.author: zhaoduwei
- */
- it('testEquals005', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
- let gaogao1 = new uri.URI('http://[1:0:0:1:2:1:2:1]/path1?query#fagment123');
- let res = gaogao.equals(gaogao1);
- expect(res).assertEqual(false);
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_001
- * @tc.desc: Normalizes this URI's path.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_001', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66./../././mm/.././path1?query#fagment');
- let res = gaogao.normalize();
- expect(res.path).assertEqual("/path/path1");
- expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/path1?query#fagment");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_002
- * @tc.desc: Normalizes this URI's path.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_002', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path?query#fagment');
- let res = gaogao.normalize();
- expect(res.path).assertEqual("/../../path");
- expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path?query#fagment");
- })
-
- /**
- * @tc.name: testNormalize003
- * @tc.desc: Normalizes this URI's path.
- * @tc.author: zhaoduwei
- */
- it('testNormalize003', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment');
- let res = gaogao.normalize();
- expect(res.path).assertEqual("/../../../aa/bb/cc");
- expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../../aa/bb/cc?query#fagment");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_004
- * @tc.desc: Normalizes this URI's path.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_004', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../path/.././../aa/bb/cc?query');
- let res = gaogao.normalize();
- expect(res.path).assertEqual("/../../aa/bb/cc");
- expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../aa/bb/cc?query");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_005
- * @tc.desc: Normalizes this URI's path.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_005', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/./path/./aa/bb/cc?query#fagment');
- let res = gaogao.normalize();
- expect(res.path).assertEqual("/path/aa/bb/cc");
- expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/aa/bb/cc?query#fagment");
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_001
- * @tc.desc: Returns the content of this URI as a US-ASCII string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_001', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment');
- let res = gaogao.toString();
- expect(res).assertEqual('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment');
- })
-
- /**
- * @tc.name: testToString002
- * @tc.desc: Returns the content of this URI as a US-ASCII string.
- * @tc.author: zhaoduwei
- */
- it('testToString002', 0, function () {
- let gaogao = new uri.URI('htt1p://gg:gaogao@[::192.9.5.5]:99/path/66path1?query#fagment');
- let res = gaogao.toString();
- expect(res).assertEqual('htt1p://gg:gaogao@[::192.9.5.5]:99/path/66path1?query#fagment');
- })
-
- /**
- * @tc.name: testToString003
- * @tc.desc: Returns the content of this URI as a US-ASCII string.
- * @tc.author: zhaoduwei
- */
- it('testToString003', 0, function () {
- let gaogao = new uri.URI('ftp://username:password@www.baidu.com:88/path?query#fagment');
- let res = gaogao.toString();
- expect(res).assertEqual('ftp://username:password@www.baidu.com:88/path?query#fagment');
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_004
- * @tc.desc: Returns the content of this URI as a US-ASCII string.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_004', 0, function () {
- let gaogao = new uri.URI('http://gg:gao你好gao@199.98.55.44:99/path/p你好ath?qu你好ery#fag你好ment');
- let res = gaogao.toString();
- expect(res).assertEqual('http://gg:gao%E4%BD%A0%E5%A5%BDgao@199.98.55.44:99/path/' +
- 'p%E4%BD%A0%E5%A5%BDath?qu%E4%BD%A0%E5%A5%BDery#fag%E4%BD%A0%E5%A5%BDment');
- })
-
- /**
- * @tc.name: testToString005
- * @tc.desc: Returns the content of this URI as a US-ASCII string.
- * @tc.author: zhaoduwei
- */
- it('testToString005', 0, function () {
- let gaogao = new uri.URI('http://gg:gaogao@199.98.55.44:99/path/path?query#fagment');
- let res = gaogao.toString();
- expect(res).assertEqual('http://gg:gaogao@199.98.55.44:99/path/path?query#fagment');
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_001
- * @tc.desc: Tells whether or not this URI is absolute.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_001', 0, function () {
- let gaogao = new uri.URI('f/tp://username:password@www.baidu.com:88/path?query#fagment');
- let res = gaogao.checkIsAbsolute();
- expect(res).assertEqual(false);
- })
-
- /**
- * @tc.name: SUB_Runtime_JSAPI_002
- * @tc.desc: Tells whether or not this URI is absolute.
- * @tc.author: zhaoduwei
- */
- it('SUB_Runtime_JSAPI_002', 0, function () {
- let gaogao = new uri.URI('ftp://username:password@www.baidu.com:88/path?query#fagment');
- let res = gaogao.checkIsAbsolute();
- expect(res).assertEqual(true);
- })
-
- /**
- * @tc.name: testCheckIsAbsolute003
- * @tc.desc: Tells whether or not this URI is absolute.
- * @tc.author: zhaoduwei
- */
- it('testCheckIsAbsolute003', 0, function () {
- let gaogao = new uri.URI('htt/p://username:password@www.baidu.com:88/path?query#fagment');
- let res = gaogao.checkIsAbsolute();
- expect(res).assertEqual(false);
- })
-
- /**
- * @tc.name: testCheckIsAbsolute004
- * @tc.desc: Tells whether or not this URI is absolute.
- * @tc.author: zhaoduwei
- */
- it('testCheckIsAbsolute004', 0, function () {
- let gaogao = new uri.URI('https://username:password@www.baidu.com:88/path?query#fagment');
- let res = gaogao.checkIsAbsolute();
- expect(res).assertEqual(true);
- })
-
- /**
- * @tc.name: testCheckIsAbsolute005
- * @tc.desc: Tells whether or not this URI is absolute.
- * @tc.author: zhaoduwei
- */
- it('testCheckIsAbsolute005', 0, function () {
- let gaogao = new uri.URI('http1://username:password@www.baidu.com:88/path?query#fagment');
- let res = gaogao.checkIsAbsolute();
- expect(res).assertEqual(true);
- })
-})
\ No newline at end of file
+/*
+ * Copyright (C) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the 'License')
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import uri from '@ohos.uri'
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
+export function UriTest() {
+describe('UriTest', function () {
+
+ /**
+ * @tc.name: testUriConstruction001
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction001', 0, function () {
+ try {
+ let that = new uri.URI('#http://username:password@host:8080/directory/file?foo=1&bar=2');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: #It can't be the first");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction002
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction002', 0, function () {
+ try {
+ let that = new uri.URI({name: 'gaogao'});
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: input type err");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction003
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction003', 0, function () {
+ try {
+ let that = new uri.URI('ht/tp://username:pas sword@host:8080/directory/file?foo=1&bar=2');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: SpecialPath does not conform to the rule");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction004
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction004', 0, function () {
+ try {
+ let that = new uri.URI('http://username:password@[::]:8080/directory/file?Query#gaogao faofao');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: Fragment does not conform to the rule");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction005
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction005', 0, function () {
+ try {
+ let that = new uri.URI('http://username:password@host:8080/directory/file?foo^=1&bar=2#gaogaofaofao');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: Query does not conform to the rule");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction006
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction006', 0, function () {
+ try {
+ let that = new uri.URI('1http://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: Scheme the first character must be a letter");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction007
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction007', 0, function () {
+ try {
+ let that = new uri.URI('ht@tp://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: scheme does not conform to the rule");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction008
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction008', 0, function () {
+ try {
+ let that = new uri.URI('http://username:password@[::]:80r80/directory/file?foo=1&bar=2#gaogaofaofao');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: Prot does not conform to the rule");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction009
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction009', 0, function () {
+ try {
+ let that = new uri.URI('http://username:password@[::12:55:8080/directory/file?foo=1&bar=2#gaogaofaofao');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: IPv6 is missing a closing bracket");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction010
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction010', 0, function () {
+ try {
+ let that = new uri.URI('http://username:pa^ssword@[::12:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: userInfo does not conform to the rule");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction011
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction011', 0, function () {
+ try {
+ let that = new uri.URI('http://username:password@[::1你2:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao');
+ } catch (err) {
+ expect(err.toString()).assertEqual("Error: ipv6 does not conform to the rule");
+ }
+ })
+
+ /**
+ * @tc.name: testUriConstruction012
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction012', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@www.baidu.com:99/path/path?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@www.baidu.com:99");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@www.baidu.com:99/path/path?query");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("www.baidu.com");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/path");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction013
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction013', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1080::8:800:200C:417A]:99/path/66path1?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@[1080::8:800:200C:417A]:99");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@[1080::8:800:200C:417A]:99/path/66path1?query");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("[1080::8:800:200C:417A]");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/66path1");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction014
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction014', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[::]:88/path/path66?foooo#gaogao');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@[::]:88");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@[::]:88/path/path66?foooo");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("[::]");
+ expect(gaogao.port).assertEqual("88");
+ expect(gaogao.path).assertEqual("/path/path66");
+ expect(gaogao.query).assertEqual("foooo");
+ expect(gaogao.fragment).assertEqual("gaogao");
+ })
+
+ /**
+ * @tc.name: testUriConstruction015
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction015', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66path1?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@[1:0:0:1:2:1:2:1]:99");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66path1?query");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("[1:0:0:1:2:1:2:1]");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/66path1");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction016
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction016', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[::FFFF:129.144.52.38]:99/path/path?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@[::FFFF:129.144.52.38]:99");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@[::FFFF:129.144.52.38]:99/path/path?query");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("[::FFFF:129.144.52.38]");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/path");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction017
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction017', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[::192.9.5.5]:99/path/path?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@[::192.9.5.5]:99");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@[::192.9.5.5]:99/path/path?query");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("[::192.9.5.5]");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/path");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction018
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction018', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[22::22:2:2%ss]:99/path/path?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@[22::22:2:2%ss]:99");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@[22::22:2:2%ss]:99/path/path?query");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("[22::22:2:2%ss]");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/path");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction019
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction019', 0, function () {
+ let gaogao =
+ new uri.URI('http://gg:gaogao@[fe80:0000:0001:0000:0440:44ff:1233:5678]:99/path/path?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@[fe80:0000:0001:0000:0440:44ff:1233:5678]:99");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@[fe80:0000:0001:0000:0440:44ff:1233:5678]:99/path/path?query");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("[fe80:0000:0001:0000:0440:44ff:1233:5678]");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/path");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction020
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction020', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[fe80::0001:0000]:99/path/path?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@[fe80::0001:0000]:99");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@[fe80::0001:0000]:99/path/path?query");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("[fe80::0001:0000]");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/path");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction021
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction021', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@199.98.55.44:99/path/path?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("gg:gaogao@199.98.55.44:99");
+ expect(gaogao.ssp).assertEqual("//gg:gaogao@199.98.55.44:99/path/path?query");
+ expect(gaogao.userInfo).assertEqual("gg:gaogao");
+ expect(gaogao.host).assertEqual("199.98.55.44");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/path");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction022
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction022', 0, function () {
+ let gaogao = new uri.URI('http://16.9.5.4:99/path/path?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("16.9.5.4:99");
+ expect(gaogao.ssp).assertEqual("//16.9.5.4:99/path/path?query");
+ expect(gaogao.userInfo).assertEqual("null");
+ expect(gaogao.host).assertEqual("16.9.5.4");
+ expect(gaogao.port).assertEqual("99");
+ expect(gaogao.path).assertEqual("/path/path");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction023
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction023', 0, function () {
+ let gaogao = new uri.URI('http://49.99.54.12:50/path/path23?query#fagment');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("49.99.54.12:50");
+ expect(gaogao.ssp).assertEqual("//49.99.54.12:50/path/path23?query");
+ expect(gaogao.userInfo).assertEqual("null");
+ expect(gaogao.host).assertEqual("49.99.54.12");
+ expect(gaogao.port).assertEqual("50");
+ expect(gaogao.path).assertEqual("/path/path23");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("fagment");
+ })
+
+ /**
+ * @tc.name: testUriConstruction024
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction024', 0, function () {
+ let gaogao = new uri.URI('http://user@49.10pe8.54.12:80/path/path23?query#qwer');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("user@49.10pe8.54.12:80");
+ expect(gaogao.ssp).assertEqual("//user@49.10pe8.54.12:80/path/path23?query");
+ expect(gaogao.userInfo).assertEqual("null");
+ expect(gaogao.host).assertEqual("null");
+ expect(gaogao.port).assertEqual("-1");
+ expect(gaogao.path).assertEqual("/path/path23");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("qwer");
+ })
+
+ /**
+ * @tc.name: testUriConstruction025
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction025', 0, function () {
+ let gaogao = new uri.URI('http://user@www.baidu.com/path/path23?query#qwer');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("user@www.baidu.com");
+ expect(gaogao.ssp).assertEqual("//user@www.baidu.com/path/path23?query");
+ expect(gaogao.userInfo).assertEqual("user");
+ expect(gaogao.host).assertEqual("www.baidu.com");
+ expect(gaogao.port).assertEqual("-1");
+ expect(gaogao.path).assertEqual("/path/path23");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("qwer");
+ })
+
+ /**
+ * @tc.name: testUriConstruction026
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction026', 0, function () {
+ let gaogao = new uri.URI('http://user@www.hw.com:77/path/path23?query#qwer');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("user@www.hw.com:77");
+ expect(gaogao.ssp).assertEqual("//user@www.hw.com:77/path/path23?query");
+ expect(gaogao.userInfo).assertEqual("user");
+ expect(gaogao.host).assertEqual("www.hw.com");
+ expect(gaogao.port).assertEqual("77");
+ expect(gaogao.path).assertEqual("/path/path23");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("qwer");
+ })
+
+ /**
+ * @tc.name: testUriConstruction027
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction027', 0, function () {
+ let gaogao = new uri.URI('ht2tp://user@www.h12343w.com:77/path/path23?query#qwer');
+ expect(gaogao.scheme).assertEqual("ht2tp");
+ expect(gaogao.authority).assertEqual("user@www.h12343w.com:77");
+ expect(gaogao.ssp).assertEqual("//user@www.h12343w.com:77/path/path23?query");
+ expect(gaogao.userInfo).assertEqual("user");
+ expect(gaogao.host).assertEqual("www.h12343w.com");
+ expect(gaogao.port).assertEqual("77");
+ expect(gaogao.path).assertEqual("/path/path23");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("qwer");
+ })
+
+ /**
+ * @tc.name: testUriConstruction028
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction028', 0, function () {
+ let gaogao = new uri.URI('ht2tp://user@www.1hw.1com:77/path/path23?query#qwer');
+ expect(gaogao.scheme).assertEqual("ht2tp");
+ expect(gaogao.authority).assertEqual("user@www.1hw.1com:77");
+ expect(gaogao.ssp).assertEqual("//user@www.1hw.1com:77/path/path23?query");
+ expect(gaogao.userInfo).assertEqual("null");
+ expect(gaogao.host).assertEqual("null");
+ expect(gaogao.port).assertEqual("-1");
+ expect(gaogao.path).assertEqual("/path/path23");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("qwer");
+ })
+
+ /**
+ * @tc.name: testUriConstruction029
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction029', 0, function () {
+ let gaogao = new uri.URI('http://user@hosthost/path/path23?query#qwer');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("user@hosthost");
+ expect(gaogao.ssp).assertEqual("//user@hosthost/path/path23?query");
+ expect(gaogao.userInfo).assertEqual("user");
+ expect(gaogao.host).assertEqual("hosthost");
+ expect(gaogao.port).assertEqual("-1");
+ expect(gaogao.path).assertEqual("/path/path23");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("qwer");
+ })
+
+ /**
+ * @tc.name: testUriConstruction030
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction030', 0, function () {
+ let gaogao = new uri.URI('http://user@[::]/path/path23?query#qwer');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("user@[::]");
+ expect(gaogao.ssp).assertEqual("//user@[::]/path/path23?query");
+ expect(gaogao.userInfo).assertEqual("user");
+ expect(gaogao.host).assertEqual("[::]");
+ expect(gaogao.port).assertEqual("-1");
+ expect(gaogao.path).assertEqual("/path/path23");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("qwer");
+ })
+
+ /**
+ * @tc.name: testUriConstruction031
+ * @tc.desc: Constructs a URI by parsing the given string.
+ * @tc.author: zhaoduwei
+ */
+ it('testUriConstruction031', 0, function () {
+ let gaogao = new uri.URI('http://[::192:0:5]/path/path23?query#qwer');
+ expect(gaogao.scheme).assertEqual("http");
+ expect(gaogao.authority).assertEqual("[::192:0:5]");
+ expect(gaogao.ssp).assertEqual("//[::192:0:5]/path/path23?query");
+ expect(gaogao.userInfo).assertEqual("null");
+ expect(gaogao.host).assertEqual("[::192:0:5]");
+ expect(gaogao.port).assertEqual("-1");
+ expect(gaogao.path).assertEqual("/path/path23");
+ expect(gaogao.query).assertEqual("query");
+ expect(gaogao.fragment).assertEqual("qwer");
+ })
+
+ /**
+ * @tc.name: testEquals001
+ * @tc.desc: Tests this URI for equality with another object.
+ * @tc.author: zhaoduwei
+ */
+ it('testEquals001', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
+ let gaogao1 = gaogao;
+ let res = gaogao.equals(gaogao1);
+ expect(res).assertEqual(true);
+ })
+
+ /**
+ * @tc.name: testEquals002
+ * @tc.desc: Tests this URI for equality with another object.
+ * @tc.author: zhaoduwei
+ */
+ it('testEquals002', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
+ let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
+ let res = gaogao.equals(gaogao1);
+ expect(res).assertEqual(true);
+ })
+
+ /**
+ * @tc.name: testEquals003
+ * @tc.desc: Tests this URI for equality with another object.
+ * @tc.author: zhaoduwei
+ */
+ it('testEquals003', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
+ let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment123');
+ let res = gaogao.equals(gaogao1);
+ expect(res).assertEqual(false);
+ })
+
+ /**
+ * @tc.name: testEquals004
+ * @tc.desc: Tests this URI for equality with another object.
+ * @tc.author: zhaoduwei
+ */
+ it('testEquals004', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@wwwaaa:99/path1?query#fagment');
+ let gaogao1 = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment123');
+ let res = gaogao.equals(gaogao1);
+ expect(res).assertEqual(false);
+ })
+
+ /**
+ * @tc.name: testEquals005
+ * @tc.desc: Tests this URI for equality with another object.
+ * @tc.author: zhaoduwei
+ */
+ it('testEquals005', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment');
+ let gaogao1 = new uri.URI('http://[1:0:0:1:2:1:2:1]/path1?query#fagment123');
+ let res = gaogao.equals(gaogao1);
+ expect(res).assertEqual(false);
+ })
+
+ /**
+ * @tc.name: testNormalize001
+ * @tc.desc: Normalizes this URI's path.
+ * @tc.author: zhaoduwei
+ */
+ it('testNormalize001', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66./../././mm/.././path1?query#fagment');
+ let res = gaogao.normalize();
+ expect(res.path).assertEqual("/path/path1");
+ expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/path1?query#fagment");
+ })
+
+ /**
+ * @tc.name: testNormalize002
+ * @tc.desc: Normalizes this URI's path.
+ * @tc.author: zhaoduwei
+ */
+ it('testNormalize002', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path?query#fagment');
+ let res = gaogao.normalize();
+ expect(res.path).assertEqual("/../../path");
+ expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path?query#fagment");
+ })
+
+ /**
+ * @tc.name: testNormalize003
+ * @tc.desc: Normalizes this URI's path.
+ * @tc.author: zhaoduwei
+ */
+ it('testNormalize003', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment');
+ let res = gaogao.normalize();
+ expect(res.path).assertEqual("/../../../aa/bb/cc");
+ expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../../aa/bb/cc?query#fagment");
+ })
+
+ /**
+ * @tc.name: testNormalize004
+ * @tc.desc: Normalizes this URI's path.
+ * @tc.author: zhaoduwei
+ */
+ it('testNormalize004', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../path/.././../aa/bb/cc?query');
+ let res = gaogao.normalize();
+ expect(res.path).assertEqual("/../../aa/bb/cc");
+ expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../aa/bb/cc?query");
+ })
+
+ /**
+ * @tc.name: testNormalize005
+ * @tc.desc: Normalizes this URI's path.
+ * @tc.author: zhaoduwei
+ */
+ it('testNormalize005', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/./path/./aa/bb/cc?query#fagment');
+ let res = gaogao.normalize();
+ expect(res.path).assertEqual("/path/aa/bb/cc");
+ expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/aa/bb/cc?query#fagment");
+ })
+
+ /**
+ * @tc.name: testToString001
+ * @tc.desc: Returns the content of this URI as a US-ASCII string.
+ * @tc.author: zhaoduwei
+ */
+ it('testToString001', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment');
+ let res = gaogao.toString();
+ expect(res).assertEqual('http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment');
+ })
+
+ /**
+ * @tc.name: testToString002
+ * @tc.desc: Returns the content of this URI as a US-ASCII string.
+ * @tc.author: zhaoduwei
+ */
+ it('testToString002', 0, function () {
+ let gaogao = new uri.URI('htt1p://gg:gaogao@[::192.9.5.5]:99/path/66path1?query#fagment');
+ let res = gaogao.toString();
+ expect(res).assertEqual('htt1p://gg:gaogao@[::192.9.5.5]:99/path/66path1?query#fagment');
+ })
+
+ /**
+ * @tc.name: testToString003
+ * @tc.desc: Returns the content of this URI as a US-ASCII string.
+ * @tc.author: zhaoduwei
+ */
+ it('testToString003', 0, function () {
+ let gaogao = new uri.URI('ftp://username:password@www.baidu.com:88/path?query#fagment');
+ let res = gaogao.toString();
+ expect(res).assertEqual('ftp://username:password@www.baidu.com:88/path?query#fagment');
+ })
+
+ /**
+ * @tc.name: testToString004
+ * @tc.desc: Returns the content of this URI as a US-ASCII string.
+ * @tc.author: zhaoduwei
+ */
+ it('testToString004', 0, function () {
+ let gaogao = new uri.URI('http://gg:gao你好gao@199.98.55.44:99/path/p你好ath?qu你好ery#fag你好ment');
+ let res = gaogao.toString();
+ expect(res).assertEqual('http://gg:gao%E4%BD%A0%E5%A5%BDgao@199.98.55.44:99/path/' +
+ 'p%E4%BD%A0%E5%A5%BDath?qu%E4%BD%A0%E5%A5%BDery#fag%E4%BD%A0%E5%A5%BDment');
+ })
+
+ /**
+ * @tc.name: testToString005
+ * @tc.desc: Returns the content of this URI as a US-ASCII string.
+ * @tc.author: zhaoduwei
+ */
+ it('testToString005', 0, function () {
+ let gaogao = new uri.URI('http://gg:gaogao@199.98.55.44:99/path/path?query#fagment');
+ let res = gaogao.toString();
+ expect(res).assertEqual('http://gg:gaogao@199.98.55.44:99/path/path?query#fagment');
+ })
+
+ /**
+ * @tc.name: testCheckIsAbsolute001
+ * @tc.desc: Tells whether or not this URI is absolute.
+ * @tc.author: zhaoduwei
+ */
+ it('testCheckIsAbsolute001', 0, function () {
+ let gaogao = new uri.URI('f/tp://username:password@www.baidu.com:88/path?query#fagment');
+ let res = gaogao.checkIsAbsolute();
+ expect(res).assertEqual(false);
+ })
+
+ /**
+ * @tc.name: testCheckIsAbsolute002
+ * @tc.desc: Tells whether or not this URI is absolute.
+ * @tc.author: zhaoduwei
+ */
+ it('testCheckIsAbsolute002', 0, function () {
+ let gaogao = new uri.URI('ftp://username:password@www.baidu.com:88/path?query#fagment');
+ let res = gaogao.checkIsAbsolute();
+ expect(res).assertEqual(true);
+ })
+
+ /**
+ * @tc.name: testCheckIsAbsolute003
+ * @tc.desc: Tells whether or not this URI is absolute.
+ * @tc.author: zhaoduwei
+ */
+ it('testCheckIsAbsolute003', 0, function () {
+ let gaogao = new uri.URI('htt/p://username:password@www.baidu.com:88/path?query#fagment');
+ let res = gaogao.checkIsAbsolute();
+ expect(res).assertEqual(false);
+ })
+
+ /**
+ * @tc.name: testCheckIsAbsolute004
+ * @tc.desc: Tells whether or not this URI is absolute.
+ * @tc.author: zhaoduwei
+ */
+ it('testCheckIsAbsolute004', 0, function () {
+ let gaogao = new uri.URI('https://username:password@www.baidu.com:88/path?query#fagment');
+ let res = gaogao.checkIsAbsolute();
+ expect(res).assertEqual(true);
+ })
+
+ /**
+ * @tc.name: testCheckIsAbsolute005
+ * @tc.desc: Tells whether or not this URI is absolute.
+ * @tc.author: zhaoduwei
+ */
+ it('testCheckIsAbsolute005', 0, function () {
+ let gaogao = new uri.URI('http1://username:password@www.baidu.com:88/path?query#fagment');
+ let res = gaogao.checkIsAbsolute();
+ expect(res).assertEqual(true);
+ })
+})
+}
\ No newline at end of file
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/resources/base/element/string.json b/commonlibrary/ets_utils/uri_lib_standard/src/main/resources/base/element/string.json
index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..ffc1ab6f94264b1fcbbb30068e6ec1ff96369e0e 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/src/main/resources/base/element/string.json
+++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/resources/base/element/string.json
@@ -1,12 +1,28 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "entry_MainAbility"
- },
- {
- "name": "mainability_description",
- "value": "JS_Empty Ability"
- }
- ]
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "entry_MainAbility"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Empty Ability"
+ },
+ {
+ "name": "MainAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "MainAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "TestAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "TestAbility_label",
+ "value": "label"
+ }
+ ]
}
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/BUILD.gn b/distributeddatamgr/appdatamgrjstest/hap/BUILD.gn
index 183dfd7aed63de8fd79046dcab8dfb73fcaebec8..e97cff2668aaa3dd45d74bc0f18da34cc968c81e 100644
--- a/distributeddatamgr/appdatamgrjstest/hap/BUILD.gn
+++ b/distributeddatamgr/appdatamgrjstest/hap/BUILD.gn
@@ -21,8 +21,6 @@ ohos_js_hap_suite("appdatamgr_js_test") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAppdatamagrJsTest"
- subsystem_name = "distributeddatamgr"
- part_name = "relational_store"
}
ohos_js_assets("appdatamgr_js_assets") {
js2abc = true
diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/app.js b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/app.js
index 6a06f7f6cad18519bf28b42a2a171b69d2140f32..9b225d0cce79fd927c66e75cd35a88267a92431d 100644
--- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/app.js
+++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/app.js
@@ -1,22 +1,22 @@
-/*
-* Copyright (c) 2021 Huawei Device Co., Ltd.
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-export default {
- onCreate() {
- console.info('TestApplication onCreate');
- },
- onDestroy() {
- console.info('TestApplication onDestroy');
- }
-};
+/*
+* 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/src/main/js/MainAbility/i18n/en-US.json b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/i18n/en-US.json
index 55561b83737c3c31d082fbfa11e5fc987a351104..3cb24b374b1d919ca8eac0638f361692b603a900 100644
--- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/i18n/en-US.json
+++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/i18n/en-US.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/i18n/zh-CN.json b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/i18n/zh-CN.json
index cce1af06761a42add0cac1a0567aa3237eda8cb4..c804e32c0c3103929baca5617cdac70be11fdba1 100644
--- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/i18n/zh-CN.json
+++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/i18n/zh-CN.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/pages/index/index.css b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/pages/index/index.css
index e19021816bc61bc4cb5128677386b9789132e270..59e50f0bfb9ab1919501533a2b8b87771a4162e9 100644
--- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/pages/index/index.css
+++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/pages/index/index.css
@@ -1,23 +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;
-}
+/*
+* 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/src/main/js/MainAbility/pages/index/index.hml b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/pages/index/index.hml
index 1c26cf73deab18390844a53a103458b10ed11e93..99a01341103ff63765e8163279d1e50a00e039d4 100644
--- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/pages/index/index.hml
+++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/MainAbility/pages/index/index.hml
@@ -1,5 +1,5 @@
-
-
- {{ $t('strings.hello') }} {{title}}
-
-
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/List.test.js b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/List.test.js
index e84182992f332f29da33981a5006b3d837c0a9c2..56694bf6804ed0b45bf1b73738bf3bac4e19a806 100644
--- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/List.test.js
+++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/List.test.js
@@ -12,24 +12,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import dataAbilityPredicatesTest from './StorageHelperJsunit.test.js'
-import rdbStoreBackupRestoreWithFAContextTest from './StoragePromiseJsunit.test.js'
-import rdbstoreChangeEncryptKeyTest from './StorageCallBackJsunit.test.js'
-import rdbStoreDataSharePredicatesTest from './StorageSyncJsunit.test.js'
-import rdbStoreDeleteTest from './RdbstoreInsertJsunit.test.js'
-import rdbStoreDistributedTest from './RdbstoreDeleteJsunit.test.js'
-import rdbstoreInsertTest from './RdbStoreResultSetJsunit.test.js'
-import rdbStorePredicatesJoinTest from './RdbstorePredicatesJsunit.test.js'
-import rdbPredicatesTest from './RdbstoreRdbstoreJsunit.test.js'
-import rdbStoreTest from './RdbstoreStoreExcuteSqlJsunit.test.js'
-import rdbResultSetTest from './RdbstoreUpdateJsunit.test.js'
-import rdbstoreStoreExcuteSqlTest from './DataAbilityPredicatesJsunit.test.js'
+import dataAbilityPredicatesTest from './DataAbilityPredicatesJsunit.test.js'
+import rdbStoreBackupRestoreWithFAContextTest from './RdbstoreBackupRestoreWithFAContextJsunit.test.js'
+import rdbstoreChangeEncryptKeyTest from './RdbstoreChangeEncryptKeyJsunit.test.js'
+import rdbStoreDataSharePredicatesTest from './RdbStoreDataShareJsunit.test.js'
+import rdbStoreDeleteTest from './RdbstoreDeleteJsunit.test.js'
+import rdbStoreDistributedTest from './RdbStoreDistributedJsunit.test.js'
+import rdbstoreInsertTest from './RdbstoreInsertJsunit.test.js'
+import rdbStorePredicatesJoinTest from './RdbstorePredicatesJoinJsunit.test.js'
+import rdbPredicatesTest from './RdbstorePredicatesJsunit.test.js'
+import rdbStoreTest from './RdbstoreRdbstoreJsunit.test.js'
+import rdbResultSetTest from './RdbStoreResultSetJsunit.test.js'
+import rdbstoreStoreExcuteSqlTest from './RdbstoreStoreExcuteSqlJsunit.test.js'
import rdbstoreTransactionTest from './RdbstoreTransactionJsunit.test.js'
-import rdbStoreUpdateTest from './RdbstorePredicatesJoinJsunit.test.js'
-import storageCallBackTest from './RdbStoreDistributedJsunit.test.js'
-import storageHelperTest from './RdbstoreChangeEncryptKeyJsunit.test.js'
-import storagePromiseTest from './RdbStoreDataShareJsunit.test.js'
-import storageSyncTest from './RdbstoreBackupRestoreWithFAContextJsunit.test.js'
+import rdbStoreUpdateTest from './RdbstoreUpdateJsunit.test.js'
+import storageCallBackTest from './StorageCallBackJsunit.test.js'
+import storageHelperTest from './StorageHelperJsunit.test.js'
+import storagePromiseTest from './StoragePromiseJsunit.test.js'
+import storageSyncTest from './StorageSyncJsunit.test.js'
export default function testsuite() {
dataAbilityPredicatesTest()
rdbStoreBackupRestoreWithFAContextTest()
diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/RdbstoreStoreExcuteSqlJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/RdbstoreStoreExcuteSqlJsunit.test.js
index 7d8f70ce92561503626de2c14337fc59bbcefa9d..d6ef99fad522a2806bc103af019d7a5e1ea0f15d 100644
--- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/RdbstoreStoreExcuteSqlJsunit.test.js
+++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/test/RdbstoreStoreExcuteSqlJsunit.test.js
@@ -12,7 +12,7 @@
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import dataRdb from '@ohos.data.rdb';
const TAG = "[RDB_JSKITS_TEST]"
@@ -23,343 +23,345 @@ const STORE_CONFIG = {
}
var rdbStore = undefined;
-describe('rdbStoreInsertTest', function () {
- beforeAll(async function () {
- console.info(TAG + 'beforeAll')
- rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
- await rdbStore.executeSql(CREATE_TABLE_TEST, null);
- })
-
- beforeEach(async function () {
- await rdbStore.executeSql("DELETE FROM test");
- console.info(TAG + 'beforeEach')
- })
-
- afterEach(function () {
- console.info(TAG + 'afterEach')
- })
-
- afterAll(async function () {
- console.info(TAG + 'afterAll')
- rdbStore = null
- await dataRdb.deleteRdbStore("ExcuteSqlTest.db");
- })
-
- /**
- * @tc.name resultSet ExcuteSql normal test
- * @tc.number SUB_DDM_AppDataFWK_JSRDB_ExcuteSql_0010
- * @tc.desc resultSet ExcuteSql normal test
- */
- it('ExcuteSqlTest0001', 0, async function (done) {
- console.info(TAG + "************* ExcuteSqlTest0001 start *************");
- var u8 = new Uint8Array([1, 2, 3])
- //插入
- const valueBucket = {
- "name": "zhangsan",
- "age": 18,
- "salary": 100.5,
- "blobType": u8,
+export default function rdbstoreStoreExcuteSqlTest() {
+ describe('rdbstoreStoreExcuteSqlTest', function () {
+ beforeAll(async function () {
+ console.info(TAG + 'beforeAll')
+ rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
+ await rdbStore.executeSql(CREATE_TABLE_TEST, null);
+ })
+
+ beforeEach(async function () {
+ await rdbStore.executeSql("DELETE FROM test");
+ console.info(TAG + 'beforeEach')
+ })
+
+ afterEach(function () {
+ console.info(TAG + 'afterEach')
+ })
+
+ afterAll(async function () {
+ console.info(TAG + 'afterAll')
+ rdbStore = null
+ await dataRdb.deleteRdbStore("ExcuteSqlTest.db");
+ })
+
+ /**
+ * @tc.name resultSet ExcuteSql normal test
+ * @tc.number SUB_DDM_AppDataFWK_JSRDB_ExcuteSql_0010
+ * @tc.desc resultSet ExcuteSql normal test
+ */
+ it('ExcuteSqlTest0001', 0, async function (done) {
+ console.info(TAG + "************* ExcuteSqlTest0001 start *************");
+ var u8 = new Uint8Array([1, 2, 3])
+ //插入
+ const valueBucket = {
+ "name": "zhangsan",
+ "age": 18,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(1).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
+ {
+ const valueBucket = {
+ "name": "lisi",
+ "age": 18,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(2).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
}
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(1).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- {
- const valueBucket = {
- "name": "lisi",
- "age": 18,
- "salary": 100.5,
- "blobType": u8,
+ {
+ const valueBucket = {
+ "name": "lisi",
+ "age": 20,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(3).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
}
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(2).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- }
- {
- const valueBucket = {
- "name": "lisi",
- "age": 20,
- "salary": 100.5,
- "blobType": u8,
+ //sql删除
+ let executeSqlPromise = rdbStore.executeSql("DELETE FROM test WHERE age = ? OR age = ?", ["18", "20"])
+ executeSqlPromise.then(async (resultSet) => {
+ await console.info(TAG + "executeSql done: " + resultSet);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await executeSqlPromise
+
+
+ let querySqlPromise = rdbStore.querySql("SELECT * FROM test")
+ querySqlPromise.then(async (resultSet) => {
+ await expect(0).assertEqual(resultSet.rowCount)
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await querySqlPromise
+
+ done();
+ console.info(TAG + "************* ExcuteSqlTest0001 end *************");
+ })
+
+ /**
+ * @tc.name resultSet ExcuteSql normal test
+ * @tc.number SUB_DDM_AppDataFWK_JSRDB_ExcuteSql_0020
+ * @tc.desc resultSet ExcuteSql normal test
+ */
+ it('ExcuteSqlTest0002', 0, async function (done) {
+ console.info(TAG + "************* ExcuteSqlTest0002 start *************");
+ var u8 = new Uint8Array([2, 3, 4])
+ //插入
+ const valueBucket = {
+ "name": "zhangsan",
+ "age": 18,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(4).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
+ {
+ const valueBucket = {
+ "name": "lisi",
+ "age": 19,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(5).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
}
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(3).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- }
- //sql删除
- let executeSqlPromise = rdbStore.executeSql("DELETE FROM test WHERE age = ? OR age = ?", ["18", "20"])
- executeSqlPromise.then(async (resultSet) => {
- await console.info(TAG + "executeSql done: " + resultSet);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await executeSqlPromise
-
-
- let querySqlPromise = rdbStore.querySql("SELECT * FROM test")
- querySqlPromise.then(async (resultSet) => {
- await expect(0).assertEqual(resultSet.rowCount)
- }).catch((err) => {
- expect(null).assertFail();
- })
- await querySqlPromise
-
- done();
- console.info(TAG + "************* ExcuteSqlTest0001 end *************");
- })
-
- /**
- * @tc.name resultSet ExcuteSql normal test
- * @tc.number SUB_DDM_AppDataFWK_JSRDB_ExcuteSql_0020
- * @tc.desc resultSet ExcuteSql normal test
- */
- it('ExcuteSqlTest0002', 0, async function (done) {
- console.info(TAG + "************* ExcuteSqlTest0002 start *************");
- var u8 = new Uint8Array([2, 3, 4])
- //插入
- const valueBucket = {
- "name": "zhangsan",
- "age": 18,
- "salary": 100.5,
- "blobType": u8,
+ {
+ const valueBucket = {
+ "name": "lisi",
+ "age": 20,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(6).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
}
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(4).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- {
- const valueBucket = {
- "name": "lisi",
- "age": 19,
- "salary": 100.5,
- "blobType": u8,
+ let executeSqlPromise = rdbStore.executeSql("DELETE FROM test WHERE name = 'lisi'")
+ executeSqlPromise.then(async () => {
+ await console.info(TAG + "executeSql done");
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await executeSqlPromise
+
+ let querySqlPromise = rdbStore.querySql("SELECT * FROM test")
+ querySqlPromise.then(async (resultSet) => {
+ await expect(1).assertEqual(resultSet.rowCount)
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await querySqlPromise
+
+ done();
+ console.info(TAG + "************* ExcuteSqlTest0002 end *************");
+ })
+
+ /**
+ * @tc.name resultSet ExcuteSql normal test
+ * @tc.number SUB_DDM_AppDataFWK_JSRDB_ExcuteSql_0030
+ * @tc.desc resultSet ExcuteSql normal test
+ */
+ it('ExcuteSqlTest0003', 0, async function (done) {
+ console.info(TAG + "************* ExcuteSqlTest0003 start *************");
+ var u8 = new Uint8Array([3, 4, 5])
+ var nameStr = "lisi" + "e".repeat(2000) + "zhangsan"
+ //插入
+ const valueBucket = {
+ "name": "zhangsan",
+ "age": 18,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(7).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
+ {
+ const valueBucket = {
+ "name": nameStr,
+ "age": 19,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(8).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
}
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(5).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- }
- {
- const valueBucket = {
- "name": "lisi",
- "age": 20,
- "salary": 100.5,
- "blobType": u8,
+ {
+ const valueBucket = {
+ "name": nameStr,
+ "age": 28,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(9).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
}
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(6).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- }
- let executeSqlPromise = rdbStore.executeSql("DELETE FROM test WHERE name = 'lisi'")
- executeSqlPromise.then(async () => {
- await console.info(TAG + "executeSql done");
- }).catch((err) => {
- expect(null).assertFail();
- })
- await executeSqlPromise
-
- let querySqlPromise = rdbStore.querySql("SELECT * FROM test")
- querySqlPromise.then(async (resultSet) => {
- await expect(1).assertEqual(resultSet.rowCount)
- }).catch((err) => {
- expect(null).assertFail();
- })
- await querySqlPromise
-
- done();
- console.info(TAG + "************* ExcuteSqlTest0002 end *************");
- })
-
- /**
- * @tc.name resultSet ExcuteSql normal test
- * @tc.number SUB_DDM_AppDataFWK_JSRDB_ExcuteSql_0030
- * @tc.desc resultSet ExcuteSql normal test
- */
- it('ExcuteSqlTest0003', 0, async function (done) {
- console.info(TAG + "************* ExcuteSqlTest0003 start *************");
- var u8 = new Uint8Array([3, 4, 5])
- var nameStr = "lisi" + "e".repeat(2000) + "zhangsan"
- //插入
- const valueBucket = {
- "name": "zhangsan",
- "age": 18,
- "salary": 100.5,
- "blobType": u8,
+ let predicates = await new dataRdb.RdbPredicates("test")
+ predicates.equalTo("name", nameStr)
+ let querySqlPromise = rdbStore.query(predicates)
+ querySqlPromise.then(async (resultSet) => {
+ await expect(2).assertEqual(resultSet.rowCount)
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await querySqlPromise
+
+ let executeSqlPromise = rdbStore.executeSql("DELETE FROM test WHERE age = 19 AND name ='" + nameStr + "'")
+ executeSqlPromise.then(async () => {
+ await console.info(TAG + "executeSql done." );
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await executeSqlPromise
+ {
+ let querySqlPromise = rdbStore.querySql("SELECT * FROM test WHERE name ='" + nameStr + "'")
+ querySqlPromise.then(async (resultSet) => {
+ await expect(1).assertEqual(resultSet.rowCount)
+ expect(true).assertEqual(resultSet.goToFirstRow())
+ const name = resultSet.getString(resultSet.getColumnIndex("name"))
+ const age = resultSet.getLong(resultSet.getColumnIndex("age"))
+ const salary = resultSet.getDouble(resultSet.getColumnIndex("salary"))
+ const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType"))
+ expect(nameStr).assertEqual(name)
+ expect(2012).assertEqual(name.length)
+ expect(28).assertEqual(age)
+ expect(100.5).assertEqual(salary)
+ expect(3).assertEqual(blobType[0])
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await querySqlPromise
}
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(7).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- {
- const valueBucket = {
- "name": nameStr,
- "age": 19,
- "salary": 100.5,
- "blobType": u8,
+ done();
+ console.info(TAG + "************* ExcuteSqlTest0003 end *************");
+ })
+
+ /**
+ * @tc.name resultSet ExcuteSql normal test
+ * @tc.number SUB_DDM_AppDataFWK_JSRDB_ExcuteSql_0040
+ * @tc.desc resultSet ExcuteSql normal test
+ */
+ it('ExcuteSqlTest0004', 0, async function (done) {
+ console.info(TAG + "************* ExcuteSqlTest0004 start *************");
+ var u8 = new Uint8Array([3, 4, 5])
+ //插入
+ const valueBucket = {
+ "name": "zhangsan",
+ "age": 18,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(10).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
+ {
+ const valueBucket = {
+ "name": "lisi",
+ "age": 19,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(11).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
}
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(8).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- }
- {
- const valueBucket = {
- "name": nameStr,
- "age": 28,
- "salary": 100.5,
- "blobType": u8,
+ {
+ const valueBucket = {
+ "name": "lisi",
+ "age": 28,
+ "salary": 100.5,
+ "blobType": u8,
+ }
+ let insertPromise = rdbStore.insert("test", valueBucket)
+ insertPromise.then(async (ret) => {
+ expect(12).assertEqual(ret);
+ await console.info(TAG + "insert done: " + ret);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await insertPromise
}
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(9).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- }
- let predicates = await new dataRdb.RdbPredicates("test")
- predicates.equalTo("name", nameStr)
- let querySqlPromise = rdbStore.query(predicates)
- querySqlPromise.then(async (resultSet) => {
- await expect(2).assertEqual(resultSet.rowCount)
- }).catch((err) => {
- expect(null).assertFail();
- })
- await querySqlPromise
-
- let executeSqlPromise = rdbStore.executeSql("DELETE FROM test WHERE age = 19 AND name ='" + nameStr + "'")
- executeSqlPromise.then(async () => {
- await console.info(TAG + "executeSql done." );
- }).catch((err) => {
- expect(null).assertFail();
- })
- await executeSqlPromise
- {
- let querySqlPromise = rdbStore.querySql("SELECT * FROM test WHERE name ='" + nameStr + "'")
- querySqlPromise.then(async (resultSet) => {
- await expect(1).assertEqual(resultSet.rowCount)
- expect(true).assertEqual(resultSet.goToFirstRow())
- const name = resultSet.getString(resultSet.getColumnIndex("name"))
- const age = resultSet.getLong(resultSet.getColumnIndex("age"))
- const salary = resultSet.getDouble(resultSet.getColumnIndex("salary"))
- const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType"))
- expect(nameStr).assertEqual(name)
- expect(2012).assertEqual(name.length)
- expect(28).assertEqual(age)
- expect(100.5).assertEqual(salary)
- expect(3).assertEqual(blobType[0])
- }).catch((err) => {
- expect(null).assertFail();
- })
- await querySqlPromise
- }
- done();
- console.info(TAG + "************* ExcuteSqlTest0003 end *************");
+ let QuerySqlPromise = rdbStore.executeSql("DROP TABLE IF EXISTS test")
+ QuerySqlPromise.then(async (resultSet) => {
+ await console.info(TAG + "executeSql done: " + resultSet);
+ }).catch((err) => {
+ expect(null).assertFail();
+ })
+ await QuerySqlPromise
+
+ done();
+ console.info(TAG + "************* ExcuteSqlTest0004 end *************");
+ })
+
+
+ console.info(TAG + "*************Unit Test End*************");
})
-
- /**
- * @tc.name resultSet ExcuteSql normal test
- * @tc.number SUB_DDM_AppDataFWK_JSRDB_ExcuteSql_0040
- * @tc.desc resultSet ExcuteSql normal test
- */
- it('ExcuteSqlTest0004', 0, async function (done) {
- console.info(TAG + "************* ExcuteSqlTest0004 start *************");
- var u8 = new Uint8Array([3, 4, 5])
- //插入
- const valueBucket = {
- "name": "zhangsan",
- "age": 18,
- "salary": 100.5,
- "blobType": u8,
- }
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(10).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- {
- const valueBucket = {
- "name": "lisi",
- "age": 19,
- "salary": 100.5,
- "blobType": u8,
- }
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(11).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- }
- {
- const valueBucket = {
- "name": "lisi",
- "age": 28,
- "salary": 100.5,
- "blobType": u8,
- }
- let insertPromise = rdbStore.insert("test", valueBucket)
- insertPromise.then(async (ret) => {
- expect(12).assertEqual(ret);
- await console.info(TAG + "insert done: " + ret);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await insertPromise
- }
- let QuerySqlPromise = rdbStore.executeSql("DROP TABLE IF EXISTS test")
- QuerySqlPromise.then(async (resultSet) => {
- await console.info(TAG + "executeSql done: " + resultSet);
- }).catch((err) => {
- expect(null).assertFail();
- })
- await QuerySqlPromise
-
- done();
- console.info(TAG + "************* ExcuteSqlTest0004 end *************");
- })
-
-
- console.info(TAG + "*************Unit Test End*************");
-})
\ No newline at end of file
+}
diff --git a/distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/test/List.test.js b/distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/test/List.test.js
index daa7b49ea9dfec12d19642c2f236df44fd848ab9..882b1083afc40e61889d6334aeafa2f97304078e 100644
--- a/distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/test/List.test.js
+++ b/distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/test/List.test.js
@@ -14,5 +14,5 @@
*/
import objectStoreTest from './ObjectStoreJsunit.test.js'
export default function testsuite() {
-objectStoreTest()
+ objectStoreTest()
}
diff --git a/distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/test/ObjectStoreJsunit.test.js b/distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/test/ObjectStoreJsunit.test.js
index b34e485993018ac2bdc29c1be9779116e7e4480a..cd6da6bc2f4527d43ff0bd2cceda5eff65209056 100644
--- a/distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/test/ObjectStoreJsunit.test.js
+++ b/distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/test/ObjectStoreJsunit.test.js
@@ -12,7 +12,7 @@
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import distributedObject from '@ohos.data.distributedDataObject';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
@@ -66,7 +66,7 @@ var tokenID = undefined;
const TIMEOUT = 2000;
const PERMISSION_USER_SET = 1;
const PERMISSION_USER_NAME = "ohos.permission.DISTRIBUTED_DATASYNC";
-
+export default function objectStoreTest() {
describe('objectStoreTest', function () {
beforeAll(async function (done) {
console.info("====>beforeAll start====");
@@ -774,4 +774,5 @@ describe('objectStoreTest', function () {
console.info(TAG + "************* testRevokeSave002 end *************");
})
console.info(TAG + "*************Unit Test End*************");
-})
\ No newline at end of file
+})
+}
\ No newline at end of file
diff --git a/sensors/miscdevice_standard/BUILD.gn b/sensors/miscdevice_standard/BUILD.gn
old mode 100755
new mode 100644
index bb3a4072d93f9fbd99d64e34f80b550310f35c6b..9ffc93b7460661278a83002b6087c2d64ee5cfd4
--- a/sensors/miscdevice_standard/BUILD.gn
+++ b/sensors/miscdevice_standard/BUILD.gn
@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
-# limitations under the License.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
@@ -23,7 +23,9 @@ ohos_js_hap_suite("miscdevice_js_test") {
hap_name = "ActsmiscdeviceJSApiTest"
}
ohos_js_assets("miscdevice_js_assets") {
- source_dir = "./src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("miscdevice_js_resources") {
sources = [ "./src/main/resources" ]
diff --git a/sensors/miscdevice_standard/Test.json b/sensors/miscdevice_standard/Test.json
old mode 100755
new mode 100644
index 08ab49d444686017fed40652af735610cca0f19d..741aeefa18b39167aa54ffb8e564886539e712ba
--- a/sensors/miscdevice_standard/Test.json
+++ b/sensors/miscdevice_standard/Test.json
@@ -1,18 +1,19 @@
-{
- "description": "Configuration for miscdevice js api Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "160000",
- "package": "ohos.acts.sensors.sensor.function",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsmiscdeviceJSApiTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
+{
+ "description": "Configuration for miscdevice js api Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "160000",
+ "shell-timeout": "160000",
+ "bundle-name": "ohos.acts.sensors.sensor.function",
+ "package-name": "ohos.acts.sensors.sensor.function"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsmiscdeviceJSApiTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
}
\ No newline at end of file
diff --git a/sensors/miscdevice_standard/signature/openharmony_sx.p7b b/sensors/miscdevice_standard/signature/openharmony_sx.p7b
old mode 100755
new mode 100644
diff --git a/sensors/miscdevice_standard/src/main/config.json b/sensors/miscdevice_standard/src/main/config.json
index 8bebd310db83135aa6bf5cbc3bcfc7ede9d21550..4cf12423e5db61b8b000222120399f9d1b1f1fc3 100644
--- a/sensors/miscdevice_standard/src/main/config.json
+++ b/sensors/miscdevice_standard/src/main/config.json
@@ -1,66 +1,99 @@
-{
- "app": {
- "bundleName": "ohos.acts.sensors.sensor.function",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "ohos.acts.sensors.sensor.function",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry"
- },
- "abilities": [
- {
- "visible": true,
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "ohos.acts.sensors.sensor.function.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
- }
- }
- ],
- "reqPermissions": [
- {
- "name": "ohos.permission.VIBRATE",
- "reason": "need use ohos.permission.VIBRATE"
- }
- ]
- }
-}
+{
+ "app": {
+ "bundleName": "ohos.acts.sensors.sensor.function",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.acts.sensors.sensor.function",
+ "name": ".entry",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".MainAbility",
+ "srcLanguage": "js",
+ "srcPath": "MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:MainAbility_desc",
+ "label": "$string:MainAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name": "ohos.permission.VIBRATE",
+ "reason": "need use ohos.permission.VIBRATE"
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ },
+ "mainAbility": ".MainAbility",
+ "srcPath": ""
+ }
+}
\ No newline at end of file
diff --git a/sensors/miscdevice_standard/src/main/js/MainAbility/app.js b/sensors/miscdevice_standard/src/main/js/MainAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..8f82427eebd9a826e9dbd6a2e30f00e824737b27
--- /dev/null
+++ b/sensors/miscdevice_standard/src/main/js/MainAbility/app.js
@@ -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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/i18n/en-US.json b/sensors/miscdevice_standard/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/i18n/en-US.json
rename to sensors/miscdevice_standard/src/main/js/MainAbility/i18n/en-US.json
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/i18n/zh-CN.json b/sensors/miscdevice_standard/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/i18n/zh-CN.json
rename to sensors/miscdevice_standard/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/sensors/miscdevice_standard/src/main/js/default/pages/index/index.css b/sensors/miscdevice_standard/src/main/js/MainAbility/pages/index/index.css
old mode 100755
new mode 100644
similarity index 100%
rename from sensors/miscdevice_standard/src/main/js/default/pages/index/index.css
rename to sensors/miscdevice_standard/src/main/js/MainAbility/pages/index/index.css
diff --git a/sensors/miscdevice_standard/src/main/js/default/pages/index/index.hml b/sensors/miscdevice_standard/src/main/js/MainAbility/pages/index/index.hml
old mode 100755
new mode 100644
similarity index 100%
rename from sensors/miscdevice_standard/src/main/js/default/pages/index/index.hml
rename to sensors/miscdevice_standard/src/main/js/MainAbility/pages/index/index.hml
diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/pages/index/index.js b/sensors/miscdevice_standard/src/main/js/MainAbility/pages/index/index.js
similarity index 69%
rename from commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/pages/index/index.js
rename to sensors/miscdevice_standard/src/main/js/MainAbility/pages/index/index.js
index e478684e6715484fcbef0d6b02ff9b6e2ae197c3..af4eb3e36a12da5f06a27d61d5fd178a846dc866 100644
--- a/commonlibrary/ets_utils/uri_lib_standard/src/main/js/default/pages/index/index.js
+++ b/sensors/miscdevice_standard/src/main/js/MainAbility/pages/index/index.js
@@ -1,38 +1,32 @@
-/*
- * Copyright (C) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import app from '@system.app'
-import device from '@system.device'
-import router from '@system.router'
-import {Core} from 'deccjsunit/index'
-
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow finish')
- const core = Core.getInstance()
- core.init()
- require('../../../test/List.test')
- core.execute()
- },
- onReady() {
- },
-}
-
+/*
+ * Copyright (C) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
+}
diff --git a/sensors/miscdevice_standard/src/main/js/TestAbility/app.js b/sensors/miscdevice_standard/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..b84fbce8f576be6c9d868b31280b0f6383d35402
--- /dev/null
+++ b/sensors/miscdevice_standard/src/main/js/TestAbility/app.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
\ No newline at end of file
diff --git a/sensors/miscdevice_standard/src/main/js/TestAbility/i18n/en-US.json b/sensors/miscdevice_standard/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/sensors/miscdevice_standard/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/sensors/miscdevice_standard/src/main/js/TestAbility/i18n/zh-CN.json b/sensors/miscdevice_standard/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/sensors/miscdevice_standard/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/sensors/miscdevice_standard/src/main/js/TestAbility/pages/index/index.css b/sensors/miscdevice_standard/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/sensors/miscdevice_standard/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.container {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ left: 0px;
+ top: 0px;
+ width: 100%;
+ height: 100%;
+}
+
+.title {
+ font-size: 60px;
+ text-align: center;
+ width: 100%;
+ height: 40%;
+ margin: 10px;
+}
+
+@media screen and (device-type: phone) and (orientation: landscape) {
+ .title {
+ font-size: 60px;
+ }
+}
+
+@media screen and (device-type: tablet) and (orientation: landscape) {
+ .title {
+ font-size: 100px;
+ }
+}
\ No newline at end of file
diff --git a/sensors/miscdevice_standard/src/main/js/TestAbility/pages/index/index.hml b/sensors/miscdevice_standard/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/sensors/miscdevice_standard/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/sensors/miscdevice_standard/src/main/js/TestAbility/pages/index/index.js b/sensors/miscdevice_standard/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/sensors/miscdevice_standard/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/sensors/miscdevice_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/sensors/miscdevice_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511
--- /dev/null
+++ b/sensors/miscdevice_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/sensors/miscdevice_standard/src/main/js/test/List.test.js b/sensors/miscdevice_standard/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..9357dee4851f9fe39e739889a31a94d1fc75cb91
--- /dev/null
+++ b/sensors/miscdevice_standard/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.
+ */
+import VibratorJsTest_misc_1 from './Vibrator_old.test.js'
+import VibratorJsTest_misc_2 from './Vibrator_new.test.js'
+export default function testsuite() {
+ VibratorJsTest_misc_1()
+ VibratorJsTest_misc_2()
+}
diff --git a/sensors/miscdevice_standard/src/main/js/default/test/Vibrator_new.test.js b/sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js
similarity index 86%
rename from sensors/miscdevice_standard/src/main/js/default/test/Vibrator_new.test.js
rename to sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js
index ea26fd3ba39708253413ece20ee7242e032426af..aabb6596342d7e31d55435269aa6fa81b4f854ab 100644
--- a/sensors/miscdevice_standard/src/main/js/default/test/Vibrator_new.test.js
+++ b/sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js
@@ -1,488 +1,490 @@
-/*
- * 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 vibrator from '@ohos.vibrator'
-
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe("VibratorJsTest_misc_2", function () {
- beforeAll(function () {
-
- /*
- * @tc.setup: setup invoked before all testcases
- */
- console.info('beforeAll caled')
- })
-
- afterAll(function () {
-
- /*
- * @tc.teardown: teardown invoked after all testcases
- */
- console.info('afterAll caled')
- })
-
- beforeEach(function () {
-
- /*
- * @tc.setup: setup invoked before each testcases
- */
- console.info('beforeEach caled')
- })
-
- afterEach(function () {
-
- /*
- * @tc.teardown: teardown invoked after each testcases
- */
- console.info('afterEach caled')
- })
-
- /*
- * @tc.name:VibratorJsTest001
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0010
- */
- it("VibratorJsTest001", FUNCTION|MEDIUMTEST|LEVEL0, async function (done) {
- function vibrateCallback(error) {
- if (error) {
- console.info('VibratorJsTest001 vibrator error');
- expect(false).assertTrue();
- } else {
- console.info('VibratorJsTest001 vibrator success');
- expect(true).assertTrue();
- }
- setTimeout(() => {
- done();
- }, 500);
- }
- vibrator.vibrate(10, vibrateCallback);
- })
-
- /*
- * @tc.name:VibratorJsTest002
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0020
- */
- it("VibratorJsTest002", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- function vibrateCallback(error) {
- if (error) {
- console.info('VibratorJsTest002 vibrator success');
- expect(true).assertTrue();
- } else {
- console.info('VibratorJsTest002 vibrator error');
- expect(false).assertTrue();
- }
- setTimeout(() => {
- done();
- }, 500);
- }
- vibrator.vibrate(-1, vibrateCallback);
- })
-
- /*
- * @tc.name:VibratorJsTest003
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0030
- */
- it("VibratorJsTest003", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- function vibrateCallback(error) {
- if (error) {
- console.info('VibratorJsTest003 vibrator success');
- expect(true).assertTrue();
- } else {
- console.info('VibratorJsTest003 vibrator error');
- expect(false).assertTrue();
- }
- setTimeout(() => {
- done();
- }, 500);
- }
- vibrator.vibrate(1800000 + 1, vibrateCallback);
- })
-
- /*
- * @tc.name:VibratorJsTest004
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0040
- */
- it("VibratorJsTest004", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- function vibrateCallback(error) {
- if (error) {
- console.info('VibratorJsTest004 vibrator error');
- expect(false).assertTrue();
- } else {
- console.info('VibratorJsTest004 vibrator success');
- expect(true).assertTrue();
- }
- setTimeout(() => {
- done();
- }, 500);
- }
- vibrator.vibrate(1800000, vibrateCallback);
- })
-
- /*
- * @tc.name:VibratorJsTest005
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0050
- */
- it("VibratorJsTest005", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- function vibrateCallback(error) {
- if (error) {
- console.info('VibratorJsTest005 vibrator success');
- expect(true).assertTrue();
- } else {
- console.info('VibratorJsTest005 vibrator error');
- expect(false).assertTrue();
- }
- setTimeout(() => {
- done();
- }, 500);
- }
- vibrator.vibrate("", vibrateCallback);
- })
-
- /*
- * @tc.name:VibratorJsTest006
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0060
- */
- it("VibratorJsTest006", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- function vibrateCallback(error) {
- if (error) {
- console.info('VibratorJsTest006 vibrator success');
- expect(true).assertTrue();
- } else {
- console.info('VibratorJsTest006 vibrator error');
- expect(false).assertTrue();
- }
- setTimeout(() => {
- done();
- }, 500);
- }
- vibrator.vibrate("xxx", vibrateCallback);
- })
-
- /*
- * @tc.name:VibratorJsTest007
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0070
- */
- it("VibratorJsTest007", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- function vibrateCallback(error) {
- if (error) {
- console.info('VibratorJsTest007 vibrator error');
- expect(false).assertTrue();
- } else {
- console.info('VibratorJsTest007 vibrator success');
- expect(true).assertTrue();
- }
- setTimeout(() => {
- done();
- }, 500);
- }
- vibrator.vibrate("haptic.clock.timer", vibrateCallback);
- })
-
- /*
- * @tc.name:VibratorJsTest008
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0080
- */
- it("VibratorJsTest008", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- function vibrateCallback(error) {
- if (error) {
- console.info('VibratorJsTest008 stop error');
- expect(false).assertTrue();
- } else {
- console.info('VibratorJsTest008 stop success');
- expect(true).assertTrue();
- }
- setTimeout(() => {
- done();
- }, 500);
- }
- vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET, vibrateCallback);
- })
-
- /*
- * @tc.name:VibratorJsTest009
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0090
- */
- it("VibratorJsTest009", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- console.info('----------------------VibratorJsTest001---------------------------');
- function stopPromise() {
- return new Promise((resolve, reject) => {
- vibrator.stop("time", (error) => {
- if (error) {
- console.info('VibratorJsTest009 stop error');
- expect(false).assertTrue();
- setTimeout((err) => {
- reject(err);
- }, 500);
- } else {
- console.info('VibratorJsTest009 stop success');
- expect(true).assertTrue();
- setTimeout(() => {
- resolve();
- }, 500);
- }
- });
- })
- }
-
- let promise = new Promise((resolve, reject) => {
- vibrator.vibrate(180000, (error) => {
- if (error) {
- console.info('VibratorJsTest009 vibrate error');
- expect(false).assertTrue();
- setTimeout((err) => {
- reject(err);
- }, 500);
- } else {
- console.info('VibratorJsTest009 vibrate success');
- expect(true).assertTrue();
- setTimeout(() => {
- resolve();
- }, 500);
- }
- });
- })
-
- await promise.then(() => {
- return stopPromise();
- }, () => {
- console.info("VibratorJsTest009 reject");
- })
- done();
- })
-
- /*
- * @tc.name:VibratorJsTest010
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0100
- */
- it("VibratorJsTest010", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- function vibrateCallback(error) {
- if (error) {
- console.info('VibratorJsTest010 stop success');
- expect(true).assertTrue();
- } else {
- console.info('VibratorJsTest010 stop off');
- expect(false).assertTrue();
- }
- setTimeout(() => {
- done();
- }, 500);
- }
- vibrator.stop("", vibrateCallback);
- })
-
- /*
- * @tc.name:VibratorJsTest011
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0110
- */
- it("VibratorJsTest011", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- vibrator.vibrate(1000).then(() => {
- console.log("VibratorJsTest011 vibrate success");
- expect(true).assertTrue();
- setTimeout(() => {
- done();
- }, 500);
- }, (error) => {
- expect(false).assertTrue();
- console.log("VibratorJsTest011 vibrate error");
- setTimeout(() => {
- done();
- }, 500);
- });
- })
-
- /*
- * @tc.name:VibratorJsTest012
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0120
- */
- it("VibratorJsTest012", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- vibrator.vibrate(-1).then(() => {
- console.log("VibratorJsTest012 vibrate error");
- expect(false).assertTrue();
- setTimeout(() => {
- done();
- }, 500);
- }, (error) => {
- expect(true).assertTrue();
- console.log("VibratorJsTest012 vibrate success");
- setTimeout(() => {
- done();
- }, 500);
- });
- })
-
- /*
- * @tc.name:VibratorJsTest013
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0130
- */
- it("VibratorJsTest013", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- vibrator.vibrate(1800000 + 1).then(() => {
- console.log("VibratorJsTest013 vibrate error");
- expect(false).assertTrue();
- setTimeout(() => {
- done();
- }, 500);
- }, (error) => {
- expect(true).assertTrue();
- console.log("VibratorJsTest013 vibrate success");
- setTimeout(() => {
- done();
- }, 500);
- });
- })
-
- /*
- * @tc.name:VibratorJsTest014
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0140
- */
- it("VibratorJsTest014", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(() => {
- console.log("VibratorJsTest014 vibrate success");
- expect(true).assertTrue();
- setTimeout(() => {
- done();
- }, 500);
- }, (error) => {
- expect(false).assertTrue();
- console.log("VibratorJsTest014 vibrate error");
- setTimeout(() => {
- done();
- }, 500);
- });
- })
-
- /*
- * @tc.name:VibratorJsTest015
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150
- */
- it("VibratorJsTest015", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- vibrator.vibrate("").then(() => {
- console.log("VibratorJsTest015 vibrate error");
- expect(false).assertTrue();
- setTimeout(() => {
- done();
- }, 500);
- }, (error) => {
- expect(true).assertTrue();
- console.log("VibratorJsTest015 vibrate success");
- setTimeout(() => {
- done();
- }, 500);
- });
- })
-
- /*
- * @tc.name:VibratorJsTest016
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0160
- */
- it("VibratorJsTest016", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- vibrator.stop("").then(() => {
- console.log("VibratorJsTest016 stop error");
- expect(false).assertTrue();
- setTimeout(() => {
- done();
- }, 500);
- }, (error) => {
- expect(true).assertTrue();
- console.log("VibratorJsTest016 stop success");
- setTimeout(() => {
- done();
- }, 500);
- });
- })
-
- /*
- * @tc.name:VibratorJsTest017
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0170
- */
- it("VibratorJsTest017", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- vibrator.stop("preset").then(() => {
- console.log("VibratorJsTest017 off success");
- expect(true).assertTrue();
- setTimeout(() => {
- done();
- }, 500);
- }, (error) => {
- expect(false).assertTrue();
- console.log("VibratorJsTest017 off error");
- setTimeout(() => {
- done();
- }, 500);
- });
- })
-
- /*
- * @tc.name:VibratorJsTest018
- * @tc.desc:Verification results of the incorrect parameters of the test interface.
- * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0180
- */
- it("VibratorJsTest018", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
- function stopPromise() {
- return new Promise((resolve, reject) => {
- vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_TIME).then(() => {
- console.log("VibratorJsTest018 stop success");
- expect(true).assertTrue();
- setTimeout(() => {
- resolve();
- }, 500);
- }, (error) => {
- expect(false).assertTrue();
- console.log("VibratorJsTest018 stop error");
- setTimeout((err) => {
- reject(err);
- }, 500);
- });
- })
- }
-
- let promise = new Promise((resolve, reject) => {
- vibrator.vibrate(180000).then(() => {
- console.log("VibratorJsTest018 vibrate success");
- expect(true).assertTrue();
- setTimeout(() => {
- resolve();
- }, 500);
- }, (error) => {
- expect(false).assertTrue();
- console.log("VibratorJsTest018 vibrate error");
- setTimeout((err) => {
- reject(err);
- }, 500);
- });
- })
-
- await promise.then(() => {
- return stopPromise();
- }, () => {
- console.info("VibratorJsTest018 reject");
- })
- done();
- })
-})
+/*
+ * 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 vibrator from '@ohos.vibrator'
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
+
+export default function VibratorJsTest_misc_2() {
+describe("VibratorJsTest_misc_2", function () {
+ beforeAll(function () {
+
+ /*
+ * @tc.setup: setup invoked before all testcases
+ */
+ console.info('beforeAll caled')
+ })
+
+ afterAll(function () {
+
+ /*
+ * @tc.teardown: teardown invoked after all testcases
+ */
+ console.info('afterAll caled')
+ })
+
+ beforeEach(function () {
+
+ /*
+ * @tc.setup: setup invoked before each testcases
+ */
+ console.info('beforeEach caled')
+ })
+
+ afterEach(function () {
+
+ /*
+ * @tc.teardown: teardown invoked after each testcases
+ */
+ console.info('afterEach caled')
+ })
+
+ /*
+ * @tc.name:VibratorJsTest001
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0010
+ */
+ it("VibratorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
+ function vibrateCallback(error) {
+ if (error) {
+ console.info('VibratorJsTest001 vibrator error');
+ expect(false).assertTrue();
+ } else {
+ console.info('VibratorJsTest001 vibrator success');
+ expect(true).assertTrue();
+ }
+ setTimeout(() => {
+ done();
+ }, 500);
+ }
+ vibrator.vibrate(10, vibrateCallback);
+ })
+
+ /*
+ * @tc.name:VibratorJsTest002
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0020
+ */
+ it("VibratorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ function vibrateCallback(error) {
+ if (error) {
+ console.info('VibratorJsTest002 vibrator success');
+ expect(true).assertTrue();
+ } else {
+ console.info('VibratorJsTest002 vibrator error');
+ expect(false).assertTrue();
+ }
+ setTimeout(() => {
+ done();
+ }, 500);
+ }
+ vibrator.vibrate(-1, vibrateCallback);
+ })
+
+ /*
+ * @tc.name:VibratorJsTest003
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0030
+ */
+ it("VibratorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ function vibrateCallback(error) {
+ if (error) {
+ console.info('VibratorJsTest003 vibrator success');
+ expect(true).assertTrue();
+ } else {
+ console.info('VibratorJsTest003 vibrator error');
+ expect(false).assertTrue();
+ }
+ setTimeout(() => {
+ done();
+ }, 500);
+ }
+ vibrator.vibrate(1800000 + 1, vibrateCallback);
+ })
+
+ /*
+ * @tc.name:VibratorJsTest004
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0040
+ */
+ it("VibratorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ function vibrateCallback(error) {
+ if (error) {
+ console.info('VibratorJsTest004 vibrator error');
+ expect(false).assertTrue();
+ } else {
+ console.info('VibratorJsTest004 vibrator success');
+ expect(true).assertTrue();
+ }
+ setTimeout(() => {
+ done();
+ }, 500);
+ }
+ vibrator.vibrate(1800000, vibrateCallback);
+ })
+
+ /*
+ * @tc.name:VibratorJsTest005
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0050
+ */
+ it("VibratorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ function vibrateCallback(error) {
+ if (error) {
+ console.info('VibratorJsTest005 vibrator success');
+ expect(true).assertTrue();
+ } else {
+ console.info('VibratorJsTest005 vibrator error');
+ expect(false).assertTrue();
+ }
+ setTimeout(() => {
+ done();
+ }, 500);
+ }
+ vibrator.vibrate("", vibrateCallback);
+ })
+
+ /*
+ * @tc.name:VibratorJsTest006
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0060
+ */
+ it("VibratorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ function vibrateCallback(error) {
+ if (error) {
+ console.info('VibratorJsTest006 vibrator success');
+ expect(true).assertTrue();
+ } else {
+ console.info('VibratorJsTest006 vibrator error');
+ expect(false).assertTrue();
+ }
+ setTimeout(() => {
+ done();
+ }, 500);
+ }
+ vibrator.vibrate("xxx", vibrateCallback);
+ })
+
+ /*
+ * @tc.name:VibratorJsTest007
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0070
+ */
+ it("VibratorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ function vibrateCallback(error) {
+ if (error) {
+ console.info('VibratorJsTest007 vibrator error');
+ expect(false).assertTrue();
+ } else {
+ console.info('VibratorJsTest007 vibrator success');
+ expect(true).assertTrue();
+ }
+ setTimeout(() => {
+ done();
+ }, 500);
+ }
+ vibrator.vibrate("haptic.clock.timer", vibrateCallback);
+ })
+
+ /*
+ * @tc.name:VibratorJsTest008
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0080
+ */
+ it("VibratorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ function vibrateCallback(error) {
+ if (error) {
+ console.info('VibratorJsTest008 stop error');
+ expect(false).assertTrue();
+ } else {
+ console.info('VibratorJsTest008 stop success');
+ expect(true).assertTrue();
+ }
+ setTimeout(() => {
+ done();
+ }, 500);
+ }
+ vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET, vibrateCallback);
+ })
+
+ /*
+ * @tc.name:VibratorJsTest009
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0090
+ */
+ it("VibratorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ console.info('----------------------VibratorJsTest001---------------------------');
+ function stopPromise() {
+ return new Promise((resolve, reject) => {
+ vibrator.stop("time", (error) => {
+ if (error) {
+ console.info('VibratorJsTest009 stop error');
+ expect(false).assertTrue();
+ setTimeout((err) => {
+ reject(err);
+ }, 500);
+ } else {
+ console.info('VibratorJsTest009 stop success');
+ expect(true).assertTrue();
+ setTimeout(() => {
+ resolve();
+ }, 500);
+ }
+ });
+ })
+ }
+
+ let promise = new Promise((resolve, reject) => {
+ vibrator.vibrate(180000, (error) => {
+ if (error) {
+ console.info('VibratorJsTest009 vibrate error');
+ expect(false).assertTrue();
+ setTimeout((err) => {
+ reject(err);
+ }, 500);
+ } else {
+ console.info('VibratorJsTest009 vibrate success');
+ expect(true).assertTrue();
+ setTimeout(() => {
+ resolve();
+ }, 500);
+ }
+ });
+ })
+
+ await promise.then(() => {
+ return stopPromise();
+ }, () => {
+ console.info("VibratorJsTest009 reject");
+ })
+ done();
+ })
+
+ /*
+ * @tc.name:VibratorJsTest010
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0100
+ */
+ it("VibratorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ function vibrateCallback(error) {
+ if (error) {
+ console.info('VibratorJsTest010 stop success');
+ expect(true).assertTrue();
+ } else {
+ console.info('VibratorJsTest010 stop off');
+ expect(false).assertTrue();
+ }
+ setTimeout(() => {
+ done();
+ }, 500);
+ }
+ vibrator.stop("", vibrateCallback);
+ })
+
+ /*
+ * @tc.name:VibratorJsTest011
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0110
+ */
+ it("VibratorJsTest011", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ vibrator.vibrate(1000).then(() => {
+ console.log("VibratorJsTest011 vibrate success");
+ expect(true).assertTrue();
+ setTimeout(() => {
+ done();
+ }, 500);
+ }, (error) => {
+ expect(false).assertTrue();
+ console.log("VibratorJsTest011 vibrate error");
+ setTimeout(() => {
+ done();
+ }, 500);
+ });
+ })
+
+ /*
+ * @tc.name:VibratorJsTest012
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0120
+ */
+ it("VibratorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ vibrator.vibrate(-1).then(() => {
+ console.log("VibratorJsTest012 vibrate error");
+ expect(false).assertTrue();
+ setTimeout(() => {
+ done();
+ }, 500);
+ }, (error) => {
+ expect(true).assertTrue();
+ console.log("VibratorJsTest012 vibrate success");
+ setTimeout(() => {
+ done();
+ }, 500);
+ });
+ })
+
+ /*
+ * @tc.name:VibratorJsTest013
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0130
+ */
+ it("VibratorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ vibrator.vibrate(1800000 + 1).then(() => {
+ console.log("VibratorJsTest013 vibrate error");
+ expect(false).assertTrue();
+ setTimeout(() => {
+ done();
+ }, 500);
+ }, (error) => {
+ expect(true).assertTrue();
+ console.log("VibratorJsTest013 vibrate success");
+ setTimeout(() => {
+ done();
+ }, 500);
+ });
+ })
+
+ /*
+ * @tc.name:VibratorJsTest014
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0140
+ */
+ it("VibratorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ vibrator.vibrate(vibrator.EffectId.EFFECT_CLOCK_TIMER).then(() => {
+ console.log("VibratorJsTest014 vibrate success");
+ expect(true).assertTrue();
+ setTimeout(() => {
+ done();
+ }, 500);
+ }, (error) => {
+ expect(false).assertTrue();
+ console.log("VibratorJsTest014 vibrate error");
+ setTimeout(() => {
+ done();
+ }, 500);
+ });
+ })
+
+ /*
+ * @tc.name:VibratorJsTest015
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150
+ */
+ it("VibratorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ vibrator.vibrate("").then(() => {
+ console.log("VibratorJsTest015 vibrate error");
+ expect(false).assertTrue();
+ setTimeout(() => {
+ done();
+ }, 500);
+ }, (error) => {
+ expect(true).assertTrue();
+ console.log("VibratorJsTest015 vibrate success");
+ setTimeout(() => {
+ done();
+ }, 500);
+ });
+ })
+
+ /*
+ * @tc.name:VibratorJsTest016
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0160
+ */
+ it("VibratorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ vibrator.stop("").then(() => {
+ console.log("VibratorJsTest016 stop error");
+ expect(false).assertTrue();
+ setTimeout(() => {
+ done();
+ }, 500);
+ }, (error) => {
+ expect(true).assertTrue();
+ console.log("VibratorJsTest016 stop success");
+ setTimeout(() => {
+ done();
+ }, 500);
+ });
+ })
+
+ /*
+ * @tc.name:VibratorJsTest017
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0170
+ */
+ it("VibratorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ vibrator.stop("preset").then(() => {
+ console.log("VibratorJsTest017 off success");
+ expect(true).assertTrue();
+ setTimeout(() => {
+ done();
+ }, 500);
+ }, (error) => {
+ expect(false).assertTrue();
+ console.log("VibratorJsTest017 off error");
+ setTimeout(() => {
+ done();
+ }, 500);
+ });
+ })
+
+ /*
+ * @tc.name:VibratorJsTest018
+ * @tc.desc:Verification results of the incorrect parameters of the test interface.
+ * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0180
+ */
+ it("VibratorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
+ function stopPromise() {
+ return new Promise((resolve, reject) => {
+ vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_TIME).then(() => {
+ console.log("VibratorJsTest018 stop success");
+ expect(true).assertTrue();
+ setTimeout(() => {
+ resolve();
+ }, 500);
+ }, (error) => {
+ expect(false).assertTrue();
+ console.log("VibratorJsTest018 stop error");
+ setTimeout((err) => {
+ reject(err);
+ }, 500);
+ });
+ })
+ }
+
+ let promise = new Promise((resolve, reject) => {
+ vibrator.vibrate(180000).then(() => {
+ console.log("VibratorJsTest018 vibrate success");
+ expect(true).assertTrue();
+ setTimeout(() => {
+ resolve();
+ }, 500);
+ }, (error) => {
+ expect(false).assertTrue();
+ console.log("VibratorJsTest018 vibrate error");
+ setTimeout((err) => {
+ reject(err);
+ }, 500);
+ });
+ })
+
+ await promise.then(() => {
+ return stopPromise();
+ }, () => {
+ console.info("VibratorJsTest018 reject");
+ })
+ done();
+ })
+})
+}
diff --git a/sensors/miscdevice_standard/src/main/js/default/test/Vibrator_old.test.js b/sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js
similarity index 86%
rename from sensors/miscdevice_standard/src/main/js/default/test/Vibrator_old.test.js
rename to sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js
index efa1a14ef0aee8f261e850316c7600b494c5be14..85308bd477fe3362169e138642bf53e231bf1732 100644
--- a/sensors/miscdevice_standard/src/main/js/default/test/Vibrator_old.test.js
+++ b/sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js
@@ -14,8 +14,9 @@
*/
import vibrator from '@system.vibrator';
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium'
+export default function VibratorJsTest_misc_1() {
describe("VibratorJsTest_misc_1", function () {
beforeAll(function () {
@@ -59,7 +60,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0190
*/
- it("SubVibratorJsTest0001", FUNCTION|MEDIUMTEST|LEVEL0, async function (done) {
+ it("SubVibratorJsTest0001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------SubVibratorJsTest0001---------------------------');
vibrator.vibrate({
mode: 'long',
@@ -82,7 +83,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0200
*/
- it("SubVibratorJsTest0002", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
+ it("SubVibratorJsTest0002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0002---------------------------');
vibrator.vibrate({
mode: 'short',
@@ -105,7 +106,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0210
*/
- it("SubVibratorJsTest0003", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
+ it("SubVibratorJsTest0003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0003---------------------------');
vibrator.vibrate({
mode: 'short',
@@ -125,7 +126,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0220
*/
- it("SubVibratorJsTest0004", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
+ it("SubVibratorJsTest0004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0004---------------------------');
vibrator.vibrate({
mode: 'short',
@@ -141,7 +142,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0230
*/
- it("SubVibratorJsTest0005", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
+ it("SubVibratorJsTest0005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0005---------------------------');
vibrator.vibrate({
success: function () {
@@ -160,7 +161,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0240
*/
- it("SubVibratorJsTest0006", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
+ it("SubVibratorJsTest0006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0006---------------------------');
vibrator.vibrate({
mode: 'long',
@@ -181,7 +182,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0250
*/
- it("SubVibratorJsTest0007", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
+ it("SubVibratorJsTest0007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0007---------------------------');
try {
vibrator.vibrate({
@@ -205,7 +206,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0260
*/
- it("SubVibratorJsTest0008", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
+ it("SubVibratorJsTest0008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0008---------------------------');
vibrator.vibrate({
mode: 'short',
@@ -237,7 +238,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0270
*/
- it("SubVibratorJsTest0009", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
+ it("SubVibratorJsTest0009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0009---------------------------');
try {
vibrator.vibrate();
@@ -254,7 +255,7 @@ describe("VibratorJsTest_misc_1", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0280
*/
- it("SubVibratorJsTest0010", FUNCTION|MEDIUMTEST|LEVEL3, async function (done) {
+ it("SubVibratorJsTest0010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------SubVibratorJsTest0010---------------------------');
try {
vibrator.vibrate({
@@ -275,4 +276,4 @@ describe("VibratorJsTest_misc_1", function () {
})
})
-
\ No newline at end of file
+ }
diff --git a/sensors/miscdevice_standard/src/main/resources/base/element/string.json b/sensors/miscdevice_standard/src/main/resources/base/element/string.json
old mode 100755
new mode 100644
index ad074eddc620c5cf6d5f37abe9d8370bb160bc89..3520dfa9b2587ee3b02085843c8953526ce4c594
--- a/sensors/miscdevice_standard/src/main/resources/base/element/string.json
+++ b/sensors/miscdevice_standard/src/main/resources/base/element/string.json
@@ -1,12 +1,28 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "miscdeviceJSApiTest"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "miscdeviceJSApiTest"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ },
+ {
+ "name": "MainAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "MainAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "TestAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "TestAbility_label",
+ "value": "label"
+ }
+ ]
}
\ No newline at end of file
diff --git a/sensors/miscdevice_standard/src/main/resources/base/media/icon.png b/sensors/miscdevice_standard/src/main/resources/base/media/icon.png
old mode 100755
new mode 100644