diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn
index ecfc3c910e57482f50759006cf199da4b4ca5002..391e1a9589f71111c16c6571c05bba8edb6e39a1 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackFifthSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAmsCallBackFifthSceneTest") {
hap_name = "ActsAmsCallBackFifthSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json
index a6acecdedc743f9fede539867900ce4ed9602a9c..c61389c6e9c79cde550a5015691beb716aa44a62 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamscallbackfifthscene",
+ "bundle-name": "com.example.actsamscallbackfifthscene",
+ "package-name": "com.example.actsamscallbackfifthscene",
"shell-timeout": "600000"
},
"kits": [
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index 27b7481c8e06acb037bead27db497d9e793bc83d..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-let abilityNameList = [
- "com.ohos.launcher.MainAbility",
- "com.ohos.callui.ServiceAbility",
- "com.example.SimulateFeatureAbilityFir",
- "com.example.VerifyIoThirdAbility",
- "com.example.SimulateFeatureAbilitySed",
- "com.example.actsamscallbackfifthscene.MainAbility"
-]
-
-let bundleNameList = [
- "com.ohos.launcher",
- "com.ohos.systemui",
- "com.ohos.callui",
- "com.ohos.contacts",
- "com.ohos.mms",
- "com.ohos.telephonydataability",
- "com.ohos.contactsdataability",
- "com.ix.simulate.feature",
- "com.ix.verify.io",
- "com.example.actsamscallbackfifthscene"
-]
-
-describe('ActsAmsCallBackFifthScene', function () {
- console.info('----ActsAmsCallBackFifthScene----');
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.io",
- abilityName: "com.example.VerifyIoThirdAbility",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilitySed",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- setTimeout(done, 5000);
- });
-
- function timeout(done) {
- expect().assertFail();
- console.debug('Acts_Ams_test=========timeout========');
- done();
- }
-
- function sleep(delay) {
- let start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_6600
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by CallBack)
- */
- it('Acts_Ams_test_6600', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- appManager.getProcessRunningInfos(
- (error, info) => {
- console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (let i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_6600 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- }
- );
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json
similarity index 53%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json
index 7df3196c86f21ef950a1bb3607520e8a96d198d2..92e6a35a32b5b6d328ef13185401ab8e305defcc 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbackfifthscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -26,16 +28,42 @@
"installationFree": true
},
"abilities": [
- {
- "visible": true,
- "name": "com.example.actsamscallbackfifthscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
- }
+ {
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
+ }
],
"reqPermissions": [
{
@@ -77,7 +105,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.css
similarity index 99%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css
rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.css
index a6053c61f9615fcd50fefb51f878568f3e39e59b..8b5cce53e8f61458e5a3005866217e0df1dfa133 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.css
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.css
@@ -31,6 +31,7 @@
height: 40%;
margin: 10px;
}
+
.btn {
width: 50%;
height: 100px;
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.js
similarity index 68%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js
rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.js
index 952dcd80ed26a3a70b2a2ff305cf9b2ad648cb67..08b387efa1ae9f8d78e6f45bb95d9c97b7a8cca3 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.js
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/MainAbility/pages/index/index.js
@@ -13,8 +13,6 @@
* limitations under the License.
*/
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
let once = true
@@ -29,20 +27,6 @@ export default {
if (once) {
once = false
console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
}
},
onReady() {
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/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/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/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/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..ab4eb6cdbbd8ac58416b5ffb92d68bc0038dc1cb
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.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/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/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/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..0c19f9ef0916b62dddcf4804f8916eebc6db71e5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsCallBackFifthScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsCallBackFifthScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdbfb07bf2a21de7eeb65e730e297391cd31764f
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,145 @@
+/*
+ * 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 featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+let abilityNameList = [
+ "com.ohos.launcher.MainAbility",
+ "com.ohos.callui.ServiceAbility",
+ "com.example.SimulateFeatureAbilityFir",
+ "com.example.VerifyIoThirdAbility",
+ "com.example.SimulateFeatureAbilitySed",
+ "com.example.actsamscallbackfifthscene.MainAbility"
+]
+
+let bundleNameList = [
+ "com.ohos.launcher",
+ "com.ohos.systemui",
+ "com.ohos.callui",
+ "com.ohos.contacts",
+ "com.ohos.mms",
+ "com.ohos.telephonydataability",
+ "com.ohos.contactsdataability",
+ "com.ix.simulate.feature",
+ "com.ix.verify.io",
+ "com.example.actsamscallbackfifthscene"
+]
+export default function ActsAmsCallBackFifthScene() {
+ describe('ActsAmsCallBackFifthScene', function () {
+ console.info('----ActsAmsCallBackFifthScene----');
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.io",
+ abilityName: "com.example.VerifyIoThirdAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFifthScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilitySed",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFifthScene SimulateFeatureAbilitySed start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ setTimeout(done, 5000);
+ });
+
+ function timeout(done) {
+ expect().assertFail();
+ console.debug('Acts_Ams_test=========timeout========');
+ done();
+ }
+
+ function sleep(delay) {
+ let start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_6600
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by CallBack)
+ */
+ it('Acts_Ams_test_6600', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ appManager.getProcessRunningInfos(
+ (error, info) => {
+ console.info('Acts_Ams_test_6600 getProcessRunningInfos error.code \
+ ' + error.code + ', data length [' + info.length + ']');
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (let i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_6600 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ }
+ );
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..a4311fdbd2698c510a48ba2b754eb7a868367984
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn
index 2d1e9fecc0641629cecccbe727a574eddc955c38..ecd15d7bfe59577f1157466035c4f1b6fddf5b8e 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackFirstSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,11 @@ ohos_js_hap_suite("ActsAmsCallBackFirstSceneTest") {
hap_name = "ActsAmsCallBackFirstSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json
index 2b8fd0fed8dcf06b9420551f7d1540ac36bda975..b8119e4f4e8b9a4166c3eef0bddc9fb5576407f3 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamscallbackfirstscene",
+ "bundle-name": "com.example.actsamscallbackfirstscene",
+ "package-name": "com.example.actsamscallbackfirstscene",
"shell-timeout": "600000"
},
"kits": [
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index 90fad1b6444f235a225c6048353ff9adcc6b7891..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-
-let once = true
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- if (once) {
- once = false
- console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
- }
- },
- onReady() {
- console.info('onReady');
- },
-}
-
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index bfc3c92aa28c10754088e302b49520e0fc1cf618..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2022 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit'
-
-describe('ActsAmsCallBackFirstScene', function () {
- console.info('----ActsAmsCallBackFirstScene----');
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- done();
- });
-
- function timeout(done) {
- expect().assertFail();
- console.debug('Acts_Ams_test=========timeout========');
- done();
- }
-
- function sleep(delay) {
- var start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_0200
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by CallBack)
- */
- it('Acts_Ams_test_0200', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- appManager.getProcessRunningInfos(
- (error, info) => {
- console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_0200 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- });
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json
similarity index 55%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json
index 7cf34a5c9138c8a8b27dc5d4e577b33587f8905d..08626438965d52dad65503a4dad984dc99774724 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbackfirstscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -26,16 +28,42 @@
"installationFree": true
},
"abilities": [
- {
- "visible": true,
- "name": "com.example.actsamscallbackfirstscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
- }
+ {
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
+ }
],
"reqPermissions": [
{
@@ -81,7 +109,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.css
similarity index 82%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js
rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.css
index c282338f488137b3385950256daceaa29f6cee4f..8638acd36fde08d0ce5c079cbda61e32c3c90129 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/test/List.test.js
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.css
@@ -12,4 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.js
similarity index 68%
rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js
rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.js
index 952dcd80ed26a3a70b2a2ff305cf9b2ad648cb67..178dbc0cfb05aed067f2825a53a3adab9a4160b7 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.js
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/MainAbility/pages/index/index.js
@@ -13,10 +13,9 @@
* limitations under the License.
*/
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
let once = true
export default {
data: {
@@ -29,20 +28,6 @@ export default {
if (once) {
once = false
console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
}
},
onReady() {
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/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/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/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/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.css
similarity index 77%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css
rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.css
index a6053c61f9615fcd50fefb51f878568f3e39e59b..2b45eb97c17e67ef5d63436aad8998113aa95d6d 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/default/pages/index/index.css
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.css
@@ -1,38 +1,50 @@
-/*
- * 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 {
- 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;
-}
-.btn {
- width: 50%;
- height: 100px;
- font-size: 40px;
-}
+/*
+ * 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 {
+ 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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/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/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a9226a14620ea34be42e7c29b68742208c3b3175
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsCallBackFirstScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsCallBackFirstScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..97e42e908f8b66d93827331e8c42ebeeace6d0fe
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,88 @@
+/*
+ * 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 featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+export default function ActsAmsCallBackFirstScene() {
+ describe('ActsAmsCallBackFirstScene', function () {
+ console.info('----ActsAmsCallBackFirstScene----');
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFirstScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ done();
+ });
+
+ function timeout(done) {
+ expect().assertFail();
+ console.debug('Acts_Ams_test=========timeout========');
+ done();
+ }
+
+ function sleep(delay) {
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_0200
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by CallBack)
+ */
+ it('Acts_Ams_test_0200', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ appManager.getProcessRunningInfos(
+ (error, info) => {
+ console.info('Acts_Ams_test_0200 getProcessRunningInfos error.code \
+ ' + error.code + ', data length [' + info.length + ']');
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_0200 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ });
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..a4311fdbd2698c510a48ba2b754eb7a868367984
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn
index a1c7de3ebbcff0f2134a7d02750979145dde3ee4..4c54032042ddfd4d8a81b05882189bc1ae2a16db 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackFourthSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAmsCallBackFourthSceneTest") {
hap_name = "ActsAmsCallBackFourthSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json
index 9e0e972fa094b5253a5354544f4bac6377dcb137..28d13d6bb074c63fefb77db2c4d1bf906682bcd1 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamscallbackfourthscene",
+ "bundle-name": "com.example.actsamscallbackfourthscene",
+ "package-name": "com.example.actsamscallbackfourthscene",
"shell-timeout": "600000"
},
"kits": [
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index 0adfdff8c339d190b7d3fa7edc468969feff72d9..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('ActsAmsCallBackFourthScene', function () {
- console.info('----ActsAmsCallBackFourthScene----');
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.io",
- abilityName: "com.example.VerifyIoThirdAbility",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.act",
- abilityName: "com.example.VerifyActThirdAbility",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.entry",
- abilityName: "com.example.SimulateEntryAbilityFir",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- done();
- });
-
- function timeout(done) {
- expect().assertFail();
- console.debug('Acts_Ams_test=========timeout========');
- done();
- }
-
- function sleep(delay) {
- let start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_5000
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by CallBack)
- */
- it('Acts_Ams_test_5000', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- appManager.getProcessRunningInfos(
- (error, info) => {
- console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (let i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_5000 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- });
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json
similarity index 55%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json
index b9d71249358ebf98d5ecb8677068bf2126859779..4d0fbdc896090ed05980b57b4463d9c989a8dbe8 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbackfourthscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -26,16 +28,42 @@
"installationFree": true
},
"abilities": [
- {
- "visible": true,
- "name": "com.example.actsamscallbackfourthscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
- }
+ {
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
+ }
],
"reqPermissions": [
{
@@ -81,7 +109,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.css
similarity index 82%
rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js
rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.css
index c282338f488137b3385950256daceaa29f6cee4f..2334ecfa2c147f276998e82e2c35f62800cfb031 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/List.test.js
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.css
@@ -12,4 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.js
similarity index 67%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js
rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.js
index 43f7611f8ff1cf870dfbf48dd5bd9a8790e15b8f..08b387efa1ae9f8d78e6f45bb95d9c97b7a8cca3 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/default/pages/index/index.js
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/MainAbility/pages/index/index.js
@@ -13,8 +13,6 @@
* limitations under the License.
*/
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
let once = true
@@ -29,20 +27,6 @@ export default {
if (once) {
once = false
console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- id: 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
}
},
onReady() {
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/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/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/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/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.css
similarity index 77%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css
rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.css
index a6053c61f9615fcd50fefb51f878568f3e39e59b..2b45eb97c17e67ef5d63436aad8998113aa95d6d 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/default/pages/index/index.css
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.css
@@ -1,38 +1,50 @@
-/*
- * 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 {
- 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;
-}
-.btn {
- width: 50%;
- height: 100px;
- font-size: 40px;
-}
+/*
+ * 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 {
+ 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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/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/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..2a77e10277fecb1ecfcffd67a899282ee603d566
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsCallBackFourthScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsCallBackFourthScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..0019c3985a815880ee77632e93767c458f3764f2
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+export default function ActsAmsCallBackFourthScene() {
+ describe('ActsAmsCallBackFourthScene', function () {
+ console.info('----ActsAmsCallBackFourthScene----');
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.io",
+ abilityName: "com.example.VerifyIoThirdAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFourthScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFourthScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.act",
+ abilityName: "com.example.VerifyActThirdAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFourthScene VerifyActThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.entry",
+ abilityName: "com.example.SimulateEntryAbilityFir",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackFourthScene SimulateEntryAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ done();
+ });
+
+ function timeout(done) {
+ expect().assertFail();
+ console.debug('Acts_Ams_test=========timeout========');
+ done();
+ }
+
+ function sleep(delay) {
+ let start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_5000
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by CallBack)
+ */
+ it('Acts_Ams_test_5000', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ appManager.getProcessRunningInfos(
+ (error, info) => {
+ console.info('Acts_Ams_test_5000 getProcessRunningInfos error.code \
+ ' + error.code + ', data length [' + info.length + ']');
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (let i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_5000 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ });
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..a4311fdbd2698c510a48ba2b754eb7a868367984
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn
index 88501a06a3c2173fae4f42c8b46f35aa08f6c436..fc0823c5619580660a3ed835154df699626717f6 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackSecondSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAmsCallBackSecondSceneTest") {
hap_name = "ActsAmsCallBackSecondSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json
index 28073d2930479d8611788145c0985dd35f44ab5d..445182eea769c33921c4c13615fa4da20e23f755 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamscallbacksecondscene",
+ "bundle-name": "com.example.actsamscallbacksecondscene",
+ "package-name": "com.example.actsamscallbacksecondscene",
"shell-timeout": "600000"
},
"kits": [
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index 97db2e34824ae6fe1eeba98f7bb182217726d375..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit'
-
-describe('ActsAmsCallBackSecondScene', function () {
- console.info('----ActsAmsCallBackSecondScene----');
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.io",
- abilityName: "com.example.VerifyIoThirdAbility",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackSecondScene VerifyIoThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- done();
- });
-
- function timeout(done) {
- expect().assertFail();
- console.debug('Acts_Ams_test=========timeout========');
- done();
- }
-
- function sleep(delay) {
- let start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_1800
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by CallBack)
- */
- it('Acts_Ams_test_1800', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- appManager.getProcessRunningInfos(
- (error, info) => {
- console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (let i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_1800 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- });
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json
similarity index 55%
rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json
index ffd0db98f01cd820f83f9bf772a52a1e88ebc17c..42a625c57bf984e35fdee29967f8cc87d362fb25 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbacksecondscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -26,16 +28,42 @@
"installationFree": true
},
"abilities": [
- {
- "visible": true,
- "name": "com.example.actsamscallbacksecondscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
- }
+ {
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
+ }
],
"reqPermissions": [
{
@@ -81,7 +109,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.css
similarity index 82%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js
rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.css
index c282338f488137b3385950256daceaa29f6cee4f..2334ecfa2c147f276998e82e2c35f62800cfb031 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/entry/src/main/js/test/List.test.js
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.css
@@ -12,4 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.js
similarity index 67%
rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js
rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.js
index f470b9c0afaf71f7752215a1fb5e76fe5e352543..08b387efa1ae9f8d78e6f45bb95d9c97b7a8cca3 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.js
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/MainAbility/pages/index/index.js
@@ -13,8 +13,6 @@
* limitations under the License.
*/
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
let once = true
@@ -29,20 +27,6 @@ export default {
if (once) {
once = false
console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
}
},
onReady() {
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/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/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/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/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.css
similarity index 77%
rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css
rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.css
index a6053c61f9615fcd50fefb51f878568f3e39e59b..2b45eb97c17e67ef5d63436aad8998113aa95d6d 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/default/pages/index/index.css
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.css
@@ -1,38 +1,50 @@
-/*
- * 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 {
- 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;
-}
-.btn {
- width: 50%;
- height: 100px;
- font-size: 40px;
-}
+/*
+ * 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 {
+ 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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/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/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d595f671e5b8c2d97edf17cf0ad1fa58fb611363
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsCallBackSecondScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsCallBackSecondScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..ec967a4a9bced6e26c7b2b27e38cdb4f8543a163
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+export default function ActsAmsCallBackSecondScene() {
+ describe('ActsAmsCallBackSecondScene', function () {
+ console.info('----ActsAmsCallBackSecondScene----');
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.io",
+ abilityName: "com.example.VerifyIoThirdAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackSecondScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackSecondScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ done();
+ });
+
+ function timeout(done) {
+ expect().assertFail();
+ console.debug('Acts_Ams_test=========timeout========');
+ done();
+ }
+
+ function sleep(delay) {
+ let start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_1800
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by CallBack)
+ */
+ it('Acts_Ams_test_1800', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ appManager.getProcessRunningInfos(
+ (error, info) => {
+ console.info('Acts_Ams_test_1800 getProcessRunningInfos error.code \
+ ' + error.code + ', data length [' + info.length + ']');
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (let i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_1800 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ });
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..054c46cf82e60c39de9ec845737cdda67a89676d
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn
index fc71bc14a491422e020b2edfd1d2f1c91e148088..79b9a0d70ef1d8aea1f1a58e108c6e14162ec208 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsCallBackThirdSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAmsCallBackThirdSceneTest") {
hap_name = "ActsAmsCallBackThirdSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json
index 51f3d22e86e847315580e496a2a8963daa92f895..688e85f5699f2bb50d9560ed71543d4086aa43e7 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamscallbackthirdscene",
+ "bundle-name": "com.example.actsamscallbackthirdscene",
+ "package-name": "com.example.actsamscallbackthirdscene",
"shell-timeout": "600000"
},
"kits": [
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index a6053c61f9615fcd50fefb51f878568f3e39e59b..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.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;
-}
-.btn {
- width: 50%;
- height: 100px;
- font-size: 40px;
-}
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index f470b9c0afaf71f7752215a1fb5e76fe5e352543..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-let once = true
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- if (once) {
- once = false
- console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
- }
- },
- onReady() {
- console.info('onReady');
- },
-}
-
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js
deleted file mode 100644
index c282338f488137b3385950256daceaa29f6cee4f..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/List.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index fe25d2e6dd6ae2ee5253c6569dd604c1853cdce4..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('ActsAmsCallBackThirdScene', function () {
- console.info('----ActsAmsCallBackThirdScene----');
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.io",
- abilityName: "com.example.VerifyIoThirdAbility",
- action: "action1",
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- done();
- });
-
- function sleep(delay) {
- let start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_3400
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by CallBack)
- */
- it('Acts_Ams_test_3400', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- appManager.getProcessRunningInfos(
- (error, info) => {
- console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code \
- ' + error.code + ', data length [' + info.length + ']');
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (let i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_3400 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- });
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json
similarity index 55%
rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json
index e1ae6f5d9c472ec59da1ae2b78a3314e331926a5..98f7d882be177dd78143aa3c4f7575f5c458b4a5 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamscallbackthirdscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -26,16 +28,42 @@
"installationFree": true
},
"abilities": [
- {
- "visible": true,
- "name": "com.example.actsamscallbackthirdscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
- }
+ {
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
+ }
],
"reqPermissions": [
{
@@ -81,7 +109,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2334ecfa2c147f276998e82e2c35f62800cfb031
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.css
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..08b387efa1ae9f8d78e6f45bb95d9c97b7a8cca3
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,36 @@
+/*
+ * 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')
+let once = true
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ if (once) {
+ once = false
+ console.info('onShow finish')
+ }
+ },
+ onReady() {
+ console.info('onReady');
+ },
+}
+
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/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/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/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/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2b45eb97c17e67ef5d63436aad8998113aa95d6d
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,50 @@
+/*
+ * 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 {
+ 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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/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/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..6f30824ff3c4ee282fc0d6317e5aa8bdf3acab93
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsCallBackThirdScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsCallBackThirdScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..2f01f033ac0234a466a6f2c096292e38e966c3cf
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+export default function ActsAmsCallBackThirdScene() {
+ describe('ActsAmsCallBackThirdScene', function () {
+ console.info('----ActsAmsCallBackThirdScene----');
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackThirdScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.io",
+ abilityName: "com.example.VerifyIoThirdAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsCallBackThirdScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ done();
+ });
+
+ function sleep(delay) {
+ let start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_3400
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by CallBack)
+ */
+ it('Acts_Ams_test_3400', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ appManager.getProcessRunningInfos(
+ (error, info) => {
+ console.info('Acts_Ams_test_3400 getProcessRunningInfos error.code \
+ ' + error.code + ', data length [' + info.length + ']');
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (let i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_3400 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ });
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..0a0eff2e837ebae5538b39d43cdcb884af4b3307
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn
index 58f7a2113509991c2fa75235821b22aed8670815..bb404efea206deb6f513417185d7996ee5a8bec0 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/BUILD.gn
@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsTestFifthSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -22,9 +22,12 @@ ohos_js_hap_suite("ActsAmsTestFifthSceneTest") {
hap_name = "ActsAmsTestFifthSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json
index f02cf70ee9fc043a341f2934a01bae7b426aecdc..3d52382e7e0e2d63adf20f8d29b3128df437f520 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamstestfifthscene",
+ "bundle-name": "com.example.actsamstestfifthscene",
+ "package-name": "com.example.actsamstestfifthscene",
"shell-timeout": "600000"
},
"kits": [
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index a6053c61f9615fcd50fefb51f878568f3e39e59b..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.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;
-}
-.btn {
- width: 50%;
- height: 100px;
- font-size: 40px;
-}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js
deleted file mode 100644
index c282338f488137b3385950256daceaa29f6cee4f..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/List.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index fd889cd019c5043941c9a8975bde3b5aa0bb1092..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-let abilityNameList = [
- "com.ohos.launcher.MainAbility",
- "com.ohos.callui.ServiceAbility",
- "com.example.SimulateFeatureAbilityFir",
- "com.example.SimulateFeatureAbilitySed",
- "com.example.VerifyIoThirdAbility",
- "com.example.actsamstestfifthscene.MainAbility"
-]
-
-let bundleNameList = [
- "com.ohos.launcher",
- "com.ohos.systemui",
- "com.ohos.callui",
- "com.ohos.contacts",
- "com.ohos.mms",
- "com.ohos.telephonydataability",
- "com.ohos.contactsdataability",
- "com.ix.simulate.feature",
- "com.ix.verify.io",
- "com.example.actsamstestfifthscene"
-]
-
-describe('ActsAmsTestFifthScene', function () {
- console.info('----ActsAmsTestFifthScene----');
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.io",
- abilityName: "com.example.VerifyIoThirdAbility",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilitySed",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- done();
- });
-
- function timeout(done) {
- expect().assertFail();
- console.debug('Acts_Ams_test=========timeout========');
- done();
- }
-
- function sleep(delay) {
- let start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_0100
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by Promise)
- */
- it('Acts_Ams_test_0100', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- let info = await appManager.getProcessRunningInfos();
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (let i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json
similarity index 55%
rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json
index cba2279aca6cfa9b5f13825242a7dbf771a52118..84a1ef48066bb38570eb16606ff13a12e44c5063 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamstestfifthscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -26,16 +28,42 @@
"installationFree": true
},
"abilities": [
- {
- "visible": true,
- "name": "com.example.actsamstestfifthscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
- }
+ {
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
+ }
],
"reqPermissions": [
{
@@ -81,7 +109,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2334ecfa2c147f276998e82e2c35f62800cfb031
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.css
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..08b387efa1ae9f8d78e6f45bb95d9c97b7a8cca3
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,36 @@
+/*
+ * 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')
+let once = true
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ if (once) {
+ once = false
+ console.info('onShow finish')
+ }
+ },
+ onReady() {
+ console.info('onReady');
+ },
+}
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/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/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/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/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2b45eb97c17e67ef5d63436aad8998113aa95d6d
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,50 @@
+/*
+ * 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 {
+ 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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/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/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..1c4621831e0be86eee65c5e9708e1754ed1acf22
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsTestFifthScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsTestFifthScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f45e6131a079dc378f59cebf661896d47af06017
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+let abilityNameList = [
+ "com.ohos.launcher.MainAbility",
+ "com.ohos.callui.ServiceAbility",
+ "com.example.SimulateFeatureAbilityFir",
+ "com.example.SimulateFeatureAbilitySed",
+ "com.example.VerifyIoThirdAbility",
+ "com.example.actsamstestfifthscene.MainAbility"
+]
+
+let bundleNameList = [
+ "com.ohos.launcher",
+ "com.ohos.systemui",
+ "com.ohos.callui",
+ "com.ohos.contacts",
+ "com.ohos.mms",
+ "com.ohos.telephonydataability",
+ "com.ohos.contactsdataability",
+ "com.ix.simulate.feature",
+ "com.ix.verify.io",
+ "com.example.actsamstestfifthscene"
+]
+export default function ActsAmsTestFifthScene() {
+ describe('ActsAmsTestFifthScene', function () {
+ console.info('----ActsAmsTestFifthScene----');
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestFifthScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.io",
+ abilityName: "com.example.VerifyIoThirdAbility",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestFifthScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilitySed",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestFifthScene SimulateFeatureAbilitySed start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ done();
+ });
+
+ function timeout(done) {
+ expect().assertFail();
+ console.debug('Acts_Ams_test=========timeout========');
+ done();
+ }
+
+ function sleep(delay) {
+ let start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_0100
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by Promise)
+ */
+ it('Acts_Ams_test_0100', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ let info = await appManager.getProcessRunningInfos();
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (let i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..dd84c367c3202eb70dcc78ed2cbe61b2e119b602
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfifthscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn
index 41b9102aad76a0c3c11650e656d09b3921bc56b3..140c37d5391389e848e355fb82a612732e16e9c8 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/BUILD.gn
@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsTestFirstSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -22,9 +22,11 @@ ohos_js_hap_suite("ActsAmsTestFirstSceneTest") {
hap_name = "ActsAmsTestFirstSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json
index 4bd37e87f41bbd17e4e4d12f92e5298214501d4d..a841c8d6fdc0c2cf9e5426f1186c9c14c5054137 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamstestfirstscene",
+ "bundle-name": "com.example.actsamstestfirstscene",
+ "package-name": "com.example.actsamstestfirstscene",
"shell-timeout": "600000"
},
"kits": [
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index a6053c61f9615fcd50fefb51f878568f3e39e59b..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.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;
-}
-.btn {
- width: 50%;
- height: 100px;
- font-size: 40px;
-}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index f470b9c0afaf71f7752215a1fb5e76fe5e352543..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-let once = true
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- if (once) {
- once = false
- console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
- }
- },
- onReady() {
- console.info('onReady');
- },
-}
-
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js
deleted file mode 100644
index c282338f488137b3385950256daceaa29f6cee4f..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/List.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index 5df9e464ebfbef5cae9b21a534ab842019f8a9fe..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('ActsAmsTestFirstScene', function () {
- console.info('----ActsAmsTestFirstScene----');
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- done();
- });
-
- function timeout(done) {
- expect().assertFail();
- console.debug('Acts_Ams_test=========timeout========');
- done();
- }
-
- function sleep(delay) {
- var start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_0100
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by Promise)
- */
- it('Acts_Ams_test_0100', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- var info = await appManager.getProcessRunningInfos();
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json
similarity index 55%
rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json
index 0aa9487ed498072bc9ad5296434c59c1e992d4d8..89355be858387a8e59792bf9fbf9e0be39814cdd 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamstestfirstscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -25,26 +27,42 @@
"moduleType": "entry"
},
"abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "visible": true,
- "name": "com.example.actsamstestfirstscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
- }
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
+ }
],
"reqPermissions": [
{
@@ -90,7 +108,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.css
similarity index 82%
rename from ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js
rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.css
index c282338f488137b3385950256daceaa29f6cee4f..8638acd36fde08d0ce5c079cbda61e32c3c90129 100644
--- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/entry/src/main/js/test/List.test.js
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.css
@@ -12,4 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..08b387efa1ae9f8d78e6f45bb95d9c97b7a8cca3
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,36 @@
+/*
+ * 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')
+let once = true
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ if (once) {
+ once = false
+ console.info('onShow finish')
+ }
+ },
+ onReady() {
+ console.info('onReady');
+ },
+}
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/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/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/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/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2b45eb97c17e67ef5d63436aad8998113aa95d6d
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,50 @@
+/*
+ * 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 {
+ 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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/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/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d926d8da96d21af2e5e4e6e3d15b0833265dbe94
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsTestFirstScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsTestFirstScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f7a92b9000abcdd224800ffbd13636bfffd90484
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+export default function ActsAmsTestFirstScene() {
+ describe('ActsAmsTestFirstScene', function () {
+ console.info('----ActsAmsTestFirstScene----');
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestFirstScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ done();
+ });
+
+ function timeout(done) {
+ expect().assertFail();
+ console.debug('Acts_Ams_test=========timeout========');
+ done();
+ }
+
+ function sleep(delay) {
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_0100
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by Promise)
+ */
+ it('Acts_Ams_test_0100', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ var info = await appManager.getProcessRunningInfos();
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_0100 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..dd84c367c3202eb70dcc78ed2cbe61b2e119b602
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfirstscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn
index 20b13d3aeb4eccefda5834d8ae61201627cc21ad..bb9ffa777ab41df5da40df35a5aaa52a801e2a27 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/BUILD.gn
@@ -10,10 +10,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsTestFourthSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -22,9 +23,12 @@ ohos_js_hap_suite("ActsAmsTestFourthSceneTest") {
hap_name = "ActsAmsTestFourthSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json
index cf3b5c6e2b9a34eb75eea53b4e0b376a865f1e20..bac0cbf90d5daaa3b7f5e8d0fa96714b202ca52b 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/Test.json
@@ -1,10 +1,11 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamstestfourthscene",
- "shell-timeout": "60000"
+ "bundle-name": "com.example.actsamstestfourthscene",
+ "package-name": "com.example.actsamstestfourthscene",
+ "shell-timeout": "600000"
},
"kits": [
{
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index a6053c61f9615fcd50fefb51f878568f3e39e59b..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.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;
-}
-.btn {
- width: 50%;
- height: 100px;
- font-size: 40px;
-}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index f470b9c0afaf71f7752215a1fb5e76fe5e352543..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-let once = true
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- if (once) {
- once = false
- console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
- }
- },
- onReady() {
- console.info('onReady');
- },
-}
-
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js
deleted file mode 100644
index c282338f488137b3385950256daceaa29f6cee4f..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/List.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index 009209ae9a20d45389f20bfe37cb17a19951aef2..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('ActsAmsTestFourthScene', function () {
- console.info('----ActsAmsTestFourthScene----');
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.io",
- abilityName: "com.example.VerifyIoThirdAbility",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.act",
- abilityName: "com.example.VerifyActThirdAbility",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestFourthScene VerifyActThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.entry",
- abilityName: "com.example.SimulateEntryAbility",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestFourthScene SimulateEntryAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- done();
- });
-
- function timeout(done) {
- expect().assertFail();
- console.debug('Acts_Ams_test=========timeout========');
- done();
- }
-
- function sleep(delay) {
- var start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_1700
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by Promise)
- */
- it('Acts_Ams_test_1700', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- var info = await appManager.getProcessRunningInfos();
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json
similarity index 55%
rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json
index b0f032e0fe4674ccc58e1706483c08ad9fd23118..76e63afa3d5607148d98d956f8ebf4466bc5d539 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamstestfourthscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -26,16 +28,42 @@
"installationFree": true
},
"abilities": [
- {
- "visible": true,
- "name": "com.example.actsamstestfourthscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
- }
+ {
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
+ }
],
"reqPermissions": [
{
@@ -81,7 +109,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2334ecfa2c147f276998e82e2c35f62800cfb031
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.css
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..08b387efa1ae9f8d78e6f45bb95d9c97b7a8cca3
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,36 @@
+/*
+ * 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')
+let once = true
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ if (once) {
+ once = false
+ console.info('onShow finish')
+ }
+ },
+ onReady() {
+ console.info('onReady');
+ },
+}
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/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/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/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/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2b45eb97c17e67ef5d63436aad8998113aa95d6d
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,50 @@
+/*
+ * 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 {
+ 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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/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/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..975abcb5f665c7385a5a1216d1b3b8163014b931
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsTestFourthScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsTestFourthScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..85272fd597763d821ee117fbe1cdf13a6b4b510b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+export default function ActsAmsTestFourthScene() {
+ describe('ActsAmsTestFourthScene', function () {
+ console.info('----ActsAmsTestFourthScene----');
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.io",
+ abilityName: "com.example.VerifyIoThirdAbility",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestFourthScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestFourthScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.act",
+ abilityName: "com.example.VerifyActThirdAbility",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestFourthScene VerifyActThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.entry",
+ abilityName: "com.example.SimulateEntryAbility",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestFourthScene SimulateEntryAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ done();
+ });
+
+ function timeout(done) {
+ expect().assertFail();
+ console.debug('Acts_Ams_test=========timeout========');
+ done();
+ }
+
+ function sleep(delay) {
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_1700
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by Promise)
+ */
+ it('Acts_Ams_test_1700', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ var info = await appManager.getProcessRunningInfos();
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..dd84c367c3202eb70dcc78ed2cbe61b2e119b602
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestfourthscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn
index cf56c295b754db845c83001248d9dae95f8567e7..c4e09388f63b092a0a47fd24ee89753197bf85a2 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/BUILD.gn
@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsTestSecondSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -22,9 +22,12 @@ ohos_js_hap_suite("ActsAmsTestSecondSceneTest") {
hap_name = "ActsAmsTestSecondSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json
index 2a9a90561bebb0b996de85ebf4eab2367d244f0f..cb5016a78be8fa498d948b73bfac9e3f90667a22 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamstestsecondscene",
+ "bundle-name": "com.example.actsamstestsecondscene",
+ "package-name": "com.example.actsamstestsecondscene",
"shell-timeout": "600000"
},
"kits": [
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index a6053c61f9615fcd50fefb51f878568f3e39e59b..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.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;
-}
-.btn {
- width: 50%;
- height: 100px;
- font-size: 40px;
-}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index f470b9c0afaf71f7752215a1fb5e76fe5e352543..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-let once = true
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- if (once) {
- once = false
- console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
- }
- },
- onReady() {
- console.info('onReady');
- },
-}
-
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js
deleted file mode 100644
index c282338f488137b3385950256daceaa29f6cee4f..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/List.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index e90d26e448b692c576e90a51105c55850b0009bf..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('ActsAmsTestSecondScene', function () {
- console.info('----ActsAmsTestSecondScene----');
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.io",
- abilityName: "com.example.VerifyIoThirdAbility",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- done();
- });
-
- function timeout(done) {
- expect().assertFail();
- console.debug('Acts_Ams_test=========timeout========');
- done();
- }
-
- function sleep(delay) {
- var start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_1700
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by Promise)
- */
- it('Acts_Ams_test_1700', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- var info = await appManager.getProcessRunningInfos();
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json
similarity index 56%
rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json
index 70128f8ab2936d883531ec674175bcd0d6ca5950..c28a0df5fa67a140fd34de540d64271526a055a7 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamstestsecondscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -27,16 +29,42 @@
},
"abilities": [
{
- "visible": true,
- "name": "com.example.actsamstestsecondscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
}
- ],
+ ],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
@@ -81,7 +109,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2334ecfa2c147f276998e82e2c35f62800cfb031
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.css
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..08b387efa1ae9f8d78e6f45bb95d9c97b7a8cca3
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,36 @@
+/*
+ * 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')
+let once = true
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ if (once) {
+ once = false
+ console.info('onShow finish')
+ }
+ },
+ onReady() {
+ console.info('onReady');
+ },
+}
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/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/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/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/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..1ba8e4e82ace01dad36c1279ea520b4903c57e8f
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,37 @@
+/*
+ * 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;
+}
+
+
+@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/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/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/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..fb011db8fc405b9b27a1af7e50cff375f1cc69f2
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsTestSecondScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsTestSecondScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a8075e657b17ef98392437d50214307da90ec8c7
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+export default function ActsAmsTestSecondScene() {
+ describe('ActsAmsTestSecondScene', function () {
+ console.info('----ActsAmsTestSecondScene----');
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.io",
+ abilityName: "com.example.VerifyIoThirdAbility",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestSecondScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestSecondScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ done();
+ });
+
+ function timeout(done) {
+ expect().assertFail();
+ console.debug('Acts_Ams_test=========timeout========');
+ done();
+ }
+
+ function sleep(delay) {
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_1700
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by Promise)
+ */
+ it('Acts_Ams_test_1700', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ var info = await appManager.getProcessRunningInfos();
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_1700 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..a4311fdbd2698c510a48ba2b754eb7a868367984
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestsecondscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/resources/base/media/icon.png
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn
index 1e9d4da0b4008c392844d6794f5ae5a6cafbe8ea..f982b0ac260b142c9b5eafec949ae83a0306eed8 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/BUILD.gn
@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsTestThirdSceneTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -22,9 +22,12 @@ ohos_js_hap_suite("ActsAmsTestThirdSceneTest") {
hap_name = "ActsAmsTestThirdSceneTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json
index 629d269911692abfa2847d5990a4785a1dd4ab53..6928b68cafd77a5c70a5bd6fb497b401a7c1f6f2 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/Test.json
@@ -3,7 +3,8 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsamstestthirdscene",
+ "bundle-name": "com.example.actsamstestthirdscene",
+ "package-name": "com.example.actsamstestthirdscene",
"shell-timeout": "600000"
},
"kits": [
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index a6053c61f9615fcd50fefb51f878568f3e39e59b..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.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;
-}
-.btn {
- width: 50%;
- height: 100px;
- font-size: 40px;
-}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js
deleted file mode 100644
index f470b9c0afaf71f7752215a1fb5e76fe5e352543..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-let once = true
-export default {
- data: {
- title: ''
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- if (once) {
- once = false
- console.info('onShow finish')
-
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
- this.timeout = 10000
-
- require('../../../test/List.test')
- core.execute()
- }
- },
- onReady() {
- console.info('onReady');
- },
-}
-
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index 76e501f214f84c96a44d08973dbbdeab8515e1de..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "JsHelloWorld"
- },
- {
- "name": "mainability_description",
- "value": "hap sample empty page"
- }
- ]
-}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js
deleted file mode 100644
index c282338f488137b3385950256daceaa29f6cee4f..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/List.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-require('./MangerAbilityJsunit.test.js')
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
deleted file mode 100644
index 570a85fe0df63cc9cf5bbf4584cdbd210e5e4d65..0000000000000000000000000000000000000000
--- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/test/MangerAbilityJsunit.test.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import featureAbility from '@ohos.ability.featureAbility'
-import appManager from "@ohos.application.appManager"
-import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
-
-describe('ActsAmsTestThirdScene', function () {
- console.info('----ActsAmsTestThirdScene----');
-
- beforeAll(async function (done) {
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.simulate.feature",
- abilityName: "com.example.SimulateFeatureAbilityFir",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
-
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.ix.verify.io",
- abilityName: "com.example.VerifyIoThirdAbility",
- action: "action1",
- entities: ["entity1"],
- type: "MIMETYPE",
- uri: "key={true,true,false}",
- options:
- {},
- parameters:
- {},
- },
- }, (error, data) => {
- console.info('ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code \
- ' + error.code + ', data length [' + data.length + ']');
- }
- );
- done();
- });
-
- function timeout(done) {
- expect().assertFail();
- console.debug('Acts_Ams_test=========timeout========');
- done();
- }
-
- function sleep(delay) {
- var start = new Date().getTime();
- while (true) {
- if (new Date().getTime() - start > delay) {
- break;
- }
- }
- }
-
- /*
- * @tc.number : Acts_Ams_test_3300
- * @tc.name : getProcessRunningInfos : Get All Running Processes Info
- * @tc.desc : Get All Running Processes Info(by Promise)
- */
- it('Acts_Ams_test_3300', 0, async function (done) {
- console.info("sleep begin");
- sleep(5000);
- console.info("sleep end");
- var info = await appManager.getProcessRunningInfos();
- console.info('Acts_Ams_test_3300 getProcessRunningInfos JSON String: ' + JSON.stringify(info));
- expect(Array.isArray(info)).assertEqual(true);
- expect(info.length).assertLarger(0);
- for (var i = 0; i < info.length; i++) {
- console.info('Acts_Ams_test_3300 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
- expect(typeof (info[i].pid)).assertEqual("number");
- expect(info[i].pid).assertLarger(0);
-
- expect(typeof (info[i].processName)).assertEqual("string");
- expect(info[i].processName.length).assertLarger(0);
- expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
- expect(info[i].bundleNames.length).assertEqual(0);
-
- expect(typeof (info[i].uid)).assertEqual("number");
- expect(info[i].uid).assertLarger(0);
- }
- done();
- })
-})
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json
similarity index 55%
rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/config.json
rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json
index 404bffd0fe34f5f9783b3cc0f7b8b650026f134e..4885d8a231c4551314be3bc456edd44afd201bfc 100644
--- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/config.json
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsamstestthirdscene",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -26,16 +28,42 @@
"installationFree": true
},
"abilities": [
- {
- "visible": true,
- "name": "com.example.actsamstestthirdscene.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "isVisible": "true",
- "launchType": "singleton"
- }
+ {
+ "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": "singleton"
+ },
+ {
+ "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": "singleton"
+ }
],
"reqPermissions": [
{
@@ -81,7 +109,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/app.js
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/app.js
rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/app.js
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/en-US.json
rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/i18n/en-US.json
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/i18n/zh-CN.json
rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..322e0a4d40a4fde7e032c2d66e7a2a74445f7880
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.css
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/default/pages/index/index.hml
rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.hml
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..08b387efa1ae9f8d78e6f45bb95d9c97b7a8cca3
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,36 @@
+/*
+ * 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')
+let once = true
+export default {
+ data: {
+ title: ''
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ if (once) {
+ once = false
+ console.info('onShow finish')
+ }
+ },
+ onReady() {
+ console.info('onReady');
+ },
+}
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/app.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/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/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/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/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2b45eb97c17e67ef5d63436aad8998113aa95d6d
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,50 @@
+/*
+ * 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 {
+ 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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.hml b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/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/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/List.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..13fd8bd003bd45600a002bf4aaabe57323423f08
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import ActsAmsTestThirdScene from './MangerAbilityJsunit.test.js'
+
+export default function testsuite() {
+ ActsAmsTestThirdScene()
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..19bfe09592268acb2cb4025bab0a78c330e6b8a4
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/js/test/MangerAbilityJsunit.test.js
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import featureAbility from '@ohos.ability.featureAbility'
+import appManager from "@ohos.application.appManager"
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+export default function ActsAmsTestThirdScene() {
+ describe('ActsAmsTestThirdScene', function () {
+ console.info('----ActsAmsTestThirdScene----');
+
+ beforeAll(async function (done) {
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.simulate.feature",
+ abilityName: "com.example.SimulateFeatureAbilityFir",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestThirdScene SimulateFeatureAbilityFir start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.ix.verify.io",
+ abilityName: "com.example.VerifyIoThirdAbility",
+ action: "action1",
+ entities: ["entity1"],
+ type: "MIMETYPE",
+ uri: "key={true,true,false}",
+ options:
+ {},
+ parameters:
+ {},
+ },
+ }, (error, data) => {
+ console.info('ActsAmsTestThirdScene VerifyIoThirdAbility start, error.code \
+ ' + error.code + ', data length [' + data.length + ']');
+ }
+ );
+ done();
+ });
+
+ function timeout(done) {
+ expect().assertFail();
+ console.debug('Acts_Ams_test=========timeout========');
+ done();
+ }
+
+ function sleep(delay) {
+ var start = new Date().getTime();
+ while (true) {
+ if (new Date().getTime() - start > delay) {
+ break;
+ }
+ }
+ }
+
+ /*
+ * @tc.number : Acts_Ams_test_3300
+ * @tc.name : getProcessRunningInfos : Get All Running Processes Info
+ * @tc.desc : Get All Running Processes Info(by Promise)
+ */
+ it('Acts_Ams_test_3300', 0, async function (done) {
+ console.info("sleep begin");
+ sleep(5000);
+ console.info("sleep end");
+ var info = await appManager.getProcessRunningInfos();
+ console.info('Acts_Ams_test_3300 getProcessRunningInfos JSON String: ' + JSON.stringify(info));
+ expect(Array.isArray(info)).assertEqual(true);
+ expect(info.length).assertLarger(0);
+ for (var i = 0; i < info.length; i++) {
+ console.info('Acts_Ams_test_3300 getProcessRunningInfo[' + i + "]: " + JSON.stringify(info[i]));
+ expect(typeof (info[i].pid)).assertEqual("number");
+ expect(info[i].pid).assertLarger(0);
+
+ expect(typeof (info[i].processName)).assertEqual("string");
+ expect(info[i].processName.length).assertLarger(0);
+ expect(Array.isArray(info[i].bundleNames)).assertEqual(true);
+ expect(info[i].bundleNames.length).assertEqual(0);
+
+ expect(typeof (info[i].uid)).assertEqual("number");
+ expect(info[i].uid).assertLarger(0);
+ }
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..a4311fdbd2698c510a48ba2b754eb7a868367984
--- /dev/null
+++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "JsHelloWorld"
+ },
+ {
+ "name": "mainability_description",
+ "value": "hap sample empty page"
+ },
+ {
+ "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/ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/media/icon.png
similarity index 100%
rename from ability/ability_runtime/abilitymanager/actsamstestthirdscene/entry/src/main/js/resources/base/media/icon.png
rename to ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/resources/base/media/icon.png