diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/BUILD.gn b/aafwk/aafwk_standard/actsstartcomponenttest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bbb5260599f35b47a90d89bdbdc4e563e640e21d --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos_var.gni") + +group("actsstartcomponenttest") { + testonly = true + if (is_standard_system) { + deps = [ + "SpecifiedUserActionExtension_100:ActsSpecifiedUserActionextensionZeroTest", + "SpecifiedUserActionExtension_101:ActsSpecifiedUserActionextensiononeTest", + + # "SpecifiedUserAction_100:ActsSpecifiedUserActionZeroTest", + # "SpecifiedUserAction_101:ActsSpecifiedUserActiononeTest", + ] + } +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/AppScope/app.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..8bb263cd5ffeda467f07d3524c528d85b4d9d307 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsspecifieduseractionextensionzerotest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 8, + "targetAPIVersion": 8, + "car": { + "apiCompatibleVersion": 8, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0d3507c0d180557b94bc5f0071ba146b4909fe51 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/AppScope/resources/base/media/app_icon.png b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/AppScope/resources/base/media/app_icon.png differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/BUILD.gn b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..1490f2b07e7f659b330843ce118a9ad3385110c5 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSpecifiedUserActionextensionZeroTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actsspecifieduseractionextensionzerotest_js_assets", + ":actsspecifieduseractionextensionzerotest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsSpecifiedUserActionextensionZeroTest" +} + +ohos_app_scope("actsspecifieduseractionextensionzerotest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsspecifieduseractionextensionzerotest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsspecifieduseractionextensionzerotest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsspecifieduseractionextensionzerotest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/Test.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..54ddad9da9e9250d228cd6096b5a08a290feb86d --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/Test.json @@ -0,0 +1,49 @@ + +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "120000", + "package": "com.example.actsspecifieduseractionextensionzerotest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsSpecifiedUserActionextensionZeroTest.hap", + "ActsSpecifiedUserActionextensiononeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionextensionZeroTest.hap->/system/app/ActsSpecifiedUserActionextensionZeroTest.hap"] + }, + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm create -n 102 -t normal", + "acm switch -i 101" + ], + "teardown-command":[ + "acm delete -i 101", + "acm delete -i 102" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionextensiononeTest.hap->/system/app/ActsSpecifiedUserActionextensiononeTest.hap"] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 100" + ] + } + ] +} + diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..2af31f94003ccd1a69174aa942c8129dfa6f5d08 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate") + globalThis.stageContext = this.context; + globalThis.startnum = 0 + console.log("MyAbilityStage finish") + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..e2bb24f02d8d0e9b72bea2f2e7faa83c1872b01c --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility/MainAbility.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 MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate"); + globalThis.abilityWant = want; + globalThis.abilityContext = this.context + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility onDestroy"); + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility onWindowStageCreate"); + windowStage.setUIContent(this.context, "pages/index/index", null); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy"); + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility onForeground"); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground"); + } +}; diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..16193dc05377887155f14e2cb714438378a6c7f6 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,58 @@ +/* + * 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' +import commonEvent from '@ohos.commonevent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); + console.debug("====>close this context====>") + globalThis.ability2Context.terminateSelf(); +} + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility2 onCreate") + + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + globalThis.ability2Context = this.context + windowStage.setUIContent(this.context, "pages/index", null) + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..d689638e378d4661777f73507e56e61398eb057a --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,207 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import rpc from '@ohos.rpc'; +import osaccount from '@ohos.account.osAccount' +globalThis.ACCOUNT_ID100; +globalThis.ACCOUNT_ID101; +globalThis.ACCOUNT_ID102; +class Stub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + // process client's request + onRemoteRequest(code, data, reply, option) { + reply.writeNoException(); + reply.writeString("success"); + return true; + } +} +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility onCreate'); + } + onDestory(){ + console.log('ServiceAbility onDestory'); + } + onRequest(want,startId) { + console.log('ServiceAbility onRequest'); + } + + onConnect(want) { + console.log('ServiceAbility onConnect'); + console.log('globalThis.startnum is ' + globalThis.startnum); + + switch (globalThis.startnum) { + case 1: + console.log('ServiceAbility case 1'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' + },globalThis.ACCOUNT_ID100 ,{ + windowMode: 2, + displayId: 1 + }).then(() => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0100 ====>success!") + }) + console.debug("====>case 1 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 2: + console.log('ServiceAbility case 2'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' + },globalThis.ACCOUNT_ID102 ,{ + windowMode: 2, + displayId: 1 + }).then(() => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0300 ====>success!") + }) + console.debug("====>case 2 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 3: + console.log('ServiceAbility case 3'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.MainAbility2' + },globalThis.ACCOUNT_ID101,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0500====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_0500====>sunccess!"+ JSON.stringify(data)) + })) + console.debug("====>case 3 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 4: + console.log('ServiceAbility case 4'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' + },globalThis.ACCOUNT_ID102, { + windowMode: 2, + displayId: 1 + },((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0600====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_0600====>sunccess!"+ JSON.stringify(data)) + })) + console.debug("====>case 4 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 5: + console.log('ServiceAbility case 5'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + },globalThis.ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0700====>success!"+ JSON.stringify(data)) + }) + break; + case 6: + console.log('ServiceAbility case 6'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + },globalThis.ACCOUNT_ID102,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0900====>fail!!!") + console.log("====>end ACTS_StartServiceAbilityWithAccount_0900====>sunccess!") + })) + console.debug("====>case 6 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 7: + console.log('ServiceAbility case 7'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility2' + }, globalThis.ACCOUNT_ID101,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_1100====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_1100====>sunccess!"+ JSON.stringify(data)) + })) + console.debug("====>case 7 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 8: + console.log('ServiceAbility case 8'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + }, globalThis.ACCOUNT_ID102,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_1200====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_1200====>sunccess!"+ JSON.stringify(data)) + })) + console.debug("====>case 8 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 9: + console.log('ServiceAbility case 9'); + this.context.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + }, globalThis.ACCOUNT_ID100) + break; + case 10: + console.log('ServiceAbility case 10'); + this.context.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + },globalThis.ACCOUNT_ID102) + + console.debug("====>case 10 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + default: + console.log("====> ServiceAbility end default =====>") + break; + } + } + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/service.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..91a83dbc24c50064a2031ddf77606699a059fac9 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility/service.ts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..c82a4d6aad5ad0ef52ac3e2b4154585d896497d0 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,57 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonevent" + +export default class ServiceAbility2 extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility2 onCreate'); + globalThis.abilityWant = want; + } + + onDestory(){ + console.log('ServiceAbility2 onDestory'); + } + + onRequest(want,startId) { + console.log('ServiceAbility2 onRequest'); + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { + console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") + this.context.terminateSelf(); + console.log("====> terminateSelf End=====>") + }); + } + + onConnect(want) { + console.log('ServiceAbility2 onConnect'); + if (want.action == 'StartAbilityPromise') { + console.log('stub StartAbilityPromise OnConnect start '); + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { + console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") + this.context.terminateSelf(); + console.log("====> StartAbilityPromise End=====>") + }); + } + } + + onDisconnect(want) { + console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility2 onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/service.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..91a83dbc24c50064a2031ddf77606699a059fac9 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/ServiceAbility2/service.ts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..85c2511e8ff64181a4aa29ff445e2f506e53b159 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,49 @@ +/* + * 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 file from '@system.file'; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/second/second.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c768edb999b1b54fef3268922817734b1f1c954 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..94fe1a9e24e4b1b3b29c3175c233334ff0205cb3 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,833 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import commonEvent from '@ohos.commonevent' +import osaccount from '@ohos.account.osAccount' + +var ACTS_ABILITYCONTEX = { + events: ["ABILITYCONTEX_Start_CommonEvent"] +}; + +const START_ABILITY_TIMEOUT = 3000; +console.debug("====>in Ability.test====>"); + +export default function abilityTest(abilityContext) { + console.debug("====>in ACTS_InterfaceMultiUsers====>"); + describe('ACTS_StartService', function () { + beforeAll(function(done) { + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ + console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); + globalThis.ACCOUNT_ID100 = data1[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ + console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); + globalThis.ACCOUNT_ID101 = data2[0]; + osAccountManager.activateOsAccount(102, (err)=>{ + console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); + osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ + console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); + globalThis.ACCOUNT_ID102 = data3[0]; + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + done(); + }) + }) + }) + }) + },3000) + }) + }) + },3000) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0100 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : In multi-user non-concurrent mode, + * the specified user is equal to the current user and the user's task list exists (promise) + */ + it('ACTS_StartServiceAbilityWithAccount_0100', 0, async function (done) { + let Subscriber + var flag = true; + var startresult = false; + globalThis.startnum = 1; + + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0100 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0100 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(() => { + done() + }, 1000) + } + + function timeout() { + console.debug('in ACTS_StartServiceAbilityWithAccount_0100 timeout'); + if (flag == true) { + expect().assertFail(); + console.debug('ACTS_StartServiceAbilityWithAccount_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0300 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist), call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0300', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 2; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0300 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0300 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0300start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0500 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists, call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_0500', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 3; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + // setTimeout(() => { + + // }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0500 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0500 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0500 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + done(); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0500start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0600 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist), + * call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_0600', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 4; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0600 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0600 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0600 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0600start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0700 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user is equal to the current user, + * and the user's task list exists, call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0700', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 5; + + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0700start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(() => { + done() + }, 1000) + } + + function timeout() { + console.debug('in ACTS_StartServiceAbilityWithAccount_0700 timeout'); + if (flag == true) { + expect().assertFail(); + console.debug('ACTS_StartServiceAbilityWithAccount_0700 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0900 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist), + * call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0900', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 6; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0900 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0900 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0900 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0900 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0900start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_1100 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists, call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_1100', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 7; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>1100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_1100 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_1100 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_1100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>1100start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_1200 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist), + * call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_1200', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 8; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>1200 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_1200 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_1200 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_1200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>1200start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_ConnectServiceAbilityWithAccount_0100 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user is equal to the current user and the user's task list exists + */ + it('ACTS_ConnectServiceAbilityWithAccount_0100', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 9; + + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0100 ConnectServiceAbility connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + setTimeout(() => { + done() + }, 1000) + } + + function timeout() { + console.debug('in ACTS_ConnectServiceAbilityWithAccount_0100 timeout'); + if (flag == true) { + expect().assertFail(); + console.debug('ACTS_ConnectServiceAbilityWithAccount_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_ConnectServiceAbilityWithAccount_0300 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user does not have a task list (the user does not exist) + */ + it('ACTS_ConnectServiceAbilityWithAccount_0300', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 10; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectServiceAbilityWithAccount_0300 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectServiceAbilityWithAccount_0300 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_ConnectServiceAbilityWithAccount_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0300 ConnectServiceAbility connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + }) +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ff5edb425dba3b891b8c9be8ecdd720380e6792 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityTest from './Ability.test.ets' + + +export default function testsuite(context) { + + console.debug("====>in list.test====>"); + abilityTest(context) + +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/module.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9c126792232352538eccbf0e50ad039ffee63058 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/module.json @@ -0,0 +1,131 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsspecifieduseractionextensionzerotest.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + }, + { + "name": "com.example.actsspecifieduseractionextensionzerotest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + "name": "com.example.actsspecifieduseractionextensionzerotest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + }, + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + } + ], + + "requestPermissions": [ + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS", + "reason": "ceshi" + }, + { + "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", + "reason": "ceshi" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", + "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.INSTALL_BUNDLE", + "reason":"need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.MANAGE_MISSIONS", + "reason":"need use ohos.permission.MANAGE_MISSIONS" + }, + { + "name":"ohos.permission.GET_RUNNING_INFO", + "reason":"need use ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.CLEAN_APPLICATION_DATA", + "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + } + ] + } +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..376647878b379044fa3300dfa4662c98a4c3efbc --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsContextTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..96b478210df9884592229ae2db6f6bb7f86c14f4 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6 Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_100/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/app.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..ed83806652cf16428f867cec533b239e9b78b05c --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsspecifieduseractionextensiononetest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 8, + "targetAPIVersion": 8, + "car": { + "apiCompatibleVersion": 8, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0d3507c0d180557b94bc5f0071ba146b4909fe51 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/media/app_icon.png b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/AppScope/resources/base/media/app_icon.png differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/BUILD.gn b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e15f6fb9d9a79c0726b9ac255abd17af5992cd72 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSpecifiedUserActionextensiononeTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actsspecifieduseractionextensiononetest_js_assets", + ":actsspecifieduseractionextensiononetest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsSpecifiedUserActionextensiononeTest" +} + +ohos_app_scope("actsspecifieduseractionextensiononetest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsspecifieduseractionextensiononetest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsspecifieduseractionextensiononetest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsspecifieduseractionextensiononetest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/Test.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..69c870be2c8ae8de4cde76c5c86767d4dc201cf4 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/Test.json @@ -0,0 +1,67 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsspecifieduseractionextensiononetest", + "shell-timeout": "300000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm create -n 102 -t normal", + "acm switch -i 101" + ], + "teardown-command":[ + "acm delete -i 101", + "acm delete -i 102" + ] + }, + { + "test-file-name": [ + "ActsSpecifiedUserActionextensiononeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionextensiononeTest.hap->/system/app/ActsSpecifiedUserActionextensiononeTest.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 100" + ] + }, + + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionextensionZeroTest.hap->/system/app/ActsSpecifiedUserActionextensionZeroTest.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 101" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 644 /data/*.hap" + ] + } + ] +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..77b702155893ee17996bb4cd08a54c708c6776c5 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate") + globalThis.stageContext = this.context; + globalThis.startnum = 0 + console.log("MyAbilityStage finish") + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9110ed3e98f20b7fcf704bf671c9403c7ca101e --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate"); + globalThis.abilityWant = want; + globalThis.abilityContext = this.context + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility onDestroy"); + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility onWindowStageCreate"); + windowStage.setUIContent(this.context, "pages/index/index", null); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy"); + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility onForeground"); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground"); + } +}; diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b8511f036e7dd8c50aa1b072e1f7789643aae2f --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,58 @@ +/* + * 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 Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonevent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); + console.debug("====>close this context====>") + globalThis.ability2Context.terminateSelf(); +} + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility2 onCreate") + + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + globalThis.ability2Context = this.context + windowStage.setUIContent(this.context, "pages/index", null) + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..cdb745d7cf1c5a1da64b5c08f8c3698298923a38 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,125 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import rpc from '@ohos.rpc'; +class Stub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + // process client's request + onRemoteRequest(code, data, reply, option) { + reply.writeNoException(); + reply.writeString("success"); + return true; + } +} +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility onCreate'); + } + onDestory(){ + console.log('ServiceAbility onDestory'); + } + onRequest(want,startId) { + console.log('ServiceAbility onRequest'); + } + + onConnect(want) { + console.log('ServiceAbility onConnect'); + console.log('globalThis.startnum is ' + globalThis.startnum); + + switch (globalThis.startnum) { + case 1: + console.log('ServiceAbility case 1'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.MainAbility2' + },100, { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0200 ====>success!") + }) + console.debug("====>case 1 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensiononetest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + break; + + case 2: + console.log('ServiceAbility case 2'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + }, globalThis.ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0800====>success!"+ JSON.stringify(data)) + }) + console.debug("====>case 3 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensiononetest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + + case 3: + console.log('ServiceAbility case 3'); + this.context.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensionzerotest', + abilityName: 'com.example.actsspecifieduseractionextensionzerotest.ServiceAbility2' + }, globalThis.ACCOUNT_ID100) + console.debug("====>case 5 end====>"); + var myStub = new Stub("com.example.actsspecifieduseractionextensiononetest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + break; + case 4: + console.log('ServiceAbility case 4'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility2' + },101,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_1000====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_1000====>sunccess!"+ JSON.stringify(data)) + })) + break; + case 5: + console.log('ServiceAbility case 5'); + this.context.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility2' + }, globalThis.ACCOUNT_ID101,((err, data) => { + console.log("====>end ACTS_StartServiceAbilityWithAccount_0400====>fail!!!"+ JSON.stringify(err)) + console.log("====>end ACTS_StartServiceAbilityWithAccount_0400====>sunccess!"+ JSON.stringify(data)) + })) + break; + default: + console.log("====> ServiceAbility end default =====>") + break; + } + } + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/service.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..383f9f0ebefc00d5761c83f88fcd1ba6c9500cd1 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility/service.ts @@ -0,0 +1,11 @@ +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1a52e61124b2ff22256f1fd48dbdf3ec98c189b --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,49 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonevent" + +export default class ServiceAbility2 extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility2 onCreate'); + globalThis.abilityWant = want; + } + + onDestory(){ + console.log('ServiceAbility2 onDestory'); + } + + onRequest(want,startId) { + console.log('ServiceAbility2 onRequest'); + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { + console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") + this.context.terminateSelf(); + console.log("====> terminateSelf End=====>") + }); + } + + onConnect(want) { + console.log('ServiceAbility2 onConnect'); + } + + onDisconnect(want) { + console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility2 onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/service.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..383f9f0ebefc00d5761c83f88fcd1ba6c9500cd1 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/ServiceAbility2/service.ts @@ -0,0 +1,11 @@ +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c7af41137cd69406214fbe1b42f3261fea4c4aa8 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file'; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/second/second.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c768edb999b1b54fef3268922817734b1f1c954 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/Ability.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7dc02b5b5e962babf011815ee2abfd5e53b3631d --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,458 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import commonEvent from '@ohos.commonevent' +import osaccount from '@ohos.account.osAccount' + + +var ACTS_ABILITYCONTEX = { + events: ["ABILITYCONTEX_Start_CommonEvent"] +}; + +const START_ABILITY_TIMEOUT = 3000; +console.debug("====>in Ability.test====>"); + +export default function abilityTest(abilityContext) { + console.debug("====>in ACTS_InterfaceMultiUsers====>"); + describe('ACTS_StartService', function () { + beforeAll(function(done) { + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ + console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); + globalThis.ACCOUNT_ID100 = data1[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ + console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); + globalThis.ACCOUNT_ID101 = data2[0]; + osAccountManager.activateOsAccount(102, (err)=>{ + console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); + osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ + console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); + globalThis.ACCOUNT_ID102 = data3[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + done(); + }) + }) + }) + }) + },3000) + }) + }) + },3000) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0200 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists, call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0200', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 1; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0200 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0200 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0200start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0800 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists, call Promise + */ + it('ACTS_StartServiceAbilityWithAccount_0800', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 2; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + done(); + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0800 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0800 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0800 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0800start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_ConnectServiceAbilityWithAccount_0200 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * the specified user is not equal to the current user, + * and the user's task list exists + */ + it('ACTS_ConnectServiceAbilityWithAccount_0200', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 3; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect().assertFail(); + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(false); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>ACTS_ConnectServiceAbilityWithAccount_0200 disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>ACTS_ConnectServiceAbilityWithAccount_0200 in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_ConnectServiceAbilityWithAccount_0200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('ACTS_ConnectServiceAbilityWithAccount_0200 onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 0200start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>ACTS_ConnectServiceAbilityWithAccount_0200 number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_1000 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user is equal to the current user, + * and the user's task list exists, call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_1000', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 4; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_1000 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_1000 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_1000 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>1000start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + + /* + * @tc.number : ACTS_StartServiceAbilityWithAccount_0400 + * @tc.name : In multi-user non-concurrent mode + * @tc.desc : System application, in multi-user non-concurrent mode, + * when the specified user is equal to the current user, + * and the user's task list exists, call AsyncCallback + */ + it('ACTS_StartServiceAbilityWithAccount_0400', 0, async function (done) { + let Subscriber + var flag = true + var startresult = false + globalThis.startnum = 5; + console.log('====>globalThis.startnum is====>' + globalThis.startnum); + + function SubscribeCallBack(err, data) { + expect(data.event == "ABILITYCONTEX_Start_CommonEvent").assertTrue(); + console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ABILITYCONTEX_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + abilityContext.disconnectAbility(globalThis.number).then((err) => { + console.debug("====>err is====>" + JSON.stringify(err)); + }) + console.log('====>disconnectAbility finish'); + setTimeout(() => { + done(); + }, 1000) + } + + function onConnectCallback(element, remote) { + console.log('ACTS_StartServiceAbilityWithAccount_0400 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_StartServiceAbilityWithAccount_0400 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(() => { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if (flag == true) { + console.debug('ACTS_StartServiceAbilityWithAccount_0400 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).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("====>0400start connectAbility====>"); + globalThis.number = await abilityContext.connectAbility( + { + bundleName: 'com.example.actsspecifieduseractionextensiononetest', + abilityName: 'com.example.actsspecifieduseractionextensiononetest.ServiceAbility' + }, { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback + }) + console.debug("====>number is====>" + JSON.stringify(globalThis.number)); + }) + }) + }) + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecefaf77b73ec4f9ff4bae9da238eb9431fc172b --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityTest from './Ability.test.ets' + + +export default function testsuite(context) { + + console.debug("====>in list.test====>"); + abilityTest(context) + +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/module.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..56ba946b3e9f382f6bf858c7bc3ccbf100a26cb9 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/module.json @@ -0,0 +1,131 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsspecifieduseractionextensiononetest.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + }, + { + "name": "com.example.actsspecifieduseractionextensiononetest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + "name": "com.example.actsspecifieduseractionextensiononetest.ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + }, + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsspecifieduseractionextensiononetest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + } + ], + + "requestPermissions": [ + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS", + "reason": "ceshi" + }, + { + "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", + "reason": "ceshi" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", + "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.INSTALL_BUNDLE", + "reason":"need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.MANAGE_MISSIONS", + "reason":"need use ohos.permission.MANAGE_MISSIONS" + }, + { + "name":"ohos.permission.GET_RUNNING_INFO", + "reason":"need use ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.CLEAN_APPLICATION_DATA", + "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + } + ] + } +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..376647878b379044fa3300dfa4662c98a4c3efbc --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsContextTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..96b478210df9884592229ae2db6f6bb7f86c14f4 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6 Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserActionExtension_101/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/app.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..ed5b06c79254f2185f17329ee977b447f3b33dad --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsspecifieduseractionzerotest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 8, + "targetAPIVersion": 8, + "car": { + "apiCompatibleVersion": 8, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0d3507c0d180557b94bc5f0071ba146b4909fe51 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/media/app_icon.png b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/AppScope/resources/base/media/app_icon.png differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/BUILD.gn b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8393689f2f7effa41c8a9076d984db93306c3f19 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSpecifiedUserActionZeroTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actsspecifieduseractionzerotest_js_assets", + ":actsspecifieduseractionzerotest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsSpecifiedUserActionZeroTest" +} + +ohos_app_scope("actsspecifieduseractionzerotest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsspecifieduseractionzerotest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsspecifieduseractionzerotest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsspecifieduseractionzerotest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/Test.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..dd33d382f46e45855127780caf9573afd5dc9893 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/Test.json @@ -0,0 +1,50 @@ + +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsspecifieduseractionzerotest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsSpecifiedUserActionZeroTest.hap", + "ActsSpecifiedUserActiononeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionZeroTest.hap->/system/app/ActsSpecifiedUserActionZeroTest.hap"] + }, + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm create -n 102 -t normal", + "acm switch -i 101" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActiononeTest.hap->/system/app/ActsSpecifiedUserActiononeTest.hap"] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 100" + ], + "teardown-command":[ + "acm delete -i 101", + "acm delete -i 102" + ] + } + +] +} + diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..f85fcf92b35787bd01eb2edb753cdd6b49f1dfdd --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..dda3b5af41be69b50e122118c9b4979f28a962f8 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility/MainAbility.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 MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + 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) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..d03b8a235a71be8d1dc3404879bed68aa995f206 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,57 @@ +/* + * 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' +import commonEvent from '@ohos.commonevent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); + console.debug("====>close this context====>") + globalThis.ability2Context.terminateSelf(); +} +export default class MainAbility2 extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility2 onCreate") + + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + globalThis.ability2Context = this.context + windowStage.setUIContent(this.context, "pages/index", null) + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..0cbe7345494763b3f6fac1f2227cf2a96278483f --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,66 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonevent" +import rpc from '@ohos.rpc'; +class Stub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + // process client's request + onRemoteRequest(code, data, reply, option) { + reply.writeNoException(); + reply.writeString("success"); + return true; + } +} +export default class ServiceAbility2 extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility2 onCreate'); + globalThis.abilityWant = want; + } + + onDestory(){ + console.log('ServiceAbility2 onDestory'); + } + + onRequest(want,startId) { + console.log('ServiceAbility2 onRequest'); + } + + onConnect(want) { + console.log('ServiceAbility2 onConnect'); + if (want.action == 'StartAbilityPromise') { + console.log('stub StartAbilityPromise OnConnect start '); + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { + console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") + console.log("====> StartAbilityPromise End=====>") + }); + + var myStub = new Stub("com.example.actsspecifieduseractionzerotest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + } + } + + onDisconnect(want) { + console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility2 onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/service.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..b4e93f63e685c503c43c7e9ba6a88c3ba155fcfa --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/ServiceAbility2/service.ts @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..85c2511e8ff64181a4aa29ff445e2f506e53b159 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,49 @@ +/* + * 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 file from '@system.file'; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/second/second.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c768edb999b1b54fef3268922817734b1f1c954 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3aa7c14456fb97e151b01733fb093df5d09ec3be --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,22 @@ +/* + * 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 abilityTest from './abilityTest.ets' + + +export default function testsuite(context) { + + abilityTest(context) + +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/abilityTest.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/abilityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..caea5b06e08c276e545e47c776bc396296eebadc --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/ets/test/abilityTest.ets @@ -0,0 +1,935 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import commonEvent from '@ohos.commonEvent'; +import osaccount from '@ohos.account.osAccount' + +var ACTS_ABILITYCONTEX = { + events: ["ABILITYCONTEX_Start_CommonEvent"] +}; +var ACCOUNT_ID100; +var ACCOUNT_ID101; +var ACCOUNT_ID102; + +const START_ABILITY_TIMEOUT = 3000; +export default function abilityTest(abilityContext) { + describe('ACTS_AbilityContext', function () { + beforeAll(function(done) { + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ + console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); + ACCOUNT_ID100 = data1[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ + console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); + ACCOUNT_ID101 = data2[0]; + osAccountManager.activateOsAccount(102, (err)=>{ + console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); + osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ + console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); + ACCOUNT_ID102 = data3[0]; + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + done(); + }) + }) + }) + }) + },3000) + }) + }) + },3000) + }) + }) + + + /* + * @tc.number: ACTS_StartStandardAbilityWithAccount_0100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, + * call the AbilityContext::startAbilityWithAccount interface of + * Promise (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0100', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0100====>start") + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>ACTS_StartStandardAbilityWithAccount_0100 UnSubscribeCallback====>"); + setTimeout(function(){ + done(); + },2000) + } + + function timeout() { + if(flag == false) { + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityWithAccount_0100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID100, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0100====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0300 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), + * call the AbilityContext::startAbilityWithAccount interface of + * Promise (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0300', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0300 ====> start") + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0300 ====> timeout'); + done(); + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility12' + },ACCOUNT_ID102, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0300====>success!"+ JSON.stringify(data)) + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0500 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the AbilityContext::startAbilityWithAccount interface + * of AsyncCallback (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0500', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0500 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0500====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0500 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + },ACCOUNT_ID101, { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0500====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0600 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call the + * AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (with the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0600', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0600 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0600====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0600 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102, { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0600====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0700 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, call the + * AbilityCont. + * ext::startAbilityWithAccount interface of Promise (without the StartOptions parameter) + * to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0700', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0700 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0700====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>ACTS_StartStandardAbilityWithAccount_0700 UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false) { + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityWithAccount_0700 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0700====>success!"+ JSON.stringify(data)) + }) + }) + + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0900 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call + * the AbilityContext::startAbilityWithAccount interface of + * Promise (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0900', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0900 ====> start") + + var Subscriber; + + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0900 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0900====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0900 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0900====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_1100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, call the + * AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_1100', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_1100 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>1100 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_1100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_1100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + },ACCOUNT_ID101, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_1100====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_1200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call the + * AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_1200', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_1200 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>1200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_1200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_1200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102,((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_1200====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, + * call the Promise's AbilityContext::startAbilityForResultWithAccount + * (with the StartOptions parameter) interface to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0100', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0100 ====> start") + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>ACTS_StartStandardAbilityForResultWithAccount_0100 UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID100, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0100====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0300 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), + * call the AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) + * interface of Promise to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0300', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0300 ====> start") + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0300 ====> timeout'); + done(); + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0300====>success!"+ JSON.stringify(data)) + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0500 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, call the + * AsyncCallback's AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) + * interface to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0500', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0500 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0500====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0500 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID101, + { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0500 === success!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0600 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call the + * AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) interface of + * AsyncCallback to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0600', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0600 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0600====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0600 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + }, ACCOUNT_ID102, + { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0600 === success!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0700 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, + * call the Promise's AbilityContext::startAbilityForResultWithAccount + * (without the StartOptions parameter) interface to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0700', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0700 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0700====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false) + { + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0700 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0700====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0900 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), call the + * AbilityContext::startAbilityForResultWithAccount (no StartOptions parameter) interface of + * Promise to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0900', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0900 ====> start") + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0900 ====> timeout'); + done(); + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID102).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0900====>success!"+ JSON.stringify(data)) + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_1100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the AsyncCallback's + * AbilityContext::startAbilityForResultWithAccount (without the StartOptions parameter) interface + * to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_1100', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1100 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>1100 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_1100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_1100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID101, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1100 === success!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_1200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), + * call the AbilityContext::startAbilityForResultWithAccount (no StartOptions parameter) + * interface of AsyncCallback to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_1200', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1200 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>1200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_1200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + }, ACCOUNT_ID102, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1200 === success!" + JSON.stringify(data)) + })) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_1200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /** + * @tc.number: ACTS_ConnectStandardAbilityWithAccount_0100 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is equal to the current user and the user's task list exists, + * call the AbilityContext::connectAbilityWithAccount interface to connect to Ability. + */ + it('ACTS_ConnectStandardAbilityWithAccount_0100', 0, async function (done) { + console.log("ACTS_ConnectStandardAbilityWithAccount_0100====>start") + var Subscriber; + var flag = true; + var number = 0; + + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectStandardAbilityWithAccount_0100 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectStandardAbilityWithAccount_0100 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>WithAccount 0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + abilityContext.disconnectAbility(number).then((err)=>{ + console.debug("====>err is====>" + JSON.stringify(err)); + }) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_ConnectStandardAbilityWithAccount_0100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>ACTS_ConnectStandardAbilityWithAccount_0100 UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false) { + expect().assertFail(); + console.debug('ACTS_ConnectStandardAbilityWithAccount_0100 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start connectAbilityWithAccount====>"); + number = await abilityContext.connectAbilityWithAccount({ + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + }, ACCOUNT_ID100,{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + }) + + /** + * @tc.number: ACTS_ConnectStandardAbilityWithAccount_0300 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user does not have a task list (the user does not exist), + * call the AbilityContext::connectAbilityWithAccount interface to connect the Ability. + */ + it('ACTS_ConnectStandardAbilityWithAccount_0300', 0, async function (done) { + console.log("ACTS_ConnectStandardAbilityWithAccount_0300 ====> start") + var Subscriber; + var flag = true; + var number = 0; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>WithAccount 0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + abilityContext.disconnectAbility(number).then((err)=>{ + console.debug("====>err is====>" + JSON.stringify(err)); + }) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectStandardAbilityWithAccount_0300 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectStandardAbilityWithAccount_0300 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_ConnectStandardAbilityWithAccount_0300====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start connectAbilityWithAccount====>"); + number = await abilityContext.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + },ACCOUNT_ID102 ,{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0300 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/module.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d6278a9b4360ea4445bcec8dbac16a5234330935 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/module.json @@ -0,0 +1,122 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsspecifieduseractionzerotest.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + }, + { + "name": "com.example.actsspecifieduseractionzerotest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsspecifieduseractionzerotest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + } + ], + + "requestPermissions": [ + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS", + "reason": "ceshi" + }, + { + "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", + "reason": "ceshi" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", + "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.INSTALL_BUNDLE", + "reason":"need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.MANAGE_MISSIONS", + "reason":"need use ohos.permission.MANAGE_MISSIONS" + }, + { + "name":"ohos.permission.GET_RUNNING_INFO", + "reason":"need use ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.CLEAN_APPLICATION_DATA", + "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + } + ] + } +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..376647878b379044fa3300dfa4662c98a4c3efbc --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsContextTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..96b478210df9884592229ae2db6f6bb7f86c14f4 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6 Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_100/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/app.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c828e9ea13ce4521ee8fee589fa097bd2562cd28 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsspecifieduseractiononetest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon" : "$media:icon", + "label" : "$string:app_name", + "description" : "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 8, + "targetAPIVersion": 8, + "car": { + "apiCompatibleVersion": 8, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0d3507c0d180557b94bc5f0071ba146b4909fe51 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ohosProject" + } + ] +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/media/app_icon.png b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/AppScope/resources/base/media/app_icon.png differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/BUILD.gn b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0c9fd928106433015ea6bf82d1e97a7dfec81658 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSpecifiedUserActiononeTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actsspecifieduseractiononetest_js_assets", + ":actsspecifieduseractiononetest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsSpecifiedUserActiononeTest" +} + +ohos_app_scope("actsspecifieduseractiononetest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsspecifieduseractiononetest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsspecifieduseractiononetest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsspecifieduseractiononetest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/Test.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5f76cadc76d94d80dcfd69f5ed322130eadbc98c --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/Test.json @@ -0,0 +1,63 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "com.example.actsspecifieduseractiononetest", + "shell-timeout": "300000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "acm create -n 101 -t normal", + "acm create -n 102 -t normal", + "acm switch -i 101" + ] + }, + { + "test-file-name": [ + "ActsSpecifiedUserActiononeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount" + ] + }, + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActiononeTest.hap->/system/app/ActsSpecifiedUserActiononeTest.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 100" + ] + }, + + { + "type": "PushKit", + "push": [ + "ActsSpecifiedUserActionZeroTest.hap->/system/app/ActsSpecifiedUserActionZeroTest.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "acm switch -i 101" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 644 /data/*.hap" + ] + } + ] +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/Application/AbilityStage.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1c5ee1bb927e65a011b199387cf07e6611773b8 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility/MainAbility.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..dda3b5af41be69b50e122118c9b4979f28a962f8 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility/MainAbility.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 MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + 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) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility2/MainAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..0935bca48e44c58c8453102b9c05874cc0150531 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,57 @@ +/* + * 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' +import commonEvent from '@ohos.commonevent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_STAWA_CommonEvent====>"); + console.debug("====>close this context====>") + globalThis.ability2Context.terminateSelf(); +} + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility2 onCreate") + + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility2 onWindowStageCreate") + globalThis.ability2Context = this.context + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent", PublishCallBackOne); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility onBackground") + } +}; diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..ffdaa817467d3076ed3c80771ad3d7c3470d310a --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/ServiceAbility2.ts @@ -0,0 +1,68 @@ +/* + * 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonevent" +import rpc from '@ohos.rpc'; +class Stub extends rpc.RemoteObject { + constructor(des) { + super(des); + } + // process client's request + onRemoteRequest(code, data, reply, option) { + reply.writeNoException(); + reply.writeString("success"); + return true; + } +} +export default class ServiceAbility2 extends ServiceExtensionAbility { + onCreate(want) { + console.log('ServiceAbility2 onCreate'); + globalThis.abilityWant = want; + } + + onDestory(){ + console.log('ServiceAbility2 onDestory'); + } + + onRequest(want,startId) { + console.log('ServiceAbility2 onRequest'); + } + + onConnect(want) { + let extensionContext = this.context + console.log('ServiceAbility2 onConnect'); + if (want.action == 'StartAbilityPromise') { + console.log('stub StartAbilityPromise OnConnect start '); + commonEvent.publish("ABILITYCONTEX_Start_CommonEvent",() => { + console.log("publish Publish ABILITYCONTEX_Start_CommonEvent callback") + extensionContext.terminateSelf(); + console.log("====> StartAbilityPromise End=====>") + }); + + var myStub = new Stub("com.example.actsspecifieduseractiononetest.MainAbility"); + console.log('ThirdAbility onConnect before return:') + return myStub; + } + } + + onDisconnect(want) { + console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility2 onDestroy'); + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/service.ts b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..91a83dbc24c50064a2031ddf77606699a059fac9 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/ServiceAbility2/service.ts @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/index/index.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..85c2511e8ff64181a4aa29ff445e2f506e53b159 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,49 @@ +/* + * 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 file from '@system.file'; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" +import testsuite from "../../test/List.test.ets" +@Entry +@Component +struct Index { + aboutToAppear() { + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + console.info("subscribeEvent run !!!!") + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + 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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/second/second.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c768edb999b1b54fef3268922817734b1f1c954 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/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/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/List.test.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..53cc0398619d5d572e4dc1ed0cff44f75c2aa040 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,22 @@ +/* + * 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 abilityTest from './abilityTest.ets' + + +export default function testsuite(context) { + + abilityTest(context) + +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/abilityTest.ets b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/abilityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..506fdcc1cfdbcef20efffd3ee98dcd63ddde7e5d --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/ets/test/abilityTest.ets @@ -0,0 +1,540 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import commonEvent from '@ohos.commonEvent'; +import osaccount from '@ohos.account.osAccount' + +var ACTS_ABILITYCONTEX = { + events: ["ABILITYCONTEX_Start_CommonEvent"] +}; +var ACCOUNT_ID100; +var ACCOUNT_ID101; +var ACCOUNT_ID102; + +const START_ABILITY_TIMEOUT = 3000; +export default function abilityTest(abilityContext) { + describe('ACTS_AbilityContext', function () { + beforeAll(function(done) { + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.activateOsAccount(100, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data1)=>{ + console.debug("====>getOsAccountLocalIdFromProcess100" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess100" + " data:" + JSON.stringify(data1)); + ACCOUNT_ID100 = data1[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 101 err:" + JSON.stringify(err)); + setTimeout(()=>{ + osAccountManager.queryActivatedOsAccountIds((err,data2)=>{ + console.debug("====>getOsAccountLocalIdFromProcess101" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess101" + " data:" + JSON.stringify(data2)); + ACCOUNT_ID101 = data2[0]; + osAccountManager.activateOsAccount(102, (err)=>{ + console.debug("====>activateOsAccount localId: 102 err:" + JSON.stringify(err)); + osAccountManager.queryActivatedOsAccountIds((err,data3)=>{ + console.debug("====>getOsAccountLocalIdFromProcess102" + " err:" + JSON.stringify(err)); + console.debug("====>getOsAccountLocalIdFromProcess102" + " data:" + JSON.stringify(data3)); + ACCOUNT_ID102 = data3[0]; + osAccountManager.activateOsAccount(101, (err)=>{ + console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err)); + done(); + }) + }) + }) + }) + },3000) + }) + }) + },3000) + }) + }) + + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the Promise's AbilityContext::startAbilityWithAccount + * interface (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0200', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0200====>start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID100, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0200====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0400 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, + * call the AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (with the StartOptions parameter) to start Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0400', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0400 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0400====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityWithAccount_0400 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + done(); + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + },ACCOUNT_ID101, + { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0400====>success!!!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_0800 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the Promise's AbilityContext::startAbilityWithAccount + * interface (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_0800', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_0800 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_0800====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityWithAccount_0800 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + },ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_0800====>success!"+ JSON.stringify(data)) + }) + }) + + + /** + * @tc.number: ACTS_StartStandardAbilityWithAccount_1000 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, call the + * AbilityContext::startAbilityWithAccount interface of + * AsyncCallback (without the StartOptions parameter) to start the Ability. + */ + it('ACTS_StartStandardAbilityWithAccount_1000', 0, async function (done) { + console.log("ACTS_StartStandardAbilityWithAccount_1000 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityWithAccount_1000====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityWithAccount_1000 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbility====>"); + await abilityContext.startAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + },ACCOUNT_ID101, ((err, data) => { + console.log("====>end ACTS_StartStandardAbilityWithAccount_1000====>success!!!" + JSON.stringify(data)) + })) + }) + + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, call the + * Promise's AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) + * interface to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0200', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0200 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + }, ACCOUNT_ID100, + { + windowMode: 2, + displayId: 1 + }).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0200====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0400 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: When the specified user is equal to the current user and the user's task list exists, call the + * AsyncCallback's AbilityContext::startAbilityForResultWithAccount (with the StartOptions parameter) + * interface to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0400', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0400 ====> start") + + var Subscriber; + var flag = false; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0400====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0400 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID101, + { + windowMode: 2, + displayId: 1 + }, ((err, data) => { + console.log("StartStandardAbilityForResultWithAccount_0400 === success!" + JSON.stringify(data)) + })) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_0800 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the Promise's + * AbilityContext::startAbilityForResultWithAccount (without the StartOptions parameter) interface + * to start Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_0800', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_0800 ====> start") + + var Subscriber; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_0800====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_StartStandardAbilityForResultWithAccount_0800 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.MainAbility2' + }, ACCOUNT_ID100).then((data) => { + console.log("====>end ACTS_StartStandardAbilityForResultWithAccount_0800====>success!"+ JSON.stringify(data)) + }) + }) + + /** + * @tc.number: ACTS_StartStandardAbilityForResultWithAccount_1000 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the AsyncCallback's + * AbilityContext::startAbilityForResultWithAccount (without the StartOptions parameter) + * interface to start the Ability. + */ + it('ACTS_StartStandardAbilityForResultWithAccount_1000', 0, async function (done) { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1000 ====> start") + var flag = false; + var Subscriber; + + function SubscribeCallBack(err, data) { + flag = true; + expect(data.event).assertEqual("ABILITYCONTEX_Start_CommonEvent"); + console.debug("====>1000 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_StartStandardAbilityForResultWithAccount_1000====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + if(flag == false){ + expect().assertFail(); + console.debug('ACTS_StartStandardAbilityForResultWithAccount_1000 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + + } + } + + + setTimeout(timeout, START_ABILITY_TIMEOUT); + console.debug("====>start startAbilityForResult====>"); + await abilityContext.startAbilityForResultWithAccount( + { + bundleName: 'com.example.actsspecifieduseractiononetest', + abilityName: 'com.example.actsspecifieduseractiononetest.MainAbility2' + }, ACCOUNT_ID101, ((err, data) => { + console.log("ACTS_StartStandardAbilityForResultWithAccount_1000 === success!" + JSON.stringify(data)) + })) + }) + + + /** + * @tc.number: ACTS_ConnectStandardAbilityWithAccount_0200 + * @tc.name: Provides a system interface to specify user startup components (standard page). + * @tc.desc: If the specified user is not equal to the current user and the user's task list exists, + * call the AbilityContext::connectAbilityWithAccount interface to connect the Ability. + */ + it('ACTS_ConnectStandardAbilityWithAccount_0200', 0, async function (done) { + console.log("ACTS_ConnectStandardAbilityWithAccount_0200 ====> start") + var Subscriber; + var flag = true; + var number = 0; + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.debug("====>WithAccount 0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + abilityContext.disconnectAbility(number).then((err)=>{ + console.debug("====>err is====>" + JSON.stringify(err)); + }) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function onConnectCallback(element, remote) { + console.log('ACTS_ConnectStandardAbilityWithAccount_0200 onConnectCallback====> element=' + JSON.stringify(element)); + console.log('ACTS_ConnectStandardAbilityWithAccount_0200 onConnectCallback====> remote=' + JSON.stringify(remote)); + setTimeout(()=> { + console.log('====>in timeout'); + console.debug("====>flag is====>" + JSON.stringify(flag)); + if(flag == true) { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }, 1000); + } + function onDisconnectCallback(element) { + console.log('onDisconnectCallback====> element=' + JSON.stringify(element)); + } + + function onFailedCallback(code) { + console.log('onFailedCallback====> code=' + JSON.stringify(code)) + } + + commonEvent.createSubscriber(ACTS_ABILITYCONTEX).then(async (data) => { + console.debug("ACTS_ConnectStandardAbilityWithAccount_0200====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start connectAbilityWithAccount====>"); + number = await abilityContext.connectAbilityWithAccount( + { + bundleName: 'com.example.actsspecifieduseractionzerotest', + abilityName: 'com.example.actsspecifieduseractionzerotest.ServiceAbility2', + action: "StartAbilityPromise" + },ACCOUNT_ID102 ,{ + onConnect:onConnectCallback, + onDisconnect:onDisconnectCallback, + onFailed: onFailedCallback + }) + }) + + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback====>"); + done(); + } + + function timeout() { + console.debug('ACTS_ConnectStandardAbilityWithAccount_0200 ====> timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/module.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9fb5911c1b183e7c33828ef0087b619cbfda5ebd --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/module.json @@ -0,0 +1,110 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.example.actsspecifieduseractiononetest.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + }, + { + "name": "com.example.actsspecifieduseractiononetest.MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts", + "name": "com.example.actsspecifieduseractiononetest.ServiceAbility2", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:phone_entry_main", + "type": "service", + "visible": true + } + ], + + "requestPermissions": [ + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.INSTALL_BUNDLE", + "reason":"need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.MANAGE_MISSIONS", + "reason":"need use ohos.permission.MANAGE_MISSIONS" + }, + { + "name":"ohos.permission.GET_RUNNING_INFO", + "reason":"need use ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", + "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.CLEAN_APPLICATION_DATA", + "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + } + ] + } +} diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..376647878b379044fa3300dfa4662c98a4c3efbc --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsContextTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/profile/main_pages.json b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..96b478210df9884592229ae2db6f6bb7f86c14f4 --- /dev/null +++ b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6 Binary files /dev/null and b/aafwk/aafwk_standard/actsstartcomponenttest/SpecifiedUserAction_101/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn index 2511df530d3da7990748e98358edeccaf919fd5b..1e742fed0e5369d14b5f98dcbdbf61fb3ebe3761 100755 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn +++ b/aafwk/aafwk_standard/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn @@ -37,4 +37,4 @@ ohos_resources("actsamsusersextensionsystemtest_resources") { sources = [ "entry/src/main/resources" ] deps = [ ":actsamsusersextensionsystemtest_app_profile" ] hap_profile = "entry/src/main/module.json" -} \ No newline at end of file +} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn index 3e3f4abfae48a994ef87a712616c38d0457dc7c0..b3dd9ae9bfabcba69c160f9853732a22e11c836c 100755 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn +++ b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppA/BUILD.gn @@ -37,4 +37,4 @@ ohos_resources("actsamsuserskillprocessappa_resources") { sources = [ "entry/src/main/resources" ] deps = [ ":actsamsuserskillprocessappa_app_profile" ] hap_profile = "entry/src/main/module.json" -} \ No newline at end of file +} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn index c5c1be1a34c97e6a62b25327f5bf4352af7cc5c6..9e4027b42a84f1196a629e190d5d3ae474a94382 100755 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn +++ b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppB/BUILD.gn @@ -37,4 +37,4 @@ ohos_resources("actsamsuserskillprocessappb_resources") { sources = [ "entry/src/main/resources" ] deps = [ ":actsamsuserskillprocessappb_app_profile" ] hap_profile = "entry/src/main/module.json" -} \ No newline at end of file +} diff --git a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn index 937b9574e78d0b58968ad26759b48d178cdf318b..9e83279c41e965d1f4e07a362cc2ef5726f2c079 100755 --- a/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn +++ b/aafwk/aafwk_standard/actsusers/ActsAmsUsersKillProcessAppC/BUILD.gn @@ -37,4 +37,4 @@ ohos_resources("actsamsuserskillprocessappc_resources") { sources = [ "entry/src/main/resources" ] deps = [ ":actsamsuserskillprocessappc_app_profile" ] hap_profile = "entry/src/main/module.json" -} \ No newline at end of file +} diff --git a/aafwk/aafwk_standard/actsusers/BUILD.gn b/aafwk/aafwk_standard/actsusers/BUILD.gn index ff546c9ad87813f277e45203652fd101fc274904..88ebe65f3a549074bc35da6a9e0a1b6557f99a50 100755 --- a/aafwk/aafwk_standard/actsusers/BUILD.gn +++ b/aafwk/aafwk_standard/actsusers/BUILD.gn @@ -17,16 +17,15 @@ group("actsusers") { testonly = true if (is_standard_system) { deps = [ - "actsconnectabilitysystemabilitytest:ActsConnectAbilitySystemAbilityTest", - "actsextensionconnectabilitytest:ActsExtensionConnectAbilityTest", - "actsserviceabilityrelytest:actsServiceAbilityRelyHap", - "ActsAmsUsersSystemTest:ActsAmsUsersSystemTest", + "ActsAmsUsersApi7AppA:ActsAmsUsersApi7AppA", "ActsAmsUsersExtensionSystemTest:ActsAmsUsersExtensionSystemTest", "ActsAmsUsersKillProcessAppA:ActsAmsUsersKillProcessAppA", "ActsAmsUsersKillProcessAppB:ActsAmsUsersKillProcessAppB", "ActsAmsUsersKillProcessAppC:ActsAmsUsersKillProcessAppC", - "ActsAmsUsersApi7AppA:ActsAmsUsersApi7AppA" + "ActsAmsUsersSystemTest:ActsAmsUsersSystemTest", + "actsconnectabilitysystemabilitytest:ActsConnectAbilitySystemAbilityTest", + "actsextensionconnectabilitytest:ActsExtensionConnectAbilityTest", + "actsserviceabilityrelytest:actsServiceAbilityRelyHap", ] } } - diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn index 66761d33cd4c797c21acb8f62c2ad2233d4dde9e..ee3d4bb15b5c621c33284b16330a95eaae9e777e 100755 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn +++ b/aafwk/aafwk_standard/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/BUILD.gn @@ -37,4 +37,4 @@ ohos_resources("actskillprocesswithaccountrelyhap_resources") { sources = [ "entry/src/main/resources" ] deps = [ ":actskillprocesswithaccountrelyhap_app_profile" ] hap_profile = "entry/src/main/module.json" -} \ No newline at end of file +} diff --git a/aafwk/aafwk_standard/killprocesswithaccountstage/BUILD.gn b/aafwk/aafwk_standard/killprocesswithaccountstage/BUILD.gn index 0f33811bbf4648fa4426741d079282dc917203f6..477f57284154b22a22657b27f932ce1162c73b6a 100755 --- a/aafwk/aafwk_standard/killprocesswithaccountstage/BUILD.gn +++ b/aafwk/aafwk_standard/killprocesswithaccountstage/BUILD.gn @@ -17,8 +17,8 @@ group("killprocesswithaccountstage") { testonly = true if (is_standard_system) { deps = [ - "ActsKillProcessWithAccountTest:ActsKillProcessWithAccountTest", "ActsKillProcessWithAccountRelyHap:ActsKillProcessWithAccountRelyHap", + "ActsKillProcessWithAccountTest:ActsKillProcessWithAccountTest", ] } }