From 5e62a8e0ba5307b5fa75d8fa3fefbe372f1ed7d3 Mon Sep 17 00:00:00 2001 From: xuchenghua09 Date: Tue, 6 Sep 2022 17:29:43 +0800 Subject: [PATCH] update Signed-off-by: xuchenghua09 --- .../ActsAmsUsersExtensionSystemTest/BUILD.gn | 10 +- .../ActsAmsUsersExtensionSystemTest/Test.json | 12 +- .../src/main/ets/MainAbility/MainAbility.ts | 36 +- .../ets/MainAbility/pages/index/index.ets | 31 ++ .../ets/MainAbility/pages/second/second.ets | 43 +++ .../src/main/ets/MainAbility2/MainAbility2.ts | 6 +- .../main/ets/ServiceAbility/ServiceAbility.ts | 30 +- .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 +++++ .../entry/src/main/ets/test/Ability.test.ets | 330 +++++++++--------- .../entry/src/main/ets/test/List.test.ets | 4 +- .../resources/base/profile/main_pages.json | 4 +- .../signature/openharmony_sx.p7b | Bin 3442 -> 3820 bytes .../ActsAmsUsersExtensionThirdTest/BUILD.gn | 2 + .../ActsAmsUsersExtensionThirdTest/Test.json | 19 +- .../src/main/ets/MainAbility/MainAbility.ts | 61 ++-- .../ets/MainAbility/pages/index/index.ets | 31 ++ .../ets/MainAbility/pages/second/second.ets | 44 +++ .../src/main/ets/MainAbility2/MainAbility2.ts | 6 +- .../main/ets/ServiceAbility/ServiceAbility.ts | 27 +- .../src/main/ets/TestAbility/TestAbility.ts | 51 +++ .../src/main/ets/TestAbility/pages/index.ets | 48 +++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 +++++ .../entry/src/main/ets/test/Ability.test.ets | 63 ++-- .../entry/src/main/ets/test/List.test.ets | 4 +- .../main/resources/base/element/string.json | 2 +- .../resources/base/profile/main_pages.json | 4 +- .../signature/openharmony_sx.p7b | Bin 3426 -> 3820 bytes .../ActsAmsUsersSystemTest/Test.json | 2 +- .../actsusers/ActsAmsUsersThirdTest/BUILD.gn | 2 + .../actsusers/ActsAmsUsersThirdTest/Test.json | 9 +- .../src/main/ets/MainAbility/MainAbility.ts | 2 +- .../ets/MainAbility/pages/index/index.ets | 42 +++ .../ets/MainAbility/pages/second/second.ets | 43 +++ .../src/main/ets/MainAbility2/MainAbility2.ts | 4 +- .../src/main/ets/MainAbility3/MainAbility3.ts | 6 +- .../src/main/ets/TestAbility/TestAbility.ts | 51 +++ .../src/main/ets/TestAbility/pages/index.ets | 48 +++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 +++++ .../entry/src/main/ets/test/Ability.test.ets | 62 ++-- .../entry/src/main/ets/test/List.test.ets | 4 +- .../resources/base/profile/main_pages.json | 4 +- ability/ability_runtime/actsusers/BUILD.gn | 2 +- .../BUILD.gn | 2 + .../Test.json | 11 +- .../src/main/ets/MainAbility/MainAbility.ts | 51 ++- .../ets/MainAbility/pages/index/index.ets | 42 +++ .../ets/MainAbility/pages/second/second.ets | 43 +++ .../src/main/ets/TestAbility/TestAbility.ts | 51 +++ .../src/main/ets/TestAbility/pages/index.ets | 48 +++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 +++++ .../entry/src/main/ets/test/List.test.ets | 4 +- .../ets/test/manyusersabilitytest.test.ets | 72 ++-- .../resources/base/profile/main_pages.json | 4 +- .../signature/openharmony_sx.p7b | Bin 3442 -> 3820 bytes .../actsmanyuserthirdabilitytest/BUILD.gn | 4 +- .../actsmanyuserthirdabilitytest/Test.json | 10 +- .../src/main/ets/MainAbility/MainAbility.ts | 5 +- .../ets/MainAbility/pages/index/index.ets | 42 +++ .../ets/MainAbility/pages/second/second.ets | 43 +++ .../src/main/ets/TestAbility/TestAbility.ts | 51 +++ .../src/main/ets/TestAbility/pages/index.ets | 48 +++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 +++++ .../entry/src/main/ets/test/List.test.ets | 4 +- .../ets/test/manyusersabilitytest.test.ets | 72 ++-- .../resources/base/profile/main_pages.json | 4 +- .../signature/openharmony_sx.p7b | Bin 0 -> 3820 bytes 66 files changed, 1689 insertions(+), 461 deletions(-) create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/index/index.ets create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/second/second.ets create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility/pages/index/index.ets create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility/pages/second/second.ets create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/pages/index.ets create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility/pages/index/index.ets create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility/pages/second/second.ets create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/pages/index.ets create mode 100644 ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/index/index.ets create mode 100644 ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/second/second.ets create mode 100644 ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts create mode 100644 ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/pages/index.ets create mode 100644 ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/pages/index/index.ets create mode 100644 ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/pages/second/second.ets create mode 100644 ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts create mode 100644 ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/pages/index.ets create mode 100644 ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn index 15d4b2e77..d290d611a 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn @@ -14,7 +14,7 @@ import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsAmsUsersExtensionSystemTest") { - hap_profile = "entry/src/main/module.json" + hap_profile = "./entry/src/main/module.json" js_build_mode = "debug" deps = [ ":actsamsusersextensionsystemtest_js_assets", @@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsAmsUsersExtensionSystemTest") { ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" hap_name = "ActsAmsUsersExtensionSystemTest" + subsystem_name = "ability" + part_name = "ability_runtime" } ohos_app_scope("actsamsusersextensionsystemtest_app_profile") { @@ -31,11 +33,11 @@ ohos_app_scope("actsamsusersextensionsystemtest_app_profile") { } ohos_js_assets("actsamsusersextensionsystemtest_js_assets") { - source_dir = "entry/src/main/ets" + source_dir = "./entry/src/main/ets" } ohos_resources("actsamsusersextensionsystemtest_resources") { - sources = [ "entry/src/main/resources" ] + sources = [ "./entry/src/main/resources" ] deps = [ ":actsamsusersextensionsystemtest_app_profile" ] - hap_profile = "entry/src/main/module.json" + hap_profile = "./entry/src/main/module.json" } diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/Test.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/Test.json index 4517a84f8..23c3021a3 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/Test.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/Test.json @@ -1,10 +1,12 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "300000", - "package": "com.acts.actsinterfacemultiusersextensiontest", - "shell-timeout": "300000" + "bundle-name": "com.acts.actsinterfacemultiusersextensiontest", + "module-name":"phone", + "shell-timeout": "300000", + "testcase-timeout": "30000" }, "kits": [ { @@ -12,6 +14,10 @@ "run-command": [ "acm create -n user101 -t normal", "acm switch -i 101" + ], + "teardown-command": [ + "acm switch -i 100", + "acm delete -i 101" ] }, { diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts index 10dd9a1ea..627735a9b 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,38 +13,42 @@ * limitations under the License. */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' export default class MainAbility extends Ability { - onCreate(want,launchParam){ - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate") + onCreate(want, launchParam) { + console.log('MainAbility onCreate') globalThis.abilityWant = want; + globalThis.abilityContext = this.context; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { - // Ability is destroying, release resources for this ability - console.log("MainAbility onDestroy") + console.log('MainAbility onDestroy') } onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index/index', null) } onWindowStageDestroy() { - //Main window is destroyed, release UI related resources - console.log("MainAbility onWindowStageDestroy") + console.log('MainAbility onWindowStageDestroy') } onForeground() { - // Ability has brought to foreground - console.log("MainAbility onForeground") + console.log('MainAbility onForeground') } onBackground() { - // Ability has back to background - console.log("MainAbility onBackground") + console.log('MainAbility onBackground') } + }; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/index/index.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/index/index.ets new file mode 100644 index 000000000..3213051cd --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -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. + */ +@Entry +@Component +struct Index { + @State message: string = 'ActsAmsUsersExtensionSystemTest' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/second/second.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/second/second.ets new file mode 100644 index 000000000..f9009a3e8 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts index 69bd30f43..3a23181f8 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -19,7 +19,7 @@ export default class MainAbility2 extends Ability { onCreate(want, launchParam) { console.log("MainAbility2 onCreate"); - globalThis.abilityContext = this.context + globalThis.abilityContext2 = this.context } onDestroy() { @@ -28,10 +28,10 @@ export default class MainAbility2 extends Ability { onWindowStageCreate(windowStage) { console.log("MainAbility2 onWindowStageCreate"); - windowStage.setUIContent(this.context, "pages/index/second", null); + windowStage.setUIContent(this.context, "MainAbility/pages/index/second", null); commonEvent.publish("ACTS_InterfaceMultiUsersExtension_CommonEvent", () => { console.log("publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") - globalThis.abilityContext.terminateSelf().then(() => { + globalThis.abilityContext2.terminateSelf().then(() => { commonEvent.publish("ACTS_TerminateSelf_CommonEvent", ()=>{ console.log('terminateSelf promise'); }); diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts index 62e5690da..9585ba864 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -79,6 +79,8 @@ export default class ServiceAbility extends ServiceExtensionAbility { },{ windowMode:0 },(err,data) => { + console.debug("==== err is====>"+ JSON.stringify(err)); + console.debug("==== errCode is====>"+ JSON.stringify(err.code)); console.debug("====>startAbility end====>" ); }) var myStub7 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility"); @@ -92,7 +94,9 @@ export default class ServiceAbility extends ServiceExtensionAbility { abilityName: 'com.acts.error.MainAbility2' },{ windowMode:0 - },() => { + },(err,data) => { + console.debug("==== err is====>"+ JSON.stringify(err)); + console.debug("==== errCode is====>"+ JSON.stringify(err.code)); console.debug("====>startAbility end====>" ); }) var myStub2 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility"); @@ -126,8 +130,10 @@ export default class ServiceAbility extends ServiceExtensionAbility { { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility2' - },() => { - console.debug("====>startAbility end====>" ); + },(err,data) => { + console.debug("==== err is====>"+ JSON.stringify(err)); + console.debug("==== errCode is====>"+ JSON.stringify(err.code)); + console.debug("====>startAbility end====>" ); }) var myStub8 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility"); console.log('ThirdAbility onConnect before return:') @@ -138,8 +144,10 @@ export default class ServiceAbility extends ServiceExtensionAbility { { bundleName: 'com.acts.error', abilityName: 'com.acts.error.ServiceAbility2' - },() => { - console.debug("====>startAbility end====>" ); + },(err,data) => { + console.debug("==== err is====>"+ JSON.stringify(err)); + console.debug("==== errCode is====>"+ JSON.stringify(err.code)); + console.debug("====>startAbility end====>" ); }) var myStub4 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility"); console.log('ThirdAbility onConnect before return:') @@ -186,8 +194,10 @@ export default class ServiceAbility extends ServiceExtensionAbility { { bundleName: 'com.acts.error', abilityName: 'com.acts.error.ServiceAbility2' - },() => { - console.debug("====>startAbility end====>" ); + },(err,data) => { + console.debug("==== err is====>"+ JSON.stringify(err)); + console.debug("==== errCode is====>"+ JSON.stringify(err.code)); + console.debug("====>startAbility end====>" ); }) var myStub6 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility"); console.log('ThirdAbility onConnect before return:') @@ -210,8 +220,10 @@ export default class ServiceAbility extends ServiceExtensionAbility { { bundleName: 'com.example.userservicesystemapi7', abilityName: 'com.example.userservicesystemapi7.ServiceAbility' - },() => { - console.debug("====>startAbility end====>" ); + },(err,data) => { + console.debug("==== err is====>"+ JSON.stringify(err)); + console.debug("==== errCode is====>"+ JSON.stringify(err.code)); + console.debug("====>startAbility end====>" ); }) var myStub10 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility"); console.log('ThirdAbility onConnect before return:') diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..9f9cabbe3 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * 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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.acts.actsinterfacemultiusersextensiontest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets index ed891c859..a20fe5e8a 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets @@ -12,13 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import commonEvent from '@ohos.commonEvent' import osaccount from '@ohos.account.osAccount' var subscriberInfo_MainAbility = { events: ["ACTS_InterfaceMultiUsersExtension_CommonEvent"] - }; +}; var subscriberInfo_MainAbility2 = { events: ["ACTS_TerminateSelf_CommonEvent"] }; @@ -29,21 +29,11 @@ var osAccountManager const START_ABILITY_TIMEOUT = 6000; globalThis.number = 0; console.debug("====>in Ability.test====>"); -export default function abilityTest(abilityContext) { +export default function abilityTest() { console.debug("====>in function abilityTest====>"); describe('ActsInterfaceMultiUsersExtensionTest', function () { - afterAll(function() { - osAccountManager = osaccount.getAccountManager(); - console.debug("====>get AccountManager finish===="); - osAccountManager.activateOsAccount(100, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - osAccountManager.removeOsAccount(101, (err)=>{ - console.debug("====>remove localId: 101" + " err:" + JSON.stringify(err)); - }) - }) - }) console.debug("====>in ACTS_InterfaceMultiUsers====>"); - + /* * @tc.number : ACTS_ExtensionStartAbility_0100 * @tc.name : start new ability @@ -55,46 +45,46 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 1 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent") { startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } - commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo) => { - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>0100start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( - { - bundleName: 'com.acts.actsinterfacemultiusersextensiontest', - abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - }) - console.debug("====>number is====>" + JSON.stringify(globalThis.number)); - }) + commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { + console.debug("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>0100start connectAbility====>"); + globalThis.number = await globalThis.abilityContext.connectAbility( + { + bundleName: 'com.acts.actsinterfacemultiusersextensiontest', + abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); }) + }) function UnSubscribeCallback() { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); - setTimeout(()=>{ + setTimeout(() => { done() - },1000) + }, 1000) } function timeout() { console.debug('in ACTS_ExtensionStartAbility_0100 timeout'); - if(flag == true) { + if (flag == true) { expect().assertFail(); console.debug('ACTS_ExtensionStartAbility_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) @@ -115,11 +105,11 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 2 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect().assertFail(); expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent") { startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); @@ -128,21 +118,21 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); - setTimeout(()=>{ + setTimeout(() => { done(); - },1000) + }, 1000) } function onConnectCallback(element, remote) { console.log(' onConnectCallback====> element=' + JSON.stringify(element)); console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { + setTimeout(() => { console.log('====>in timeout'); console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { + if (flag == true) { console.debug('ACTS_ExtensionStartAbility_0200 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } @@ -157,18 +147,18 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0200start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, onFailed: onFailedCallback }) console.debug("====>number is====>" + JSON.stringify(globalThis.number)); @@ -185,15 +175,15 @@ export default function abilityTest(abilityContext) { let Subscriber var flag = true var startresult = false - globalThis.startnum=3 + globalThis.startnum = 3 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent") { startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -201,12 +191,12 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0300start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' @@ -219,14 +209,14 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); - setTimeout(()=>{ + setTimeout(() => { done() - },1000) + }, 1000) } function timeout() { console.debug('in ACTS_ExtensionStartAbility_0300 timeout'); - if(flag == true) { + if (flag == true) { expect().assertFail(); console.debug('ACTS_ExtensionStartAbility_0300 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) @@ -247,11 +237,11 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 4 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect().assertFail(); expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent") { startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); @@ -260,21 +250,21 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); - setTimeout(()=>{ + setTimeout(() => { done(); - },1000) + }, 1000) } function onConnectCallback(element, remote) { console.log(' onConnectCallback====> element=' + JSON.stringify(element)); console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { + setTimeout(() => { console.log('====>in timeout'); console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { + if (flag == true) { console.debug('ACTS_ExtensionStartAbility_0400 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } @@ -289,18 +279,18 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0400start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, onFailed: onFailedCallback }) console.debug("====>number is====>" + JSON.stringify(globalThis.number)); @@ -320,13 +310,13 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 5 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent") { startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -334,12 +324,12 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0500start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' @@ -352,14 +342,14 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); - setTimeout(()=>{ + setTimeout(() => { done() - },1000) + }, 1000) } function timeout() { console.debug('in ACTS_ExtensionStartAbility_0500 timeout'); - if(flag == true) { + if (flag == true) { expect().assertFail(); console.debug('ACTS_ExtensionStartAbility_0500 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) @@ -380,11 +370,11 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 6 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect().assertFail(); expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent") { startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); @@ -393,21 +383,21 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); - setTimeout(()=>{ + setTimeout(() => { done(); - },1000) + }, 1000) } function onConnectCallback(element, remote) { console.log(' onConnectCallback====> element=' + JSON.stringify(element)); console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { + setTimeout(() => { console.log('====>in timeout'); console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { + if (flag == true) { console.debug('ACTS_ExtensionStartAbility_0600 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } @@ -422,18 +412,18 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0600start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, onFailed: onFailedCallback }) console.debug("====>number is====>" + JSON.stringify(globalThis.number)); @@ -450,15 +440,15 @@ export default function abilityTest(abilityContext) { let Subscriber var flag = true var startresult = false - globalThis.startnum=7 + globalThis.startnum = 7 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent") { startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -466,12 +456,12 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0700start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' @@ -484,14 +474,14 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); - setTimeout(()=>{ + setTimeout(() => { done() - },1000) + }, 1000) } function timeout() { console.debug('in ACTS_ExtensionStartAbility_0700 timeout'); - if(flag == true) { + if (flag == true) { expect().assertFail(); console.debug('ACTS_ExtensionStartAbility_0700 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) @@ -513,11 +503,11 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 8 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect().assertFail(); expect(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent").assertTrue(); console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent") { startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); @@ -526,21 +516,21 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); - setTimeout(()=>{ + setTimeout(() => { done(); - },1000) + }, 1000) } function onConnectCallback(element, remote) { console.log(' onConnectCallback====> element=' + JSON.stringify(element)); console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { + setTimeout(() => { console.log('====>in timeout'); console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { + if (flag == true) { console.debug('ACTS_ExtensionStartAbility_0800 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } @@ -555,18 +545,18 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0800start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, onFailed: onFailedCallback }) console.debug("====>number is====>" + JSON.stringify(globalThis.number)); @@ -583,15 +573,15 @@ export default function abilityTest(abilityContext) { let Subscriber var flag = true var startresult = false - globalThis.startnum=13 + globalThis.startnum = 13 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent").assertTrue(); console.debug("====>0900 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent") { startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -599,12 +589,12 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility3).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0900start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' @@ -617,14 +607,14 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); - setTimeout(()=>{ + setTimeout(() => { done() - },1000) + }, 1000) } function timeout() { console.debug('in ACTS_ExtensionStartAbility_0900 timeout'); - if(flag == true) { + if (flag == true) { expect().assertFail(); console.debug('ACTS_ExtensionStartAbility_0900 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) @@ -644,15 +634,15 @@ export default function abilityTest(abilityContext) { let Subscriber var flag = true var startresult = false - globalThis.startnum=14 + globalThis.startnum = 14 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent").assertTrue(); console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ + if (data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent") { startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -660,12 +650,12 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility3).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>1000start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' @@ -678,14 +668,14 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); - setTimeout(()=>{ + setTimeout(() => { done() - },1000) + }, 1000) } function timeout() { console.debug('in ACTS_ExtensionStartAbility_1000 timeout'); - if(flag == true) { + if (flag == true) { expect().assertFail(); console.debug('ACTS_ExtensionStartAbility_1000 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) @@ -707,13 +697,13 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 9 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_TerminateSelf_CommonEvent"){ + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ACTS_TerminateSelf_CommonEvent") { startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -730,18 +720,18 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0100start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, onFailed: onFailedCallback }) console.debug("====>number is====>" + JSON.stringify(globalThis.number)); @@ -752,14 +742,14 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); - setTimeout(()=>{ + setTimeout(() => { done() - },1000) + }, 1000) } function timeout() { console.debug('in ACTS_ExtensionTerminateSelf_0100 timeout'); - if(flag == true) { + if (flag == true) { expect().assertFail(); console.debug('ACTS_ExtensionTerminateSelf_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) @@ -780,11 +770,11 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 10 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect().assertFail(); expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_TerminateSelf_CommonEvent"){ + if (data.event == "ACTS_TerminateSelf_CommonEvent") { startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); @@ -793,21 +783,21 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); - setTimeout(()=>{ + setTimeout(() => { done(); - },1000) + }, 1000) } function onConnectCallback(element, remote) { console.log(' onConnectCallback====> element=' + JSON.stringify(element)); console.log(' onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { + setTimeout(() => { console.log('====>in timeout'); console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { + if (flag == true) { console.debug(' - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } @@ -822,18 +812,18 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0200start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, onFailed: onFailedCallback }) console.debug("====>number is====>" + JSON.stringify(globalThis.number)); @@ -853,13 +843,13 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 11 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_TerminateSelf_CommonEvent"){ + if (data.event == "ACTS_TerminateSelf_CommonEvent") { startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -867,12 +857,12 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0300start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' @@ -885,14 +875,14 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); - setTimeout(()=>{ + setTimeout(() => { done() - },1000) + }, 1000) } function timeout() { console.debug('in ACTS_ExtensionTerminateSelf_0300 timeout'); - if(flag == true) { + if (flag == true) { expect().assertFail(); console.debug('ACTS_ExtensionTerminateSelf_0300 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) @@ -914,11 +904,11 @@ export default function abilityTest(abilityContext) { var startresult = false globalThis.startnum = 12 console.log('====>globalThis.startnum is====>' + globalThis.startnum); - function SubscribeCallBack (err, data) { + function SubscribeCallBack(err, data) { expect().assertFail(); expect(data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); - if(data.event == "ACTS_TerminateSelf_CommonEvent"){ + if (data.event == "ACTS_TerminateSelf_CommonEvent") { startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); @@ -927,21 +917,21 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data) => { console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); - setTimeout(()=>{ + setTimeout(() => { done(); - },1000) + }, 1000) } function onConnectCallback(element, remote) { console.log('ACTS_ExtensionTerminateSelf_0400 onConnectCallback====> element=' + JSON.stringify(element)); console.log('ACTS_ExtensionTerminateSelf_0400 onConnectCallback====> remote=' + JSON.stringify(remote)); - setTimeout(()=> { + setTimeout(() => { console.log('====>in timeout'); console.debug("====>flag is====>" + JSON.stringify(flag)); - if(flag == true) { + if (flag == true) { console.debug('ACTS_ExtensionTerminateSelf_0400 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } @@ -956,18 +946,18 @@ export default function abilityTest(abilityContext) { } commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { console.debug("====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ + data.getSubscribeInfo().then(async (SubscribeInfo) => { console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0400start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensiontest', abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility' - },{ - onConnect:onConnectCallback, - onDisconnect:onDisconnectCallback, + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, onFailed: onFailedCallback }) console.debug("====>number is====>" + JSON.stringify(globalThis.number)); diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets index f4e1c2a61..87a37045f 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets @@ -14,7 +14,7 @@ */ import abilityTest from './Ability.test.ets' -export default function testsuite(context) { +export default function testsuite() { console.debug("====>in list.test====>"); - abilityTest(context) + abilityTest() } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json index 6898b31d2..02221db61 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/signature/openharmony_sx.p7b index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 100644 GIT binary patch delta 966 zcmZ8gPe>F|7ffHm0N!Yiq{63}l#VlpM*6df1k$8{d-zbJf%IRstLPYZ6b%>_u-0ij4x zH=VF&XqxsNWGF#rwB|@IF=ACTMF zzcjU=$znwT&qF9K6|jjWk)lHav)IHgMqFzY^m5C+gk(I^#e>w=k>h|?IjH;4;vmH~ zWxvG`6T!$h*zTLsP0v7Ash!VMW7HT38FA1cJ&r2|`leiD@uXlZw%mQ_WkX48PpDdl znoQnQFVvnxR7wCzF3&Aqn@`Vf9ecjNG4OEnF+P`D@f!D5?|=LLZ0JYkts09QW)JOS zk5n&8{c4}sQn&u=&$hVUNUofCAjVUB@vV1XhX*E~G@aRAT&@5qwPB{BRkWACf<0UP&5-Gqam*WHydX{n+IbmGYb==K@%%K zLLuXVCRPTPCYC?dN@b}<#hLkey2<$|sY+IcI&gu!#9W|&lA)e~o`I5%QfX;s3Xp4R zU}TNVHwFsV>L?|Z=B4DM>SikErR9V4r=*sp=HwTo7U_cB>0gkV=aE>Ho1a&yq%*mn zQF`-gMt5dDm^O&#CUdb$*8`oK19X0IWpPPrZhSJx0T3^wr6!h?f}Eq20dzT39_TkE zpzT0=ax;rT0apyNyeJjq+vJke6kQaV=vbgypt@3!^OXv+Gr<8+l$V&JRJ)*w?X5u* z)8@Tw^V#c-3@i;yP0dWqqYU)n(ZtDOsKlbsS0JUwB~>lzXREYEyJd#zv%~Mr0)50D zE=m7Vko;r+3 { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts index 3a43ba767..9623986e8 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -19,7 +19,7 @@ export default class MainAbility2 extends Ability { onCreate(want, launchParam) { console.log("MainAbility2 onCreate"); - globalThis.abilityContext = this.context + globalThis.abilityContext2 = this.context } onDestroy() { @@ -28,10 +28,10 @@ export default class MainAbility2 extends Ability { onWindowStageCreate(windowStage) { console.log("MainAbility2 onWindowStageCreate"); - windowStage.setUIContent(this.context, "pages/index/second", null); + windowStage.setUIContent(this.context, "MainAbility/pages/index/second", null); commonEvent.publish("ACTS_InterfaceMultiUsersExtension_CommonEvent", () => { console.log("publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") - globalThis.abilityContext.terminateSelf().then(() => { + globalThis.abilityContext2.terminateSelf().then(() => { commonEvent.publish("ACTS_TerminateSelf_CommonEvent", ()=>{ console.log('terminateSelf promise'); }); diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts index 04f85c959..f363a918d 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -76,7 +76,8 @@ export default class ServiceAbility extends ServiceExtensionAbility { abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility2' },{ windowMode:0 - },() => { + },(err,data) => { + console.debug("====>err is====>" + JSON.stringify(err)); console.debug("====>startAbility end====>" ); }) var myStub7 = new Stub("com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility"); @@ -90,7 +91,8 @@ export default class ServiceAbility extends ServiceExtensionAbility { abilityName: 'com.acts.error.MainAbility2' },{ windowMode:0 - },() => { + },(err,data) => { + console.debug("====>err is====>" + JSON.stringify(err)); console.debug("====>startAbility end====>" ); }) var myStub2 = new Stub("com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility"); @@ -124,9 +126,10 @@ export default class ServiceAbility extends ServiceExtensionAbility { { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility2' - },() => { - console.debug("====>startAbility end====>" ); - }) + },(err,data) => { + console.debug("====>err is====>" + JSON.stringify(err)); + console.debug("====>startAbility end====>" ); + }) var myStub8 = new Stub("com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility"); console.log('ThirdAbility onConnect before return:') return myStub8; @@ -136,9 +139,10 @@ export default class ServiceAbility extends ServiceExtensionAbility { { bundleName: 'com.acts.error', abilityName: 'com.acts.error.ServiceAbility2' - },() => { - console.debug("====>startAbility end====>" ); - }) + },(err,data) => { + console.debug("====>err is====>" + JSON.stringify(err)); + console.debug("====>startAbility end====>" ); + }) var myStub4 = new Stub("com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility"); console.log('ThirdAbility onConnect before return:') return myStub4; @@ -178,9 +182,10 @@ export default class ServiceAbility extends ServiceExtensionAbility { { bundleName: 'com.acts.error', abilityName: 'com.acts.error.ServiceAbility2' - },() => { - console.debug("====>startAbility end====>" ); - }) + },(err,data) => { + console.debug("====>err is====>" + JSON.stringify(err)); + console.debug("====>startAbility end====>" ); + }) var myStub6 = new Stub("com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility"); console.log('ThirdAbility onConnect before return:') return myStub6; diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 000000000..e9f9aadff --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,51 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/pages/index.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 000000000..fae969f98 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..8b106a82e --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * 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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/Ability.test.ets index 49a09a444..044a87d36 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/Ability.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import commonEvent from '@ohos.commonEvent' import osaccount from '@ohos.account.osAccount' @@ -26,20 +26,11 @@ var osAccountManager const START_ABILITY_TIMEOUT = 6000; globalThis.number = 0; console.debug("====>in Ability.test====>"); -export default function abilityTest(abilityContext) { +export default function abilityTest() { console.debug("====>in function abilityTest====>"); describe('ActsInterfaceMultiUsersExtensionThirdTest', function () { - afterAll(function() { - osAccountManager = osaccount.getAccountManager(); - console.debug("====>get AccountManager finish===="); - osAccountManager.activateOsAccount(100, (err)=>{ - console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); - osAccountManager.removeOsAccount(101, (err)=>{ - console.debug("====>remove localId: 101" + " err:" + JSON.stringify(err)); - }) - }) - }) console.debug("====>in ACTS_InterfaceMultiUsers====>"); + /* * @tc.number : ACTS_ThirdPartyExtensionStartAbility_0100 * @tc.name : start new ability @@ -57,7 +48,7 @@ export default function abilityTest(abilityContext) { if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -70,7 +61,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0100start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -124,7 +115,7 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -158,7 +149,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0200start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -189,7 +180,7 @@ export default function abilityTest(abilityContext) { if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -202,7 +193,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0300start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -256,7 +247,7 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -290,7 +281,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0400start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -322,7 +313,7 @@ export default function abilityTest(abilityContext) { if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -335,7 +326,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0500start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -389,7 +380,7 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -423,7 +414,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0600start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -454,7 +445,7 @@ export default function abilityTest(abilityContext) { if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){ startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -467,7 +458,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0700start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -522,7 +513,7 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -556,7 +547,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0800start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -586,7 +577,7 @@ export default function abilityTest(abilityContext) { if(data.event == "ACTS_TerminateSelf_CommonEvent"){ startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -599,7 +590,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0100start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -652,7 +643,7 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -686,7 +677,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0200start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -717,7 +708,7 @@ export default function abilityTest(abilityContext) { if(data.event == "ACTS_TerminateSelf_CommonEvent"){ startresult = true } - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -730,7 +721,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0300start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' @@ -784,7 +775,7 @@ export default function abilityTest(abilityContext) { console.debug("====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(false); - abilityContext.disconnectAbility(globalThis.number).then((data)=>{ + globalThis.abilityContext.disconnectAbility(globalThis.number).then((data)=>{ console.debug("====>data is====>" + JSON.stringify(data)); }) console.log('====>disconnectAbility finish'); @@ -820,7 +811,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>0400start connectAbility====>"); - globalThis.number = await abilityContext.connectAbility( + globalThis.number = await globalThis.abilityContext.connectAbility( { bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest', abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility' diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/List.test.ets index 38ad693b9..3a84309ab 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/List.test.ets +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/List.test.ets @@ -14,7 +14,7 @@ */ import abilityTest from './Ability.test.ets' -export default function testsuite(context) { +export default function testsuite() { console.debug("====>in list.test====>"); - abilityTest(context) + abilityTest() } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/element/string.json index 376647878..f03b06594 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/element/string.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/element/string.json @@ -29,4 +29,4 @@ "value": "Demo" } ] -} \ No newline at end of file +} diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/profile/main_pages.json index 96b478210..010134e5c 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/profile/main_pages.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/profile/main_pages.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/signature/openharmony_sx.p7b index f06e218defa7f707e22a3890903c574e1c498217..dcec6c9615032c1b48bf185e839d9720dd68aab0 100644 GIT binary patch delta 1004 zcmZ8gPe>F|73wC3t}l`K_dEg=B+)Pof+QDY;Iv2 z69{1*WDgNxNYSZ7gon;1gct+`5_-x0KoLQZgxB88&Tfu#{J!7!`}4i|z8w2?yd=4e zKlsS0+05*2oM~W}+{R5>+F%(b8J7<6k%`$1gX%e!kzD@Xe;~8u@;5n`FWia>^aBM% zENtka4)X|{6+ki}B_z-mZYqZAHIqRZnx>div1JpSb!>0iE}H(dVU1(mMw0}3Y!_*8=jBGo4Dy710_3=4?bfGo5l*$C-8t z@HuA!Z&fD*X$V@VY9Z_Bs)j@v>p3H=s-gnY3=`9lqnPx^< zzQXj^ANBQoKLKm7yYh3cxf0NCLQ|tkz$#ic%8x5vtUXb@9p(_U9X~C&PB#}IX$OQN zK}EB|o}s20H;^g@oza>jp+u!YW!y6{79ye{^Vss9dmkS`-did*r3_<6!vu8L@s|(G zDeS*A(V<3TMSz#bB)C+-8k$6+0!^638n!X=v_?U%XSvrj2OZ7EL&Q*!Wq~#!sQb|3 z5Wxnazr`>W!ARZT?weLLM@1Kiksqwas4g6Qc99jNl9*((&=l`>DtjmxFp~NcYg8WLS}CB@YCJ* z19vy>Bw5`c6&#gV2`|t<+ E1CWL-VgLXD delta 602 zcmaDO`$($Zpouq*jZ>@5qwPB{BRkWACSHG_kT(+}qanWmFB@kA;1P^HYGrhB``#1qHe( znZ+eVnMtK3APpszG6f(V`Ni>>c_pdoMTsC`pw`mT%oHW7i5u1HmC6!xGE*{3DwV9N zmGbgSbdyrk@{2&`nOd4yn3)=xTIhhq6Vpmki-5vr7M3RF#z5g(9i@^=u<=EyIjM=o zsX%j+O7l{3Qgt))((*y(rKFan=HwTo7U_blQ}QoJ&GSes%FWNK1gZtQbn;Y2(aozF z-I@7ddLf>i%*8654E9i3YGO$#$U#aOKyT#b7v(1A!~=b*1hgM$a&BfZC~S&B))l3K z{GMErnxcy$6CDdw3shGM@_fWVC0{(WnpGwaW`;fQV{>Y`~TJTDXBGk { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts index d11ff297a..e66016096 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -16,7 +16,7 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' function PublishCallBackOne() { console.debug("====>Publish CallBack ACTS_StartAbility_0100_CommonEvent====>"); - globalThis.abilityContext.terminateSelf(); + globalThis.abilityContext2.terminateSelf(); console.debug("====>terminateSelf succese====>") commonEvent.publish("ACTS_TerminateSelf_CommonEvent", ()=>{ console.debug("====>publish ACTS_TerminateSelf_CommonEvent====>") @@ -34,7 +34,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { console.log("MainAbility2 onWindowStageCreate") - globalThis.abilityContext = this.context + globalThis.abilityContext2 = this.context commonEvent.publish("ACTS_InterfaceMultiUsers_0100_Start_CommonEvent", PublishCallBackOne); } diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility3/MainAbility3.ts index 160c319d1..f02f2fdec 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility3/MainAbility3.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -26,9 +26,9 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { console.log("MainAbility3 onWindowStageCreate") - globalThis.abilityContext = this.context + globalThis.abilityContext3 = this.context windowStage.setUIContent(this.context, "pages/index/second", null) - globalThis.abilityContext.terminateSelfWithResult( + globalThis.abilityContext3.terminateSelfWithResult( { resultCode:1, want:{ @@ -46,7 +46,7 @@ export default class MainAbility extends Ability { onForeground() { console.log("MainAbility3 onForeground") - globalThis.abilityContext.terminateSelfWithResult({ + globalThis.abilityContext3.terminateSelfWithResult({ resultCode: 1 }) } diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 000000000..e9f9aadff --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,51 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/pages/index.ets b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 000000000..fae969f98 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..96bad66c9 --- /dev/null +++ b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * 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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.acts.actsinterfacemultiusersthirdtest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/Ability.test.ets index 474672fb8..455e13eb3 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/Ability.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" import commonEvent from '@ohos.commonEvent' import osaccount from '@ohos.account.osAccount' @@ -22,7 +22,7 @@ var subscriberInfo_MainAbility = { var osAccountManager const START_ABILITY_TIMEOUT = 6000; console.debug("====>in Ability.test====>"); -export default function abilityTest(abilityContext) { +export default function abilityTest() { console.debug("====>in function abilityTest====>"); describe('ActsInterfaceMultiUsersThirdTest', function () { @@ -50,7 +50,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - await abilityContext.startAbility( + await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2' @@ -101,7 +101,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - await abilityContext.startAbility( + await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility2' @@ -151,15 +151,16 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - abilityContext.startAbility( + globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2' }, { windowMode:0 - },() => { + },(err,data) => { + console.debug("====>startAbility err:====>" + JSON.stringify(err)); console.debug("====>startAbility end====>" ); - }) + }) }) }) @@ -203,7 +204,7 @@ export default function abilityTest(abilityContext) { commonEvent.subscribe(Subscriber, SubscribeCallBack); }) console.debug("====>start startAbility====>"); - await abilityContext.startAbility( + await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility2' @@ -252,7 +253,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - await abilityContext.startAbility( + await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2' @@ -301,7 +302,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - await abilityContext.startAbility( + await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility2' @@ -349,12 +350,13 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - abilityContext.startAbility( + globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2' - },() => { - console.debug("====>startAbility end====>" ); + },(err,data) => { + console.debug("====>startAbility err:====>" + JSON.stringify(err)); + console.debug("====>startAbility end====>" ); }) }) }) @@ -399,7 +401,7 @@ export default function abilityTest(abilityContext) { commonEvent.subscribe(Subscriber, SubscribeCallBack); }) console.debug("====>start startAbility====>"); - await abilityContext.startAbility( + await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility2' @@ -438,7 +440,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3', @@ -466,7 +468,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility3', @@ -497,7 +499,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3', @@ -524,7 +526,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility3', @@ -555,7 +557,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3', @@ -581,7 +583,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility3', @@ -610,7 +612,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3', @@ -635,7 +637,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility3', @@ -673,7 +675,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - await abilityContext.startAbility( + await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2' @@ -722,7 +724,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - await abilityContext.startAbility( + await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility2' @@ -772,7 +774,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - abilityContext.startAbility( + globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2' @@ -821,7 +823,7 @@ export default function abilityTest(abilityContext) { Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); console.debug("====>start startAbility====>"); - await abilityContext.startAbility( + await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility2' @@ -862,7 +864,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3', @@ -889,7 +891,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility3', @@ -919,7 +921,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiusersthirdtest', abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3', @@ -945,7 +947,7 @@ export default function abilityTest(abilityContext) { } setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>start startAbilityForResult====>"); - await abilityContext.startAbilityForResult( + await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', abilityName: 'com.acts.error.MainAbility3', diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/List.test.ets index 198b3e409..f454ef993 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/List.test.ets +++ b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/List.test.ets @@ -14,7 +14,7 @@ */ import abilityTest from './Ability.test.ets' -export default function testsuite(context) { +export default function testsuite() { console.debug("====>in list.test====>"); - abilityTest(context) + abilityTest() } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/resources/base/profile/main_pages.json index 6898b31d2..02221db61 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/resources/base/profile/main_pages.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/resources/base/profile/main_pages.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/BUILD.gn b/ability/ability_runtime/actsusers/BUILD.gn index 48b6afef0..62fc33cc6 100644 --- a/ability/ability_runtime/actsusers/BUILD.gn +++ b/ability/ability_runtime/actsusers/BUILD.gn @@ -13,7 +13,7 @@ import("//build/ohos_var.gni") -group("actsusers") { +group("actsusers900") { testonly = true if (is_standard_system) { deps = [ diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn index 28ed27d1d..9d04bcc22 100644 --- a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn @@ -22,6 +22,8 @@ ohos_js_hap_suite("ActsConnectAbilitySystemAbilityTest") { ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" hap_name = "ActsConnectAbilitySystemAbilityTest" + subsystem_name = "ability" + part_name = "ability_runtime" } ohos_app_scope("actsconnectabilitysystemabilitytest_app_profile") { diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/Test.json b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/Test.json index 5a2cbc313..59844f8e0 100644 --- a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/Test.json +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/Test.json @@ -2,10 +2,12 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", - "test-timeout": "120000", - "package": "com.example.actsconnectabilitysystemabilitytest", - "shell-timeout": "60000" + "type": "OHJSUnitTest", + "test-timeout": "300000", + "bundle-name": "com.example.actsconnectabilitysystemabilitytest", + "module-name":"phone", + "shell-timeout": "300000", + "testcase-timeout": "30000" }, "kits": [ { @@ -15,6 +17,7 @@ "acm switch -i 101" ], "teardown-command":[ + "acm switch -i 101", "acm delete -i 101" ] }, diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts index 438999971..7f32c4093 100644 --- a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -1,55 +1,50 @@ /* -* 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. -*/ + * 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 Ability from '@ohos.application.Ability' export default class MainAbility extends Ability { - - onCreate(want, launchParam) { + onCreate(want,launchParam){ // Ability is creating, initialize resources for this ability - console.log("AbilityMultiInstanceTest onCreate") + console.log("MainAbility onCreate") globalThis.abilityWant = want; } onDestroy() { // Ability is destroying, release resources for this ability - console.log("AbilityMultiInstanceTest onDestroy") + console.log("MainAbility onDestroy") } onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability - console.log("AbilityMultiInstanceTest onWindowStageCreate") + console.log("MainAbility onWindowStageCreate") globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("AbilityMultiInstanceTest onWindowStageDestroy") + //Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy") } - onForeground() { // Ability has brought to foreground - console.log("AbilityMultiInstanceTest onForeground") + console.log("MainAbility onForeground") } onBackground() { // Ability has back to background - console.log("AbilityMultiInstanceTest onBackground") + console.log("MainAbility onBackground") } - -}; +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/index/index.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/index/index.ets new file mode 100644 index 000000000..5a7b56cd6 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../../test/List.test' +import router from '@ohos.router' + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + + } + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('MainAbility') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/second/second.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/second/second.ets new file mode 100644 index 000000000..caa9f1c5f --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 000000000..e9f9aadff --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,51 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/pages/index.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 000000000..fae969f98 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..764da81c4 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * 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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.example.actsconnectabilitysystemabilitytest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets index 548001ece..28df98361 100644 --- a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets @@ -13,6 +13,6 @@ * limitations under the License. */ import abilityTest from './manyusersabilitytest.test.ets' -export default function testsuite(context) { - abilityTest(context) +export default function testsuite() { + abilityTest() } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets index 5abbdbcbd..16e465888 100644 --- a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import commonEvent from '@ohos.commonEvent' @@ -66,7 +66,7 @@ var unsubscriberInfoStartAbility_0200 = { const START_ABILITY_TIMEOUT = 1000; globalThis.number = 0; -export default function abilityTest(abilityContext) { +export default function abilityTest() { describe('ActssystemabilityTest', function () { /* @@ -87,7 +87,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent"); console.debug("====>ACTS_ConnectAbility_0100 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -114,7 +114,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('AMS_ConnectAbility_0100 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -139,7 +139,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ConnectAbility_0100 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -189,7 +189,7 @@ export default function abilityTest(abilityContext) { commonEvent.unsubscribe(subscriber, unSubscribeCallback) } id = setTimeout(timeout, START_ABILITY_TIMEOUT); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbilityone", @@ -217,7 +217,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_DisconnectAbility_0100 5 CallBack data:====>" + JSON.stringify(data)); clearTimeout(id); console.debug("====>ACTS_DisconnectAbility_0100 6====>"); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -241,7 +241,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('AMS_DonnectAbility_0300 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -249,7 +249,7 @@ export default function abilityTest(abilityContext) { } id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_DisconnectAbility_0100 3====>"); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -283,7 +283,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_DisconnectAbility_0200 1111 connectAbility2====>"); console.debug("====>ACTS_DisconnectAbility_0200 66 Subscriber====>"); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( 999, (error, data) => { console.log('ACTS_DisconnectAbility_0200 5 DisconnectAbility result errCode : ' @@ -309,7 +309,7 @@ export default function abilityTest(abilityContext) { console.debug('unsubscribe subscriberdisconnect'); commonEvent.unsubscribe(subscriber, () => { console.debug('unsubscribe subscriber') - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('ACTS_DisconnectAbility_0200 9 DisconnectAbility result errCode : ' @@ -326,7 +326,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_DisconnectAbility_0200 10 Subscriber====>"); subscriber = data; await commonEvent.subscribe(subscriber, subscribeCallBack) - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -358,7 +358,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_DisconnectAbility_0300 4 CallBack data:====>" + JSON.stringify(data)); clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0500_commonEvent"); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('ACTS_DisconnectAbility_0300 5 DisconnectAbility result errCode : ' @@ -382,7 +382,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('AMS_ConnectAbility_0500 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('ACTS_DisconnectAbility_0300 7 DisconnectAbility result errCode : ' @@ -391,7 +391,7 @@ export default function abilityTest(abilityContext) { } id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_DisconnectAbility_0300 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -425,7 +425,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_DisconnectAbility_0400 1111 connectAbility2====>"); console.debug("====>ACTS_DisconnectAbility_0400 66 Subscriber====>"); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( 999, (error, data) => { console.log('ACTS_DisconnectAbility_0400 5 DisconnectAbility result errCode : ' @@ -451,7 +451,7 @@ export default function abilityTest(abilityContext) { console.debug('unsubscribe subscriberdisconnect'); commonEvent.unsubscribe(subscriber, () => { console.debug('unsubscribe subscriber') - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('ACTS_DisconnectAbility_0400 9 DisconnectAbility result errCode : ' @@ -468,7 +468,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_DisconnectAbility_0400 10 Subscriber====>"); subscriber = data; await commonEvent.subscribe(subscriber, subscribeCallBack) - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -501,7 +501,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0700_commonEvent"); console.debug("====>ACTS_ExtensionConnectAbility_0100 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -525,7 +525,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('ACTS_ExtensionConnectAbility_0100 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -533,7 +533,7 @@ export default function abilityTest(abilityContext) { } id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ExtensionConnectAbility_0100 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -560,7 +560,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0800_commonEvent"); console.debug("====>ACTS_ExtensionConnectAbility_0200 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -583,7 +583,7 @@ export default function abilityTest(abilityContext) { function timeout() { console.debug('ACTS_ExtensionConnectAbility_0200 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -591,7 +591,7 @@ export default function abilityTest(abilityContext) { } id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ExtensionConnectAbility_0200 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -618,7 +618,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0900_commonEvent"); console.debug("====>ACTS_ExtensionDisconnectAbility_0100 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -642,7 +642,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('ACTS_ExtensionDisconnectAbility_0100 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -650,7 +650,7 @@ export default function abilityTest(abilityContext) { } id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ExtensionDisconnectAbility_0100 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -677,7 +677,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_1000_commonEvent"); console.debug("====>ACTS_ExtensionDisconnectAbility_0200 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -701,7 +701,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('ACTS_ExtensionDisconnectAbility_0200 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -709,7 +709,7 @@ export default function abilityTest(abilityContext) { } id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ExtensionDisconnectAbility_0200 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -736,7 +736,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_1100_commonEvent"); console.debug("====>ACTS_ExtensionDisconnectAbility_0300 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -759,7 +759,7 @@ export default function abilityTest(abilityContext) { function timeout() { console.debug('ACTS_ExtensionDisconnectAbility_0300 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -767,7 +767,7 @@ export default function abilityTest(abilityContext) { } id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ExtensionDisconnectAbility_0300 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", @@ -795,7 +795,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_1200_commonEvent"); console.debug("====>ACTS_ExtensionDisconnectAbility_0400 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -818,7 +818,7 @@ export default function abilityTest(abilityContext) { function timeout() { console.debug('ACTS_ExtensionDisconnectAbility_0400 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -826,7 +826,7 @@ export default function abilityTest(abilityContext) { } id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ExtensionDisconnectAbility_0400 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsconnectabilitysystemabilitytest", abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility", diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json index 96b478210..010134e5c 100644 --- a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json +++ b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/signature/openharmony_sx.p7b index cc53179a48f88f20acc379c138a001e9a15838f6..dcec6c9615032c1b48bf185e839d9720dd68aab0 100644 GIT binary patch delta 966 zcmZ8gPe>F|7ffHm0N!Yiq{63}l#VlpM*6df1k$8{d-zbJf%IRstLPYZ6b%>_u-0ij4x zH=VF&XqxsNWGF#rwB|@IF=ACTMF zzcjU=$znwT&qF9K6|jjWk)lHav)IHgMqFzY^m5C+gk(I^#e>w=k>h|?IjH;4;vmH~ zWxvG`6T!$h*zTLsP0v7Ash!VMW7HT38FA1cJ&r2|`leiD@uXlZw%mQ_WkX48PpDdl znoQnQFVvnxR7wCzF3&Aqn@`Vf9ecjNG4OEnF+P`D@f!D5?|=LLZ0JYkts09QW)JOS zk5n&8{c4}sQn&u=&$hVUNUofCAjVUB@vV1XhX*E~G@aRAT&@5qwPB{BRkWACf<0UP&5-Gqam*WHydX{n+IbmGYb==K@%%K zLLuXVCRPTPCYC?dN@b}<#hLkey2<$|sY+IcI&gu!#9W|&lA)e~o`I5%QfX;s3Xp4R zU}TNVHwFsV>L?|Z=B4DM>SikErR9V4r=*sp=HwTo7U_cB>0gkV=aE>Ho1a&yq%*mn zQF`-gMt5dDm^O&#CUdb$*8`oK19X0IWpPPrZhSJx0T3^wr6!h?f}Eq20dzT39_TkE zpzT0=ax;rT0apyNyeJjq+vJke6kQaV=vbgypt@3!^OXv+Gr<8+l$V&JRJ)*w?X5u* z)8@Tw^V#c-3@i;yP0dWqqYU)n(ZtDOsKlbsS0JUwB~>lzXREYEyJd#zv%~Mr0)50D zE=m7Vko;r+3 { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 000000000..e9f9aadff --- /dev/null +++ b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,51 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/pages/index.ets b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 000000000..fae969f98 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..4eaf1e887 --- /dev/null +++ b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * 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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.example.actsmanyusersabilitytest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/List.test.ets index f59236655..71eb7f381 100644 --- a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/List.test.ets +++ b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/List.test.ets @@ -13,7 +13,7 @@ * limitations under the License. */ import abilityTest from './manyusersabilitytest.test.ets' -export default function testsuite(context) { +export default function testsuite() { - abilityTest(context) + abilityTest() } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets index 1a8dc9b17..e1ebf0fc3 100644 --- a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets +++ b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import commonEvent from '@ohos.commonEvent' @@ -87,7 +87,7 @@ function onFailedCallback(code) { console.log('ACTS_ConnectAbility onFailedCallback====> code=' + JSON.stringify(code)) } -export default function abilityTest(abilityContext) { +export default function abilityTest() { describe('manyuserability', function () { function onFailedCallBack(code) { @@ -111,7 +111,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent"); console.debug("====>ACTS_ThirdPartyConnectAbility_0100 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -136,7 +136,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('ACTS_ThirdPartyConnectAbility_0100 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -145,7 +145,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ThirdPartyConnectAbility_0100 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -197,7 +197,7 @@ export default function abilityTest(abilityContext) { } id = setTimeout(timeout, START_ABILITY_TIMEOUT); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbilityone", @@ -221,7 +221,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_ThirdPartyDisconnectAbility_0100 5 CallBack data:====>" + JSON.stringify(data)); clearTimeout(id); console.debug("====>ACTS_ThirdPartyDisconnectAbility_0100 6====>"); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -250,7 +250,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('AMS_DonnectAbility_0300 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -259,7 +259,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ThirdPartyDisconnectAbility_0100 3====>"); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -292,7 +292,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_ThirdPartyDisconnectAbility_0200 1111 connectAbility2====>"); console.debug("====>ACTS_ThirdPartyDisconnectAbility_0200 66 Subscriber====>"); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( 999, (error, data) => { console.log('ACTS_ThirdPartyDisconnectAbility_0200 5 DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -320,7 +320,7 @@ export default function abilityTest(abilityContext) { console.debug('unsubscribe subscriberdisconnect'); commonEvent.unsubscribe(subscriber, () => { console.debug('unsubscribe subscriber') - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('ACTS_ThirdPartyDisconnectAbility_0200 9 DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -339,7 +339,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_ThirdPartyDisconnectAbility_0200 10 Subscriber====>"); subscriber = data; await commonEvent.subscribe(subscriber, subscribeCallBack) - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -374,7 +374,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_ThirdPartyDisconnectAbility_0300 4 CallBack data:====>" + JSON.stringify(data)); clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0500_commonEvent"); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('ACTS_ThirdPartyDisconnectAbility_0300 5 DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -402,7 +402,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('ACTS_ThirdPartyDisconnectAbility_0300 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('ACTS_ThirdPartyDisconnectAbility_0300 7 DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -411,7 +411,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ThirdPartyDisconnectAbility_0300 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -443,7 +443,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_ThirdPartyDisconnectAbility_0400 1111 connectAbility2====>"); console.debug("====>ACTS_ThirdPartyDisconnectAbility_0400 66 Subscriber====>"); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( 999, (error, data) => { console.log('ACTS_ThirdPartyDisconnectAbility_0400 5 DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -471,7 +471,7 @@ export default function abilityTest(abilityContext) { console.debug('unsubscribe subscriberdisconnect'); commonEvent.unsubscribe(subscriber, () => { console.debug('unsubscribe subscriber') - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('ACTS_ThirdPartyDisconnectAbility_0400 9 DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -490,7 +490,7 @@ export default function abilityTest(abilityContext) { console.debug("====>ACTS_ThirdPartyDisconnectAbility_0400 10 Subscriber====>"); subscriber = data; await commonEvent.subscribe(subscriber, subscribeCallBack) - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -525,7 +525,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0700_commonEvent"); console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0100 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -554,7 +554,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('ACTS_ExtensionConnectAbility_0100 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -563,7 +563,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0100 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -591,7 +591,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0800_commonEvent"); console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0200 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -619,7 +619,7 @@ export default function abilityTest(abilityContext) { function timeout() { console.debug('ACTS_ThirdPartyExtensionConnectAbility_0200 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -628,7 +628,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0200 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -655,7 +655,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_0900_commonEvent"); console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0100 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -684,7 +684,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('ACTS_ThirdPartyExtensionDisconnectAbility_0100 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -693,7 +693,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0100 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -721,7 +721,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_1000_commonEvent"); console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0200 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -750,7 +750,7 @@ export default function abilityTest(abilityContext) { expect().assertFail(); console.debug('ACTS_ThirdPartyExtensionDisconnectAbility_0200 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -759,7 +759,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0200 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -787,7 +787,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_1100_commonEvent"); console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0200 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -815,7 +815,7 @@ export default function abilityTest(abilityContext) { function timeout() { console.debug('ACTS_ThirdPartyExtensionDisconnectAbility_0300 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -824,7 +824,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0300 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", @@ -852,7 +852,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); expect(data.event).assertEqual("AMS_ConnectAbility_1200_commonEvent"); console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0400 5 "); - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -880,7 +880,7 @@ export default function abilityTest(abilityContext) { function timeout() { console.debug('ACTS_ThirdPartyExtensionDisconnectAbility_0400 timeout'); commonEvent.unsubscribe(subscriber, unSubscribeCallback) - abilityContext.disconnectAbility( + globalThis.abilityContext.disconnectAbility( connId, (error, data) => { console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data) @@ -889,7 +889,7 @@ export default function abilityTest(abilityContext) { id = setTimeout(timeout, START_ABILITY_TIMEOUT); console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0400 3 "); - connId = await abilityContext.connectAbility( + connId = await globalThis.abilityContext.connectAbility( { bundleName: "com.example.actsmanyusersabilitytest", abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility", diff --git a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/resources/base/profile/main_pages.json index 6898b31d2..02221db61 100644 --- a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/resources/base/profile/main_pages.json +++ b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/resources/base/profile/main_pages.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..dcec6c9615032c1b48bf185e839d9720dd68aab0 GIT binary patch literal 3820 zcmcgvdvp_39&R2D7HBDy_bQZt6or&KY0@URs58mr1(S3_(l(`RnM@|hw3C@>GU=po zK{l+cJPONt7EmabH>^B%5v}YwKF}2uS3M}O3kxVBM`c-A1s^L%c4yKQ8jk+4$8(rJ zGP(EnxZm%0zx&-YAXDR2L1X=jvcp-NB*wA1p9Bo~s6P;Q#wd0mK3 z2yr@?6y#u`gU<$YiDsG=s7RcUr~9%blXOTjjzx%W{G)NQJq07LCztFjX7%MpG}Wn;t}1pyD#zYLnSe zQzbcMt67jk-v>5MF%*%Y`c@1k*$_kNXg18{FB+oSDTd>zxURPh4^OcUA|B(|j$CYZ z<-CTFR9v9LG)V~AzUbr!LG4a=xdrw5oHnNg_MzF?CKhu#Em+!OfrC^87M%zjaiWCB zGCggDF(eXci?+6SYH{2Oi+&ihV<}4-b|DdW9Rde@aI4!RW$@x68VOkIaC{aj3bmxY zE;+|;>j>7Hlavo_#1PUBLw?kf!f;;|!US8RQ8EU#2iew0oxLvF#0Gt63uZyHUT_K{ zZui0)5HV9HW=GMLlx{GQjor-773wNE@AUJ8zHJ8mhuGBbL>s5 zOT@wnN7U~(1JuMgfv+LZ$hu<@3`%hA$smQd!9EUhihe5`mXSN=V5r>+*GCXvFd8T6 zCe|kSXLJ5!Rn?rjnq(NYg$bwNO~an7H*P}Uun9$A%z_wT(II!#3p@xCKy9@`DxQoo zO)Tj}@PsQQl8tS%lV;BCuZs{EEZQxWHv1gRV3wk-2o75b7#16GX9{)+1gORJyus>B zPUjO%>})JF+hUF2M!y4M0Ai@MM-c{#glK&_Y+_r@37$x!xN|yaaEp9cFyXLMbj(S@ z`g)3~qo;FCY#L^4z+`2EuDHh|cv!s6C^|f~j5UB5Jc2*%3Am&*BqzjC)|GOl?TP60 zCN_H{P`C95j!FNsmOHC`nniN4%6_M^QqreNfl3JdLkOOcH7L=M5U5x)DN9H{*^m`2 zOc6pdt1Q~6BxE^H$)e4Z4}xS8`2s;O3@1_{UCuH$>n>}8{Ahcl<-hat@<@UbqZ6|B z-j*&dA&=9fAZ5(=nVX+L3QlHqPRqB_S>27Z1S3^dq?OCz<8(XCP!UQ;5#R8YUd4HAl*Ly0vYAcK}PX%w@Rr{D%CYRVlRQgn!BW{?46lv zm8!4+kkBAdq*3|Rnlh!u4Gjmw&7cS-E;q6 zR-8L?ejK*5<}1~EUmRwYQ+*GOfBB7We09;t*PbxEqhgmI9{to7FQ^6MB{=s?RF4KD z7Y+Z%k{<2I6N5I*>N$JwBL}}IT(DVZ2PLw@5QXBuYPCu^U=g@S9+#*`s)xTteD>mw zwEOtGzkl}EmkYoDy17{4&EGQ>T>!#Ls9^WXy+xT|$6m*zp~&UmQU{}&{lmISMcael zU*5c~=ObiQ=uG&l^Et5dDc;Hw8@Y-MaBV zwsl^P6K*3BWPnWlNR%DkK_u;<^cHyvr~XP^pj8D6)L8Y|j@7Nji#J>;b{)Pkh5MX@ zW3wJPs2jAQ{l!axz_GdOH$R;D?)movYWs4`zK&mmY}?&^?O^kD-}b>JXUWG`{oOuv z%VWjoUf8zzdh>|ulgBTQpDn-d9y}3nF02_~|MwOIJPd}&L@ASrQwUVjE1yXUO+O}$ zno+vxnK8e-Sm4=xY+c3vb&X=l+xfeviWGp55{Qjr1@!he;?4)xcAacEuxf9`_JN)6 z4t`?+P3L#-NxgubLxq7ph8%$1e2bb^c!y8?ui4u!?$)`>s|p|4|Q1o zlSD7_Tid%fTmx&{JgYlS?ih7^>h^c+qn8v)JR&3>UCi-l9QDe~d?a^p_xgzuWUSKn z=aD?TGm7{l6q>N{^CMmRMj7`kJG!;`lh5FLE7TXpK7I9lVX*N!~ ze}186>q5R^>5+v$L?(+_gw|KQjUid)_dqly*)N(o|Teqmbtq;TcYKYlwS+Pv#X z^~MV?l^!`+c40xd)N|3{|6u8&G0`69m&Y&ljCk+T$)S>19lnbbcg=`z^7c&DU4O1& z_v>rcl)lP5aCT(o?(ZKz=kAPOTuEHu143uysNv}cPFF%11uT(lru1C~TJOj<=5Eyf zpMc#o7=7~-ut)_-w!RNX1-Sd>pr{ZUB3+7lV3ICGQxz~88^QEjRyCwmmuEV=+^ZeS zPYv7h&9PaFPpqKt3m-}jzWUn23m