diff --git a/ability/ability_runtime/BUILD.gn b/ability/ability_runtime/BUILD.gn index 1bc39080f2ec833ad3cf253ee814248323380c5d..145241a631b793b6cec3608c0acdbd986377beb5 100644 --- a/ability/ability_runtime/BUILD.gn +++ b/ability/ability_runtime/BUILD.gn @@ -17,14 +17,21 @@ group("ability_runtime") { testonly = true if (is_standard_system) { deps = [ + "TestApi:Testapi", + "aacommand:aacommand", "abilitymanager:actsabilitymanagertest", + "abilitymontior:AbilityMonitorTest", "abilitymultiinstance:abilitymultiinstance", "actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest", "actsabilitylifecyclestatenew:ActsAbilityLifecycleStateNewTest", "actsabilitymanageretstest:ActsAbilityManagerEtsTest", + "actsabilityusertest:ActsAbilityuserTest", "actscalltest:actscalltest", "actsfwkdataaccessortest:dataability", + "actsqueryfunctiontest:actsqueryfunctiontest", "actsserviceabilityclienttest:serviceability", + "actsshellcommandfunctionalitytest:actsshellcommandfunctionalitytest", + "actsstartrunnertest:ActsStartRunnerTest", "actsstserviceabilityclientcase:ActsStServiceAbilityClientCaseTest", "actsusers:actsusers", "amscontextualinforquery:amscontextualinforquery", diff --git a/ability/ability_runtime/TestApi/AppScope/app.json b/ability/ability_runtime/TestApi/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..14749691aa56153bd6e609d828a38c8eae0bf37f --- /dev/null +++ b/ability/ability_runtime/TestApi/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.testapi", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/TestApi/AppScope/resources/base/element/string.json b/ability/ability_runtime/TestApi/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..959e27c287c2b08db1978f550c3a12c09e10ccd2 --- /dev/null +++ b/ability/ability_runtime/TestApi/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Testapi" + } + ] +} diff --git a/miscservices/InputMethodTest_ets/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/TestApi/AppScope/resources/base/media/app_icon.png similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/TestApi/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/TestApi/BUILD.gn b/ability/ability_runtime/TestApi/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..fee0c4675c2235a3149b013a63a3802172211842 --- /dev/null +++ b/ability/ability_runtime/TestApi/BUILD.gn @@ -0,0 +1,41 @@ +# 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("Testapi") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":testapi_js_assets", + ":testapi_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "Testapi" +} + +ohos_app_scope("testapi_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("testapi_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("testapi_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":testapi_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/TestApi/Test.json b/ability/ability_runtime/TestApi/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..6a09f32235fdb20946f73bc1acb9b450d376e047 --- /dev/null +++ b/ability/ability_runtime/TestApi/Test.json @@ -0,0 +1,21 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.testapi", + "module-name": "entry", + "shell-timeout": "600000", + "testcase-timeout":"30000" + }, + "kits": [ + { + "test-file-name": [ + "Testapi.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/TestApi/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ae1bf3ce4d07b5d5a4e8bc485d994849d55de70 --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* +* 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("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a0ae50332bd20e5eb6b91aa93b4368e8851e542 --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,53 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + globalThis.abilityWant = want; + globalThis.abilityWant.parameters.timeout = 15000; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..24098a7d7bcabe0eb28cc7b86da366d6afebe44a --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* +* 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 '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..3974f88ea665324a70cdadb17a420a11adffbd0a --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,56 @@ +/* +* 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_DoAbilityForeground_0100_Event====>"); + setTimeout(()=>{ + globalThis.abilityContext.terminateSelf(); + console.debug("====>MainAbility2 terminateSelf succese====>") + },2000) +} +export default class MainAbility2 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility2 onCreate") + globalThis.abilityContext = this.context + } + + onDestroy() { + console.log("[Demo] MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility2 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility2 onForeground") + commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne); + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility2 onBackground") + } +}; diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility2/pages/index.ets b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility2/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..24098a7d7bcabe0eb28cc7b86da366d6afebe44a --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility2/pages/index.ets @@ -0,0 +1,48 @@ +/* +* 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 '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..7ba24cd1937ed7961e1f395922ed0bc1b46141e9 --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonevent' +function PublishCallBackOne() { + console.debug("====>Publish CallBack ACTS_DoAbilityForeground_0300_Event====>"); + globalThis.abilityContext.terminateSelf().then(()=>{ + console.debug("====>MainAbility3 terminateSelf====>"); + }); +} +export default class MainAbility3 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility3 onCreate") + globalThis.abilityContext = this.context + } + + onDestroy() { + console.log("[Demo] MainAbility3 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility3 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility3 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility3 onForeground") + globalThis.abilitydelegator.getCurrentTopAbility().then((data)=>{ + globalThis.ability3 = data + console.debug("====>MainAbility getCurrentTopAbility:====>" + JSON.stringify(globalThis.ability3)); + commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne); + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility3 onBackground") + } +}; diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility3/pages/index.ets b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility3/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..24098a7d7bcabe0eb28cc7b86da366d6afebe44a --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility3/pages/index.ets @@ -0,0 +1,48 @@ +/* +* 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 '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility4/MainAbility4.ts b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility4/MainAbility4.ts new file mode 100644 index 0000000000000000000000000000000000000000..256c3752831ce26df9dac9aa3868b78780c1ee2d --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility4/MainAbility4.ts @@ -0,0 +1,54 @@ +/* +* 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 Event====>"); +} +export default class MainAbility4 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility4 onCreate") + globalThis.abilityContext = this.context + setTimeout(()=> { + commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne); + }, 500) + } + + onDestroy() { + console.log("[Demo] MainAbility4 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility4 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility4 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility4 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility4 onBackground") + } +}; diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility5/MainAbility5.ts b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility5/MainAbility5.ts new file mode 100644 index 0000000000000000000000000000000000000000..16616949622ad97c65954f272b5e8799a81bdccf --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/MainAbility5/MainAbility5.ts @@ -0,0 +1,54 @@ +/* +* 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 Event====>"); +} +export default class MainAbility5 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility5 onCreate") + globalThis.abilityContext = this.context + setTimeout(()=> { + commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne); + }, 500) + } + + onDestroy() { + console.log("[Demo] MainAbility5 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility5 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility5 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility5 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility5 onBackground") + } +}; diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/TestApi/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..0dcab2c6aff3f83f951bc972c81cd32554e6838b --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + globalThis.abilitydelegator = AbilityDelegatorRegistry.getAbilityDelegator() + console.log("getAbilityDelegator data is" + JSON.stringify(globalThis.abilitydelegator)) + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var mainAbilityName = 'MainAbility' + let lMonitor = { + abilityName: mainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, 10, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/TestApi/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d55fb10291670d788c540dc369a36dd6ae5ce94 --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/pages/index.ets @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/TestApi/entry/src/main/ets/test/Ability.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..56cbdcd7e7ba8142de8d5b1accd1fc4b8d6658b2 --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,735 @@ +/* + * 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 'hypium/index' +import commonEvent from '@ohos.commonEvent' + +var subscriberInfo_MainAbility = { + events: ["ACTS_DoAbility_Event"] +}; +var mainability +const START_ABILITY_TIMEOUT = 4000; +const START_ABILITY_TIMEOUT_TWO_THOUSAND = 2000; +const START_ABILITY_TIMEOUT_THOUSAND = 1000; +export default function abilityTest() { + + describe('ActsChangeAbilityStagetest', function () { + beforeAll(async function (done) { + console.info('beforeAll called') + await globalThis.abilitydelegator.getCurrentTopAbility().then((data) => { + mainability = data + done() + }) + }) + console.log("====>in describe====>"); + + /* + * @tc.number : ACTS_DoAbilityForeground_0100 + * @tc.name : change abilitystage to foreground + * @tc.desc : Use doAbilityForeground to change the abilitystage to foreground.(callback) + */ + it('ACTS_DoAbilityForeground_0100', 0, async function (done) { + console.log("====>in ACTS_DoAbilityForeground_0100====>"); + var Subscriber + var flag = true + var ability + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + setTimeout(() => { + done(); + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + globalThis.abilitydelegator.doAbilityForeground(ability, (err, data) => { + console.log("====>ACTS_DoAbilityForeground_0100 data:====>" + JSON.stringify(data)); + expect(data).assertEqual(true); + setTimeout(() => { + var num = globalThis.abilitydelegator.getAbilityState(ability) + console.log("====>ACTS_DoAbilityForeground_0100 getAbilityState:====>" + JSON.stringify(num)); + expect(num).assertEqual(2); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }, START_ABILITY_TIMEOUT_THOUSAND) + }) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + globalThis.abilitydelegator.getCurrentTopAbility().then((data) => { + ability = data + console.log("===>SubscribeInfo is====>" + JSON.stringify(ability)); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility2' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityForeground_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + + + /* + * @tc.number : ACTS_DoAbilityForeground_0200 + * @tc.name : change abilitystage to foreground + * @tc.desc : Use doAbilityForeground to change the abilitystage to foreground.(callback) + */ + it('ACTS_DoAbilityForeground_0200', 0, async function (done) { + var ability + globalThis.abilitydelegator.getCurrentTopAbility().then((data) => { + ability = data + expect(JSON.stringify(data) == JSON.stringify(mainability)).assertTrue(); + console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(ability)); + globalThis.abilitydelegator.doAbilityForeground(ability, (err, data) => { + console.log("====>ACTS_DoAbilityForeground_0200 data:====>" + JSON.stringify(data)); + expect(data).assertEqual(true); + setTimeout(() => { + var num = globalThis.abilitydelegator.getAbilityState(ability) + console.log("====>ACTS_DoAbilityForeground_0200 getAbilityState:====>" + JSON.stringify(num)); + expect(num).assertEqual(2); + }, START_ABILITY_TIMEOUT_THOUSAND) + setTimeout(() => { + done() + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + }) + }) + }) + + + /* + * @tc.number : ACTS_DoAbilityForeground_0400 + * @tc.name : change abilitystage to foreground + * @tc.desc : Use doAbilityForeground to change the abilitystage to foreground.(promise) + */ + it('ACTS_DoAbilityForeground_0400', 0, async function (done) { + var Subscriber + var flag = true + var ability + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + setTimeout(() => { + done(); + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data)); + globalThis.abilitydelegator.doAbilityForeground(ability).then((data) => { + console.log("====>ACTS_DoAbilityForeground_0400 data:====>" + JSON.stringify(data)); + expect(data).assertEqual(true); + setTimeout(() => { + var num = globalThis.abilitydelegator.getAbilityState(ability) + console.log("====>ACTS_DoAbilityForeground_0400 getAbilityState:====>" + JSON.stringify(num)); + expect(num).assertEqual(2); + }, START_ABILITY_TIMEOUT_THOUSAND) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + globalThis.abilitydelegator.getCurrentTopAbility().then((data) => { + ability = data + console.log("====>ability data:====>" + JSON.stringify(ability)); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility2' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityForeground_0400 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_DoAbilityForeground_0500 + * @tc.name : change abilitystage to foreground + * @tc.desc : Use doAbilityForeground to change the abilitystage to foreground.(promise) + */ + it('ACTS_DoAbilityForeground_0500', 0, async function (done) { + var ability + setTimeout(() => { + globalThis.abilitydelegator.getCurrentTopAbility().then((data) => { + ability = data + console.log("====>getCurrentTopAbility data:====>" + JSON.stringify(data)); + console.log("====>getCurrentTopAbility mainability:====>" + JSON.stringify(mainability)); + expect(JSON.stringify(data) == JSON.stringify(mainability)).assertTrue(); + console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(ability)); + globalThis.abilitydelegator.doAbilityForeground(ability).then((data) => { + console.log("====>ACTS_DoAbilityForeground_0500 data:====>" + JSON.stringify(data)); + expect(data).assertEqual(true); + setTimeout(() => { + var num = globalThis.abilitydelegator.getAbilityState(ability) + console.log("====>ACTS_DoAbilityForeground_0500 getAbilityState:====>" + JSON.stringify(num)); + expect(num).assertEqual(2); + }, START_ABILITY_TIMEOUT_THOUSAND) + setTimeout(() => { + done() + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + }) + }) + }, 2000) + + }) + + /* + * @tc.number : ACTS_DoAbilityBackground_0100 + * @tc.name : change abilitystage to background + * @tc.desc : Use doAbilityBackground to change the abilitystage to background.(callback) + */ + it('ACTS_DoAbilityBackground_0100', 0, async function (done) { + var Subscriber + var flag = true + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + setTimeout(() => { + done(); + }, 5000) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + globalThis.abilitydelegator.getCurrentTopAbility().then((ability) => { + console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(ability)); + globalThis.abilitydelegator.doAbilityBackground(ability, (err, data1) => { + console.log("====>ACTS_DoAbilityBackground_0100 data:====>" + JSON.stringify(data1)); + expect(data1).assertEqual(true); + setTimeout(() => { + var num = globalThis.abilitydelegator.getAbilityState(ability) + console.log("====>ACTS_DoAbilityBackground_0100 getAbilityState:====>" + JSON.stringify(num)); + expect(num).assertEqual(3); + }, START_ABILITY_TIMEOUT_THOUSAND) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }) + }) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.getCurrentTopAbility().then((data) => { + console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(data)); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility2' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityBackground_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_DoAbilityBackground_0500 + * @tc.name : change abilitystage to background + * @tc.desc : Use doAbilityBackground to change the abilitystage to background.(promise) + */ + it('ACTS_DoAbilityBackground_0500', 0, async function (done) { + var Subscriber + var flag = true + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + setTimeout(() => { + done(); + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data)); + globalThis.abilitydelegator.getCurrentTopAbility().then((ability2) => { + console.log("====>getCurrentTopAbility ability2 data:====>" + JSON.stringify(ability2)); + globalThis.abilitydelegator.doAbilityBackground(ability2).then((data1) => { + console.log("====>ACTS_DoAbilityBackground_0500 data:====>" + JSON.stringify(data1)); + expect(data1).assertEqual(true); + setTimeout(() => { + var num = globalThis.abilitydelegator.getAbilityState(ability2) + console.log("====>ACTS_DoAbilityBackground_0500 getAbilityState:====>" + JSON.stringify(num)); + expect(num).assertEqual(3); + }, START_ABILITY_TIMEOUT_THOUSAND) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }) + }) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility2' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityBackground_0500 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_DoAbilityBackground_0700 + * @tc.name : change abilitystage to background + * @tc.desc : Use doAbilityBackground to change the abilitystage to background.(promise) + */ + it('ACTS_DoAbilityBackground_0700', 0, async function (done) { + var Subscriber + var flag = true + var num1 = 0 + var num2 = 0 + function UnSubscribeCallback() { + console.log("====>ACTS_DoAbilityBackground_0700 UnSubscribeCallback====>"); + flag = false + setTimeout(()=>{ + done(); + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0700 Subscribe CallBack data:====>" + JSON.stringify(data)); + globalThis.abilitydelegator.getCurrentTopAbility().then((ability2) => { + console.log("====>getCurrentTopAbility ability2 data:====>" + JSON.stringify(ability2)); + console.log("====>0700newabilityname:====>" + JSON.stringify(ability2.context.abilityInfo.name)); + globalThis.abilitydelegator.doAbilityBackground(ability2).then((data1) => { + console.log("====>doAbilityBackground data1:====>" + JSON.stringify(data1)); + expect(data1).assertEqual(true); + setTimeout(() => { + num1 = globalThis.abilitydelegator.getAbilityState(ability2) + console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState1:====>" + " " + JSON.stringify(num1)); + expect(num1).assertEqual(3); + globalThis.abilitydelegator.doAbilityForeground(ability2, (err, data) => { + console.log("====>doAbilityForeground data:====>" + JSON.stringify(data)); + expect(data).assertEqual(true); + setTimeout(() => { + num2 = globalThis.abilitydelegator.getAbilityState(ability2) + console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState2:====>" + + " " + JSON.stringify(num2)); + expect(num2).assertEqual(2); + globalThis.abilitydelegator.doAbilityBackground(ability2).then((data1) => { + console.log("====>doAbilityBackground data1:====>" + JSON.stringify(data1)); + expect(data1).assertEqual(true); + setTimeout(() => { + num1 = globalThis.abilitydelegator.getAbilityState(ability2) + console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState1:====>" + + " " + JSON.stringify(num1)); + expect(num1).assertEqual(3); + globalThis.abilitydelegator.doAbilityForeground(ability2, (err, data) => { + console.log("====>doAbilityForeground data:====>" + JSON.stringify(data)); + expect(data).assertEqual(true); + setTimeout(() => { + num2 = globalThis.abilitydelegator.getAbilityState(ability2) + console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState2:====>" + + " " + JSON.stringify(num2)); + expect(num2).assertEqual(2); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }, START_ABILITY_TIMEOUT_THOUSAND) + }) + }, START_ABILITY_TIMEOUT_THOUSAND) + }) + }, START_ABILITY_TIMEOUT_THOUSAND) + }) + }, START_ABILITY_TIMEOUT_THOUSAND) + }) + }) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility4' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityBackground_0700 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, 10000); + }) + + /* + * @tc.number : ACTS_DoAbilityBackground_0800 + * @tc.name : change abilitystage to background + * @tc.desc : Use doAbilityBackground to change the abilitystage to background failed.(promise) + */ + it('ACTS_DoAbilityBackground_0800', 0, async function (done) { + var Subscriber + var flag = true + var num1 = 0 + var num2 = 0 + function UnSubscribeCallback() { + console.log("====>ACTS_DoAbilityBackground_0800 UnSubscribeCallback====>"); + flag = false + setTimeout(()=>{ + done(); + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0800 Subscribe CallBack data:====>" + JSON.stringify(data)); + globalThis.abilitydelegator.getCurrentTopAbility().then((ability2) => { + console.log("====>getCurrentTopAbility ability2 data:====>" + JSON.stringify(ability2)); + console.log("====>0800newabilityname:====>" + JSON.stringify(ability2.context.abilityInfo.name)); + globalThis.abilitydelegator.doAbilityBackground(ability2, (err, data1) => { + console.log("====>doAbilityBackground data1:====>" + JSON.stringify(data1)); + expect(data1).assertEqual(true); + setTimeout(() => { + num1 = globalThis.abilitydelegator.getAbilityState(ability2) + console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState1:====>" + " " + JSON.stringify(num1)); + expect(num1).assertEqual(3); + globalThis.abilitydelegator.doAbilityForeground(ability2).then((data) => { + console.log("====>doAbilityForeground data:====>" + JSON.stringify(data)); + expect(data).assertEqual(true); + setTimeout(() => { + num2 = globalThis.abilitydelegator.getAbilityState(ability2) + console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState2:====>" + + " " + JSON.stringify(num2)); + expect(num2).assertEqual(2); + globalThis.abilitydelegator.doAbilityBackground(ability2, (err, data1) => { + console.log("====>doAbilityBackground data1:====>" + JSON.stringify(data1)); + expect(data1).assertEqual(true); + setTimeout(() => { + num1 = globalThis.abilitydelegator.getAbilityState(ability2) + console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState1:====>" + + " " + JSON.stringify(num1)); + expect(num1).assertEqual(3); + globalThis.abilitydelegator.doAbilityForeground(ability2).then((data) => { + console.log("====>doAbilityForeground data:====>" + JSON.stringify(data)); + expect(data).assertEqual(true); + setTimeout(() => { + num2 = globalThis.abilitydelegator.getAbilityState(ability2) + console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState2:====>" + + " " + JSON.stringify(num2)); + expect(num2).assertEqual(2); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }, START_ABILITY_TIMEOUT_THOUSAND) + }) + }, START_ABILITY_TIMEOUT_THOUSAND) + }) + }, START_ABILITY_TIMEOUT_THOUSAND) + }) + }, START_ABILITY_TIMEOUT_THOUSAND) + }) + }) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility5' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityBackground_0800 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, 10000); + }) + + /* + * @tc.number : ACTS_DoAbilityForeground_0300 + * @tc.name : change abilitystage to foreground + * @tc.desc : Use doAbilityForeground to change the abilitystage to foreground failed.(callback) + */ + it('ACTS_DoAbilityForeground_0300', 0, async function (done) { + var Subscriber + var result = null + var flag = true + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + setTimeout(() => { + done(); + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.log("====>0300 Subscribe CallBack globalThis.ability3:====>" + JSON.stringify(globalThis.ability3)); + console.log("====>0300 ability3 name:====>" + JSON.stringify(globalThis.ability3.context.abilityInfo.name)); + setTimeout(() => { + result = globalThis.abilitydelegator.doAbilityForeground(globalThis.ability3, (err, data) => { + console.log("====>ACTS_DoAbilityForeground_0300 data:====>" + JSON.stringify(data)); + expect().assertFail(); + }) + console.log("====>0300 result:====>" + JSON.stringify(result)); + expect(result).assertEqual(undefined); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }, START_ABILITY_TIMEOUT_THOUSAND) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility3' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityForeground_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_DoAbilityForeground_0600 + * @tc.name : change abilitystage to foreground + * @tc.desc : Use doAbilityForeground to change the abilitystage to foreground failed.(promise) + */ + it('ACTS_DoAbilityForeground_0600', 0, async function (done) { + var Subscriber + var flag = true + var result = null + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + setTimeout(() => { + done(); + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + setTimeout(() => { + result = globalThis.abilitydelegator.doAbilityForeground(globalThis.ability3) + console.log("====>0600 result:====>" + JSON.stringify(result)); + expect(result).assertEqual(undefined); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }, START_ABILITY_TIMEOUT_THOUSAND) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility3' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityForeground_0600 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_DoAbilityBackground_0300 + * @tc.name : change abilitystage to background + * @tc.desc : Use doAbilityBackground to change the abilitystage to background failed.(callback) + */ + it('ACTS_DoAbilityBackground_0300', 0, async function (done) { + var Subscriber + var flag = true + var result = null + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + setTimeout(() => { + done(); + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + setTimeout(() => { + result = globalThis.abilitydelegator.doAbilityBackground(globalThis.ability3, (err, data) => { + console.log("====>ACTS_DoAbilityBackground_0300 data:====>" + JSON.stringify(data)); + expect().assertFail(); + }) + console.log("====>DoAbilityBackground0300 result:====>" + JSON.stringify(result)); + expect(result).assertEqual(undefined); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }, START_ABILITY_TIMEOUT_THOUSAND) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility3' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityBackground_0300 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_DoAbilityBackground_0600 + * @tc.name : change abilitystage to background + * @tc.desc : Use doAbilityBackground to change the abilitystage to background failed.(promise) + */ + it('ACTS_DoAbilityBackground_0600', 0, async function (done) { + var Subscriber + var flag = true + var result = null + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + setTimeout(() => { + done(); + }, START_ABILITY_TIMEOUT_TWO_THOUSAND) + } + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_DoAbility_Event").assertTrue(); + console.log("====>0600 Subscribe CallBack data:====>" + JSON.stringify(data)); + setTimeout(() => { + result = globalThis.abilitydelegator.doAbilityBackground(globalThis.ability3) + console.log("====>DoAbilityBackground0600 result:====>" + JSON.stringify(result)); + expect(result).assertEqual(undefined); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + }, START_ABILITY_TIMEOUT_THOUSAND) + } + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then((SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.testapi', + abilityName: 'MainAbility3' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_DoAbilityBackground_0600 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/TestApi/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf6f241a06f8aa77442bd600ce6e870c760e88fe --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/module.json b/ability/ability_runtime/TestApi/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..7a1472e58ff341698d9813355041a0f9b2de291b --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/module.json @@ -0,0 +1,66 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label", + "visible": true + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label", + "visible": true + }, + { + "name": "MainAbility4", + "srcEntrance": "./ets/MainAbility4/MainAbility4.ts", + "description": "$string:MainAbility4_desc", + "icon": "$media:icon", + "label": "$string:MainAbility4_label" + }, + { + "name": "MainAbility5", + "srcEntrance": "./ets/MainAbility5/MainAbility5.ts", + "description": "$string:MainAbility5_desc", + "icon": "$media:icon", + "label": "$string:MainAbility5_label" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/TestApi/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/TestApi/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..671f704bdb73586893debeaa6a1afb04da8aaa51 --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/resources/base/element/string.json @@ -0,0 +1,64 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "MainAbility4_desc", + "value": "description" + }, + { + "name": "MainAbility4_label", + "value": "label" + }, + { + "name": "MainAbility5_desc", + "value": "description" + }, + { + "name": "MainAbility5_label", + "value": "label" + }, + { + "name": "app_name", + "value": "Testapi" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/miscservices/RequestTest_js/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/TestApi/entry/src/main/resources/base/media/icon.png similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/TestApi/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/TestApi/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/TestApi/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/TestApi/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/miscservices/InputMethodTest_ets/signature/openharmony_sx.p7b b/ability/ability_runtime/TestApi/signature/openharmony_sx.p7b similarity index 100% rename from miscservices/InputMethodTest_ets/signature/openharmony_sx.p7b rename to ability/ability_runtime/TestApi/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/aacommand/AACommand07/AppScope/app.json b/ability/ability_runtime/aacommand/AACommand07/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..4a84ad65ac64e239e4a1fada7fe16d9cd0bd71df --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/AppScope/app.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.example.aacommand07", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} + diff --git a/ability/ability_runtime/aacommand/AACommand07/AppScope/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommand07/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1d52c844a0fcb0026b357b5ac16d9f4d633fb133 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommand07" + } + ] +} diff --git a/miscservices/TimeTest_js/src/main/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommand07/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from miscservices/TimeTest_js/src/main/resources/base/media/icon.png rename to ability/ability_runtime/aacommand/AACommand07/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/aacommand/AACommand07/BUILD.gn b/ability/ability_runtime/aacommand/AACommand07/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2d38d0d991f5c315fd91605c9df9eb540ae9d16e --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/BUILD.gn @@ -0,0 +1,45 @@ +# 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_hap("AACommand07") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "AACommand07" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":aacommand07_js_assets", + ":aacommand07_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("aacommand07_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("aacommand07_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("aacommand07_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":aacommand07_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/aacommand/AACommand07/Test.json b/ability/ability_runtime/aacommand/AACommand07/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..c77e1f277237b3d2d2ae23da33480da6654a7c3e --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/Test.json @@ -0,0 +1,11 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.aacommand07", + "module-name": "entry_test", + "shell-timeout": "600000" + } +} + diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..6ceb0c290ae831a45143a5e2b42d4351f2fc3d7e --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * 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("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..e7e16a3bb9038acf57bcb62cb075936dd52751b3 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,48 @@ +/* + * 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) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba39ca0b8a7b5945c39305a283fa45295b384511 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * 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 '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..3401c3086d0cee5469ed98f66563eb3ce9b42629 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,56 @@ +/* + * 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 AACommand_Debugapp====>"); + console.debug("====>close this context====>====>"); +} +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/index2", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility2 onForeground") + commonEvent.publish("AACommand_Debugapp", PublishCallBackOne); + + } + + onBackground() { + // Ability has back to background + console.log("MainAbility2 onBackground") + } +}; diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..80bd7e7d76e7503cc70d16fa699f7e2839144bc7 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,60 @@ +// @ts-nocheck +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility3 onCreate") + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility3 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility3 onWindowStageCreate") + globalThis.ability3Context = this.context + windowStage.setUIContent(this.context, "pages/index3", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility3 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility3 onForeground") + var Delegator = AbilityDelegatorRegistry.getAbilityDelegator() + Delegator.startAbility( + { + bundleName: 'com.example.aacommand07', + abilityName: 'MainAbility2' + },()=> { + console.log("====>ACTS_AACommand_test_0700 startAbility end====>"); + }) + } + + onBackground() { + // Ability has back to background + console.log("MainAbility3 onBackground") + } +}; diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed3951fd7f0a0f55cba89cd970fe1b41ef2b385f --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..acec006720dcf4c601c7b6c409af77da3f18a0d1 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/pages/index2.ets b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/pages/index2.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1b234e8809675c00426bd142fe4a5d990eb7189 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/pages/index2.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World2' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/pages/index3.ets b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/pages/index3.ets new file mode 100644 index 0000000000000000000000000000000000000000..47fa0c889d6ef329d988fcb43083b4ccb86594b5 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/pages/index3.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'Hello World3' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6f7122cfaa0819d23d2fcf7a92ae7110dfa0bcc --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,76 @@ +/* + * 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 'hypium/index' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import commonEvent from "@ohos.commonevent" + +var subscriberInfo_startdebugapp = { + events: ["AACommand_Debugapp"], +}; +const START_ABILITY_TIMEOUT = 4000; + +export default function abilityTest() { + describe('ACTS_AACommand_01_3', function () { + + it('ACTS_AACommand_package_0700', 0, async function (done) { + + var Subscriber; + var flag = true; + + commonEvent.createSubscriber(subscriberInfo_startdebugapp).then(async (data) => { + console.debug("ACTS_AACommand_package_0700====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + await globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.aacommand07', + abilityName: 'MainAbility3' + }) + }) + function SubscribeCallBack(err, data) { + console.debug("====>ACTS_AACommand_package_0700 startAbility start====>"); + var Delegator = AbilityDelegatorRegistry.getAbilityDelegator() + Delegator.getCurrentTopAbility().then((data) => { + console.debug("====>ACTS_AACommand_package_0700 thisTopAbility====>" + JSON.stringify(data.lastRequestWant)); + console.debug("====>thisTopAbility 0700 ====>" + JSON.stringify(data.launchWant)) + var i = JSON.stringify(data.launchWant).indexOf('debugApp":true'); + console.debug("ACTS_AACommand_package_0700 i = " + i) + expect(i == -1).assertEqual(false); + }).catch((err) => { + console.debug("====>ACTS_AACommand_package_0700 err thisTopAbility====>" + JSON.stringify(err)) + }) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function UnSubscribeCallback() { + flag = false; + console.debug("ACTS_AACommand_package_0700====>UnSubscribe CallBack====>"); + globalThis.ability2Context.terminateSelf(); + globalThis.ability3Context.terminateSelf(); + done(); + } + + setTimeout(() => { + if (flag == true) { + console.debug("====>0700====>end====>flag" + flag); + console.debug("in ACTS_AACommand_package_0700 - timeout"); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + expect().assertFail(); + } + console.debug("ACTS_AACommand_package_0700 - timeout"); + }, START_ABILITY_TIMEOUT); + }) + }) +}; diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb35098ac281d443c7add6de76cee00a268ce092 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..915ec9f18e47b5a526d9ecd2b7e525560307603e --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/module.json @@ -0,0 +1,51 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label" + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a106bfa7cfe421cbcb7ca52dce84c56556148ab8 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommand07" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/miscservices/TimerTest_js/src/main/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/resources/base/media/icon.png similarity index 100% rename from miscservices/TimerTest_js/src/main/resources/base/media/icon.png rename to ability/ability_runtime/aacommand/AACommand07/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/miscservices/RequestTest_js/signature/openharmony_sx.p7b b/ability/ability_runtime/aacommand/AACommand07/signature/openharmony_sx.p7b similarity index 100% rename from miscservices/RequestTest_js/signature/openharmony_sx.p7b rename to ability/ability_runtime/aacommand/AACommand07/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/aacommand/AACommand08/AppScope/app.json b/ability/ability_runtime/aacommand/AACommand08/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..584b04945a468b91dbe261cd837929140c2b2547 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/AppScope/app.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.example.aacommand08", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} + diff --git a/ability/ability_runtime/aacommand/AACommand08/AppScope/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommand08/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8136cf5198bcc9a7e931031e4796cedcbf520a96 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommand08" + } + ] +} diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommand08/AppScope/resources/base/media/app_icon.png similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/aacommand/AACommand08/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/aacommand/AACommand08/BUILD.gn b/ability/ability_runtime/aacommand/AACommand08/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ef5d754d9fd13d482c8f43b4d5d8d457925e71f0 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/BUILD.gn @@ -0,0 +1,45 @@ +# 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_hap("AACommand08") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "AACommand08" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":aacommand08_js_assets", + ":aacommand08_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("aacommand08_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("aacommand08_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("aacommand08_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":aacommand08_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/aacommand/AACommand08/Test.json b/ability/ability_runtime/aacommand/AACommand08/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5e59b5a676c9c4c15534cd8f4dcc2c3312bddcbb --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/Test.json @@ -0,0 +1,11 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.aacommand08", + "module-name": "entry_test", + "shell-timeout": "600000" + } +} + diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..48e2332d00a46d6f719d7e7c1df0c48ab05ed1e2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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 Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d55879f3923d5f6a95525162dc5ebb865d7aa28 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility/pages/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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..c3c2afea064ddea0dd55388f2cb0fa1f54fcf3ea --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/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 AACommand_Debugapp====>"); + console.debug("====>close this context====>====>"); +} +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/index2", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility2 onForeground") + commonEvent.publish("AACommand_Debugapp", PublishCallBackOne); + + } + + onBackground() { + // Ability has back to background + console.log("MainAbility2 onBackground") + } +}; diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..94d27f27ba4cac4e1d98d5428bb2cbd202b970a2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,61 @@ +// @ts-nocheck +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("MainAbility3 onCreate") + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility3 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility3 onWindowStageCreate") + globalThis.ability3Context = this.context + windowStage.setUIContent(this.context, "pages/index3", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility3 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility3 onForeground") + var Delegator = AbilityDelegatorRegistry.getAbilityDelegator() + Delegator.startAbility( + { + bundleName: 'com.example.aacommand08', + abilityName: 'MainAbility2' + },()=> { + console.log("====>ACTS_AACommand_test_0800 startAbility end====>"); + }) + } + + onBackground() { + // Ability has back to background + console.log("MainAbility3 onBackground") + } +}; diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..e91260fa5f26fac6676194e4b369171abac560e7 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/pages/index2.ets b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/pages/index2.ets new file mode 100644 index 0000000000000000000000000000000000000000..3677a8602752609fa974b34b53749162392bb00b --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/pages/index2.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World2' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/pages/index3.ets b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/pages/index3.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae4dc02582f7c4aaf7583dee23b1f2383a481cb0 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/pages/index3.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World3' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6532f95ba4ba7b7ff3c8c73e5f27c131fc5f440d --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,76 @@ +/* + * 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 'hypium/index' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import commonEvent from "@ohos.commonevent" + +var subscriberInfo_startdebugapp = { + events: ["AACommand_Debugapp"], +}; +const START_ABILITY_TIMEOUT = 4000; + +export default function abilityTest() { + describe('ACTS_AACommand_01_3', function () { + + it('ACTS_AACommand_package_0800', 0, async function (done) { + + var Subscriber; + var flag = true; + + commonEvent.createSubscriber(subscriberInfo_startdebugapp).then(async (data) => { + console.debug("ACTS_AACommand_package_0800====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + await globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.aacommand08', + abilityName: 'MainAbility3' + }) + }) + function SubscribeCallBack(err, data) { + console.debug("====>ACTS_AACommand_package_0800 startAbility start====>"); + var Delegator = AbilityDelegatorRegistry.getAbilityDelegator() + Delegator.getCurrentTopAbility().then((data) => { + console.debug("====>ACTS_AACommand_package_0800 thisTopAbility====>" + JSON.stringify(data.lastRequestWant)); + console.debug("====>thisTopAbility 0800 ====>" + JSON.stringify(data.launchWant)) + var i = JSON.stringify(data.launchWant).indexOf('debugApp":true'); + console.debug("ACTS_AACommand_package_0800 i = " + i) + expect(i == -1).assertEqual(true); + }).catch((err) => { + console.debug("====>ACTS_AACommand_package_0800 err thisTopAbility====>" + JSON.stringify(err)) + }) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + function UnSubscribeCallback() { + flag = false; + console.debug("ACTS_AACommand_package_0800====>UnSubscribe CallBack====>"); + globalThis.ability2Context.terminateSelf(); + globalThis.ability3Context.terminateSelf(); + done(); + } + + setTimeout(() => { + if (flag == true) { + console.debug("====>0800====>end====>flag" + flag); + console.debug("in ACTS_AACommand_package_0800 - timeout"); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + expect().assertFail(); + } + console.debug("ACTS_AACommand_package_0800 - timeout"); + }, START_ABILITY_TIMEOUT); + }) + }) +}; diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..915ec9f18e47b5a526d9ecd2b7e525560307603e --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/module.json @@ -0,0 +1,51 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label" + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0c604fbf8d698e5ee603510b7bcc4338d564d65c --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommand08" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/miscservices/screenlock_js/src/main/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/resources/base/media/icon.png similarity index 100% rename from miscservices/screenlock_js/src/main/resources/base/media/icon.png rename to ability/ability_runtime/aacommand/AACommand08/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/miscservices/TimeTest_js/signature/openharmony_sx.p7b b/ability/ability_runtime/aacommand/AACommand08/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from miscservices/TimeTest_js/signature/openharmony_sx.p7b rename to ability/ability_runtime/aacommand/AACommand08/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/AppScope/app.json b/ability/ability_runtime/aacommand/AACommandPrintSync/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..1bf95ebd7c5b193a104f8064922fee5db290f7ff --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/AppScope/app.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.example.aacommandprintsync", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} + diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/AppScope/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandPrintSync/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..aa65d165a1993002a64b0a99443385d50e420a1c --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandPrintSync" + } + ] +} diff --git a/miscservices/wallpaper_js/src/main/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommandPrintSync/AppScope/resources/base/media/app_icon.png similarity index 100% rename from miscservices/wallpaper_js/src/main/resources/base/media/icon.png rename to ability/ability_runtime/aacommand/AACommandPrintSync/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/BUILD.gn b/ability/ability_runtime/aacommand/AACommandPrintSync/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f095421e10d64ae54a6e5d9216def011169ad26b --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/BUILD.gn @@ -0,0 +1,45 @@ +# 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_hap("AACommandPrintSync") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "AACommandPrintSync" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":aacommandprintsync_js_assets", + ":aacommandprintsync_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("aacommandprintsync_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("aacommandprintsync_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("aacommandprintsync_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":aacommandprintsync_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/Test.json b/ability/ability_runtime/aacommand/AACommandPrintSync/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5516acb35d25f0def2b68b989534390b54684623 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/Test.json @@ -0,0 +1,11 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.aacommandprintsync", + "module-name": "entry_test_desc", + "shell-timeout": "600000" + } +} + diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..4568e9a3c429f9ff6befb5d0949a8deadcd773fe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,53 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + globalThis.abilityContext = this.context; + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d55879f3923d5f6a95525162dc5ebb865d7aa28 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/MainAbility/pages/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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..d25a97b4abb594bd562c6c9c9d9da2ba3c26da1a --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..10980c8f8de9f345cfdc88247bc43ffa9f3a486a --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,115 @@ +/* +* 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 'hypium/index' + +export default function abilityTest() { + describe('ACTS_AACommand_01_3', function () { + /** + * @tc.number: ACTS_AACommand_printSync_0100 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, + * The printSync information includes Chinese, special characters, etc. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_printSync_0100', 0, async function (done) { + console.log("ACTS_AACommand_printSync_0100 start ====> " ) + var msg = '测试日志!@#$%^&*()_+QWE{}|?> " ) + var finishmsg = 'ACTS_AACommand_printSync_0100 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{ + console.log("ACTS_AACommand_printSync_0100 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_printSync_0100 finishTest test end " + + "========> callback data: "+JSON.stringify(data)) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_printSync_0200 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, + * The length of the printSync message is 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_printSync_0200', 0, async function (done) { + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + globalThis.abilityDelegator.printSync(msg); + console.log("ACTS_AACommand_printSync_0200 printSync end ====> " ) + var finishmsg = 'ACTS_AACommand_printSync_0200 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_printSync_0200 print test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_printSync_0300 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid + * The length of the printSync message is greater than 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_printSync_0300', 0, async function (done) { + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + + 'fffffffffff' + globalThis.abilityDelegator.printSync(msg); + console.log("ACTS_AACommand_printSync_0300 printSync end ====> " ) + var finishmsg = 'ACTS_AACommand_printSync_0300 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_printSync_0300 print test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_printSync_0400 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, + * printSync information is null. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_printSync_0400', 0, async function (done) { + globalThis.abilityDelegator.printSync(null); + console.log("ACTS_AACommand_printSync_0300 printSync end ====> " ) + var finishmsg = 'ACTS_AACommand_printSync_0400 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_printSync_0400 print test end ========> callback " ) + done() + }) + }) + }) +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..96db0c371f6341dbf2ed7025e2dcedd77b341fac --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9c9d8709b37227ba50e33520f161e3de3cf0e598 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommandPrintSync" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/miscservices/TimerTest_js/signature/openharmony_sx.p7b b/ability/ability_runtime/aacommand/AACommandPrintSync/signature/openharmony_sx.p7b similarity index 100% rename from miscservices/TimerTest_js/signature/openharmony_sx.p7b rename to ability/ability_runtime/aacommand/AACommandPrintSync/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/AppScope/app.json b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a7992d0033e3e05de16a47fe14148e79e38f2eb1 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.aacommandprintsynctest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/AppScope/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4272338db95cf5b4c9b646446db1376cbb8738a0 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + } + ] +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/BUILD.gn b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..56629398832be9e32c367d9968aab174ada98c51 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("AACommandPrintSyncTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":aacommandprintsynctest_js_assets", + ":aacommandprintsynctest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AACommandPrintSyncTest" +} + +ohos_app_scope("aacommandprintsynctest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("aacommandprintsynctest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("aacommandprintsynctest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":aacommandprintsynctest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/Test.json b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..099ec073ec15576061d691403d2532b516e6dd56 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/Test.json @@ -0,0 +1,35 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.aacommandprintsynctest", + "module-name": "entry_test", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + " hilog -Q pidoff", + "hilog -Q domainoff", + "hilog -b D" + ] + }, + { + "type": "PushKit", + "push": [ + "AACommandPrintSync.hap->/data/AACommandPrintSync.hap" + ] + }, + { + "test-file-name": [ + "AACommandPrintSyncTest.hap", + "AACommandPrintSync.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5372e63b8688f4a5749d3c39918e1eba1c513ce4 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + globalThis.abilityContext = this.context; + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d55879f3923d5f6a95525162dc5ebb865d7aa28 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/pages/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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..d25a97b4abb594bd562c6c9c9d9da2ba3c26da1a --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..30b2cea80d87af681ee81b33edf54c5fe0218c69 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,177 @@ +/* +* 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 'hypium/index' +import appManager from '@ohos.application.AppManager'; +const DELAY = 3000 +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +export default function abilityTest() { + describe('ActsAbilityTest', function () { + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + function checkRunningProcess(name, dataInfo) { + for (let i = 0, len = dataInfo.length; i < len; i++) { + if (dataInfo[i].processName == name) { + return true; + } + } + return false; + } + + /** + * @tc.number: ACTS_AACommand_printSync_0100 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid + * The printSync information includes Chinese, special characters, etc. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_printSync_0100', 0, async function (done) { + console.log("ACTS_AACommand_printSync_0100 --- start") + var cmd = 'aa test -b com.example.aacommandprintsync -m entry_test -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0100 -s unittest OpenHarmonyTestRunner' + var msg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_printSync_0100 - executeShellCommand: start ') + console.log('ACTS_AACommand_printSync_0100 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(msg); + console.log('ACTS_AACommand_printSync_0100 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_AACommand_printSync_0100 - executeShellCommand: end') + }) + setTimeout(async() => { + var procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_printSync_0100 getProcessRunningInfos ======> ' + + JSON.stringify(procrssinfo)); + var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo) + console.log("====>ACTS_AACommand_printSync_0100====>infores = " + infores) + expect(infores==false).assertEqual(true); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_printSync_0200 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, + * The length of the printSync message is 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_printSync_0200', 0, async function (done) { + console.log("ACTS_AACommand_printSync_0200 --- start") + var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0200 -s unittest OpenHarmonyTestRunner' + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_printSync_0200 - executeShellCommand: start ') + console.log('ACTS_AACommand_printSync_0200 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(msg); + console.log('ACTS_AACommand_printSync_0200 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_AACommand_printSync_0200 - executeShellCommand: end') + }) + setTimeout(async() => { + var procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_printSync_0200 getProcessRunningInfos ======> ' + + '' + JSON.stringify(procrssinfo)); + var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo) + console.log("====>ACTS_AACommand_printSync_0200====>infores = " + infores) + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_printSync_0300 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, + * The length of the printSync message is greater than 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_printSync_0300', 0, async function (done) { + console.log("ACTS_AACommand_printSync_0300 --- start") + var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0300 -s unittest OpenHarmonyTestRunner' + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + var msgcopy = 'fffffffffff' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_printSync_0300 - executeShellCommand: start ') + console.log('ACTS_AACommand_printSync_0300 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(msg); + console.log('ACTS_AACommand_printSync_0300 query string i = ' + i); + expect(i == -1).assertEqual(false); + var j = data.stdResult.indexOf(msgcopy); + console.log('ACTS_AACommand_printSync_0300 === query string j = ' + j); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_printSync_0300 - executeShellCommand: end') + }) + setTimeout(async() => { + var procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_printSync_0300 getProcessRunningInfos ======> ' + + JSON.stringify(procrssinfo)); + var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo) + console.log("====>ACTS_AACommand_printSync_0300====>infores = " + infores) + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_printSync_0400 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, + * printSync information is null. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_printSync_0400', 0, async function (done) { + console.log("ACTS_AACommand_printSync_0400 --- start") + var cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_0400 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_printSync_0400 - executeShellCommand: start ') + console.log('ACTS_AACommand_printSync_0400 stdResult = ' + data.stdResult) + expect(data.stdResult.indexOf('start ability successfully')==-1).assertEqual(false); + console.log('ACTS_AACommand_printSync_0400 - executeShellCommand: end') + }) + setTimeout(async() => { + var procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_printSync_0400 getProcessRunningInfos ======> ' + + JSON.stringify(procrssinfo)); + var infores = checkRunningProcess('com.example.aacommandprintsync', procrssinfo) + console.log("====>ACTS_AACommand_printSync_0400====>infores = ") + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..96db0c371f6341dbf2ed7025e2dcedd77b341fac --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..243c2fd1992bbd0d4d7c9757d84a5074bfec5314 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/miscservices/actspasteboardjsapitest/signature/openharmony_sx.p7b b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/signature/openharmony_sx.p7b similarity index 100% rename from miscservices/actspasteboardjsapitest/signature/openharmony_sx.p7b rename to ability/ability_runtime/aacommand/AACommandPrintSyncTest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/AppScope/app.json b/ability/ability_runtime/aacommand/AACommandRelyHap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..9fafa2af9bb12d51ebcaf5e0fd59b3ccdc703830 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.aacommandrelyhap", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/AppScope/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandRelyHap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f8664ac00f1da7bacbf89eaeccb99341223e33e0 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandRelyHap" + } + ] +} diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/aacommand/AACommandRelyHap/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandRelyHap/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/BUILD.gn b/ability/ability_runtime/aacommand/AACommandRelyHap/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..af015d12e6880ef51205cc25901e8b309b7eaebe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/BUILD.gn @@ -0,0 +1,45 @@ +# 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_hap("AACommandRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "AACommandRelyHap" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":aacommandrelyhap_js_assets", + ":aacommandrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("aacommandrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("aacommandrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("aacommandrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":aacommandrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/Test.json b/ability/ability_runtime/aacommand/AACommandRelyHap/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..0ce77b309fd9c92378b85910db1fa7b803deccb3 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/Test.json @@ -0,0 +1,4 @@ +{ + "description": "Configuration for aceceshi Tests" +} + diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b64cffca2792e1099a325ac31f3528c9179de75c --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d55879f3923d5f6a95525162dc5ebb865d7aa28 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/MainAbility/pages/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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..8b083e0087c1b880118be62e30bdca400fa905ac --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator=AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a9a4565339f6306241487e351ad83d52f2c54c0 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,484 @@ + +/* + * 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 'hypium/index' +export default function abilityTest() { + describe('ACTS_AACommand_01_3', function () { + /** + * @tc.number: ACTS_AACommand_print_0100 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. The print information includes Chinese, special characters, etc. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0100', 0, async function (done) { + console.log("ACTS_AACommand_print_0100 start ====> " ) + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_print_0100 print test end ========> callback " ) + console.log("ACTS_AACommand_print_0100 print test end ========> callback err: "+JSON.stringify(err) ) + console.log("ACTS_AACommand_print_0100 print test end ========> callback data: "+JSON.stringify(data)) + }) + var finishmsg = 'ACTS_AACommand_print_0100 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{ + console.log("ACTS_AACommand_print_0100 finishTest test end ========> callback " ) + console.log("ACTS_AACommand_print_0100 finishTest test end ========> callback data: "+JSON.stringify(data)) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_print_0200 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. The length of the print message is 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0200', 0, async function (done) { + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + globalThis.abilityDelegator.print(msg,()=>{ + console.log("print test end ========> callback " ) + }) + var finishmsg = 'ACTS_AACommand_print_0200 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_print_0200 print test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_print_0300 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. The length of the print message is greater than 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0300', 0, async function (done) { + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + + 'fffffffffff' + globalThis.abilityDelegator.print(msg,()=>{ + console.log("print test end ========> callback " ) + }) + var finishmsg = 'ACTS_AACommand_print_0300 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_print_0300 print test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_print_0400 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. print information is null. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0400', 0, async function (done) { + globalThis.abilityDelegator.print(null,()=>{ + console.log("print test end ========> callback " ) + }) + var finishmsg = 'ACTS_AACommand_print_0400 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_print_0400 print test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_print_0500 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in Promise mode. The print information includes Chinese, special characters, etc. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0500', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_print_0500 print test end ========> callback " ) + }) + var finishmsg = 'ACTS_AACommand_print_0500 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_print_0500 print test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_print_0600 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in Promise mode. The length of the print message is 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally + * through the test command. + */ + it('ACTS_AACommand_print_0600', 0, async function (done) { + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + globalThis.abilityDelegator.print(msg).then(()=>{ + console.log("ACTS_AACommand_print_0600 print test end ========> callback " ) + }) + var finishmsg = 'ACTS_AACommand_print_0600 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_print_0600 2 print test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_print_0700 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in Promise mode. The length of the print message is greater than 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0700', 0, async function (done) { + var msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + + 'fffffffffff' + globalThis.abilityDelegator.print(msg).then(()=>{ + console.log("ACTS_AACommand_print_0700 print test end ========> callback " ) + }) + var finishmsg = 'ACTS_AACommand_print_0700 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_print_0700 2 print test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_print_0800 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in Promise mode. print information is null. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally + * through the test command. + */ + it('ACTS_AACommand_print_0800', 0, async function (done) { + globalThis.abilityDelegator.print("").then(()=>{ + console.log("ACTS_AACommand_print_0800 print test end ========> callback " ) + }) + var finishmsg = 'ACTS_AACommand_print_0800 end' + globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ + console.log("ACTS_AACommand_print_0800 2 print test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0100 + * @tc.name: Each parameter of the test command is valid, and the finishTest interface is called + * in AsyncCallback mode. + * The msg parameter is valid (including Chinese and special characters) and the code parameter + * is valid (1). + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_0100', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_finish_0100 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0200 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback + * mode. The msg parameter is invalid (null) and the code parameter is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_0200', 0, async function (done) { + setTimeout(() => { + console.log('ACTS_AACommand_finish_0200 code:'+JSON.stringify(code)) + if(code!=undefined){ + expect().assertFail(); + } + done(); + }, 3000) + var code = globalThis.abilityDelegator.finishTest(null, 1,()=>{ + console.log(" ACTS_AACommand_finish_0200 finishTest test end ========> callback " ) + expect().assertFail(); + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0300 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback + * mode. The msg parameter is invalid (Undefined) and the code parameter is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_0300', 0, async function (done) { + setTimeout(() => { + console.log('ACTS_AACommand_finish_0300 code:'+JSON.stringify(code)) + if(code!=undefined){ + expect().assertFail(); + } + done(); + }, 3000) + var code = globalThis.abilityDelegator.finishTest(undefined, 1,()=>{ + console.log(" ACTS_AACommand_finish_0300 finishTest test end ========> callback " ) + expect().assertFail(); + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0400 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) and the code parameter + * is valid (Number.MAX_VALUE) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_0400', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_finish_0400 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0500 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) and the code parameter + * is valid (Number.MIN_VALUE) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_0500', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_finish_0500 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0600 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) and the code parameter + * is valid (Number.MAX_VALUE+1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_0600', 0, async function (done) { + + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_finish_0600 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0700 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) and the code parameter + * is valid (Number.MIN_VALUE-1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_0700', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_finish_0700 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0800 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) and the + * code parameter is valid (“ABCD”) + * @tc.desc: Verify that the process of the test framework is not stopped by calling this interface. + */ + it('ACTS_AACommand_finish_0800', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finish_0800 code:'+JSON.stringify(code)) + if(code!=undefined){ + expect().assertFail(); + } + done(); + }, 3000) + var code = globalThis.abilityDelegator.finishTest(msg, 'ABCD',()=>{ + console.log(" ACTS_AACommand_finish_0800 finishTest test end ========> callback " ) + expect().assertFail(); + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0900 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_0900', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log("ACTS_AACommand_finish_0900 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1000 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is invalid(null) and the code parameter is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_1000', 0, async function (done) { + var code = null + setTimeout(() => { + console.log('ACTS_AACommand_finish_1000 code:'+JSON.stringify(code)) + if(code!=undefined){ + expect().assertFail(); + } + done(); + }, 3000) + code = globalThis.abilityDelegator.finishTest(null, 1) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1100 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is invalid(undefined) and the code parameter is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_1100', 0, async function (done) { + var code=null + setTimeout(() => { + console.log('ACTS_AACommand_finish_1100 code:'+JSON.stringify(code)) + if(code!=undefined){ + expect().assertFail(); + } + done(); + }, 3000) + code = globalThis.abilityDelegator.finishTest(undefined, 1) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1200 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (Number.MAX_VALUE) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_1200', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_finish_1200 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1300 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (Number.MIN_VALUE) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_1300', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_finish_1300 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1400 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (Number.MAX_VALUE+1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_1400', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_finish_1400 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1500 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (Number.MIN_VALUE-1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_1500', 0, async function (done) { + var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ + console.log("ACTS_AACommand_finish_1500 finishTest test end ========> callback " ) + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1600 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (ABCD) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finish_1600', 0, async function (done) { + var code = null + var msg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finish_1600 code:'+JSON.stringify(code)) + if(code!=undefined){ + expect().assertFail(); + } + done(); + }, 3000) + code = globalThis.abilityDelegator.finishTest(msg, 'ABCD') + }) + }) +}; + diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..96db0c371f6341dbf2ed7025e2dcedd77b341fac --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..db4c53de70732833f295cfca677bab92e5eb640a --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommandRelyHap" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/miscservices/screenlock_js/signature/openharmony_sx.p7b b/ability/ability_runtime/aacommand/AACommandRelyHap/signature/openharmony_sx.p7b similarity index 100% rename from miscservices/screenlock_js/signature/openharmony_sx.p7b rename to ability/ability_runtime/aacommand/AACommandRelyHap/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/aacommand/AACommandpackage/AppScope/app.json b/ability/ability_runtime/aacommand/AACommandpackage/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d2072ddfc6052d753c716aebd69090d3d0b18a --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/AppScope/app.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.example.actsaacommandtestatest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} + diff --git a/ability/ability_runtime/aacommand/AACommandpackage/AppScope/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandpackage/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..94a71247c83ad7f19857a04c12a320fda72a6c4f --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandpackage" + } + ] +} diff --git a/ability/ability_runtime/aacommand/AACommandpackage/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/aacommand/AACommandpackage/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandpackage/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandpackage/BUILD.gn b/ability/ability_runtime/aacommand/AACommandpackage/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d798dea094a0c08c96c291b5e38509d0cc4a46ee --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/BUILD.gn @@ -0,0 +1,45 @@ +# 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_hap("AACommandpackage") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "AACommandpackage" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actsaacommandtestatest_js_assets", + ":actsaacommandtestatest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actsaacommandtestatest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsaacommandtestatest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsaacommandtestatest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsaacommandtestatest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/aacommand/AACommandpackage/Test.json b/ability/ability_runtime/aacommand/AACommandpackage/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a785538543670e0f9574f15c33e0ab44926f06aa --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/Test.json @@ -0,0 +1,11 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsaacommandtestatest", + "module-name": "entry_test", + "shell-timeout": "600000" + } +} + diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b64cffca2792e1099a325ac31f3528c9179de75c --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d55879f3923d5f6a95525162dc5ebb865d7aa28 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/MainAbility/pages/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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..d25a97b4abb594bd562c6c9c9d9da2ba3c26da1a --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f16b65e53bf83fe5bf8935f03401bd75d6c9a661 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = '测试框架' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f440c983b756e22b09e2a84224bad95eb3c9b657 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/Ability.test.ets @@ -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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +export default function abilityTest() { + describe('ACTS_AACommand_01_3', function () { + + /** + * @tc.number: ACTS_AACommand_test_0300_9 + * @tc.name: -b, -s unittest, -p, -s class, -s level, -s size, -s testType, -s timeout, + * -s , -w, etc. of the test command arguments are + * valid ( -s class specifies only test suites). + * @tc.desc: Verify that the test framework can start normally through the test command. + */ + it('ACTS_AACommand_test_0300_9', 0, async function (done) { + console.log("ACTS_AACommand_test_0300_9 ---------3-------- start") + var msg = 'ACTS_AACommand_0200/0300/0400/0500/0600' + globalThis.abilityDelegator.print(msg,()=>{ + console.log("ACTS_AACommand_test_0300_9 print test end ========> callback ") + }) + var AbilityDelegatorArgs = AbilityDelegatorRegistry.getArguments() + console.debug("====>getArguments is====>" + JSON.stringify(AbilityDelegatorArgs)); + expect(AbilityDelegatorArgs.bundleName).assertEqual('com.example.actsaacommandtestatest') + expect(AbilityDelegatorArgs.parameters['-b']).assertEqual('com.example.actsaacommandtestatest') + expect(AbilityDelegatorArgs.parameters['-p']).assertEqual('com.example.actsaacommandtestatest') + expect(AbilityDelegatorArgs.parameters['-s unittest']).assertEqual('OpenHarmonyTestRunner') + expect(AbilityDelegatorArgs.parameters['-w']).assertEqual("40") + expect(AbilityDelegatorArgs.parameters['-s class']).assertEqual("ACTS_AACommand_01_3") + expect(AbilityDelegatorArgs.parameters['-s level']).assertEqual("1") + expect(AbilityDelegatorArgs.parameters['-s size']).assertEqual("0") + expect(AbilityDelegatorArgs.parameters['-s testType']).assertEqual("aaa") + expect(AbilityDelegatorArgs.parameters['-s timeout']).assertEqual("5") + expect(AbilityDelegatorArgs.parameters['-s 1']).assertEqual("3") + expect(AbilityDelegatorArgs.testRunnerClassName).assertEqual('OpenHarmonyTestRunner') + done(); + }) + }) +}; diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..96db0c371f6341dbf2ed7025e2dcedd77b341fac --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9c9d8709b37227ba50e33520f161e3de3cf0e598 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommandPrintSync" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/miscservices/wallpaper_js/signature/openharmony_sx.p7b b/ability/ability_runtime/aacommand/AACommandpackage/signature/openharmony_sx.p7b similarity index 100% rename from miscservices/wallpaper_js/signature/openharmony_sx.p7b rename to ability/ability_runtime/aacommand/AACommandpackage/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/aacommand/AACommandtest/AppScope/app.json b/ability/ability_runtime/aacommand/AACommandtest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..b643c70c4996816d982da4a07003af09406739d2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.aacommandtest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/aacommand/AACommandtest/AppScope/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandtest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..cc389c091e9a85dc300cc050a47d7217475045f1 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandtest" + } + ] +} diff --git a/ability/ability_runtime/aacommand/AACommandtest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/aacommand/AACommandtest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandtest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandtest/BUILD.gn b/ability/ability_runtime/aacommand/AACommandtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..4f6288d67d450b3eb36a406c45a4b28f2054fb17 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("AACommandtest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":aacommandtest_js_assets", + ":aacommandtest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AACommandtest" +} + +ohos_app_scope("aacommandtest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("aacommandtest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("aacommandtest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":aacommandtest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/aacommand/AACommandtest/Test.json b/ability/ability_runtime/aacommand/AACommandtest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..c247ba650e182147dad86f7143bbeb0c3e81defd --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/Test.json @@ -0,0 +1,33 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.aacommandtest", + "module-name": "entry_test", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "PushKit", + "push": [ + "AACommand07.hap->/data/AACommand07.hap", + "AACommand08.hap->/data/AACommand08.hap", + "AACommandpackage.hap->/data/AACommandpackage.hap", + "AACommandRelyHap.hap->/data/AACommandRelyHap.hap" + ] + }, + { + "test-file-name": [ + "AACommandtest.hap", + "AACommand07.hap", + "AACommand08.hap", + "AACommandpackage.hap", + "AACommandRelyHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b64cffca2792e1099a325ac31f3528c9179de75c --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d55879f3923d5f6a95525162dc5ebb865d7aa28 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/pages/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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..d25a97b4abb594bd562c6c9c9d9da2ba3c26da1a --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..583288a377bce0a6cf2434ce904cd78224f804b3 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,1104 @@ +/* + * 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 'hypium/index' +import appManager from '@ohos.application.AppManager'; +const DELAY = 3000 +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +export default function abilityTest() { + describe('ACTS_AACommand_Test', function () { + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + function checkRunningProcess(name, dataInfo) { + for (let i = 0, len = dataInfo.length; i < len; i++) { + if (dataInfo[i].processName == name) { + return true; + } + } + return false; + } + + /** + * @tc.number: ACTS_AACommand_0100 + * @tc.name: -b, -s unittest, -p, -s class, -s level, -s size, -s testType, -s timeout, + * -s , -w, etc. of the test command arguments are + * valid ( -s class specifies only test suites). + * @tc.desc: Verify that the test framework can start normally through the test command. + */ + it('ACTS_AACommand_0100', 0, async function (done) { + console.log("ACTS_AACommand_0100 --- start") + let cmd = 'aa test -b com.example.actsaacommandtesta' + + 'test -m entry_test ' + + '-s unittest OpenHarmonyTestRunner ' + + '-w 40 -s class ACTS_AACommand_01_3 -s level 1 -s size 0 -s testType aaa -s '+ + 'timeout 5 -s 1 3 -D' + let delay = 3000 + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_0100 - executeShellCommand: start ') + console.log('ACTS_AACommand_0100 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf('start ability successfully'); + console.log('ACTS_AACommand_0100 query string i = ' + i); + expect(i == -1).assertEqual(false); + }) + setTimeout(async () => { + console.log('ACTS_AACommand_0100 - executeShellCommand: end') + done(); + }, delay) + }) + + /** + * @tc.number: ACTS_AACommand_0200 + * @tc.name: The -b parameter of the test command is invalid, and the other parameters such as -s and -w are valid. + * @tc.desc: Verify that the test framework cannot be started normally by passing the test command. + */ + it('ACTS_AACommand_0200', 0, async function (done) { + console.log("ACTS_AACommand_0200 --- start") + let cmd = 'aa test -b invalid -m entry_test -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_0200 - executeShellCommand: start ') + console.log('ACTS_AACommand_0200 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf('failed to start user test'); + let j = data.stdResult.indexOf('ACTS_AACommand_0200/0300/0400/0500/0600'); + console.log('ACTS_AACommand_0200 query string i = ' + i); + console.log('ACTS_AACommand_0200 query string j = ' + j); + expect(i == -1).assertEqual(false); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_0200 - executeShellCommand: end') + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_0300 + * @tc.name: The -s parameter of the test command is invalid, and the other parameters such as -b and -w are valid. + * @tc.desc:Verify that the test framework cannot be started normally by passing the test command. + */ + it('ACTS_AACommand_0300', 0, async function (done) { + console.log("ACTS_AACommand_0300 --- start") + let cmd = 'aa test -b com.example.actsaacommandtestatest -m entry_test -s invalid' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_0300 - executeShellCommand: start ') + console.log('ACTS_AACommand_0300 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf('option [-s] is incorrect'); + let j = data.stdResult.indexOf('ACTS_AACommand_0200/0300/0400/0500/0600'); + console.log('ACTS_AACommand_0300 query string i = ' + i); + console.log('ACTS_AACommand_0300 query string j = ' + j); + expect(i == -1).assertEqual(false); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_0300 - executeShellCommand: end') + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_0400 + * @tc.name: The -w parameter of the test command is invalid, and the other parameters such as -b and -s are valid. + * @tc.desc: Verify that the test framework cannot be started normally by passing the test command. + */ + it('ACTS_AACommand_0400', 0, async function (done) { + console.log("ACTS_AACommand_0400 --- start") + let cmd = 'aa test -b com.example.actsaacommandtestatest -m entry_test ' + + '-s unittest OpenHarmonyTestRunner ' + + '-w 无效值' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_0400 - executeShellCommand: start ') + console.log('ACTS_AACommand_0400 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf('start ability successfully'); + let j = data.stdResult.indexOf('ACTS_AACommand_0200/0300/0400/0500/0600'); + console.log('ACTS_AACommand_0400 query string i = ' + i); + console.log('ACTS_AACommand_0400 query string j = ' + j); + expect(i == -1).assertEqual(true); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_0400 - executeShellCommand: end') + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_0500 + * @tc.name: The -b, -s, -w and other parameters of the test command are valid, and the + * invalid -z parameter is added. + * @tc.desc: Verify that the test framework cannot be started normally by passing the test command. + */ + it('ACTS_AACommand_0500', 0, async function (done) { + console.log("ACTS_AACommand_0500 --- start") + let cmd = 'aa test -b aa test -b com.example.actsaacommandtestatest -m entry_test' + + '-s unittest OpenHarmonyTestRunner -z invalid' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_0500 - executeShellCommand: start ') + console.log('ACTS_AACommand_0500 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf('error: unknown option: -z'); + let j = data.stdResult.indexOf('ACTS_AACommand_0200/0300/0400/0500/0600'); + console.log('ACTS_AACommand_0500 query string i = ' + i); + console.log('ACTS_AACommand_0500 query string j = ' + j); + expect(i == -1).assertEqual(false); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_0500 - executeShellCommand: end') + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_0600 + * @tc.name: The -p parameter of the test command is invalid, and the -b, -s, -w and other parameters are valid. + * @tc.desc: Verify that the test framework cannot be started normally by passing the test command. + */ + it('ACTS_AACommand_0600', 0, async function (done) { + console.log("ACTS_AACommand_0600 --- start") + let cmd = 'aa test -b com.example.actsaacommandtestatest -m aatest -s unittest OpenHarmonyTestRunner -w 20' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_0600 - executeShellCommand: start ') + console.log('ACTS_AACommand_0600 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf('start ability successfully'); + let j = data.stdResult.indexOf('ACTS_AACommand_0200/0300/0400/0500/0600'); + console.log('ACTS_AACommand_0600 query string i = ' + i); + console.log('ACTS_AACommand_0600 query string j = ' + j); + expect(i == -1).assertEqual(true); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_0600 - executeShellCommand: end') + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0700 + * @tc.name: The parameters of the test command are valid, + * and the finishTest interface is called in AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) and the code parameter + * is valid (Number.MIN_VALUE-1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0700', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0700 --- start") + var cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_0700 -s unittest OpenHarmonyTestRunner' + var finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_0700 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_0700 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_0700 query string i = ' + i); + expect(i == -1).assertEqual(false); + var j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); + console.log('ACTS_AACommand_finishTest_0700 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_0700 - executeShellCommand: end') + }) + setTimeout(async() => { + var temp + var cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_0800 + * @tc.name: The -b, -s, -w and other parameters of the test command are valid, and there is no -D + * parameter setting. + * @tc.desc: Verify that the test framework cannot be started in Debug mode through the test command. + */ + it('ACTS_AACommand_0800', 0, async function (done) { + console.log("ACTS_AACommand_0800 --- start") + let cmd = 'aa test -b com.example.aacommand08 -m entry_test -s unittest OpenHarmonyTestRunner -w 3' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_0800 - executeShellCommand: start ') + console.log('ACTS_AACommand_0800 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf('start ability successfully'); + console.log('ACTS_AACommand_0800 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_AACommand_0800 - executeShellCommand: end') + done() + }) + }) + + /** + * @tc.number: ACTS_AACommand_print_0100 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. The print information includes Chinese, special characters, etc. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0100', 0, async function (done) { + console.log("ACTS_AACommand_print_0100 --- start") + let cmd = 'aa test -b com.example.aacommandrelyhap -m entry_test -s class ACTS_AACommand_01_3#ACTS_AACo' + + 'mmand_print_0100 -s unittest OpenHarmonyTestRunner' + let msg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_print_0100 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_0100 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(msg); + console.log('ACTS_AACommand_print_0100 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_AACommand_print_0100 - executeShellCommand: end') + }) + setTimeout(async() => { + let procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_print_0100 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); + let infores = checkRunningProcess('com.example.print01', procrssinfo) + console.log("====>ACTS_AACommand_print_0100====>infores = " + infores) + expect(infores==false).assertEqual(true); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_print_0200 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. The length of the print message is 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0200', 0, async function (done) { + console.log("ACTS_AACommand_print_0200 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm'+ + 'and_print_0200 -s unittest OpenHarmonyTestRunner' + let msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'+ + 'aaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_0200 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_0200 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(msg); + console.log('ACTS_AACommand_print_0200 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_AACommand_print_0200 - executeShellCommand: end') + }) + setTimeout(async() => { + let procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_print_0200 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); + let infores = checkRunningProcess('com.example.print02', procrssinfo) + console.log("====>ACTS_AACommand_print_0200====>infores = " + infores) + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_print_0300 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. The length of the print message is greater than 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0300', 0, async function (done) { + console.log("ACTS_AACommand_print_0300 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_'+ + 'AACommand_print_0300 -s unittest OpenHarmonyTestRunner' + let msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + let msgcopy = 'fffffffffff' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_0300 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_0300 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(msg); + console.log('ACTS_AACommand_print_0300 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf(msgcopy); + console.log('ACTS_AACommand_print_0300 === query string j = ' + j); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_print_0300 - executeShellCommand: end') + }) + setTimeout(async() => { + let procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_print_0300 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); + let infores = checkRunningProcess('com.example.print03', procrssinfo) + console.log("====>ACTS_AACommand_print_0300====>infores = " + infores) + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_print_0400 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. print information is null. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0400', 0, async function (done) { + console.log("ACTS_AACommand_print_0400 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComma'+ + 'nd_print_0400 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_0400 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_0400 stdResult = ' + data.stdResult) + expect(data.stdResult.indexOf('start ability successfully')==-1).assertEqual(false); + console.log('ACTS_AACommand_print_0400 - executeShellCommand: end') + }) + setTimeout(async() => { + let procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_print_0400 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); + let infores = checkRunningProcess('com.example.print04', procrssinfo) + console.log("====>ACTS_AACommand_print_0400====>infores = ") + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_print_0500 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in Promise mode. The print information includes Chinese, special characters, etc. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0500', 0, async function (done) { + console.log("ACTS_AACommand_print_0500 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm'+ + 'and_print_0500 -s unittest OpenHarmonyTestRunner' + let msg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_print_0500 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_0500 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(msg); + console.log('ACTS_AACommand_print_0500 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_AACommand_print_0500 - executeShellCommand: end') + }) + setTimeout(async() => { + let procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_print_0500 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); + let infores = checkRunningProcess('com.example.print05', procrssinfo) + console.log("====>ACTS_AACommand_print_0500====>infores = " + infores) + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_print_0600 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in Promise mode. The length of the print message is 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally + * through the test command. + */ + it('ACTS_AACommand_print_0600', 0, async function (done) { + console.log("ACTS_AACommand_print_0600 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AA' + + 'Command_print_0600 -s unittest OpenHarmonyTestRunner' + let msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaae' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_0600 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_0600 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(msg); + console.log('ACTS_AACommand_print_0600 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_AACommand_print_0600 - executeShellCommand: end') + }) + setTimeout(async() => { + let procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_print_0600 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); + let infores = checkRunningProcess('com.example.print06', procrssinfo) + console.log("====>ACTS_AACommand_print_0600====>infores = " + infores) + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_print_0700 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in Promise mode. The length of the print message is greater than 1000 characters. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0700', 0, async function (done) { + console.log("ACTS_AACommand_print_0700 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_print_0700 -s unittest OpenHarmonyTestRunner ' + let msg = '0callbackaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaa' + + '1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '4aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '5aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '6aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + '9aaaaaaaaa' + let msgcopy = 'fffffffffff' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_0700 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_0700 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(msg); + console.log('ACTS_AACommand_print_0700 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf(msgcopy); + console.log('ACTS_AACommand_print_0700 === query string j = ' + j); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_print_0700 - executeShellCommand: end') + }) + setTimeout(async() => { + let procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_print_0700 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); + let infores = checkRunningProcess('com.example.print07', procrssinfo) + console.log("====>ACTS_AACommand_print_0700====>infores = " + infores) + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_print_0800 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in Promise mode. print information is null. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally + * through the test command. + */ + it('ACTS_AACommand_print_0800', 0, async function (done) { + console.log("ACTS_AACommand_print_0800 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_print_0800 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_AACommand_print_0800 - executeShellCommand: start ') + console.log("ACTS_AACommand_print_0800 print test end ========> callback " ) + expect(data.stdResult.indexOf('start ability successfully')==-1).assertEqual(false); + console.log('ACTS_AACommand_print_0800 - executeShellCommand: end') + }) + setTimeout(async() => { + let procrssinfo = await appManager.getProcessRunningInfos() + console.log('ACTS_AACommand_print_0800 getProcessRunningInfos ======> ' + JSON.stringify(procrssinfo)); + let infores = checkRunningProcess('com.example.print08', procrssinfo) + console.log("====>ACTS_AACommand_print_0800====>infores = " + infores) + expect(infores).assertEqual(false); + done(); + }, DELAY ) + }) + + + + /** + * @tc.number: ACTS_AACommand_finishTest_0400 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in + * AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) and the code + * parameter + * is valid (Number.MAX_VALUE) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0400', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0400 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_finish_0400 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_0400 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_0400 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_0400 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); + console.log('ACTS_AACommand_finishTest_0400 query string j = ' + j); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_finishTest_0400 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + + /** + * @tc.number: ACTS_AACommand_finishTest_0100 + * @tc.name: Each parameter of the test command is valid, and the finishTest interface is called + * in AsyncCallback mode. + * The msg parameter is valid (including Chinese and special characters) and the code parameter + * is valid (1). + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0100', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0100 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_0100 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_0100 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_0100 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_0100 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: 1'); + console.log('ACTS_AACommand_finishTest_0100 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_0100 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + + /** + * @tc.number: ACTS_AACommand_finishTest_0500 + * @tc.name: The parameters of the test command are valid, and the finishTest + * interface is called in AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special + * characters) and the code parameter + * is valid (Number.MIN_VALUE) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0500', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0500 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_finish_0500 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_0500 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_0500 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_0500 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: 0'); + console.log('ACTS_AACommand_finishTest_0500 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_0500 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0600 + * @tc.name: The parameters of the test command are valid, and the finishTest + * interface is called in AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) + * and the code parameter + * is valid (Number.MAX_VALUE+1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0600', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0600 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_0600 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_0600 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_0600 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_0600 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: 1'); + console.log('ACTS_AACommand_finishTest_0600 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_0600 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0700 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in + * AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) and the code + * parameter + * is valid (Number.MIN_VALUE-1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0700', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0700 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_0700 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_0700 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_0700 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_0700 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); + console.log('ACTS_AACommand_finishTest_0700 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_0700 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + + /** + * @tc.number: ACTS_AACommand_finishTest_0900 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0900', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0900 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_0900 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_0900 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_0900 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_0900 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: 1'); + console.log('ACTS_AACommand_finishTest_0900 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_0900 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + + /** + * @tc.number: ACTS_AACommand_finishTest_1200 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (Number.MAX_VALUE) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_1200', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_1200 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap' + + ' -s class ACTS_AACommand_01_3#ACTS_AACommand_finish_1200 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_1200 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_1200 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_1200 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); + console.log('ACTS_AACommand_finishTest_1200 query string j = ' + j); + expect(j == -1).assertEqual(true); + console.log('ACTS_AACommand_finishTest_1200 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1300 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (Number.MIN_VALUE) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_1300', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_1300 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_1300 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_1300 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_1300 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_1300 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: 0'); + console.log('ACTS_AACommand_finishTest_1300 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_1300 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1400 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (Number.MAX_VALUE+1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_1400', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_1400 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_1400 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_1400 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_1400 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_1400 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: 1'); + console.log('ACTS_AACommand_finishTest_1400 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_1400 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1500 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is valid(including Chinese and special characters) and the code parameter + * is valid (Number.MIN_VALUE-1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_1500', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_1500 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_1500 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_1500 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_1500 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_1500 query string i = ' + i); + expect(i == -1).assertEqual(false); + let j = data.stdResult.indexOf('TestFinished-ResultCode: -1'); + console.log('ACTS_AACommand_finishTest_1500 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_1500 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") == -1).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0200 + * @tc.name: The parameters of the test command are valid, and the finishTest + * interface is called in AsyncCallback + * mode. The msg parameter is invalid (null) and the code parameter is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0200', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0200 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_0200 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, () => { + console.log('ACTS_AACommand_finishTest_0200 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0300 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in + * AsyncCallback mode. The msg parameter is invalid (Undefined) and the code parameter is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0300', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0300 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_0300 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd, () => { + console.log('ACTS_AACommand_finishTest_0300 - executeShellCommand: start ') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_0800 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in + * AsyncCallback + * mode. The msg parameter is invalid(including Chinese and special characters) and the + * code parameter is valid (“ABCD”) + * @tc.desc: Verify that the process of the test framework is not stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_0800', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_0800 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_0800 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_0800 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_0800 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_0800 query string i = ' + i); + expect(i == -1).assertEqual(true); + let j = data.stdResult.indexOf('TestFinished-ResultCode:'); + console.log('ACTS_AACommand_finishTest_0800 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_0800 exitCode = ' + data.exitCode) + expect(data.exitCode).assertEqual(0); + console.log('ACTS_AACommand_finishTest_0800 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1000 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is invalid(null) and the code parameter is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_1000', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_1000 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_1000 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd).then((data) => { + console.log('ACTS_AACommand_finishTest_1000 - executeShellCommand: start ') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") >=0).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + + /** + * @tc.number: ACTS_AACommand_finishTest_1100 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise + * mode. The msg parameter is invalid(undefined) and the code parameter is valid (1) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_1100', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_1100 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_1100 -s unittest OpenHarmonyTestRunner' + globalThis.abilityDelegator.executeShellCommand(cmd).then((data) => { + console.log('ACTS_AACommand_finishTest_1100 - executeShellCommand: start ') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + /** + * @tc.number: ACTS_AACommand_finishTest_1600 + * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in + * Promisemode. The msg parameter is valid(including Chinese and special characters) and the + * code parameter + * is valid (ABCD) + * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. + */ + it('ACTS_AACommand_finishTest_1600', 0, async function (done) { + console.log("ACTS_AACommand_finishTest_1600 --- start") + let cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap' + + ' -s class ACTS_AACommand_01_3#ACTS_AACommand_finish_1600 -s unittest OpenHarmonyTestRunner' + let finishmsg = '测试日志!@#$%^&*()_+QWE{}|?> { + console.log('ACTS_AACommand_finishTest_1600 - executeShellCommand: start ') + console.log('ACTS_AACommand_finishTest_1600 stdResult = ' + data.stdResult) + let i = data.stdResult.indexOf(finishmsg); + console.log('ACTS_AACommand_finishTest_1600 query string i = ' + i); + expect(i == -1).assertEqual(true); + let j = data.stdResult.indexOf('TestFinished-ResultCode:'); + console.log('ACTS_AACommand_finishTest_1600 query string j = ' + j); + expect(j == -1).assertEqual(false); + console.log('ACTS_AACommand_finishTest_1600 exitCode = ' + data.exitCode) + expect(data.exitCode).assertEqual(0); + console.log('ACTS_AACommand_finishTest_1600 - executeShellCommand: end') + }) + setTimeout(async() => { + let temp + let cmd ='aa dump -a' + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + JSON.stringify(d)); + temp = d["stdResult"]; + expect(temp.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() + console.info('executeShellCommand end'); + }) + done(); + }, DELAY ) + }) + }) +}; diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..96db0c371f6341dbf2ed7025e2dcedd77b341fac --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..958969326b93d7f5b5ba1daab2fbe5621ecb88bd --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandtest/signature/openharmony_sx.p7b b/ability/ability_runtime/aacommand/AACommandtest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/aacommand/AACommandtest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/aacommand/BUILD.gn b/ability/ability_runtime/aacommand/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..97b8cfe45a0fbc69f5d4109e71b5b3964096c624 --- /dev/null +++ b/ability/ability_runtime/aacommand/BUILD.gn @@ -0,0 +1,29 @@ +# 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") + +group("aacommand") { + testonly = true + if (is_standard_system) { + deps = [ + "AACommand07:AACommand07", + "AACommand08:AACommand08", + "AACommandPrintSync:AACommandPrintSync", + "AACommandPrintSyncTest:AACommandPrintSyncTest", + "AACommandRelyHap:AACommandRelyHap", + "AACommandpackage:AACommandpackage", + "AACommandtest:AACommandtest", + ] + } +} diff --git a/ability/ability_runtime/abilitymontior/AppScope/app.json b/ability/ability_runtime/abilitymontior/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..e86a6a2b98200ce764ba2d559422851a807956b2 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/AppScope/app.json @@ -0,0 +1,22 @@ +{ + "app": { + "bundleName": "com.example.abilitymonitortest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} + diff --git a/ability/ability_runtime/abilitymontior/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitymontior/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c89972fa5472b99a3d51bfc909db0bc72aaf5416 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityMonitorTest" + } + ] +} diff --git a/ability/ability_runtime/abilitymontior/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/abilitymontior/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitymontior/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/abilitymontior/BUILD.gn b/ability/ability_runtime/abilitymontior/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bc86f5ad19a2c0c827f5fe61cd9c17f4316bd40a --- /dev/null +++ b/ability/ability_runtime/abilitymontior/BUILD.gn @@ -0,0 +1,41 @@ +# 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("AbilityMonitorTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitymonitortest_js_assets", + ":abilitymonitortest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityMonitorTest" +} + +ohos_app_scope("abilitymonitortest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitymonitortest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitymonitortest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitymonitortest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitymontior/Test.json b/ability/ability_runtime/abilitymontior/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..1c7d642f53704a1075343f53211697f7d9455eb4 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/Test.json @@ -0,0 +1,27 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.abilitymonitortest", + "module-name": "entry", + "shell-timeout": "600000", + "testcase-timeout":"30000" + }, + "kits": [ + { + "test-file-name": [ + "AbilityMonitorTest.hap" + ], + "type": "AppInstallKit", + "run-command": [ + " hilog -Q pidoff", + "hilog -Q domainoff", + "hilog -b D", + "hilog -r" + ], + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/abilitymontior/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ae1bf3ce4d07b5d5a4e8bc485d994849d55de70 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* +* 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("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..7cd4a33f11a19e9f1af2922cd76c4c4ff3341943 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,53 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + globalThis.abilityWant = want; + globalThis.abilityWant.parameters.timeout = 15000; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6091c2af5b5261edb91ea6c462b18821acb16285 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..f2ddb735e77f9e54a6bc0e517aaec89cf917d246 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,54 @@ +/* +* 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 MainAbility2 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility2 onCreate") + globalThis.abilityWant = want; + globalThis.abilityContext = this.context + } + + onDestroy() { + console.log("[Demo] MainAbility2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility2 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + setTimeout(()=>{ + globalThis.abilityContext.terminateSelf().then(()=>{ + console.log("====>in terminateSelf====>"); + }) + },2000) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility2 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility2 onBackground") + } +}; diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..245b0a8c011df578ec5694474ce81f214b20833c --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonevent' + +function PublishCallBack() { + console.debug("====>Publish CallBack ====>"); +} +export default class MainAbility3 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility3 onCreate") + globalThis.abilityWant = want; + globalThis.abilityContext = this.context + } + + onDestroy() { + console.log("[Demo] MainAbility3 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility3 onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + setTimeout(()=>{ + globalThis.abilityContext.terminateSelf().then(()=>{ + console.log("====>in terminateSelf====>"); + }) + },2000) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility3 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility3 onForeground") + commonEvent.publish("commonEvent_foreground", PublishCallBack); + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility3 onBackground") + } +}; diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility4/MainAbility4.ts b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility4/MainAbility4.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd3a47d657b78d181e97370cd51b527d229c3f01 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/MainAbility4/MainAbility4.ts @@ -0,0 +1,54 @@ +/* +* 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 MainAbility4 extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + globalThis.abilityContext = this.context + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + setTimeout(()=>{ + globalThis.abilityContext.terminateSelf().then(()=>{ + console.log("====>in terminateSelf====>"); + }) + },2000) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/abilitymontior/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9c1933695ecf0b16c64ab77ac2e65fa852a089a --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilitydelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/abilitymontior/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d55fb10291670d788c540dc369a36dd6ae5ce94 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/pages/index.ets @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..37cbf1f99eb45f18ed24e7e79b360cbb2872bbdd --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,2234 @@ +/* + * 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 'hypium/index' +import abilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import Subscriber from '@ohos.commonEvent' + +export default function abilityTest() { + describe('ActsAbilityMonitor', function () { + + /** + * @tc.number: ACTS_AddAbilityMonitor_Callback_0100 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility to trigger onAbilityCreate (Callback). + */ + it('ACTS_AddAbilityMonitor_Callback_0100', 0, async function (done) { + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + function onAbilityCreate() { + console.debug("====>0100--onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_0100", AddAbilityData, publishCallback); + } + console.debug("====>ACTS_AddAbilityMonitor_0100 start====>"); + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_0100"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("0100getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + }, (async (err) => { + console.debug("====>ACTS_AddAbilityMonitor_0100 addAbilityMonitor====>" + err.code); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>0100startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_0100===createSubscriber" + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_0100CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, (err, data) => { + console.log('===UnSubscribeCallBacka===' + err.code) + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Callback_0200 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility to + * trigger onAbilityForeground (Callback). + */ + it('ACTS_AddAbilityMonitor_Callback_0200', 0, async function (done) { + function onAbilityForeground() { + console.debug("====>0200--onAbilityForeground====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_0200", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_0200"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("0200getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onAbilityForeground: onAbilityForeground + }, (async (err) => { + console.debug("====>ACTS_AddAbilityMonitor_0200 success====>" + err.code); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>0200startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_0200===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(data, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_0200CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, (err, data) => { + console.log('===UnSubscribeCallBack===' + err.code) + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Callback_0300 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility to trigger + * onAbilityBackground (Callback). + */ + it('ACTS_AddAbilityMonitor_Callback_0300', 0, async function (done) { + function onAbilityBackgroundPromise() { + console.debug("====>onAbilityBackgroundPromise ====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_0300", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + function UnSubscribeCallback() { + console.debug("====>commonEvent_foreground UnSubscribeCallback====>"); + } + function SubscribeCallBack(err, data) { + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_0300===createSubscriber" + JSON.stringify(data)); + var AddAbility = data + Delegator.getCurrentTopAbility().then((ability) => { + console.info("===ACTS_AddAbilityMonitor_0300===ability" + JSON.stringify(ability)); + Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_0300CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBack===') + Subscriber.unsubscribe(subscriber, UnSubscribeCallback); + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + Delegator.doAbilityBackground(ability).then(async (data) => { + console.info("===ACTS_AddAbilityMonitor_0300===data" + JSON.stringify(data)); + expect(data).assertEqual(true) + }) + }) + }) + } + var AddAbilityData + var subscriber + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_0300"] + }; + var commonEvent_Foreground = { + events: ["commonEvent_foreground"] + }; + var Delegator = abilityDelegatorRegistry.getAbilityDelegator() + console.log("1000getAbilityDelegator data is" + JSON.stringify(Delegator)) + Delegator.addAbilityMonitor( + { + abilityName: 'MainAbility3', + onAbilityBackground: onAbilityBackgroundPromise + }, (async (err) => { + console.debug("====>ACTS_AddAbilityMonitor_0300 addAbilityMonitor====>" + err.code); + })) + Subscriber.createSubscriber(commonEvent_Foreground, async (err, data) => { + console.debug("====>Create Subscriber====>"); + subscriber = data; + Subscriber.subscribe(subscriber, SubscribeCallBack); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility3' + }).then(async () => { + console.debug("====>startAbility success====>"); + }) + }) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Callback_0400 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityDestroy (Callback). + */ + it('ACTS_AddAbilityMonitor_Callback_0400', 0, async function (done) { + function onAbilityDestroy() { + console.debug("====>onAbilityDestroy====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_0400", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_0400"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("0400getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility4', + onAbilityDestroy: onAbilityDestroy + }, (async (err) => { + console.debug("====>ACTS_AddAbilityMonitor_0400 success====>" + err.code); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility4' + }).then(async () => { + console.debug("====>0400startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_0400===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(data, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_0400CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, (err, data) => { + console.log('===UnSubscribeCallBack===' + err.code) + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Callback_0500 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onWindowStageCreate (Callback). + */ + it('ACTS_AddAbilityMonitor_Callback_0500', 0, async function (done) { + function onWindowStageCreate() { + console.debug("====>onWindowStageCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_0500", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_0500"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("0500getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onWindowStageCreate: onWindowStageCreate + }, (async (err) => { + console.debug("====>ACTS_AddAbilityMonitor_0500 success====>" + err.code); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>0500startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_0500===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(data, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_0500CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, (err, data) => { + console.log('===UnSubscribeCallBacke===' + err.code) + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Callback_0600 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onWindowStageDestroy (Callback). + */ + it('ACTS_AddAbilityMonitor_Callback_0600', 0, async function (done) { + function onWindowStageDestroy() { + console.debug("====>onWindowStageDestroy====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_0600", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_0600"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("0700getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility4', + onWindowStageDestroy: onWindowStageDestroy + }, (async (err) => { + console.debug("====>ACTS_AddAbilityMonitor_0600 success====>" + err.code); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility4' + }).then(async () => { + console.debug("====>0600startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_0600===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(data, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_0600CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBackf===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Callback_0700 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate with many + * a time (Callback). + */ + it('ACTS_AddAbilityMonitor_Callback_0700', 0, async function (done) { + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + function onAbilityCreate() { + console.debug("====>0700--onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_0700", AddAbilityData, publishCallback); + } + var AddAbilityData + console.debug("====>ACTS_AddAbilityMonitor_0700 start====>"); + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_0700"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("0700getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + }, (async (err) => { + console.debug("====>ACTS_AddAbilityMonitor_0700 addAbilityMonitorfir====>" + err.code); + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + }, (async (err) => { + console.debug("====>ACTS_AddAbilityMonitor_0700 addAbilityMonitorsec====>" + err.code); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>0700startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_0700===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_0700CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, (err, data) => { + console.log('===UnSubscribeCallBacka===' + err.code) + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + })) + })) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Promise_0100 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate (promise). + */ + it('ACTS_AddAbilityMonitor_Promise_0100', 0, async function (done) { + function onAbilityCreatePromise() { + console.debug("====>onAbilityCreatePromise ====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_0800", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_0800"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("ACTS_AddAbilityMonitor_0800 data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreatePromise + }).then(() => { + console.debug("====>ACTS_AddAbilityMonitor_0800 success====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>0800startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_0800===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_0800CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, (err, data) => { + console.log('===UnSubscribeCallBack===' + err.code) + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Promise_0200 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityForeground (promise). + */ + it('ACTS_AddAbilityMonitor_Promise_0200', 0, async function (done) { + function onAbilityForegroundPromise() { + console.debug("====>onAbilityForegroundPromise ====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_0900", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_0900"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("0900getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onAbilityForeground: onAbilityForegroundPromise + }).then(async () => { + console.debug("====>ACTS_AddAbilityMonitor_0900 success====>"); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>0900startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_0900===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_0900CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBack===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Promise_0300 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityBackground (promise). + */ + it('ACTS_AddAbilityMonitor_Promise_0300', 0, async function (done) { + function onAbilityBackgroundPromise() { + console.debug("====>onAbilityBackgroundPromise ====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_1000", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + function UnSubscribeCallback() { + console.debug("====>commonEvent_foreground UnSubscribeCallback====>"); + } + function SubscribeCallBack(err, data) { + console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data)); + Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_1000===createSubscriber" + JSON.stringify(data)); + var AddAbility = data + Delegator.getCurrentTopAbility().then((ability) => { + console.info("===ACTS_AddAbilityMonitor_1000===ability" + JSON.stringify(ability)); + Delegator.doAbilityBackground(ability).then(async (data) => { + console.info("===ACTS_AddAbilityMonitor_1000===data" + JSON.stringify(data)); + expect(data).assertEqual(true) + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_1000CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBack===') + Subscriber.unsubscribe(subscriber, UnSubscribeCallback); + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + } + var AddAbilityData + var subscriber + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_1000"] + }; + var commonEvent_Foreground = { + events: ["commonEvent_foreground"] + }; + var Delegator = abilityDelegatorRegistry.getAbilityDelegator() + console.log("1000getAbilityDelegator data is" + JSON.stringify(Delegator)) + Delegator.addAbilityMonitor( + { + abilityName: 'MainAbility3', + onAbilityBackground: onAbilityBackgroundPromise + }).then(async () => { + console.debug("====>ACTS_AddAbilityMonitor_1000 success====>"); + }) + await Subscriber.createSubscriber(commonEvent_Foreground, async (err, data) => { + console.debug("====>Create Subscriber====>"); + subscriber = data; + Subscriber.subscribe(subscriber, SubscribeCallBack); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility3' + }).then(async () => { + console.debug("====>startAbility success====>"); + }) + }) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Promise_0400 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityDestroy (promise). + */ + it('ACTS_AddAbilityMonitor_Promise_0400', 0, async function (done) { + function onAbilityDestroyPromise() { + console.debug("====>onAbilityDestroyPromise====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_1100", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_1100"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("1100getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility4', + onAbilityDestroy: onAbilityDestroyPromise + }).then(async () => { + console.debug("====>ACTS_AddAbilityMonitor_1100 success====>"); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility4' + }).then(async () => { + console.debug("====>1100startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_1100===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(data, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_1100CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, (err, data) => { + console.log('===UnSubscribeCallBack===' + err.code) + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Promise_0500 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onWindowStageCreate (promise). + */ + it('ACTS_AddAbilityMonitor_Promise_0500', 0, async function (done) { + function onWindowStageCreatePromise() { + console.debug("====>onWindowStageCreatePromise====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_1200", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_1200"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("1200getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onWindowStageCreate: onWindowStageCreatePromise + }).then(async () => { + console.debug("====>ACTS_AddAbilityMonitor_1200 success====>"); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>1200startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_1200===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(data, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_1200CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, (err, data) => { + console.log('===UnSubscribeCallBack===' + err.code) + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Promise_0600 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onWindowStageDestroy (promise). + */ + it('ACTS_AddAbilityMonitor_Promise_0600', 0, async function (done) { + function onWindowStageDestroyPromsie() { + console.debug("====>onWindowStageDestroyPromsie====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_1300", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_1300"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("1300getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility4', + onWindowStageDestroy: onWindowStageDestroyPromsie + }).then(async () => { + console.debug("====>ACTS_AddAbilityMonitor_1300 success====>"); + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility4' + }).then(async () => { + console.debug("====>1300startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_1300===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(data, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_1300CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBack===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + }) + + /** + * @tc.number: ACTS_AddAbilityMonitor_Promise_0700 + * @tc.name: Verify that the addAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate with many + * a time (promise). + */ + it('ACTS_AddAbilityMonitor_Promise_0700', 0, async function (done) { + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + function onAbilityCreate() { + console.debug("====>1400--onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_AddAbilityMonitor_1400", AddAbilityData, publishCallback); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_AddAbilityMonitor_1400"] + }; + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("1400getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + }).then(async () => { + data.addAbilityMonitor( + { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + }).then(async () => { + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>1400startAbility success====>"); + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_AddAbilityMonitor_1400===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_AddAbilityMonitor_1400CallBack===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, (err, data) => { + console.log('===UnSubscribeCallBack===' + err.code) + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + }) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Callback_0100 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityCreate (Callback). + */ + it('ACTS_RemoveAbilityMonitor_Callback_0100', 0, async function (done) { + function onAbilityCreate() { + CallbackFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var CallbackFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0100-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0100-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor, (err) => { + console.debug("====>0100removeAbilityMonitor success====>" + err.code); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>remove0100 startAbility end====>"); + expect(CallbackFlag).assertEqual(0) + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Callback_0200 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityForeground (Callback). + */ + it('ACTS_RemoveAbilityMonitor_Callback_0200', 0, async function (done) { + function onAbilityForeground() { + CallbackFlag = -1 + console.debug("====>onAbilityForeground ====>"); + } + var CallbackFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityForeground: onAbilityForeground + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0200-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0200-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor, (err) => { + console.debug("====>0200removeAbilityMonitor success====>" + err.code); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>remove0200 startAbility end====>"); + expect(CallbackFlag).assertEqual(0) + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Callback_0300 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityBackground (Callback). + */ + it('ACTS_RemoveAbilityMonitor_Callback_0300', 0, async function (done) { + function onAbilityBackground() { + CallbackFlag = -1 + console.debug("====>onAbilityBackground ====>"); + } + var CallbackFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityBackground: onAbilityBackground + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0300-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0300-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor, (err) => { + console.debug("====>0300removeAbilityMonitor success====>" + err.code); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + expect(CallbackFlag).assertEqual(0) + console.debug("====>remove0300 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Callback_0400 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityDestroy (Callback). + */ + it('ACTS_RemoveAbilityMonitor_Callback_0400', 0, async function (done) { + function onAbilityDestroy() { + CallbackFlag = -1 + console.debug("====>onAbilityDestroy ====>"); + } + var CallbackFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityDestroy: onAbilityDestroy + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0400-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0400-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor, (err) => { + console.debug("====>0400removeAbilityMonitor success====>" + err.code); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + expect(CallbackFlag).assertEqual(0) + console.debug("====>remove0400 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Callback_0500 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onWindowStageCreate (Callback). + */ + it('ACTS_RemoveAbilityMonitor_Callback_0500', 0, async function (done) { + function onWindowStageCreate() { + CallbackFlag = -1 + console.debug("====>onWindowStageCreate ====>"); + } + var CallbackFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onWindowStageCreate: onWindowStageCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0500-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0500-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor, (err) => { + console.debug("====>0500removeAbilityMonitor success====>" + err.code); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + expect(CallbackFlag).assertEqual(0) + console.debug("====>remove0500 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Callback_0600 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onWindowStageDestroy (Callback). + */ + it('ACTS_RemoveAbilityMonitor_Callback_0600', 0, async function (done) { + function onWindowStageDestroy() { + CallbackFlag = -1 + console.debug("====>onWindowStageDestroy ====>"); + } + var CallbackFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onWindowStageDestroy: onWindowStageDestroy + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0600-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0600-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor, (err) => { + console.debug("====>0600removeAbilityMonitor success====>" + err.code); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + expect(CallbackFlag).assertEqual(0) + console.debug("====>remove0600 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Callback_0700 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityCreate (Callback). + */ + it('ACTS_RemoveAbilityMonitor_Callback_0700', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0700-getAbilityDelegator data is" + JSON.stringify(data)) + await data.removeAbilityMonitor({ + abilityName: 'WrongName', + onAbilityCreate: onAbilityCreate + }, (err) => { + console.debug("====>0700removeAbilityMonitor success====>" + err.code); + expect(err.code).assertEqual(0) + done(); + }) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Callback_0800 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityCreate (Callback). + */ + it('ACTS_RemoveAbilityMonitor_Callback_0800', 0, async function (done) { + function onAbilityCreate() { + CallbackFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var CallbackFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0800-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0800-waitAbilityMonitor success====>" + err.code); + })) + data.removeAbilityMonitor(monitor, (err) => { + console.debug("====>0800removeAbilityMonitor success====>" + err.code); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>remove0800 startAbility end====>"); + expect(CallbackFlag).assertEqual(0) + setTimeout(() => { + done(); + }, 2500) + }) + }) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Promise_0100 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityCreate (promise). + */ + it('ACTS_RemoveAbilityMonitor_Promise_0100', 0, async function (done) { + function onAbilityCreate() { + PromiseFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var PromiseFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0100-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0100-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor).then(() => { + console.debug("====>0100removeAbilityMonitor success====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>remove0100 startAbility end====>"); + expect(PromiseFlag).assertEqual(0) + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Promise_0200 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityForeground (promise). + */ + it('ACTS_RemoveAbilityMonitor_Promise_0200', 0, async function (done) { + function onAbilityForeground() { + PromiseFlag = -1 + console.debug("====>onAbilityForeground ====>"); + } + var PromiseFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityForeground: onAbilityForeground + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0200-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0200-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor).then(() => { + console.debug("====>0200removeAbilityMonitor success====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>remove0200 startAbility end====>"); + expect(PromiseFlag).assertEqual(0) + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Promise_0300 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityBackground (promise). + */ + it('ACTS_RemoveAbilityMonitor_Promise_0300', 0, async function (done) { + function onAbilityBackground() { + PromiseFlag = -1 + console.debug("====>onAbilityBackground ====>"); + } + var PromiseFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityBackground: onAbilityBackground + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0300-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0300-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor).then(() => { + console.debug("====>0300removeAbilityMonitor success====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + expect(PromiseFlag).assertEqual(0) + console.debug("====>remove0300 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Promise_0400 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityDestroy (promise). + */ + it('ACTS_RemoveAbilityMonitor_Promise_0400', 0, async function (done) { + function onAbilityDestroy() { + PromiseFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var PromiseFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityDestroy: onAbilityDestroy + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0400-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0400-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor).then(() => { + console.debug("====>0400removeAbilityMonitor success====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + expect(PromiseFlag).assertEqual(0) + console.debug("====>remove0400 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Promise_0500 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onWindowStageCreate (promise). + */ + it('ACTS_RemoveAbilityMonitor_Promise_0500', 0, async function (done) { + function onWindowStageCreate() { + PromiseFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var PromiseFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onWindowStageCreate: onWindowStageCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0500-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0500-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor).then(() => { + console.debug("====>0500removeAbilityMonitor success====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + expect(PromiseFlag).assertEqual(0) + console.debug("====>remove0500 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Promise_0600 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onWindowStageDestroy (promise). + */ + it('ACTS_RemoveAbilityMonitor_Promise_0600', 0, async function (done) { + function onWindowStageDestroy() { + PromiseFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var PromiseFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onWindowStageDestroy: onWindowStageDestroy + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0600-getAbilityDelegator data is" + JSON.stringify(data)) + data.addAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0600-addAbilityMonitor success====>" + err.code); + await data.removeAbilityMonitor(monitor).then(() => { + console.debug("====>0600removeAbilityMonitor success====>"); + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + expect(PromiseFlag).assertEqual(0) + console.debug("====>remove0600 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }) + })) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Promise_0700 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use addAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityCreate (promise). + */ + it('ACTS_RemoveAbilityMonitor_Promise_0700', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0700-getAbilityDelegator data is" + JSON.stringify(data)) + data.removeAbilityMonitor({ + abilityName: 'WrongName', + onAbilityCreate: onAbilityCreate + }).then(() => { + console.debug("====>0700 removeAbilityMonitorPromise====>") + setTimeout(() => { + done(); + }, 2500) + }).catch((err) => { + console.debug("====>0700removeAbilityMonitorPromise success====>" + err); + expect().assertFail() + setTimeout(() => { + done(); + }, 1500) + }) + }) + + /** + * @tc.number: ACTS_RemoveAbilityMonitor_Promise_0800 + * @tc.name: Verify that the removeAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add monitor and use removeAbilityMonitor + * to remove monitor then trigger + * onAbilityCreate (promise). + */ + it('ACTS_RemoveAbilityMonitor_Promise_0800', 0, async function (done) { + function onAbilityCreate() { + PromiseFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var PromiseFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("remove0800-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, (async (err) => { + console.debug("====>remove0800-waitAbilityMonitor success====>" + err.code); + })) + await data.removeAbilityMonitor(monitor).then(() => { + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + console.debug("====>remove0800 startAbility end====>"); + expect(PromiseFlag).assertEqual(0) + setTimeout(() => { + done(); + }, 2500) + }) + }) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Callback_0100 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate (Callback). + */ + it('ACTS_WaitAbilityMonitor_Callback_0100', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_WaitAbilityMonitor_Callback_0100", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_WaitAbilityMonitor_Callback_0100"] + }; + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0100-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, async (err, data) => { + console.log('===>0100err.code is===>' + JSON.stringify(err.code)) + expect(err.code).assertEqual(0) + console.debug("====>ACTS_WaitAbilityMonitor_Callback_0100 success====>"); + }) + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_WaitAbilityMonitor_Callback_0100===createSubscriber" + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_WaitAbilityMonitor_Callback_0100===' + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBack===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Callback_0200 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate exceed + * 5s(Callback). + */ + it('ACTS_WaitAbilityMonitor_Callback_0200', 0, async function (done) { + function onAbilityCreate() { + CallbackFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var CallbackFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0200-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, (err, waitability) => { + console.debug("====>ACTS_WaitAbilityMonitor_Callback_0200 success====>"); + expect(err.code).assertEqual(-1) + console.log('===>0200err.code is===>' + JSON.stringify(err.code)) + }) + setTimeout(() => { + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(() => { + expect(CallbackFlag).assertEqual(0) + console.log('===>0200CallbackFlag is===>' + JSON.stringify(CallbackFlag)) + console.debug("====>remove0200 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }, 5500) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Callback_0300 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate in + * 1s(Callback). + */ + it('ACTS_WaitAbilityMonitor_Callback_0300', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_WaitAbilityMonitor_Callback_0300", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_WaitAbilityMonitor_Callback_0300"] + }; + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0300-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, 1000, async (err, data) => { + console.log('===>0300err.code is===>' + JSON.stringify(err.code)) + expect(err.code).assertEqual(0) + console.debug("====>ACTS_WaitAbilityMonitor_Callback_0300 success====>"); + }) + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_WaitAbilityMonitor_Callback_0300===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_WaitAbilityMonitor_Callback_0300===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBack===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Callback_0400 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate exceed + * 1s (Callback). + */ + it('ACTS_WaitAbilityMonitor_Callback_0400', 0, async function (done) { + function onAbilityCreate() { + CallbackFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var CallbackFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0400-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, 1000, (err, waitability) => { + console.debug("====>ACTS_WaitAbilityMonitor_Callback_0400 success====>"); + expect(err.code).assertEqual(-1) + console.log('===>0400err.code is===>' + JSON.stringify(err.code)) + }) + setTimeout(() => { + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(() => { + expect(CallbackFlag).assertEqual(0) + console.log('===>0400CallbackFlag is===>' + JSON.stringify(CallbackFlag)) + console.debug("====>remove0400 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }, 1500) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Callback_0500 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate in + * 5s (Callback). + */ + it('ACTS_WaitAbilityMonitor_Callback_0500', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_WaitAbilityMonitor_Callback_0500", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_WaitAbilityMonitor_Callback_0500"] + }; + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0500-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, 0, async (err, data) => { + console.log('===>0500err.code is===>' + JSON.stringify(err.code)) + expect(err.code).assertEqual(0) + console.debug("====>ACTS_WaitAbilityMonitor_Callback_0500 success====>"); + }) + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_WaitAbilityMonitor_Callback_0500===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_WaitAbilityMonitor_Callback_0500===' + err.code + + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBackU===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Callback_0600 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate in + * 5s (Callback). + */ + it('ACTS_WaitAbilityMonitor_Callback_0600', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_WaitAbilityMonitor_Callback_0600", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_WaitAbilityMonitor_Callback_0600"] + }; + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0600-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, -1, async (err, data) => { + console.log('===>0600err.code is===>' + JSON.stringify(err.code)) + expect(err.code).assertEqual(0) + console.debug("====>ACTS_WaitAbilityMonitor_Callback_0600 success====>"); + }) + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_WaitAbilityMonitor_Callback_0600===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_WaitAbilityMonitor_Callback_0600===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBackU===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Promise_0100 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate (promise). + */ + it('ACTS_WaitAbilityMonitor_Promise_0100', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_WaitAbilityMonitor_Promise_0100", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_WaitAbilityMonitor_Promise_0100"] + }; + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0500-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor).then(async (data) => { + console.debug("====>ACTS_WaitAbilityMonitor_Promise_0100 success====>"); + }) + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_WaitAbilityMonitor_Promise_0100===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_WaitAbilityMonitor_Promise_0100===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBack===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Promise_0200 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate exceed + * 5s (promise). + */ + it('ACTS_WaitAbilityMonitor_Promise_0200', 0, async function (done) { + function onAbilityCreate() { + PromiseFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var PromiseFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0200-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor).then((data) => { + console.debug("====>ACTS_WaitAbilityMonitor_Callback_0200 success====>"); + }) + setTimeout(() => { + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(() => { + expect(PromiseFlag).assertEqual(0) + console.log('===>0200PromiseFlag is===>' + JSON.stringify(PromiseFlag)) + setTimeout(() => { + done(); + }, 2500) + }) + }, 5500) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Promise_0300 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate in + * 1s (promise). + */ + it('ACTS_WaitAbilityMonitor_Promise_0300', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_WaitAbilityMonitor_Promise_0300", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_WaitAbilityMonitor_Promise_0300"] + }; + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0300-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, 1000).then(async (data) => { + console.debug("====>ACTS_WaitAbilityMonitor_Promise_0300 success====>"); + }) + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_WaitAbilityMonitor_Promise_0300===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_WaitAbilityMonitor_Promise_0300===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBackM===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Promise_0400 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate exceed + * 1s (promise). + */ + it('ACTS_WaitAbilityMonitor_Promise_0400', 0, async function (done) { + function onAbilityCreate() { + PromiseFlag = -1 + console.debug("====>onAbilityCreate ====>"); + } + var PromiseFlag = 0 + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0400-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, 1000).then((data) => { + console.debug("====>ACTS_WaitAbilityMonitor_Promise_0400 success====>"); + }) + setTimeout(() => { + globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(() => { + expect(PromiseFlag).assertEqual(0) + console.log('===>0400PromiseFlag is===>' + JSON.stringify(PromiseFlag)) + console.debug("====>remove0400 startAbility end====>"); + setTimeout(() => { + done(); + }, 2500) + }) + }, 1500) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Promise_0500 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate in + * 5s (promise). + */ + it('ACTS_WaitAbilityMonitor_Promise_0500', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_WaitAbilityMonitor_Promise_0500", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_WaitAbilityMonitor_Promise_0500"] + }; + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0500-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, 100).then(async (data) => { + console.debug("====>ACTS_WaitAbilityMonitor_Promise_0500 success====>"); + }) + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_WaitAbilityMonitor_Promise_0500===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_WaitAbilityMonitor_Promise_0500===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBack===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + + /** + * @tc.number: ACTS_WaitAbilityMonitor_Promise_0600 + * @tc.name: Verify that the waitAbilityMonitor interface functions normally. + * @tc.desc: Use waitAbilityMonitor to add a monitor then use startAbility + * to trigger onAbilityCreate in + * 5s (promise). + */ + it('ACTS_WaitAbilityMonitor_Promise_0600', 0, async function (done) { + function onAbilityCreate() { + console.debug("====>onAbilityCreate====>"); + AddAbilityData = { + code: 1 + } + Subscriber.publish("ACTS_WaitAbilityMonitor_Promise_0600", AddAbilityData, publishCallback); + } + function publishCallback(err) { + console.info("===>publishCallback" + err.code); + expect(err.code).assertEqual(0); + } + var AddAbilityData + var commonEventSubscribeInfo = { + events: ["ACTS_WaitAbilityMonitor_Promise_0600"] + }; + var monitor = { + abilityName: 'MainAbility2', + onAbilityCreate: onAbilityCreate + } + var data = abilityDelegatorRegistry.getAbilityDelegator() + console.log("wait0600-getAbilityDelegator data is" + JSON.stringify(data)) + data.waitAbilityMonitor(monitor, -1).then(async (data) => { + console.debug("====>ACTS_WaitAbilityMonitor_Promise_0600 success====>"); + }) + await globalThis.abilitydelegator.startAbility( + { + bundleName: 'com.example.abilitymonitortest', + abilityName: 'MainAbility2' + }).then(async () => { + await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + console.info("===ACTS_WaitAbilityMonitor_Promise_0600===createSubscriber" + + JSON.stringify(data)); + var AddAbility = data + await Subscriber.subscribe(AddAbility, (err, data) => { + console.log('===ACTS_WaitAbilityMonitor_Promise_0600===' + + err.code + JSON.stringify(data)) + Subscriber.unsubscribe(AddAbility, () => { + console.log('===UnSubscribeCallBack===') + }) + if (data.code == 1) { + expect(data.code).assertEqual(1); + setTimeout(() => { + done(); + }, 2500) + } + else { + expect().assertFail(); + setTimeout(() => { + done(); + }, 2500) + } + }) + }) + }) + }) + + }) +} + + diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf6f241a06f8aa77442bd600ce6e870c760e88fe --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/module.json b/ability/ability_runtime/abilitymontior/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..f5cda5bfa8510fc7353208936a4191a2bb79f29e --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/module.json @@ -0,0 +1,63 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label", + "visible": true, + "launchType": "singleton" + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label", + "visible": true, + "launchType": "singleton" + }, + { + "name": "MainAbility4", + "srcEntrance": "./ets/MainAbility4/MainAbility4.ts", + "description": "$string:MainAbility4_desc", + "icon": "$media:icon", + "label": "$string:MainAbility4_label", + "visible": true, + "launchType": "singleton" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitymontior/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..5ada6af0c9cd0329a8597d0ce85c811aa83bef39 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/resources/base/element/string.json @@ -0,0 +1,48 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "MainAbility4_desc", + "value": "description" + }, + { + "name": "MainAbility4_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AbilityMonitorTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitymontior/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/abilitymontior/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitymontior/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/abilitymontior/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitymontior/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitymontior/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitymontior/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsabilityusertest/AppScope/app.json b/ability/ability_runtime/actsabilityusertest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..8c4bd449f34c37954d13a71b057eb7165cb30b1b --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsabilityusertest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsabilityusertest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsabilityusertest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..351f3d3f88bfed2e67a83773ddfd3fd438639824 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsabilityusertest" + } + ] +} diff --git a/ability/ability_runtime/actsabilityusertest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsabilityusertest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsabilityusertest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsabilityusertest/BUILD.gn b/ability/ability_runtime/actsabilityusertest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ceb477ada1b28a8c1d798d36a2d0c0d4d7f659bc --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsAbilityuserTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsabilityusertest_js_assets", + ":actsabilityusertest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAbilityuserTest" +} + +ohos_app_scope("actsabilityusertest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsabilityusertest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsabilityusertest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsabilityusertest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsabilityusertest/Test.json b/ability/ability_runtime/actsabilityusertest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..9330e2b5d4fa7a2290933a90055b067218db40f7 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsabilityusertest", + "module-name": "entry", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAbilityuserTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..32dfe93ccff0375201857794de902cec4d239442 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..ec269f7c2b85395f8335b2ad3f226ee3aeac7fd0 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,38 @@ +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + globalThis.abilityContext = this.context; + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d55879f3923d5f6a95525162dc5ebb865d7aa28 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility/pages/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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..27687000ee9c7b7b36542b4741c1efbf997ecf8d --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,55 @@ +// @ts-nocheck +/* + * 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_Start_CommonEvent====>"); + console.debug("====>close this context====>3====>"); +} +export default class MainAbility2 extends Ability { + + onCreate(want, launchParam) { + 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"); + windowStage.setUIContent(this.context, "pages/index2", null); + globalThis.ability3Context = this.context; + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility2 onWindowStageDestroy"); + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility2 onForeground"); + commonEvent.publish("ACTS_StartAbility_CommonEvent", PublishCallBackOne); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility2 onBackground"); + } +}; diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..0dab7b9eda1aea20644fdbc997e233c1f09031a0 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,55 @@ +// @ts-nocheck +/* + * 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_Start_CommonEvent====>"); + console.debug("====>close this context====>4====>"); +} +export default class MainAbility3 extends Ability { + + onCreate(want, launchParam) { + console.log("MainAbility3 onCreate"); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility3 onDestroy"); + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility3 onWindowStageCreate"); + windowStage.setUIContent(this.context, "pages/index3", null); + globalThis.ability4Context = this.context; + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility3 onWindowStageDestroy"); + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility3 onForeground"); + commonEvent.publish("ACTS_StartAbility_CommonEvent", PublishCallBackOne); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility3 onBackground"); + } +}; diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..8bcafe1a40fc3b9702796858d60586b21049c85c --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,58 @@ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index2.ets b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index2.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae4dc02582f7c4aaf7583dee23b1f2383a481cb0 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index2.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World3' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index3.ets b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index3.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae4dc02582f7c4aaf7583dee23b1f2383a481cb0 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/pages/index3.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World3' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..31deb86105aa74daa94008661b806e39d3de110b --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,225 @@ +/* + * 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 "hypium/index" +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import commonEvent from '@ohos.commonevent' +var subscriberInfo_MainAbility = { + events: ["ACTS_StartAbility_CommonEvent"] +}; +const START_ABILITY_TIMEOUT = 4000; +export default function abilityTest() { + describe('ACTS_StartAbility_Test', function () { + + /* + * @tc.number : ACTS_StartAbility_Callback_Successfully_0100 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(callback) + */ + it('ACTS_StartAbility_Callback_Successfully_0100', 0, async function (done) { + var Subscriber + var flag = true + var startresult = false + + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_StartAbility_CommonEvent").assertTrue(); + console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ACTS_StartAbility_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + done(); + } + + await commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsabilityusertest', + abilityName: 'MainAbility2' + }, () => { + console.log("====>startAbility end====>"); + }) + }) + }) + + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_StartAbility_Callback_Successfully_0100 - timeout') + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartAbility_Callback_Error_0200 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability failed.(callback) + */ + it('ACTS_StartAbility_Callback_Error_0200', 0, async function (done) { + var AbilityDelegatorArgs = AbilityDelegatorRegistry.getArguments() + console.log("====>getArguments is====>" + JSON.stringify(AbilityDelegatorArgs)); + var Subscriber + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.log("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + done(); + } + + await commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + await globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.error', + abilityName: 'com.example.error.MainAbility2' + }, () => { + console.log("====>startAbility end====>"); + }) + }) + }) + + function timeout() { + console.log('ACTS_StartAbility_Callback_Error_0200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartAbility_Promise_Successfully_0100 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(callback) + */ + it('ACTS_StartAbility_Promise_Successfully_0100', 0, async function (done) { + var Subscriber + var flag = true + var startresult = false + + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_StartAbility_CommonEvent").assertTrue(); + console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ACTS_StartAbility_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + done(); + } + + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + await globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsabilityusertest', + abilityName: 'MainAbility3' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_StartAbility_Promise_Successfully_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartAbility_Promise_Error_0200 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability failed.(callback) + */ + it('ACTS_StartAbility_Promise_Error_0200', 0, async function (done) { + var AbilityDelegatorArgs = AbilityDelegatorRegistry.getArguments() + console.log("====>getArguments is====>" + JSON.stringify(AbilityDelegatorArgs)); + var Subscriber + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.log("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + done(); + } + + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.error', + abilityName: 'com.example.error.MainAbility2' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + + function timeout() { + console.log('ACTS_StartAbility_Promise_Error_0200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/module.json b/ability/ability_runtime/actsabilityusertest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..4085e71d212cab75c38a50307aad7f60cc424e45 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/module.json @@ -0,0 +1,51 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label" + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsabilityusertest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a74dd0a469fb6b096665fc61dc0c4540caa4808d --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsabilityusertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsabilityusertest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsabilityusertest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsabilityusertest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsabilityusertest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsabilityusertest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsabilityusertest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/js/test/DataAbilityHelperJsSt.test.js b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/js/test/DataAbilityHelperJsSt.test.js index 4b13f8ccfd86edf623d24b98c1c03104acc03d37..e204b13300fb79e037cc50542e8647d4ceea252c 100644 --- a/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/js/test/DataAbilityHelperJsSt.test.js +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/js/test/DataAbilityHelperJsSt.test.js @@ -5247,7 +5247,8 @@ describe('ActsDataAbilityHelperTest', function () { function onAsyncCallback0401(err) { expect(err.code).assertEqual(0); flagCallback01++; - waitDone("onAsyncCallback0401"); + expect(false).assertTrue(); + done() } function onAsyncCallback0402(err) { flagCallback02++; @@ -5261,28 +5262,14 @@ describe('ActsDataAbilityHelperTest', function () { function onAsyncCallback0403(err) { expect(err.code).assertEqual(0); flagCallback03++; - waitDone("onAsyncCallback0403"); + expect(false).assertTrue(); + done() } function waitDone(caller) { console.debug("=ACTS_OnOff_0400 caller ====>" + caller); - if (flagCallback01 == 1 && flagCallback02 == 0 && flagCallback03 == 1) { - clearTimeout(currentAlertTimeout); - function mySetTimeout() { - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0401); - DAHelper.off("dataChange", dataAbilityUri, onAsyncCallback0403); - console.log('ACTS_OnOff_0400==== { - console.debug('ACTS_OnOff_0400====" - + flagCallback01 + flagCallback02 + flagCallback03); + if (flagCallback01 == 0 && flagCallback02 == 0 && flagCallback03 == 0) { + expect("notifyChange").assertEqual(caller); + done() } } try { diff --git a/ability/ability_runtime/actsqueryfunctiontest/BUILD.gn b/ability/ability_runtime/actsqueryfunctiontest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cce952757ea7197dd3aa7b93a89b2eb32d369603 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/BUILD.gn @@ -0,0 +1,28 @@ +# 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") + +group("actsqueryfunctiontest") { + testonly = true + if (is_standard_system) { + deps = [ + "actsgetabilitystatestagetest:ActsGetAbilityStatestAgeTest", + "actsgetappcontextstageatest:ActsGetAppContextStageaTest", + "actsgetappcontextstagebtest:ActsGetAppContextStagebTest", + "actsgetappcontexttest:ActsGetAppContextTest", + "actsgetcurrenttopabilitystageatest:ActsGetcurrentTopAbilityStageaTest", + "actsgetcurrenttopabilitystagebtest:ActsGetCurrentTopAbilityStagebTest", + ] + } +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/AppScope/app.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..ad00225337ceb7814fa596d2cdc4fee0b38db39c --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsgetabilitystatestagetest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7b20d0d51ed0729ee957a1aa9b8db3ffb5554c54 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsGetAbilityStateStageTest" + } + ] +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/BUILD.gn b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..05e5d24a0f57f38ab35f5b88053f60eea172ce51 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsGetAbilityStatestAgeTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsgetabilitystatestagetest_js_assets", + ":actsgetabilitystatestagetest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsGetAbilityStatestAgeTest" +} + +ohos_app_scope("actsgetabilitystatestagetest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsgetabilitystatestagetest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsgetabilitystatestagetest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsgetabilitystatestagetest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/Test.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..14772064daefabc0d8b11e19e5051a49b70c8ecb --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsgetabilitystatestagetest", + "module-name": "entry", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsGetAbilityStatestAgeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5be2c7c7f87be6d34c6145670610bb8274c36f72 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,53 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..8eccbf99bfb4bb39637f09c465100f5e1fad046d --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// @ts-nocheck +import router from '@ohos.router'; +import file from '@system.file'; +import testsuite from "../../test/List.test" +@Entry +@Component +struct Index { + aboutToAppear() { + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..48e2332d00a46d6f719d7e7c1df0c48ab05ed1e2 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -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 Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..cce40226d96f5c3deca26c145d8fa83bedf825a9 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,50 @@ +// @ts-nocheck +/* + * 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 MainAbility3 extends Ability { + + onCreate(want, launchParam) { + console.log("MainAbility3 onCreate") + } + + onDestroy(want) { + // Ability is destroying, release resources for this ability + console.log("MainAbility3 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility3 onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index", null) + globalThis.ability3Context = this.context; + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility3 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility3 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility3 onBackground") + } +}; diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility4/MainAbility4.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility4/MainAbility4.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ea48b09b1b6a68f52861173e2838ea777cfa1a0 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/MainAbility4/MainAbility4.ts @@ -0,0 +1,51 @@ +// @ts-nocheck +/* + * 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 MainAbility4 extends Ability { + + onCreate(want, launchParam) { + console.log("MainAbility4 onCreate") + } + + onDestroy(want) { + // Ability is destroying, release resources for this ability + console.log("MainAbility4 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility4 onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index", null) + globalThis.ability4Context = this.context; + //commonEvent.publish("ACTS_GetAppContext", PublishCallBackOne4); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility4 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility4 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility4 onBackground") + } +}; diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..e91260fa5f26fac6676194e4b369171abac560e7 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c99713b9577d3991546d2b7c560151e27f74b5a --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,197 @@ + +/* + * 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. + */ +// @ts-nocheck +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +const START_ABILITY_TIMEOUT = 4000; + +export default function abilityTest() { + describe('ActsGetAbilityStateStageTest', function () { + + /* + * @tc.number : ACTS_GetAbilityState_0200 + * @tc.name : The test framework needs to provide the following query-related functions + * @tc.desc : Get the status of the Ability in the BACKGROUND state + */ + it('ACTS_GetAbilityState_0200', 0, async function (done) { + console.debug('====>start ACTS_GetAbilityState_0200===='); + var flag = true; + var ability; + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + function onAbilityForegroundCallback2(){ + console.debug("====>onAbilityForegroundCallback2===="); + abilityDelegator.getCurrentTopAbility((err, data)=>{ + console.debug("====>getCurrentTopAbility_0200 err:" + JSON.stringify(err) + " data:" + JSON.stringify(data)); + ability = data; + abilityDelegator.doAbilityBackground(ability, (err, isBackground)=>{ + console.debug("====>doAbilityBackground_0200 data:" + JSON.stringify(isBackground)); + expect(isBackground).assertTrue(); + }) + }) + } + function onAbilityBackgroundCallback2(){ + console.debug("====>onAbilityBackgroundCallback2===="); + var state = abilityDelegator.getAbilityState(ability); + console.debug("====>ACTS_GetAbilityState_0200 state:" + state); + expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.BACKGROUND); + console.debug("====>ACTS_GetAbilityState_0200 end===="); + flag=false; + done(); + } + + + abilityDelegator.addAbilityMonitor( + {abilityName: 'MainAbility2', + onAbilityForeground:onAbilityForegroundCallback2, + onAbilityBackground:onAbilityBackgroundCallback2 + } + ).then(()=>{ + console.debug("====>addAbilityMonitor_0200 finish===="); + globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsgetabilitystatestagetest', + abilityName: 'MainAbility2', + }, (err)=>{ + console.debug("====>startAbility_0200 err:" + JSON.stringify(err)); + }) + }) + + setTimeout(()=>{ + if(flag==true){ + console.debug("====>in timeout 0200===="); + expect().assertFail(); + done(); + } + },START_ABILITY_TIMEOUT) + + }) + + /* + * @tc.number : ACTS_GetAbilityState_0300 + * @tc.name : The test framework needs to provide the following query-related functions + * @tc.desc : Get the status of the Ability in the FOREGROUND state + */ + it('ACTS_GetAbilityState_0300', 0, async function (done) { + console.debug('====>start ACTS_GetAbilityState_0300===='); + var flag = true; + var ability; + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + function onAbilityForegroundCallback3(){ + console.debug("====>onAbilityForegroundCallback3===="); + abilityDelegator.getCurrentTopAbility((err, data)=>{ + console.debug("====>getCurrentTopAbility_0300 err:" + JSON.stringify(err) + "data:" + JSON.stringify(data)); + ability = data; + var state = abilityDelegator.getAbilityState(ability); + console.debug("====>ACTS_GetAbilityState_0300 state:" + state); + expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.FOREGROUND); + abilityDelegator.doAbilityBackground(ability, (err, isBackground)=>{ + console.debug("====>doAbilityBackground_0300 data:" + JSON.stringify(isBackground)); + expect(isBackground).assertTrue(); + console.debug("====>ACTS_GetAbilityState_0300 end===="); + flag=false; + done(); + }) + }) + } + setTimeout(()=>{ + if(flag==true){ + console.debug("====>in timeout 0300===="); + expect().assertFail(); + done(); + } + },START_ABILITY_TIMEOUT) + abilityDelegator.addAbilityMonitor( + {abilityName: 'MainAbility3', + onAbilityForeground:onAbilityForegroundCallback3}).then(()=>{ + console.debug("====>addAbilityMonitor_0300 finish===="); + globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsgetabilitystatestagetest', + abilityName: 'MainAbility3', + }, (err)=>{ + console.debug("====>startAbility_0300 err:" + JSON.stringify(err)); + }) + }) + }) + + /* + * @tc.number : ACTS_GetAbilityState_0500 + * @tc.name : The test framework needs to provide the following query-related functions + * @tc.desc : Get the status of an inactive or nonexistent Ability + */ + it('ACTS_GetAbilityState_0500', 0, async function (done) { + console.debug('====>start ACTS_GetAbilityState_0500===='); + var ability = Object.create(null); + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + var state = abilityDelegator.getAbilityState(ability); + console.debug("====>ACTS_GetAppState_0500 state:" + state); + expect(state).assertEqual(undefined); + console.debug("====>ACTS_GetAbilityState_0500 end===="); + done(); + }) + + /* + * @tc.number : ACTS_GetAbilityState_0600 + * @tc.name : The test framework needs to provide the following query-related functions + * @tc.desc : Get the status of the Ability in the uninitialized state + */ + it('ACTS_GetAbilityState_0600', 0, async function (done) { + console.debug('====>start ACTS_GetAbilityState_0600====') + var flag = true; + var ability; + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + function onAbilityForegroundCallback6(){ + console.debug("====>onAbilityForegroundCallback6===="); + abilityDelegator.getCurrentTopAbility((err, data)=>{ + console.debug("====>getCurrentTopAbility_0600 err:" + JSON.stringify(err) + "data:" + JSON.stringify(data)); + ability = data; + globalThis.ability4Context.terminateSelf(); + }) + } + function onAbilityDestroyCallback6(){ + console.debug("====>onAbilityDestroyCallback6===="); + var state = abilityDelegator.getAbilityState(ability); + console.debug("====>ACTS_GetAbilityState_0600 data:" + state); + console.debug("====>UNINITIALIZED:"+ AbilityDelegatorRegistry.AbilityLifecycleState.UNINITIALIZED); + expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.UNINITIALIZED); + console.debug("====>ACTS_GetAbilityState_0600 end===="); + flag=false; + done(); + } + setTimeout(()=>{ + if(flag==true){ + console.debug("====>in timeout 0600==="); + expect().assertFail(); + done(); + } + },START_ABILITY_TIMEOUT) + abilityDelegator.addAbilityMonitor( + {abilityName: 'MainAbility4', + onAbilityForeground:onAbilityForegroundCallback6, + onAbilityDestroy:onAbilityDestroyCallback6}).then(()=>{ + console.debug("====>addAbilityMonitor_0600 finish===="); + globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsgetabilitystatestagetest', + abilityName: 'MainAbility4', + }, (err)=>{ + console.debug("====>startAbility_0600 err:" + JSON.stringify(err)); + }) + }) + + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..a8779c99a35f86d0fe682bebc3f05922edee2ce3 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/module.json @@ -0,0 +1,58 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label" + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label" + }, + { + "name": "MainAbility4", + "srcEntrance": "./ets/MainAbility4/MainAbility4.ts", + "description": "$string:MainAbility4_desc", + "icon": "$media:icon", + "label": "$string:MainAbility4_label" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6963c59e9176307de889e4dbbf05bac70ce51f79 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,48 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "MainAbility4_desc", + "value": "description" + }, + { + "name": "MainAbility4_label", + "value": "label" + }, + { + "name": "app_name", + "value": "ActsGetAbilityStatestAgeTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/AppScope/app.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..29584eed94b1058c7c7da9ccee1d09b688c845c8 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsgetappcontextstageatest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..272cac70b7d51773ee6a2b3abc128db220bcec95 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsgetappcontextstageatest" + } + ] +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/BUILD.gn b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e353bab17af7977882c7c7c17dfcf3da8d9420e1 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsGetAppContextStageaTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsgetappcontextstageatest_js_assets", + ":actsgetappcontextstageatest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsGetAppContextStageaTest" +} + +ohos_app_scope("actsgetappcontextstageatest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsgetappcontextstageatest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsgetappcontextstageatest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsgetappcontextstageatest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/Test.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..720e95d5181ff6b45fce78ef8ad92694d9edf0f5 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsgetappcontextstageatest", + "module-name": "entry", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsGetAppContextStageaTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..32dfe93ccff0375201857794de902cec4d239442 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b64cffca2792e1099a325ac31f3528c9179de75c --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/MainAbility/MainAbility/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/MainAbility/MainAbility/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0535dac994805f8d16968dda8a10b068bd32fb96 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/MainAbility/MainAbility/index.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + aboutToAppear() { + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf77e491b734ca037868cc6884581e6c4172808e --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,55 @@ +/* + * 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 PublishCallBackOne2() { + console.debug("====>Publish CallBack ACTS_StartAbility2_CommonEvent====>"); + globalThis.ability2Context.terminateSelf(); +} +export default class MainAbility1 extends Ability { + + onCreate(want, launchParam) { + console.log("MainAbility1 onCreate") + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility1 onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index", null) + globalThis.ability2Context = this.context; + commonEvent.publish("ACTS_GetAppContext", PublishCallBackOne2); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility1 onBackground") + } +}; diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..e91260fa5f26fac6676194e4b369171abac560e7 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cf14392325cf1b229f59886e1df274d949a453a --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,70 @@ +/* +* 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 'hypium/index' +import commonEvent from '@ohos.commonevent' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +const START_ABILITY_TIMEOUT = 5000; +var GetAppContext1 = { + events: ["ACTS_GetAppContext"] +}; +export default function abilityTest() { + describe('ACTS_GetAppContext_TEST', function () { + /* + * @tc.number : ACTS_GetAppContext_0200 + * @tc.name : The test framework needs to provide the following query-related functions + * @tc.desc : Get the context of the application, Ability + */ + it('ACTS_GetAppContext_0200', 0, async function (done) { + let Subscriber + var flag = true + var AbilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback===="); + flag = false + done(); + } + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_GetAppContext").assertTrue(); + console.debug("====>0200 Subscribe CallBack data:" + JSON.stringify(data)); + var context = AbilityDelegator.getAppContext(); + console.debug("====>ACTS_GetAppContext_0200 context:" + context); + expect(context.applicationInfo.name).assertEqual("com.example.actsgetappcontextstageatest"); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(GetAppContext1).then(async (data) => { + console.debug("ACTS_GetAppContext_0200====>Create Subscriber===="); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start startAbility===="); + globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsgetappcontextstageatest', + abilityName: 'MainAbility1' + }).then(()=>{ + console.debug("====>startAbility end===="); + }) + }) + function timeout() { + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_GetAppContext_0200 - timeout'); + done(); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..4130395f9b9fb4787e299ae0ee0e3d9bc58c41fd --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/module.json @@ -0,0 +1,46 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label", + "visible": true, + "launchType": "singleton" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a6cfb66e477d0cb44df0f7573a2ac243c1e231c1 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + }, + { + "name": "app_name", + "value": "ActsGetAbilityStatestAgeTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/AppScope/app.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..1b0134b024098a995a7190616401fb113d85c47f --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsgetappcontextstagebtest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..30d9143e4d0fb024a7c10c9c557732758301d21b --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsgetappcontextstagebtest" + } + ] +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/BUILD.gn b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cdf0d6095f6370b239b283955d26ffeed193ca02 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsGetAppContextStagebTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsgetappcontextstagebtest_js_assets", + ":actsgetappcontextstagebtest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsGetAppContextStagebTest" +} + +ohos_app_scope("actsgetappcontextstagebtest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsgetappcontextstagebtest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsgetappcontextstagebtest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsgetappcontextstagebtest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/Test.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..83ab46ab6a70fef8b10af05bdfd5bdae7f4fc5d0 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsgetappcontextstagebtest", + "module-name": "entry", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsGetAppContextStagebTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b64cffca2792e1099a325ac31f3528c9179de75c --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/MainAbility/MainAbility/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/MainAbility/MainAbility/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..46746f8026fb063a65ea7fdd0983c27461b91694 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/MainAbility/MainAbility/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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf77e491b734ca037868cc6884581e6c4172808e --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,55 @@ +/* + * 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 PublishCallBackOne2() { + console.debug("====>Publish CallBack ACTS_StartAbility2_CommonEvent====>"); + globalThis.ability2Context.terminateSelf(); +} +export default class MainAbility1 extends Ability { + + onCreate(want, launchParam) { + console.log("MainAbility1 onCreate") + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility1 onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index", null) + globalThis.ability2Context = this.context; + commonEvent.publish("ACTS_GetAppContext", PublishCallBackOne2); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility1 onBackground") + } +}; diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..e91260fa5f26fac6676194e4b369171abac560e7 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..da9fb73faa13b8e015b013fcf0a5478d8f858189 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,70 @@ +/* +* 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 'hypium/index' +import commonEvent from '@ohos.commonevent' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +const START_ABILITY_TIMEOUT = 5000; +var GetAppContext1 = { + events: ["ACTS_GetAppContext"] +}; +export default function abilityTest() { + describe('ACTS_GetAppContext_TEST', function () { + /* + * @tc.number : ACTS_GetAppContext_0200 + * @tc.name : The test framework needs to provide the following query-related functions + * @tc.desc : Get the context of the application, Ability + */ + it('ACTS_GetAppContext_0200', 0, async function (done) { + let Subscriber + var flag = true + var AbilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback===="); + flag = false + done(); + } + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_GetAppContext").assertTrue(); + console.debug("====>0200 Subscribe CallBack data:" + JSON.stringify(data)); + var context = AbilityDelegator.getAppContext(); + console.debug("====>ACTS_GetAppContext_0200 context:" + context); + expect(context.applicationInfo.name).assertEqual("com.example.actsgetappcontextstagebtest"); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(GetAppContext1).then(async (data) => { + console.debug("ACTS_GetAppContext_0200====>Create Subscriber===="); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start startAbility===="); + globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsgetappcontextstagebtest', + abilityName: 'MainAbility1' + }).then(()=>{ + console.debug("====>startAbility end===="); + }) + }) + function timeout() { + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_GetAppContext_0200 - timeout'); + done(); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..4130395f9b9fb4787e299ae0ee0e3d9bc58c41fd --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/module.json @@ -0,0 +1,46 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label", + "visible": true, + "launchType": "singleton" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c106fbed7f5dea5d4f262fbf4f21ffdc9f010cfa --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + }, + { + "name": "app_name", + "value": "ActsGetAppContextStagebTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..feec276e105eeb8d621c20aaf838f318b0a94150 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/AppScope/app.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..62850146ee4b4e24d38cbe3e4d97b9b973f505c8 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsgetappcontexttest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bc18e99c73c410bbea62c576dee83dce5309861f --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsgetappcontexttest" + } + ] +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/BUILD.gn b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5c75d82fc1f5d355360114511db89d1c2b91e37c --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsGetAppContextTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsgetappcontexttest_js_assets", + ":actsgetappcontexttest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsGetAppContextTest" +} + +ohos_app_scope("actsgetappcontexttest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsgetappcontexttest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsgetappcontexttest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsgetappcontexttest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/Test.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..3e674ad40136189e61aad53e61f23fa62889c16c --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsgetappcontexttest", + "module-name": "entry", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsGetAppContextTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b64cffca2792e1099a325ac31f3528c9179de75c --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f6740b4d49c013262e5d544f7bf8e00bb2da2220 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + aboutToAppear() { + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf77e491b734ca037868cc6884581e6c4172808e --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,55 @@ +/* + * 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 PublishCallBackOne2() { + console.debug("====>Publish CallBack ACTS_StartAbility2_CommonEvent====>"); + globalThis.ability2Context.terminateSelf(); +} +export default class MainAbility1 extends Ability { + + onCreate(want, launchParam) { + console.log("MainAbility1 onCreate") + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility1 onWindowStageCreate") + windowStage.setUIContent(this.context, "pages/index", null) + globalThis.ability2Context = this.context; + commonEvent.publish("ACTS_GetAppContext", PublishCallBackOne2); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility1 onForeground") + } + + onBackground() { + // Ability has back to background + console.log("MainAbility1 onBackground") + } +}; diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..e91260fa5f26fac6676194e4b369171abac560e7 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b7a410caaaa491173dbc21991e94cee1a5e78c6 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,70 @@ +/* +* 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 'hypium/index' +import commonEvent from '@ohos.commonevent' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +const START_ABILITY_TIMEOUT = 5000; +var GetAppContext1 = { + events: ["ACTS_GetAppContext"] +}; +export default function appTest() { + describe('ACTS_GetAppContext_TEST', function () { + /* + * @tc.number : ACTS_GetAppContext_0100 + * @tc.name : The test framework needs to provide the following query-related functions + * @tc.desc : Get the context of the application, Ability + */ + it('ACTS_GetAppContext_0100', 0, async function (done) { + let Subscriber + var flag = true + var AbilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + function UnSubscribeCallback() { + console.debug("====>UnSubscribeCallback===="); + flag = false + done(); + } + function SubscribeCallBack (err, data) { + expect(data.event == "ACTS_GetAppContext").assertTrue(); + console.debug("====>0100 Subscribe CallBack data:" + JSON.stringify(data)); + var context = AbilityDelegator.getAppContext(); + console.debug("====>ACTS_GetAppContext_0100 context:" + context); + expect(context.applicationInfo.name).assertEqual("com.example.actsgetappcontexttest"); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + commonEvent.createSubscriber(GetAppContext1).then(async (data) => { + console.debug("ACTS_GetAppContext_0100====>Create Subscriber===="); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.debug("====>start startAbility===="); + globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsgetappcontexttest', + abilityName: 'MainAbility1' + }).then(()=>{ + console.debug("====>startAbility end===="); + }) + }) + function timeout() { + if(flag == true) { + expect().assertFail(); + console.debug('ACTS_GetAppContext_0100 - timeout'); + done(); + } + } + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..4130395f9b9fb4787e299ae0ee0e3d9bc58c41fd --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/module.json @@ -0,0 +1,46 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label", + "visible": true, + "launchType": "singleton" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c4f09106008d7543478e71b9b6ad04a206526d97 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + }, + { + "name": "app_name", + "value": "ActsGetAppContextTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/AppScope/app.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..2b6069b71a1fa91e993f68c38d644608a5b78c51 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsgetcurrenttopabilitystageatest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b3b8ef12d9ae2e4f81c5c6bb7cbe12b8900e5e85 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsgetcurrenttopabilitystageatest" + } + ] +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/BUILD.gn b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..26f7fb523a8fc9db57c3026aaac807538500b22b --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsGetcurrentTopAbilityStageaTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsgetcurrenttopabilitystageatest_js_assets", + ":actsgetcurrenttopabilitystageatest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsGetcurrentTopAbilityStageaTest" +} + +ohos_app_scope("actsgetcurrenttopabilitystageatest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsgetcurrenttopabilitystageatest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsgetcurrenttopabilitystageatest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsgetcurrenttopabilitystageatest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/Test.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..6c3aee8e69a045333bda253acfdfdc9439e8e949 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsgetcurrenttopabilitystageatest", + "module-name": "entry", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsGetcurrentTopAbilityStageaTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/Ability1/Ability1.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/Ability1/Ability1.ts new file mode 100644 index 0000000000000000000000000000000000000000..99cabae59cdcf6180a44439728a7853e3274cd49 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/Ability1/Ability1.ts @@ -0,0 +1,52 @@ +/* + * 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 Ability1 extends Ability { + onCreate(want, launchParam) { + console.log("Ability1 onCreate"); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("Ability1 onDestroy"); + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("Ability1 onWindowStageCreate"); + windowStage.setUIContent(this.context, "pages/index1", null); + globalThis.ability2Context = this.context; + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("Ability1 onWindowStageDestroy"); + } + + onForeground() { + // Ability has brought to foreground + console.log("Ability1 onForeground"); + globalThis.ability2Context.startAbility( + { + bundleName: 'com.example.actsgetcurrenttopabilitystageatest', + abilityName: 'Ability2' + }) + } + + onBackground() { + // Ability has back to background + console.log("Ability1 onBackground"); + } +}; diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/Ability2/Ability2.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/Ability2/Ability2.ts new file mode 100644 index 0000000000000000000000000000000000000000..5601545a7160855c9de872c0f43bd9917d31065d --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/Ability2/Ability2.ts @@ -0,0 +1,54 @@ +/* + * 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 GetCurrentTopAbility2====>"); + console.debug("====>close this context====>3====>"); +} +export default class Ability2 extends Ability { + + onCreate(want, launchParam) { + console.log("Ability2 onCreate"); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("Ability2 onDestroy"); + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("Ability2 onWindowStageCreate"); + windowStage.setUIContent(this.context, "pages/index2", null); + globalThis.ability3Context = this.context; + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("Ability2 onWindowStageDestroy"); + } + + onForeground() { + // Ability has brought to foreground + console.log("Ability2 onForeground"); + commonEvent.publish("GetCurrentTopAbilityB", PublishCallBackOne); + } + + onBackground() { + // Ability has back to background + console.log("Ability2 onBackground"); + } +}; diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..6c55d2c949160275293303d557dc358edde4964b --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b737ee883cdcffd8951853938bffcdfef95b6a04 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/MainAbility/pages/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 router from '@ohos.router'; +import file from '@system.file'; +import testsuite from "../../test/List.test" +@Entry +@Component +struct Index { + aboutToAppear() { + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..e91260fa5f26fac6676194e4b369171abac560e7 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/pages/index1.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/pages/index1.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0360459cc264b6f88fc86aa8b73c2d4176d825b --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/pages/index1.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('this is A') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/pages/index2.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/pages/index2.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c467571524621b4f73596cb796db3dfa635a69c --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/pages/index2.ets @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('this is B') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b64037b740cb4bff3c3bfaea515bd50fa4b8dfba --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,103 @@ +// @ts-nocheck +/* + * 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 'hypium/index' +import abilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import commonEvent from "@ohos.commonevent" + +var subscriberInfo_MainAbility2 = { + events: ["GetCurrentTopAbilityB"], +}; +const START_ABILITY_TIMEOUT = 4000; + +export default function abilityTest() { + describe('ActsParticleAbilityTest', function () { + function sleep(time) { + return new Promise(resolve => setTimeout(resolve, time)); + } + + beforeEach(async(done)=>{ + await sleep(START_ABILITY_TIMEOUT); + done() + }) + /** + *@tc.number: ACTS_GetCurrentTopAbility_0100 + *@tc.name: Verify the interface for obtaining the Ability of the foreground + *@tc.desc:Start PageAbility1,Ability2 to be tested in turn, and get the current foreground Ability (AsyncCallback) + */ + it('ACTS_GetCurrentTopAbility_0100', 0, async function (done) { + console.log("ACTS_GetCurrentTopAbility_0100 --- start"); + var flag = true; + var Subscriber; + var AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator(); + + function SubscribeCallBack(err, data) { + console.debug("ACTS_GetCurrentTopAbility_0100====>Subscribe CallBack data:====>" + + JSON.stringify(data)); + expect(data.event == 'GetCurrentTopAbilityB').assertTrue(); + if (data.event == 'GetCurrentTopAbilityB') { + AbilityDelegator.getCurrentTopAbility((err, data) => { + console.log("ACTS_GetCurrentTopAbility_0100 and"); + console.debug("====>thisTopAbility_0100====>" + JSON.stringify(data)); + console.debug("====>thisTopAbility_0100====>want====>" + + JSON.stringify(data.lastRequestWant)); + console.debug("====>thisTopAbility_0100====>abilityName====>" + + JSON.stringify(data.lastRequestWant.abilityName)); + console.debug("====>start startAbility====>"); + if (data.lastRequestWant.abilityName == "Ability2") { + flag = false + console.debug("====>0100====>flag" + flag); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + }) + } + } + + commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { + console.debug("ACTS_GetCurrentTopAbility_0100====>Create Subscriber====>"); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + + console.log("ACTS_GetCurrentTopAbility_0100 start"); + await globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsgetcurrenttopabilitystageatest', + abilityName: 'Ability1' + }, (err) => { + console.debug("====>ACTS_GetCurrentTopAbility_0100 err:" + JSON.stringify(err)) + }) + console.log("ACTS_GetCurrentTopAbility_0100 end"); + }) + + async function UnSubscribeCallback() { + console.debug("ACTS_GetCurrentTopAbility_0100====>UnSubscribe CallBack====>"); + await globalThis.ability2Context.terminateSelf(); + await globalThis.ability3Context.terminateSelf(); + done(); + } + + setTimeout(() => { + if (flag == true) { + console.debug("====>0100====>end====>flag" + flag); + console.debug("in ACTS_GetCurrentTopAbility_0100 - timeout"); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + expect().assertFail(); + } + console.debug("ACTS_GetCurrentTopAbility_0100 - timeout"); + }, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..fe9e3ab7c2cf97d85eab89937b7663c227d3eb34 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/module.json @@ -0,0 +1,51 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "Ability1", + "srcEntrance": "./ets/Ability1/Ability1.ts", + "description": "$string:Ability1_desc", + "icon": "$media:icon", + "label": "$string:Ability1_label" + }, + { + "name": "Ability2", + "srcEntrance": "./ets/Ability2/Ability2.ts", + "description": "$string:Ability2_desc", + "icon": "$media:icon", + "label": "$string:Ability2_label" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8d5bc64e30ac841a96baee7a8f6e2fd619fb04ab --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "Ability1_desc", + "value": "description" + }, + { + "name": "Ability1_label", + "value": "label" + }, + { + "name": "Ability2_desc", + "value": "description" + }, + { + "name": "Ability2_label", + "value": "label" + }, + { + "name": "app_name", + "value": "ActsGetcurrentTopAbilityStageaTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/AppScope/app.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..b1466392f1da9a44442804e2e12fdf07ec401300 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsgetcurrenttopabilitystagebtest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..fa2514532e908f557c314a59ff56683a266706ef --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsgetcurrenttopabilitystagebtest" + } + ] +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/BUILD.gn b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8dddba27f2e3b734defd6533d8f292b70801343a --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsGetCurrentTopAbilityStagebTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsgetcurrenttopabilitystagebtest_js_assets", + ":actsgetcurrenttopabilitystagebtest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsGetCurrentTopAbilityStagebTest" +} + +ohos_app_scope("actsgetcurrenttopabilitystagebtest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsgetcurrenttopabilitystagebtest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsgetcurrenttopabilitystagebtest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsgetcurrenttopabilitystagebtest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/Test.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a37da27bdaf670bba4f5011f47224d62ad925014 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsgetcurrenttopabilitystagebtest", + "module-name": "entry", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsGetCurrentTopAbilityStagebTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/Ability1/Ability1.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/Ability1/Ability1.ts new file mode 100644 index 0000000000000000000000000000000000000000..ba319547fdb0058c46f5e84f5c8065ea23d37762 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/Ability1/Ability1.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 GetCurrentTopAbility"); +} + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log("Ability1 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this abilitya + console.log("Ability1 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("Ability1 onWindowStageCreate") + + globalThis.ability3Context = this.context + windowStage.setUIContent(this.context, "pages/index1", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("Ability1 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("Ability1 onForeground") + commonEvent.publish("GetCurrentTopAbility", publishCallBackOne); + } + + + onBackground() { + // Ability has back to background + console.log("Ability1 onBackground") + } +} + diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/Ability2/Ability2.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/Ability2/Ability2.ts new file mode 100644 index 0000000000000000000000000000000000000000..5b20afc40051826e22964ab456df2dd249adf460 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/Ability2/Ability2.ts @@ -0,0 +1,56 @@ +/* +* 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("Ability2 onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this abilitya + console.log("Ability2 onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("Ability2 onWindowStageCreate") + globalThis.ability2Context = this.context + windowStage.setUIContent(this.context, "pages/index2", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("Ability2 onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("Ability2 onForeground") + globalThis.ability2Context.startAbility( + { + bundleName: 'com.example.actsgetcurrenttopabilitystagebtest', + abilityName: 'Ability1' + }) + } + + + onBackground() { + // Ability has back to background + console.log("Ability2 onBackground") + } +} + diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/Application/AbilityStage.ts @@ -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 AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b64cffca2792e1099a325ac31f3528c9179de75c --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/MainAbility/MainAbility/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/MainAbility/MainAbility/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f6740b4d49c013262e5d544f7bf8e00bb2da2220 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/MainAbility/MainAbility/index.ets @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + aboutToAppear() { + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..e91260fa5f26fac6676194e4b369171abac560e7 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bb1376bf16a11bb8882e58381c6f1499069e0bd --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/pages/index1.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/pages/index1.ets new file mode 100644 index 0000000000000000000000000000000000000000..1597a13d12182c19838ad9e734a4a67e809f86d4 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/pages/index1.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('this is A') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/pages/index2.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/pages/index2.ets new file mode 100644 index 0000000000000000000000000000000000000000..84c1e2817d294b310f3886a85b9dab3e704d65ea --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/pages/index2.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('this is B') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d72e18167ed2ba697864ed25017c900e3d59c63f --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,141 @@ +// @ts-nocheck +/* +* 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 'hypium/index' +import abilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import commonEvent from "@ohos.commonevent" + +var subscriberInfo_MainAbility2 = { + events: ["GetCurrentTopAbility"], +}; +const START_ABILITY_TIMEOUT = 4000; +export default function abilityTest() { + describe('ActsParticleAbilityStageBTest', function () { + /** + *@tc.number: ACTS_GetCurrentTopAbility_0200 + *@tc.name: Verify the interface for obtaining the Ability of the foreground + *@tc.desc:Start PageAbility2,Ability1 to be tested in turn, and get the current foreground Ability (AsyncCallback) + */ + it('ACTS_GetCurrentTopAbility_0200', 0, async function (done) { + console.log("ACTS_GetCurrentTopAbility_0200 --- start") + abilityDelegatorRegistry.getAbilityDelegator() + var flag=true; + var Subscriber; + var AbilityDelegator=await abilityDelegatorRegistry.getAbilityDelegator(); + + function SubscribeCallBack(err, data) { + console.debug("ACTS_GetCurrentTopAbility_0200====>Subscribe CallBack data:====>" + JSON.stringify(data)); + expect(data.event == 'GetCurrentTopAbility').assertTrue(); + if (data.event == 'GetCurrentTopAbility') { + AbilityDelegator.getCurrentTopAbility((err,data) => { + console.debug("====>thisTopAbility====>"+JSON.stringify(data.lastRequestWant)) + console.debug("====>start startAbility====>"); + if(data.lastRequestWant.abilityName=='Ability1'){ + flag=false + console.debug("====>0200====>flag"+flag) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + }) + } + } + + commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { + console.debug("ACTS_GetCurrentTopAbility_0200====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + await globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsgetcurrenttopabilitystagebtest', + abilityName: 'Ability2' + }) + }) + + function UnSubscribeCallback() { + console.debug("ACTS_GetCurrentTopAbility_0200====>UnSubscribe CallBack====>"); + globalThis.ability2Context.terminateSelf(); + globalThis.ability3Context.terminateSelf(); + done(); + } + + setTimeout(()=>{ + if(flag==true){ + expect().assertFail(); + console.debug("====>0200====>end====>flag"+flag) + console.debug("in ACTS_GetCurrentTopAbility_0200 - timeout"); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + console.debug("ACTS_GetCurrentTopAbility_0200 - timeout"); + }, START_ABILITY_TIMEOUT); + }) + + /** + *@tc.number: ACTS_GetCurrentTopAbility_0500 + *@tc.name: Verify the interface for obtaining the Ability of the foreground + *@tc.desc:Start PageAbility1,Ability2 to be tested in turn, and get the current foreground Ability (Promise) + */ + it('ACTS_GetCurrentTopAbility_0500', 0, async function (done) { + console.log("ACTS_GetCurrentTopAbility_0500 --- start") + abilityDelegatorRegistry.getAbilityDelegator() + var flag=true; + var Subscriber; + var AbilityDelegator=await abilityDelegatorRegistry.getAbilityDelegator(); + + function SubscribeCallBack(err, data) { + console.debug("ACTS_GetCurrentTopAbility_0500====>Subscribe CallBack data:====>" + JSON.stringify(data)); + expect(data.event == 'GetCurrentTopAbility').assertTrue(); + if (data.event == 'GetCurrentTopAbility') { + AbilityDelegator.getCurrentTopAbility().then((data) => { + console.debug("====>thisTopAbility====>"+JSON.stringify(data.lastRequestWant)) + console.debug("====>start startAbility====>"); + if(data.lastRequestWant.abilityName=='Ability1'){ + flag=false + console.debug("====>0500====>flag"+flag) + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + }) + } + } + + commonEvent.createSubscriber(subscriberInfo_MainAbility2).then(async (data) => { + console.debug("ACTS_GetCurrentTopAbility_0500====>Create Subscriber====>"); + Subscriber = data; + await commonEvent.subscribe(Subscriber, SubscribeCallBack); + await globalThis.abilityContext.startAbility( + { + bundleName: 'com.example.actsgetcurrenttopabilitystagebtest', + abilityName: 'Ability2', + }) + }) + + function UnSubscribeCallback() { + console.debug("ACTS_GetCurrentTopAbility_0500====>UnSubscribe CallBack====>"); + globalThis.ability2Context.terminateSelf(); + globalThis.ability3Context.terminateSelf(); + done(); + } + + + setTimeout(()=>{ + if(flag==true){ + expect().assertFail(); + console.debug("====>0500====>end====>flag"+flag) + console.debug("in ACTS_GetCurrentTopAbility_0500 - timeout"); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + console.debug("ACTS_GetCurrentTopAbility_0500 - timeout"); + }, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4fb3959f2b7f435db589d34409f91f9afe6ad04c --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..fe9e3ab7c2cf97d85eab89937b7663c227d3eb34 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/module.json @@ -0,0 +1,51 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "Ability1", + "srcEntrance": "./ets/Ability1/Ability1.ts", + "description": "$string:Ability1_desc", + "icon": "$media:icon", + "label": "$string:Ability1_label" + }, + { + "name": "Ability2", + "srcEntrance": "./ets/Ability2/Ability2.ts", + "description": "$string:Ability2_desc", + "icon": "$media:icon", + "label": "$string:Ability2_label" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..5f9df3efc14e71a763b50e9114300f013e49f974 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "Ability1_desc", + "value": "description" + }, + { + "name": "Ability1_label", + "value": "label" + }, + { + "name": "Ability2_desc", + "value": "description" + }, + { + "name": "Ability2_label", + "value": "label" + }, + { + "name": "app_name", + "value": "ActsGetCurrentTopAbilityStagebTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts index 9ea5d45d127e44f894c22abcbf9695fa82b68cd2..7c3fc27b2001faee077523bd2351a04eb7c83210 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts +++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserverrelyhap/entry/src/main/ets/ServiceAbility/service.ts @@ -14,7 +14,6 @@ */ import rpc from "@ohos.rpc"; import particleAbility from '@ohos.ability.particleAbility' -import featureAbility from '@ohos.ability.featureAbility' import commonEvent from '@ohos.commonEvent' var serversecond_bundleName = "com.amsst.stserviceabilityserversecond"; var serversecond_abilityName = "com.amsst.stserviceabilityserversecond.ServiceAbility"; @@ -59,7 +58,11 @@ export default { onStop() { console.debug('ACTS_SerivceAbilityServer ==== { }); - featureAbility.terminateSelf(); + particleAbility.terminateSelf().then((data) => { + console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); + }).catch((error) => { + console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); + }); }, onCommand(want, restart, startId) { console.debug('ACTS_SerivceAbilityServer ====>onCommand=' @@ -76,7 +79,11 @@ export default { }, } ); - featureAbility.terminateSelf(); + particleAbility.terminateSelf().then((data) => { + console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); + }).catch((error) => { + console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); + }); } else if (want.action == 'ServiceStartService_1000') { particleAbility.startAbility( { @@ -89,7 +96,11 @@ export default { }, (err, data) => { console.debug('ACTS_SerivceAbilityServer start Ability 1000 callback=====' + err + ', data= ' + data + " , JSON." + JSON.stringify(data)); - featureAbility.terminateSelf(); + particleAbility.terminateSelf().then((data) => { + console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); + }).catch((error) => { + console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); + }); } ); } else { @@ -99,7 +110,11 @@ export default { || want.action == 'PageStartService_0301' || want.action == 'PageStartService_0401') { console.debug('ACTS_SerivceAbilityServer_onCommand 100 200 301 401.terminateSelf()=====>' + want.action); - featureAbility.terminateSelf(); + particleAbility.terminateSelf().then((data) => { + console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); + }).catch((error) => { + console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); + }); } } else { console.debug('ACTS_SerivceAbilityServer_onCommand publish err=====>' + err); @@ -169,7 +184,11 @@ export default { + ("json err=") + JSON.stringify(err) + " , " + want.action); }) } - featureAbility.terminateSelf(); + particleAbility.terminateSelf().then((data) => { + console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); + }).catch((error) => { + console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); + }); } }); }, diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts index aa8acf0bdbbd97a5ae2fc53d3e7d5cb186bb9228..80a93e559c71aed05ec6bcd2e94152428f02022a 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts +++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts @@ -14,7 +14,6 @@ */ import rpc from "@ohos.rpc"; import particleAbility from '@ohos.ability.particleAbility' -import featureAbility from '@ohos.ability.featureAbility' import commonEvent from '@ohos.commonEvent' var server_bundleName = "com.amsst.stserviceabilityserver"; var server_abilityName = "com.amsst.stserviceabilityserver.ServiceAbility"; @@ -59,14 +58,22 @@ export default { onStop() { console.debug('ACTS_SerivceAbilityServerSecond ==== { }); - featureAbility.terminateSelf(); + particleAbility.terminateSelf().then((data) => { + console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); + }).catch((error) => { + console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); + }); }, onCommand(want, restart, startId) { console.debug('ACTS_SerivceAbilityServerSecond ====>onCommand=' + "JSON(want)=" + JSON.stringify(want) + " ,restart=" + restart + " ,startId=" + startId); commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => { }); - featureAbility.terminateSelf(); + particleAbility.terminateSelf().then((data) => { + console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); + }).catch((error) => { + console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); + }); }, onConnect(want) { console.info('ACTS_SerivceAbilityServerSecond ====< onConnect'); @@ -161,7 +168,11 @@ export default { + ("json err=") + JSON.stringify(err) + " , " + want.action); }) } - featureAbility.terminateSelf(); + particleAbility.terminateSelf().then((data) => { + console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); + }).catch((error) => { + console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); + }); } }); }, diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/app.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..42f68baf7174c367b0d1193b6e12b90c73091821 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actskillprocesswithaccountclosetest", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b8889764aa68711d3602a8c007044f62589a9de6 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActskillProcessWithAccountCloseTest" + } + ] +} diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/BUILD.gn b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d29b393421a43c03046ccdb7a0ef4ba21783693d --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/BUILD.gn @@ -0,0 +1,45 @@ +# 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_hap("ActSkillProcessWithAccountCloseTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActSkillProcessWithAccountCloseTest" + subsystem_name = XTS_SUITENAME + final_hap_path = + "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" + testonly = true + deps = [ + ":actskillprocesswithaccountclosetest_js_assets", + ":actskillprocesswithaccountclosetest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" +} + +ohos_app_scope("actskillprocesswithaccountclosetest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actskillprocesswithaccountclosetest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actskillprocesswithaccountclosetest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actskillprocesswithaccountclosetest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/Test.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..10d0b1f21a2a8376078cceb1f6d3bb4314a3b69b --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/Test.json @@ -0,0 +1,11 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actskillprocesswithaccountclosetest", + "module-name": "entry", + "shell-timeout": "600000" + } +} + diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ae1bf3ce4d07b5d5a4e8bc485d994849d55de70 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* +* 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("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f49453f99c401118f969cc1cb3329e8b04307145 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,53 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'TestAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3690508c405ca2fd7a849fbae0ae59a37c8286e --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* +* 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 '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..7fbba8118156be41084fa06a2715e63a1ba33210 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d55fb10291670d788c540dc369a36dd6ae5ce94 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f05e8b48e9a7cf7832368951bbbc53a69674607 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,27 @@ +/* +* 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 'hypium/index' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + it('assertContain',0, function () { + console.info("it begin") + let a = 'abc' + let b = 'b' + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf6f241a06f8aa77442bd600ce6e870c760e88fe --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/module.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..63433eb8d6b9487794cb12a568e2b0f733abdad3 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/module.json @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..126ece494316f3d5856578c6d568f6db06a8178f --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "ActskillProcessWithAccountCloseTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/BUILD.gn b/ability/ability_runtime/actsshellcommandfunctionalitytest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a81d550fa311d03be3a2962cd80423d815e5fb0e --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/BUILD.gn @@ -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("//test/xts/tools/build/suite.gni") + +group("actsshellcommandfunctionalitytest") { + testonly = true + if (is_standard_system) { + deps = [ + "ActskillProcessWithAccountCloseTest:ActSkillProcessWithAccountCloseTest", + "ExecuteShellCommand:ExecuteShellCommand", + ] + } +} diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/app.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..27541cdf126c6c063c6ca6581efb9f2106725e3a --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.executeshellcommand", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d06c4d78bb1117ae47a49007f2e3c790df75ac18 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ExecuteShellCommand" + } + ] +} diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/BUILD.gn b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..969510da4b5bb3c18d07051c61cc976be068be21 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ExecuteShellCommand") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":executeshellcommand_js_assets", + ":executeshellcommand_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ExecuteShellCommand" +} + +ohos_app_scope("executeshellcommand_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("executeshellcommand_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("executeshellcommand_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":executeshellcommand_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/Test.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..74711c618ebe006b7ff026ef1fdfeb206dd20fa6 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/Test.json @@ -0,0 +1,27 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.executeshellcommand", + "module-name": "entry", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "PushKit", + "push": [ + "ActSkillProcessWithAccountCloseTest.hap->/data/ActSkillProcessWithAccountCloseTest.hap" + ] + }, + { + "test-file-name": [ + "ActSkillProcessWithAccountCloseTest.hap", + "ExecuteShellCommand.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ae1bf3ce4d07b5d5a4e8bc485d994849d55de70 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* +* 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("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b00e38977349b51175c85c51b488573515d50285 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,53 @@ +/* +* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3690508c405ca2fd7a849fbae0ae59a37c8286e --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* +* 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 '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..ade8389c0b34836a9d9f313187d5ef318bc31413 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d55fb10291670d788c540dc369a36dd6ae5ce94 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/pages/index.ets @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a759916ee7265e47bef08ae1a668bd7465f5e3b --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,343 @@ +/* + * 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 'hypium/index' +import appManager from '@ohos.application.AppManager'; + +export default function abilityTest() { + describe('ACTS_ExecuteShellCommandTest', function () { + + /** + * @tc.number: ACTS_ExecuteShellCommand_Callback_0100 + * @tc.name: Execute a shell command without arguments (AsyncCallback). + * @tc.desc: Verify that the interface executes the Shell command successfully. + */ + it('ACTS_ExecuteShellCommand_Callback_0100', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Callback_0100 --- start") + var cmd = 'aa help' + var escresult = 'usage: aa ' + globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.log('ACTS_ExecuteShellCommand_Callback_0100 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Callback_0100 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(escresult); + console.log('ACTS_ExecuteShellCommand_Callback_0100 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_ExecuteShellCommand_Callback_0100 exitCode = ' + data.exitCode) + expect(data.exitCode).assertEqual(0); + console.log('ACTS_ExecuteShellCommand_Callback_0100 - executeShellCommand: end') + done() + }) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Callback_0200 + * @tc.name: Execute shell command with timeout parameter (AsyncCallback) + * @tc.desc: Verify that the interface executes the Shell command successfully. + */ + it('ACTS_ExecuteShellCommand_Callback_0200', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Callback_0200 --- start") + var cmd = 'aa start -a MainAbility -b com.example.actskillprocesswithaccountclosetest' + globalThis.abilityDelegator.executeShellCommand(cmd, 1,(err, data) => { + console.log('ACTS_ExecuteShellCommand_Callback_0200 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Callback_0200 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf('start ability successfully.'); + console.log('ACTS_ExecuteShellCommand_Callback_0200 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_ExecuteShellCommand_Callback_0200 exitCode = ' + data.exitCode) + expect(data.exitCode).assertEqual(0); + console.log('ACTS_ExecuteShellCommand_Callback_0200 - executeShellCommand: end') + done() + }) + setTimeout(async() => { + appManager.killProcessWithAccount('com.example.actskillProcessWithAccountclosetest', 100).then(() => { + console.log('ACTS_ExecuteShellCommand_Callback_0200 killProcess ======> start'); + }) + }, 3000 ) + }) + /** + * @tc.number: ACTS_ExecuteShellCommand_Callback_0300 + * @tc.name: Execute non-existing shell command (AsyncCallback). + * @tc.desc: Failed to execute shell command on authentication interface. + */ + it('ACTS_ExecuteShellCommand_Callback_0300', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Callback_0300 --- start") + var cmd = 'ppwd -L' + globalThis.abilityDelegator.executeShellCommand(cmd, 1,(err, data) => { + console.log('ACTS_ExecuteShellCommand_Callback_0300 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Callback_0300 stdResult = ' + data.stdResult) + var i = data.stdResult.length + console.log('ACTS_ExecuteShellCommand_Callback_0300 query string i = ' + i); + expect(i == 0).assertEqual(true); + console.log('ACTS_ExecuteShellCommand_Callback_0300 exitCode = ' + data.exitCode) + expect(data.exitCode == 0).assertEqual(false); + console.log('ACTS_ExecuteShellCommand_Callback_0300 - executeShellCommand: end') + done(); + }) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Callback_0400 + * @tc.name: Execute shell command timeout (AsyncCallback) + * @tc.desc: The authentication interface executes the shell command timed out. + */ + it('ACTS_ExecuteShellCommand_Callback_0400', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Callback_0400 --- start") + var cmd = 'aa help' + var escresult = 'usage: aa ' + globalThis.abilityDelegator.executeShellCommand(cmd,0, (err, data) => { + console.log('ACTS_ExecuteShellCommand_Callback_0400 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Callback_0400 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(escresult); + console.log('ACTS_ExecuteShellCommand_Callback_0400 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_ExecuteShellCommand_Callback_0100 exitCode = ' + data.exitCode) + expect(data.exitCode).assertEqual(0); + console.log('ACTS_ExecuteShellCommand_Callback_0400 - executeShellCommand: end') + done(); + }) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Callback_0500 + * @tc.name: Invalid timeout parameter for executing shell command (AsyncCallback) + * @tc.desc: The timeout parameter for executing shell commands on the authentication interface is invalid. + */ + it('ACTS_ExecuteShellCommand_Callback_0500', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Callback_0500 --- start") + var cmd = 'aa help' + var escresult = 'usage: aa ' + globalThis.abilityDelegator.executeShellCommand(cmd,-1, (err, data) => { + console.log('ACTS_ExecuteShellCommand_Callback_0500 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Callback_0500 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(escresult); + console.log('ACTS_ExecuteShellCommand_Callback_0500 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_ExecuteShellCommand_Callback_0500 exitCode = ' + data.exitCode) + expect(data.exitCode).assertEqual(0); + console.log('ACTS_ExecuteShellCommand_Callback_0500 - executeShellCommand: end') + done(); + }) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Callback_0600 + * @tc.name: The executed shell command parameter is null (AsyncCallback) + * @tc.desc: Failed to execute shell command on authentication interface. + */ + it('ACTS_ExecuteShellCommand_Callback_0600', 0, async function (done) { + let flag=true; + console.log("ACTS_ExecuteShellCommand_Callback_0600 --- start") + globalThis.abilityDelegator.executeShellCommand("",1,(err, data) => { + console.log('ACTS_ExecuteShellCommand_Callback_0600 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Callback_0600 - executeShellCommand:data'+JSON.stringify(data)) + expect(data).assertEqual(undefined); + console.log('ACTS_ExecuteShellCommand_Callback_0600 - executeShellCommand: end') + flag=false; + done(); + }) + setTimeout(()=>{ + if(flag==true){ + console.log('ACTS_ExecuteShellCommand_Callback_0600 timeout') + expect().assertFail(); + done(); + } + },5000) + }) + + + /** + * @tc.number: ACTS_ExecuteShellCommand_Callback_0700 + * @tc.name: The timeout parameter of the execution is null (AsyncCallback) + * @tc.desc: Verify that the interface executes the Shell command successfully. + */ + it('ACTS_ExecuteShellCommand_Callback_0700', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_0700 --- start") + var cmd = 'aa help' + var code = null + setTimeout(() => { + console.log('ACTS_ExecuteShellCommand_Callback_0700 code:'+JSON.stringify(code)) + if(code!=undefined){ + expect().assertFail(); + } + done(); + }, 3000) + code = globalThis.abilityDelegator.executeShellCommand(cmd,null,() => { + console.log('ACTS_ExecuteShellCommand_Callback_0700 fail:') + expect().assertFail(); + }) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Promise_0100 + * @tc.name: Execute a shell command without arguments (Promise). + * @tc.desc: Verify that the interface executes the Shell command successfully. + */ + it('ACTS_ExecuteShellCommand_Promise_0100', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Promise_0100 --- start") + var cmd = 'aa help' + var escresult = 'usage: aa ' + globalThis.abilityDelegator.executeShellCommand(cmd, 1).then((data) => { + console.log('ACTS_ExecuteShellCommand_Promise_0100 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Promise_0100 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(escresult); + console.log('ACTS_ExecuteShellCommand_Promise_0100 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_ExecuteShellCommand_Promise_0100 exitCode = ' + data.exitCode) + expect(data.exitCode).assertEqual(0); + done(); + }) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Promise_0200 + * @tc.name: Execute shell command with timeout parameter (Promise) + * @tc.desc: Verify that the interface executes the Shell command successfully. + */ + it('ACTS_ExecuteShellCommand_Promise_0200', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Promise_0200 --- start") + var cmd = 'aa start -d 0 -a MainAbility -b com.example.actskillprocesswithaccountclosetest' + globalThis.abilityDelegator.executeShellCommand(cmd, 1).then((data) => { + console.log('ACTS_ExecuteShellCommand_Promise_0200 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Promise_0200 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf('start ability successfully.'); + console.log('ACTS_ExecuteShellCommand_Promise_0200 query string i = ' + i); + expect(i == -1).assertEqual(false); + console.log('ACTS_ExecuteShellCommand_Promise_0200 exitCode = ' + data.exitCode) + expect(data.exitCode).assertEqual(0); + console.log('ACTS_ExecuteShellCommand_Promise_0200 - executeShellCommand: end') + done() + }) + setTimeout(async() => { + appManager.killProcessWithAccount('com.example.actskillProcessWithAccountclosetest', 100).then(() => { + console.log('ACTS_ExecuteShellCommand_Promise_0200 killProcess ======> start'); + }) + }, 3000 ) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Promise_0300 + * @tc.name: Execute non-existing shell command (Promise). + * @tc.desc: Failed to execute shell command on authentication interface. + */ + it('ACTS_ExecuteShellCommand_Promise_0300', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Promise_0300 --- start") + var cmd = 'ppwd -L' + globalThis.abilityDelegator.executeShellCommand(cmd, 1).then((data) => { + console.log('ACTS_ExecuteShellCommand_Promise_0300 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Promise_0300 stdResult = ' + data.stdResult) + var i = data.stdResult.length + console.log('ACTS_ExecuteShellCommand_Promise_0300 query string i = ' + i); + expect(i == 0).assertEqual(true); + console.log('ACTS_ExecuteShellCommand_Promise_0300 exitCode = ' + data.exitCode) + expect(data.exitCode == 0).assertEqual(false); + console.log('ACTS_ExecuteShellCommand_Promise_0300 - executeShellCommand: end') + done(); + }) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Promise_0400 + * @tc.name: Execute shell command timeout (Promise) + * @tc.desc: The authentication interface executes the shell command timed out. + */ + it('ACTS_ExecuteShellCommand_Promise_0400', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Promise_0400 --- start") + var cmd = 'aa help' + var escresult = 'usage: aa ' + globalThis.abilityDelegator.executeShellCommand(cmd, 0).then((data) => { + console.log('ACTS_ExecuteShellCommand_Promise_0400 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Promise_0400 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(escresult); + console.log('ACTS_ExecuteShellCommand_Promise_0400 query string i = ' + i); + expect(data.exitCode).assertEqual(0); + console.log('ACTS_ExecuteShellCommand_Promise_0400 - executeShellCommand: end') + done(); + }) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Promise_0500 + * @tc.name: Invalid timeout parameter for executing shell command (Promise) + * @tc.desc: The timeout parameter for executing shell commands on the authentication interface is invalid. + */ + it('ACTS_ExecuteShellCommand_Promise_0500', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Promise_0500 --- start") + var cmd = 'aa help' + var escresult = 'usage: aa ' + globalThis.abilityDelegator.executeShellCommand(cmd, -1).then((data) => { + console.log('ACTS_ExecuteShellCommand_Promise_0500 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Promise_0500 stdResult = ' + data.stdResult) + var i = data.stdResult.indexOf(escresult); + console.log('ACTS_ExecuteShellCommand_Promise_0500 query string i = ' + i); + expect(data.exitCode).assertEqual(0); + console.log('ACTS_ExecuteShellCommand_Promise_0500 - executeShellCommand: end') + done(); + }) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Promise_0600 + * @tc.name: The executed shell command parameter is null (Promise) + * @tc.desc: Failed to execute shell command on authentication interface. + */ + it('ACTS_ExecuteShellCommand_Promise_0600', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Promise_0600 --- start") + let flag = true; + globalThis.abilityDelegator.executeShellCommand("",1).then((data) => { + console.log('ACTS_ExecuteShellCommand_Promise_0600 - executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Promise_0600 - executeShellCommand:data'+JSON.stringify(data)) + expect(data).assertEqual(undefined); + console.log('ACTS_ExecuteShellCommand_Callback_0600 - executeShellCommand: end') + flag=false; + done(); + },(data) => { + console.log('ACTS_ExecuteShellCommand_Promise_0600 -2 executeShellCommand: start ') + console.log('ACTS_ExecuteShellCommand_Promise_0600 -2 executeShellCommand:data'+JSON.stringify(data)) + expect(data.code).assertEqual(-1); + console.log('ACTS_ExecuteShellCommand_Callback_0600 -2 executeShellCommand: end') + flag=false; + done(); + }).catch((err) => { + console.log('ACTS_ExecuteShellCommand_Promise_0600 -2 executeShellCommand:err'+JSON.stringify(err)) + }) + setTimeout(()=>{ + if(flag==true){ + console.log('ACTS_ExecuteShellCommand_Callback_0600 timeout') + expect().assertFail(); + done(); + } + },5000) + }) + + /** + * @tc.number: ACTS_ExecuteShellCommand_Promise_0700 + * @tc.name: The timeout parameter of the execution is null (Promise) + * @tc.desc: Verify that the interface executes the Shell command successfully. + */ + it('ACTS_ExecuteShellCommand_Promise_0700', 0, async function (done) { + console.log("ACTS_ExecuteShellCommand_Promise_0700 --- start") + var cmd = 'aa help' + var code = null + code = globalThis.abilityDelegator.executeShellCommand(cmd, null) + setTimeout(() => { + console.log('ACTS_ExecuteShellCommand_Callback_0700 code:'+JSON.stringify(code)) + if(code!=undefined){ + expect().assertFail(); + } + done(); + }, 3000) + }) + }) +}; diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf6f241a06f8aa77442bd600ce6e870c760e88fe --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/module.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..63433eb8d6b9487794cb12a568e2b0f733abdad3 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/module.json @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f63f4ed4cbe767fc324cfc279c0bb408d7f49450 --- /dev/null +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "ExecuteShellCommand" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/signature/openharmony_sx.p7b b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsstartrunnertest/AppScope/app.json b/ability/ability_runtime/actsstartrunnertest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a3ea40e3bee14e0ff02f2ca46e981b9fc1ff8d32 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.actsstartyunnertest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsstartrunnertest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsstartrunnertest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..62800de69e1b240ca8f3a77234cbb12682a38ad2 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsstartrunnertest" + } + ] +} diff --git a/ability/ability_runtime/actsstartrunnertest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actsstartrunnertest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsstartrunnertest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actsstartrunnertest/BUILD.gn b/ability/ability_runtime/actsstartrunnertest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3459aa862e268cc353ae35c16a0830f1e9613e41 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/BUILD.gn @@ -0,0 +1,41 @@ +# 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("ActsStartRunnerTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsstartrunnertest_js_assets", + ":actsstartrunnertest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsStartRunnerTest" +} + +ohos_app_scope("actsstartrunnertest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsstartrunnertest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsstartrunnertest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsstartrunnertest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsstartrunnertest/Test.json b/ability/ability_runtime/actsstartrunnertest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..0f1708ff6c5e8e59e5b8694dca74b0deaeadc638 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsstartyunnertest", + "module-name": "entry", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsStartRunnerTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..32dfe93ccff0375201857794de902cec4d239442 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..bdab784ff5190f50468477c713c7203fa81e069c --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,38 @@ +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + globalThis.abilityWant = want; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..43326ac5a4887639a97e54a8db06d1d1df71bade --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility/pages/index.ets @@ -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 router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility2/MainAbility2.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a712c7979681c0b5d207dcf553017ddb2ce88f0 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -0,0 +1,55 @@ +// @ts-nocheck +/* + * 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_Start_CommonEvent====>"); + console.debug("====>close this context====>3====>"); +} +export default class MainAbility2 extends Ability { + + onCreate(want, launchParam) { + 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"); + windowStage.setUIContent(this.context, "pages/index2", null); + globalThis.ability3Context = this.context; + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility2 onWindowStageDestroy"); + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility2 onForeground"); + commonEvent.publish("ACTS_Start_CommonEvent", PublishCallBackOne); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility2 onBackground"); + } +}; diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility3/MainAbility3.ts new file mode 100644 index 0000000000000000000000000000000000000000..9e9eba0850328204f02a3d2a06d930e3018136e2 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -0,0 +1,55 @@ +// @ts-nocheck +/* + * 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_Start_CommonEvent====>"); + console.debug("====>close this context====>4====>"); +} +export default class MainAbility3 extends Ability { + + onCreate(want, launchParam) { + console.log("MainAbility3 onCreate"); + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("MainAbility3 onDestroy"); + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("MainAbility3 onWindowStageCreate"); + windowStage.setUIContent(this.context, "pages/index3", null); + globalThis.ability4Context = this.context; + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("MainAbility3 onWindowStageDestroy"); + } + + onForeground() { + // Ability has brought to foreground + console.log("MainAbility3 onForeground"); + commonEvent.publish("ACTS_Start_CommonEvent", PublishCallBackOne); + } + + onBackground() { + // Ability has back to background + console.log("MainAbility3 onBackground"); + } +}; diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..8bcafe1a40fc3b9702796858d60586b21049c85c --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,58 @@ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f2d89d2c663dceecf9df42f305a841889dfcb69 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index2.ets b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index2.ets new file mode 100644 index 0000000000000000000000000000000000000000..3677a8602752609fa974b34b53749162392bb00b --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index2.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World2' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index3.ets b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index3.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae4dc02582f7c4aaf7583dee23b1f2383a481cb0 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/pages/index3.ets @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World3' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1aba42d5668e159d24a6afa953b3a06c9f5fb801 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,251 @@ +/* + * 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 "hypium/index" +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import commonEvent from '@ohos.commonevent' +var subscriberInfo_MainAbility = { + events: ["ACTS_Start_CommonEvent"] +}; +const START_ABILITY_TIMEOUT = 4000; +export default function abilityTest() { + describe('ACTS_TestApi', function () { + + /* + * @tc.number : ACTS_TestRunner_0100 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(promise) + */ + it('ACTS_TestRunner_0100', 0, async function (done) { + var data = AbilityDelegatorRegistry.getAbilityDelegator() + expect(typeof (data)).assertEqual('object') + done(); + }) + + /* + * @tc.number : ACTS_TestRunner_0200 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(callback) + */ + it('ACTS_TestRunner_0200', 0, async function (done) { + var AbilityDelegatorArgs = AbilityDelegatorRegistry.getArguments() + console.log("====>getArguments is====>" + JSON.stringify(AbilityDelegatorArgs)); + expect(AbilityDelegatorArgs.bundleName).assertEqual('com.example.actsstartyunnertest') + expect(AbilityDelegatorArgs.parameters['-b']).assertEqual('com.example.actsstartyunnertest') + expect(AbilityDelegatorArgs.parameters['-s unittest']).assertEqual('OpenHarmonyTestRunner') + expect(AbilityDelegatorArgs.testRunnerClassName).assertEqual('OpenHarmonyTestRunner') + done(); + }) + + /* + * @tc.number : ACTS_StartAbility_Callback_0100 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(callback) + */ + it('ACTS_StartAbility_Callback_0100', 0, async function (done) { + var Subscriber + var flag = true + var startresult = false + var Delegator = AbilityDelegatorRegistry.getAbilityDelegator() + + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_Start_CommonEvent").assertTrue(); + console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ACTS_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + done(); + } + + await commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + Delegator.startAbility( + { + bundleName: 'com.example.actsstartyunnertest', + abilityName: 'MainAbility2' + }, () => { + console.log("====>startAbility end====>"); + }) + }) + }) + + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_StartAbility_Callback_0100 - timeout') + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartAbility_Callback_0200 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability failed.(callback) + */ + it('ACTS_StartAbility_Callback_0200', 0, async function (done) { + var Delegator = AbilityDelegatorRegistry.getAbilityDelegator() + var Subscriber + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.log("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + done(); + } + + await commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + Delegator.startAbility( + { + bundleName: 'com.example.error', + abilityName: 'MainAbility2' + }, () => { + console.log("====>startAbility end====>"); + }) + }) + }) + + function timeout() { + console.log('ACTS_StartAbility_Callback_0200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartAbility_Promise_0100 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability succeeded.(callback) + */ + it('ACTS_StartAbility_Promise_0100', 0, async function (done) { + var Delegator = AbilityDelegatorRegistry.getAbilityDelegator() + var Subscriber + var flag = true + var startresult = false + + function SubscribeCallBack(err, data) { + expect(data.event == "ACTS_Start_CommonEvent").assertTrue(); + console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + if (data.event == "ACTS_Start_CommonEvent") { + startresult = true + } + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + flag = false + expect(startresult).assertEqual(true); + done(); + } + + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + await Delegator.startAbility( + { + bundleName: 'com.example.actsstartyunnertest', + abilityName: 'MainAbility3' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + + function timeout() { + if (flag == true) { + expect().assertFail(); + console.log('ACTS_StartAbility_Promise_0100 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + + /* + * @tc.number : ACTS_StartAbility_Promise_0200 + * @tc.name : start new ability + * @tc.desc : Starting mainability2 with startability failed.(callback) + */ + it('ACTS_StartAbility_Promise_0200', 0, async function (done) { + var Delegator = AbilityDelegatorRegistry.getAbilityDelegator() + var Subscriber + + function SubscribeCallBack(err, data) { + expect().assertFail(); + console.log("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); + } + + function UnSubscribeCallback() { + console.log("====>UnSubscribeCallback====>"); + done(); + } + + commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { + console.log("====>Create Subscriber====>"); + data.getSubscribeInfo().then(async (SubscribeInfo) => { + console.log("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + Subscriber = data; + commonEvent.subscribe(Subscriber, SubscribeCallBack); + console.log("====>start startAbility====>"); + await Delegator.startAbility( + { + bundleName: 'com.example.error', + abilityName: 'MainAbility2' + }).then(() => { + console.log("====>startAbility end====>"); + }) + }) + }) + + function timeout() { + console.log('ACTS_StartAbility_Promise_0200 - timeout'); + commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) + } + + setTimeout(timeout, START_ABILITY_TIMEOUT); + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..caa07c3911a97aed3eab456f7864b1d430eb4e79 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/module.json b/ability/ability_runtime/actsstartrunnertest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..cb34980fee3963211cde784db3c8f95bd49a82ee --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/module.json @@ -0,0 +1,51 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility2/MainAbility2.ts", + "description": "$string:MainAbility2_desc", + "icon": "$media:icon", + "label": "$string:MainAbility2_label" + }, + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility3/MainAbility3.ts", + "description": "$string:MainAbility3_desc", + "icon": "$media:icon", + "label": "$string:MainAbility3_label" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsstartrunnertest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b8c72be1fb5a552cd53c1fbc08aec477819ea5a --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsstartrunnertest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsstartrunnertest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsstartrunnertest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsstartrunnertest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsstartrunnertest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsstartrunnertest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets index c14a130d8de5fdbcab129d17208c6fee6b38eebf..2471dd5d67bf5450626fe034290597a1d362c52c 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets @@ -268,65 +268,6 @@ export default function ApiCoverTest(abilityContext) { done() }) - /* - * @tc.number SUB_AA_Form_provider_getFormsInfo_0100 - * @tc.name The provider calls the getFormsInfo interface to obtain form information. - * @tc.desc Function test - * @tc.level 3 - */ - it('SUB_AA_Form_provider_getFormsInfo_0100', 0, async function (done) { - console.info("SUB_AA_Form_provider_getFormsInfo_0100"); - formProvider.getFormsInfo((err, value) => { - console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err)); - console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value)); - if (err.code != 0) { - expect(0).assertEqual(2) - } else { - for(let i = 0; i < value.length; i++){ - if(value[i].bundleName == "com.example.apicoverhaptest" && value[i].name == "widget"){ - trueInfo = value[i] - console.info("formProvider::GetFormsInfoTest trueInfo: " + JSON.stringify(trueInfo)); - } - } - } - checkFormInfo(trueInfo) - done() - }) - }) - - /* - * @tc.number SUB_AA_Form_provider_getFormsInfo_0200 - * @tc.name The provider calls the getFormsInfo interface to obtain form information in the module1. - * @tc.desc Function test - * @tc.level 3 - */ - it('SUB_AA_Form_provider_getFormsInfo_0200', 0, async function (done) { - console.info("SUB_AA_Form_provider_getFormsInfo_0200"); - const filter: FormInfo.FormInfoFilter = { - moduleName: "module1" - }; - formProvider.getFormsInfo(filter, (err, value) => { - console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err)); - console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value)); - if (err.code != 0) { - expect(0).assertEqual(2) - } else { - if(value.length == 0){ - expect(1).assertEqual(0) - }else{ - for(let i = 0; i < value.length; i++){ - if(value[i].bundleName == "com.example.apicoverhaptest" && value[i].name == "widget1"){ - trueInfo = value[i] - console.info("formProvider::GetFormsInfoTest trueInfo: " + JSON.stringify(trueInfo)); - } - } - } - } - checkFormInfoModule1(trueInfo) - done(); - }) - }) - /* * @tc.number SUB_AA_Form_provider_TestFormErr_0100 * @tc.name Get all FormError types. @@ -382,40 +323,4 @@ export default function ApiCoverTest(abilityContext) { done(); }); }) -} -function checkFormInfoModule1(formInfo){ - console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(formInfo)); - expect("com.example.apicoverhaptest").assertEqual(formInfo.bundleName) - expect("module1").assertEqual(formInfo.moduleName) - expect("FormAbility").assertEqual(formInfo.abilityName) - expect("widget1").assertEqual(formInfo.name) - expect("This is a service widget.").assertEqual(formInfo.description) - expect(FormInfo.FormType.JS).assertEqual(formInfo.type) - expect(FormInfo.ColorMode.MODE_DARK).assertEqual(formInfo.colorMode) - expect(formInfo.isDefault).assertTrue() - expect(formInfo.updateEnabled).assertTrue() - expect(formInfo.formVisibleNotify).assertFalse() - expect(undefined).assertEqual(formInfo.relatedBundleName) - expect("ability://xxxxx").assertEqual(formInfo.formConfigAbility) - expect(1).assertEqual(formInfo.updateDuration) - expect(2).assertEqual(formInfo.defaultDimension) - expect(2).assertEqual(formInfo.supportDimensions[0]) -} -function checkFormInfo(formInfo){ - console.info("formProvider::GetFormsInfoTest formInfo: " + JSON.stringify(formInfo)); - expect("com.example.apicoverhaptest").assertEqual(formInfo.bundleName) - expect("phone").assertEqual(formInfo.moduleName) - expect("FormAbility").assertEqual(formInfo.abilityName) - expect("widget").assertEqual(formInfo.name) - expect("This is a service widget.").assertEqual(formInfo.description) - expect(FormInfo.FormType.JS).assertEqual(formInfo.type) - expect(FormInfo.ColorMode.MODE_AUTO).assertEqual(formInfo.colorMode) - expect(formInfo.isDefault).assertTrue() - expect(formInfo.updateEnabled).assertTrue() - expect(formInfo.formVisibleNotify).assertFalse() - expect(undefined).assertEqual(formInfo.relatedBundleName) - expect("ability://xxxxx").assertEqual(formInfo.formConfigAbility) - expect(1).assertEqual(formInfo.updateDuration) - expect(2).assertEqual(formInfo.defaultDimension) - expect(2).assertEqual(formInfo.supportDimensions[0]) } \ No newline at end of file diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js index fce9888d7ad8ef22729e92f873b43dac478adb40..36d5ac0c2fe2e4bb49c2204894493a5e9f752288 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js @@ -19,6 +19,7 @@ let resultCode = 123; let bundleName = 'ohso.act.aafwk'; let mainAbilityName = 'ohos.acts.aafwk.jsap'; const errCode = 1; +const errCode1 = 202; describe('ConnectAbilityTest', function () { @@ -64,12 +65,10 @@ describe('ConnectAbilityTest', function () { * @tc.desc: StartAbility fail with error parameter.(by promise) */ it("SUB_AA_JsApi_StartAbility_0300", 0, async function (done) { - let parameter = { - 'StartAbilityParameter': { - 'want': {} - } + let startAbilityParameter = { + 'want': {} } - await featureAbility.startAbility(parameter).then((data) => { + await featureAbility.startAbility(startAbilityParameter).then((data) => { console.log('testAbility0300 data: ' + JSON.stringify(data)) expect().assertFail() }).catch((error) => { @@ -85,12 +84,10 @@ describe('ConnectAbilityTest', function () { * @tc.desc: StartAbility fail with error parameter.(by callback) */ it("SUB_AA_JsApi_StartAbility_0400", 0, async function (done) { - let parameter = { - 'StartAbilityParameter': { - 'want': {} - } + let startAbilityParameter = { + 'want': {} } - featureAbility.startAbility((parameter), (error, data) => { + featureAbility.startAbility((startAbilityParameter), (error, data) => { console.log('testAbility0400 data: ' + JSON.stringify(data)) console.log('testAbility0400 error: ' + JSON.stringify(error)) expect(errCode).assertEqual(error.code) @@ -192,16 +189,13 @@ describe('ConnectAbilityTest', function () { * @tc.desc: startAbility-want configure action+entities- entities is configurd as a string.(by promise) */ it("SUB_AA_JsApi_Ability_0900", 0, async function (done) { - let parameter = { - 'startAbilityParameter': { - 'want': { - 'bundleName': bundleName, - 'abilityName': mainAbilityName - } - + let startAbilityParameter = { + 'want': { + 'bundleName': bundleName, + 'abilityName': mainAbilityName } } - await featureAbility.startAbility(parameter).then((data) => { + await featureAbility.startAbility(startAbilityParameter).then((data) => { console.log('testAblity0900 data: ' + JSON.stringify(data)) expect().assertFail() }).catch((error) => { @@ -217,16 +211,13 @@ describe('ConnectAbilityTest', function () { * @tc.desc: startAbility-want configure action+entities- entities is configurd as a string.(by callback) */ it("SUB_AA_JsApi_Ability_1000", 0, async function (done) { - let parameter = { - 'startAbilityParameter': { - 'want': { - 'bundleName': bundleName, - 'abilityName': mainAbilityName - } - + let startAbilityParameter = { + 'want': { + 'bundleName': bundleName, + 'abilityName': mainAbilityName } } - featureAbility.startAbility((parameter), (error, data) => { + featureAbility.startAbility((startAbilityParameter), (error, data) => { console.log('testAblity1000 data: ' + JSON.stringify(data)) console.log('testAblity1000 error: ' + JSON.stringify(error)) expect(errCode).assertEqual(error.code) @@ -246,7 +237,7 @@ describe('ConnectAbilityTest', function () { expect().assertFail() }).catch((error) => { console.log('testAblity1100 error: ' + JSON.stringify(error)) - expect(errCode).assertEqual(error.code) + expect(errCode1).assertEqual(error.code) }) done() }) @@ -261,7 +252,7 @@ describe('ConnectAbilityTest', function () { featureAbility.startAbility(parameter, (error, data) => { console.log('testAblity1200 data: ' + JSON.stringify(data)) console.log('testAblity1200 error: ' + JSON.stringify(error)) - expect(errCode).assertEqual(error.code) + expect(errCode1).assertEqual(error.code) done(); }) }) @@ -277,7 +268,7 @@ describe('ConnectAbilityTest', function () { expect().assertFail() }).catch((error) => { console.log('testAblity1300 error: ' + JSON.stringify(error)) - expect(errCode).assertEqual(error.code) + expect(errCode1).assertEqual(error.code) }) done() }) @@ -291,7 +282,7 @@ describe('ConnectAbilityTest', function () { featureAbility.startAbility(undefined, (error, data) => { console.log('testAblity1400 data: ' + JSON.stringify(data)) console.log('testAblity1400 error: ' + JSON.stringify(error)) - expect(errCode).assertEqual(error.code) + expect(errCode1).assertEqual(error.code) done(); }) }) @@ -308,7 +299,7 @@ describe('ConnectAbilityTest', function () { expect.assertFail() }).catch((error) => { console.log('testAblity1500' + JSON.stringify(error)); - expect(errCode).assertEqual(error.code) + expect(errCode1).assertEqual(error.code) }) done() }) @@ -323,7 +314,7 @@ describe('ConnectAbilityTest', function () { featureAbility.startAbilityForResult(parameter, (error, data) => { console.log('testAblity1600 data: ' + JSON.stringify(data)) console.log('testAblity1600 error: ' + JSON.stringify(error)) - expect(errCode).assertEqual(error.code) + expect(errCode1).assertEqual(error.code) console.log('testAblity1600-1 error: ' + JSON.stringify(error)) done(); }) @@ -340,7 +331,7 @@ describe('ConnectAbilityTest', function () { expect.assertFail() }).catch((error) => { console.log('testAblity1700' + JSON.stringify(error)); - expect(errCode).assertEqual(error.code) + expect(errCode1).assertEqual(error.code) }) done() }) @@ -353,7 +344,7 @@ describe('ConnectAbilityTest', function () { it("SUB_AA_JsApi_Ability_1800", 0, async function (done) { featureAbility.startAbilityForResult(undefined, (error) => { console.log('testAblity1800' + JSON.stringify(error)); - expect(errCode).assertEqual(error.code) + expect(errCode1).assertEqual(error.code) done() }) }) @@ -364,19 +355,17 @@ describe('ConnectAbilityTest', function () { * @tc.desc: startAbilityForResult-wrong input parameter format want a layer outside.(by promise) */ it("SUB_AA_JsApi_Ability_1900", 0, async function (done) { - let parameter = { - 'StartAbilityParameter': { - 'want': { - 'bundleName': bundleName, - 'abilityName': mainAbilityName, - 'parameters': { - 'key': resultCode, - 'terminate': true - } + let startAbilityParameter = { + 'want': { + 'bundleName': bundleName, + 'abilityName': mainAbilityName, + 'parameters': { + 'key': resultCode, + 'terminate': true } } } - await featureAbility.startAbilityForResult(parameter).then((data) => { + await featureAbility.startAbilityForResult(startAbilityParameter).then((data) => { console.log('testAblity1900 data: ' + JSON.stringify(data)) expect.assertFail() }).catch((error) => { @@ -392,19 +381,17 @@ describe('ConnectAbilityTest', function () { * @tc.desc: startAbilityForResult-wrong input parameter format want a layer outside.(by callback) */ it("SUB_AA_JsApi_Ability_2000", 0, async function (done) { - let parameter = { - 'StartAbilityParameter': { - 'want': { - 'bundleName': bundleName, - 'abilityName': mainAbilityName, - 'parameters': { - 'key': resultCode, - 'terminate': true - } + let startAbilityParameter = { + 'want': { + 'bundleName': bundleName, + 'abilityName': mainAbilityName, + 'parameters': { + 'key': resultCode, + 'terminate': true } } } - featureAbility.startAbilityForResult(parameter, (error, data) => { + featureAbility.startAbilityForResult(startAbilityParameter, (error, data) => { console.log('testAblity2000' + JSON.stringify(error)); expect(errCode).assertEqual(error.code) done() diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets index 98e1ed889caa21abd651ba0aa80ef309090258f8..8eaf42ac8b3e569d536a781b0e92e7b15ac346b5 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets @@ -191,7 +191,7 @@ struct Index { commonEvent.publish(this.formOnDynamicRefreshEvent, commonEventPublishData, this.formOnDynamicRefreshCallBack); }) .catch((error) => { - console.info('formsystemhost refreshForm error:' + error); + console.info('formsystemhost refreshForm error:' + JSON.stringify(error)); let commonEventPublishData = { data: error.code.toString(), parameters: { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets index 5b86592fd8dc3a81a56bb820a53d60befd86c601..cce3bb1e31fc6e131fd5609d727a01618f639ab1 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/MainAbility/test/FmsAcquireForm.test.ets @@ -15,7 +15,7 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from "deccjsunit/index"; +import { beforeEach, afterEach, describe, expect, it } from "deccjsunit/index"; var onErrorForm_Event = { events: ["FMS_FormOnError_commonEvent"], @@ -30,6 +30,10 @@ var onSupplyEvent = { events: ["FMS_FormSupply_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + var deleteForm_Event = "FMS_FormDelete_commonEvent"; var subscriberOnError; @@ -48,6 +52,14 @@ export default function test() { await sleep(1000); }) + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeCallback("afterEach unsubscribe subscriberOnError")); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberCast, () => unsubscribeCallback("afterEach unsubscribe subscriberCast")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + await sleep(1000); + }) + /** * @tc.number: FMS_acquireForm_0200 * @tc.name: The form host does not have permission to use the form diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets index d1e4165606d329b53b7fe75925c0660fdea0b7cf..f0ea932ef4b4f45da952de58effc6439ded7d8f7 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/MainAbility/test/FmsAcquireForm2.test.ets @@ -15,7 +15,7 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from "deccjsunit/index"; +import { beforeEach, afterEach, describe, expect, it } from "deccjsunit/index"; var onErrorForm_Event = { events: ["FMS_FormOnError_commonEvent"], @@ -30,6 +30,10 @@ var onSupplyEvent = { events: ["FMS_FormSupply_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + var deleteForm_Event = "FMS_FormDelete_commonEvent"; var subscriberOnError; @@ -37,6 +41,10 @@ var subscriberOnAcquired; var subscriberCast; var subscriberSupply; +function sleep(time) { + return new Promise((resolve)=>setTimeout(resolve,time)); + } + export default function test() { describe(`FmsAcquiredFormTest2`, () => { @@ -47,6 +55,14 @@ export default function test() { subscriberSupply = await commonEvent.createSubscriber(onSupplyEvent); }) + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnError, () => unsubscribeCallback("afterEach unsubscribe subscriberOnError")); + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberCast, () => unsubscribeCallback("afterEach unsubscribe subscriberCast")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + await sleep(1000); + }) + /** * @tc.number: FMS_acquireForm_3800 * @tc.name: Failed to add form when parameter ability is wrong. diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json index f004fd4342be2787b9233d86904451a61773a781..b412802a8235344f13bdc6084cb49585a7437794 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/Test.json @@ -18,6 +18,13 @@ ], "type": "AppInstallKit", "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602" + ] } ] } diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets index a441a41cab763d925c649dd0ad5e749472bac451..f47eb716d1d86a365f2681e5d6ea1233cea71b1a 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/MainAbility/test/FmsDeleteForm.test.ets @@ -16,7 +16,7 @@ import featureAbility from '@ohos.ability.featureAbility'; import commonEvent from '@ohos.commonEvent'; import systemTime from '@ohos.systemTime'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index'; +import { beforeEach, afterEach, describe, expect, it } from 'deccjsunit/index'; const onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -31,6 +31,10 @@ const onSupplyEvent = { events: ["FMS_FormSupply_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + const deleteForm_Event = "FMS_FormDelete_commonEvent"; let subscriberOnAcquired; @@ -49,6 +53,14 @@ export default function test() { await sleep(1000); }); + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeCallback("afterEach unsubscribe subscriberOnReleased")); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + await sleep(1000); + }) + /** * @tc.number: FMS_deleteForm_0200 * @tc.name: host does not have permission diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets index efaa811b298e51718e335f170be315f9dcba72db..cfcc92ec5e9fddcfd215e6e021dcba41c66e132f 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/MainAbility/test/FmsDynamicRefreshForm.test.ets @@ -15,7 +15,7 @@ import featureAbility from '@ohos.ability.featureAbility'; import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index'; +import { beforeEach, afterEach, describe, expect, it } from 'deccjsunit/index'; const onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -33,6 +33,10 @@ const onSupplyEvent = { events: ["FMS_FormSupply_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + const deleteForm_Event = "FMS_FormDelete_commonEvent"; let subscriberOnAcquired; @@ -51,6 +55,14 @@ export default function test() { await sleep(1000); }); + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted")); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeCallback("afterEach unsubscribe subscriberOnRefresh")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + await sleep(1000); + }) + /** * @tc.number: FMS_timedRefresh_0100 * @tc.name: formID id is error(formID < 0) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets index 11b10395cf7c038d8fbf6f8592df22e4d21fb1b2..7cc7f1fdd4075540df93fd8e03e09bdb2b1db27e 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets @@ -62,12 +62,12 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { tempDataC = dataC[0]; expect(error.code).assertEqual(ERR_OK_CODE); expect(error.message).assertEqual(ERR_OK); - console.log(`==========${callbackName} ${describeName} end==========`); }); await sleep(2000) checkDataB(tempDataB) checkDataC(tempDataC) done(); + console.log(`==========${callbackName} ${describeName} end==========`); } catch (error) { console.log(`${callbackName} exception caught: ${JSON.stringify(error)})`); console.log(`${callbackName} should not reach here`); @@ -104,7 +104,8 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { expect(dataC.length).assertEqual(1); tempDataB = dataB[0]; tempDataC = dataC[0]; - + checkDataB(tempDataB) + checkDataC(tempDataC) done(); console.log(`==========${promiseName} ${describeName} end==========`); } catch (error) { @@ -126,15 +127,14 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { expect(formInfo.isDefault).assertTrue() expect(formInfo.updateEnabled).assertTrue() expect(formInfo.formVisibleNotify).assertTrue() - expect(undefined).assertEqual(formInfo.relatedBundleName) + expect('').assertEqual(formInfo.relatedBundleName) expect("abilityb").assertEqual(formInfo.formConfigAbility) expect(3).assertEqual(formInfo.updateDuration) expect(2).assertEqual(formInfo.defaultDimension) expect('10:30').assertEqual(formInfo.scheduledUpdateTime) expect(1).assertEqual(formInfo.supportDimensions[0]) expect(2).assertEqual(formInfo.supportDimensions[1]) - expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name) - expect('valueB').assertEqual(formInfo.customizeData[0].value) + expect('valueB').assertEqual(formInfo.customizeData.originWidgetNameB) } function checkDataC(formInfo){ expect("com.ohos.st.formsystemproviderc").assertEqual(formInfo.bundleName) @@ -148,15 +148,14 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { expect(formInfo.isDefault).assertTrue() expect(formInfo.updateEnabled).assertTrue() expect(formInfo.formVisibleNotify).assertTrue() - expect(undefined).assertEqual(formInfo.relatedBundleName) + expect('').assertEqual(formInfo.relatedBundleName) expect("abilityc").assertEqual(formInfo.formConfigAbility) expect(4).assertEqual(formInfo.updateDuration) expect('15:30').assertEqual(formInfo.scheduledUpdateTime) expect(3).assertEqual(formInfo.defaultDimension) expect(3).assertEqual(formInfo.supportDimensions[0]) expect(4).assertEqual(formInfo.supportDimensions[1]) - expect('originWidgetNameC').assertEqual(formInfo.customizeData[0].name) - expect('valueC').assertEqual(formInfo.customizeData[0].value) + expect('valueC').assertEqual(formInfo.customizeData.originWidgetNameC) } }); }; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets index 31f4d1f1c3b27ac24a08d898b5c6e207853637cd..d5bd25b2ecf5b7d57761d356a6af31a4d105a380 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/MainAbility/test/GetFormsInfo.test.ets @@ -236,15 +236,14 @@ export const getFormsInfoTest = (describeName, filterParameter) => { expect(formInfo.isDefault).assertTrue() expect(formInfo.updateEnabled).assertTrue() expect(formInfo.formVisibleNotify).assertTrue() - expect(undefined).assertEqual(formInfo.relatedBundleName) + expect('').assertEqual(formInfo.relatedBundleName) expect("abilityb").assertEqual(formInfo.formConfigAbility) expect(3).assertEqual(formInfo.updateDuration) expect(2).assertEqual(formInfo.defaultDimension) expect('10:30').assertEqual(formInfo.scheduledUpdateTime) expect(1).assertEqual(formInfo.supportDimensions[0]) expect(2).assertEqual(formInfo.supportDimensions[1]) - expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name) - expect('valueB').assertEqual(formInfo.customizeData[0].value) + expect('valueB').assertEqual(formInfo.customizeData.originWidgetNameB) } /** @@ -517,14 +516,13 @@ export const getFormsInfoTest = (describeName, filterParameter) => { expect(formInfo.isDefault).assertTrue() expect(formInfo.updateEnabled).assertTrue() expect(formInfo.formVisibleNotify).assertTrue() - expect(undefined).assertEqual(formInfo.relatedBundleName) + expect('').assertEqual(formInfo.relatedBundleName) expect("abilityc").assertEqual(formInfo.formConfigAbility) expect(4).assertEqual(formInfo.updateDuration) expect(3).assertEqual(formInfo.defaultDimension) expect(3).assertEqual(formInfo.supportDimensions[0]) expect(4).assertEqual(formInfo.supportDimensions[1]) - expect('originWidgetNameC').assertEqual(formInfo.customizeData[0].name) - expect('valueC').assertEqual(formInfo.customizeData[0].value) + expect('valueC').assertEqual(formInfo.customizeData.originWidgetNameC) } }); }; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets index 8058bc266157816b71c0119f5014986bb28193ee..670da2dc8e1a1ee9c94c6b13795653c744fb00b7 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets @@ -132,15 +132,14 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { expect(formInfo.isDefault).assertTrue() expect(formInfo.updateEnabled).assertTrue() expect(formInfo.formVisibleNotify).assertTrue() - expect(undefined).assertEqual(formInfo.relatedBundleName) + expect('').assertEqual(formInfo.relatedBundleName) expect("abilityb").assertEqual(formInfo.formConfigAbility) expect(3).assertEqual(formInfo.updateDuration) expect(2).assertEqual(formInfo.defaultDimension) expect('10:30').assertEqual(formInfo.scheduledUpdateTime) expect(1).assertEqual(formInfo.supportDimensions[0]) expect(2).assertEqual(formInfo.supportDimensions[1]) - expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name) - expect('valueB').assertEqual(formInfo.customizeData[0].value) + expect('valueB').assertEqual(formInfo.customizeData.originWidgetNameB) } function checkDataA1(formInfo){ @@ -155,15 +154,14 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { expect(formInfo.isDefault).assertTrue() expect(formInfo.updateEnabled).assertTrue() expect(formInfo.formVisibleNotify).assertTrue() - expect(undefined).assertEqual(formInfo.relatedBundleName) + expect('').assertEqual(formInfo.relatedBundleName) expect("abilitya01").assertEqual(formInfo.formConfigAbility) expect(1).assertEqual(formInfo.updateDuration) expect(1).assertEqual(formInfo.defaultDimension) expect('5:30').assertEqual(formInfo.scheduledUpdateTime) expect(1).assertEqual(formInfo.supportDimensions[0]) expect(3).assertEqual(formInfo.supportDimensions[1]) - expect('originWidgetNameA01').assertEqual(formInfo.customizeData[0].name) - expect('valueA01').assertEqual(formInfo.customizeData[0].value) + expect('valueA01').assertEqual(formInfo.customizeData.originWidgetNameA01) } function checkDataA2(formInfo){ @@ -178,7 +176,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { expect(formInfo.isDefault).assertFalse() expect(formInfo.updateEnabled).assertFalse() expect(formInfo.formVisibleNotify).assertFalse() - expect(undefined).assertEqual(formInfo.relatedBundleName) + expect('').assertEqual(formInfo.relatedBundleName) expect("abilitya02").assertEqual(formInfo.formConfigAbility) expect(2).assertEqual(formInfo.updateDuration) expect(4).assertEqual(formInfo.defaultDimension) @@ -187,8 +185,7 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { expect(2).assertEqual(formInfo.supportDimensions[1]) expect(3).assertEqual(formInfo.supportDimensions[2]) expect(4).assertEqual(formInfo.supportDimensions[3]) - expect('originWidgetNameA02').assertEqual(formInfo.customizeData[0].name) - expect('valueA02').assertEqual(formInfo.customizeData[0].value) + expect('valueA02').assertEqual(formInfo.customizeData.originWidgetNameA02) } }); }; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets index b049106819b7c52879e3fa09f629b378248cfb05..e3b8503e66822eeaece2fe0d17e078195e49d1cd 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/MainAbility/test/GetAllFormsInfo.test.ets @@ -122,15 +122,14 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { expect(formInfo.isDefault).assertTrue() expect(formInfo.updateEnabled).assertTrue() expect(formInfo.formVisibleNotify).assertTrue() - expect(undefined).assertEqual(formInfo.relatedBundleName) + expect('').assertEqual(formInfo.relatedBundleName) expect("abilityb").assertEqual(formInfo.formConfigAbility) expect(3).assertEqual(formInfo.updateDuration) expect(2).assertEqual(formInfo.defaultDimension) expect('10:30').assertEqual(formInfo.scheduledUpdateTime) expect(1).assertEqual(formInfo.supportDimensions[0]) expect(2).assertEqual(formInfo.supportDimensions[1]) - expect('originWidgetNameB').assertEqual(formInfo.customizeData[0].name) - expect('valueB').assertEqual(formInfo.customizeData[0].value) + expect('valueB').assertEqual(formInfo.customizeData.originWidgetNameB) } }); }; diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets index ea0cdf380490476ed848dddbe157e52ab82b6804..f174204c7e6e8025bfbe0d99a54d2b6de38931a9 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/ets/MainAbility/test/FmsHostDeathRecipient.test.ets @@ -15,7 +15,7 @@ import featureAbility from '@ohos.ability.featureAbility'; import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index'; +import { beforeEach, afterEach, describe, expect, it } from 'deccjsunit/index'; const onAcquiredEvent = { events: [`FMS_FormOnAcquired_commonEvent`], @@ -28,6 +28,11 @@ const onRequestEvent = { }; const formOnTerminateEvent = `FMS_FormTerminate_commonEvent`; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + + let tcNumber; let hostCounter; let providerCounter; @@ -47,6 +52,13 @@ export default function test() { onRequestEventSubscriber = await commonEvent.createSubscriber(onRequestEvent); }); + afterEach(async() => { + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onAcquiredEventSubscriber")); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onSupplyEventSubscriber")); + commonEvent.unsubscribe(onRequestEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onRequestEventSubscriber")); + await sleep(1000); + }) + /** * @tc.number: FMS_hostDeathRecipient_0200 * @tc.name: Reset host ability and requestForm. diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json index 5e0ae08e4331e977092d65e48243011363e4e07d..ac9ae4d70dca5b4c984a7c9ecb889ca79e7d6655 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/Test.json @@ -15,6 +15,13 @@ ], "type": "AppInstallKit", "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602" + ] } ] } \ No newline at end of file diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets index 1c740db61a8bfb6763f72b992fbc7a35bc4eb385..c201dbc2691d1ada18ffe859c2d2ab5f0b182f84 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/ets/MainAbility/test/FmsPerformanceTest.test.ets @@ -17,7 +17,7 @@ import featureAbility from '@ohos.ability.featureAbility'; import formHost from '@ohos.application.formHost'; import commonEvent from '@ohos.commonEvent'; import systemTime from '@ohos.systemTime'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index'; +import { beforeEach, afterEach, describe, expect, it } from 'deccjsunit/index'; const onAcquiredEvent = { events: [`FMS_FormOnAcquired_commonEvent`], @@ -38,9 +38,17 @@ const publishOnDeleteCallback = (tcNumber, done) => { done(); } +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + let onAcquiredEventSubscriber; let onSupplyEventSubscriber; +function sleep(time) { + return new Promise((resolve)=>setTimeout(resolve,time)); + } + export default function test() { describe(`FmsPerformanceTest`, () => { @@ -49,6 +57,12 @@ export default function test() { onSupplyEventSubscriber = await commonEvent.createSubscriber(onSupplyEvent); }); + afterEach(async() => { + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onAcquiredEventSubscriber")); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onSupplyEventSubscriber")); + await sleep(1000); + }) + /** * @tc.number: FMS_performanceTest_0100 * @tc.name: Performance test. diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets index 3437587e817b12ce0c0e62ac824233437df4f14f..2a4b59f8a2776dea27a433bf5e42faf4e42be5be 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/MainAbility/test/FmsReleaseForm.test.ets @@ -15,7 +15,7 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; +import { beforeAll, beforeEach, afterEach, describe, expect, it } from "deccjsunit/index"; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -28,6 +28,10 @@ var onReleasedFormEvent = { }; var deleteForm_Event = "FMS_FormDelete_commonEvent"; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + var subscriberOnAcquired; var subscriberOnDeleted; var subscriberOnReleased; @@ -45,6 +49,14 @@ export default function test() { subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); subscriberOnDeleted = await commonEvent.createSubscriber(onDeletedFormEvent); subscriberOnReleased = await commonEvent.createSubscriber(onReleasedFormEvent); + await sleep(1000); + }) + + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted")); + commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeCallback("afterEach unsubscribe subscriberOnReleased")); + await sleep(1000); }) /** diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets index b0521cab47a78567b35960b74f7059998f69288a..ce857acd33bfbc6ede705215eb65c1dca0d959fa 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/MainAbility/test/FmsFormStateDisable.test.ets @@ -15,7 +15,7 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; +import { beforeAll, beforeEach, afterEach, describe, expect, it } from "deccjsunit/index"; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -33,6 +33,10 @@ var onSupplyEvent = { events: ["FMS_FormSupply_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + var deleteForm_Event = "FMS_FormDelete_commonEvent"; var subscriberOnAcquired; @@ -55,6 +59,14 @@ export default function test() { await sleep(1000); }) + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberDel, () => unsubscribeCallback("afterEach unsubscribe subscriberDel")); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + await sleep(1000); + }) + /** * @tc.number: FMS_disableFormsUpdate_0200 * @tc.name: The form user does not have permission. diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json index 6de3637f2fd1edb97c32d70be810f0d81879bb55..d0068688e3849ed62e3927354377d88da1d255c6 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/Test.json @@ -20,6 +20,13 @@ ], "type": "AppInstallKit", "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602" + ] } ] } diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets index 886ff89ca9911b7cde1fdd096cacd5dd7afe0d8c..96c355bb6390721e0ec067fe5c3c5fa06cfaf0db 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/MainAbility/test/FmsFormStateEnable.test.ets @@ -15,7 +15,7 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; +import { beforeAll, beforeEach, afterEach, describe, expect, it } from "deccjsunit/index"; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -33,6 +33,10 @@ var onSupplyEvent = { events: ["FMS_FormSupply_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + var deleteForm_Event = "FMS_FormDelete_commonEvent"; var subscriberOnAcquired; @@ -55,6 +59,13 @@ export default function test() { await sleep(1000); }) + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberDel, () => unsubscribeCallback("afterEach unsubscribe subscriberDel")); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + await sleep(1000); + }) /** * @tc.number: FMS_enableFormsUpdate_0200 * @tc.name: The form user does not have permission. diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets index 2b88bb784585dd67c33b13963dc9ef5757a05378..1f851a364c76e882460b982d9c83d20bc8caf43e 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible.test.ets @@ -15,7 +15,7 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { describe, beforeEach, expect, it } from "deccjsunit/index"; +import { describe, afterEach, beforeEach, expect, it } from "deccjsunit/index"; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -33,6 +33,10 @@ var onSupplyEvent = { events: ["FMS_FormSupply_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + var deleteForm_Event = "FMS_FormDelete_commonEvent"; var subscriberOnAcquired; @@ -51,6 +55,13 @@ export default function test() { await sleep(1000); }) + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberDel, () => unsubscribeCallback("afterEach unsubscribe subscriberDel")); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + await sleep(1000); + }) /** * @tc.number: FMS_notifyInvisibleForms_0200 * @tc.name: The form user does not have permission. diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets index e972f88887c2201dd5982887e26b52f7ba13eac5..c886fd3df6150137fa79787ddaba4b9af7745841 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyInvisible2.test.ets @@ -15,7 +15,7 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from "deccjsunit/index"; +import { beforeEach, afterEach, describe, expect, it } from "deccjsunit/index"; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -29,6 +29,10 @@ var onSupplyEvent = { events: ["FMS_FormSupply_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + var deleteForm_Event = "FMS_FormDelete_commonEvent"; var subscriberOnAcquired; @@ -46,6 +50,12 @@ export default function test() { await sleep(1000); }) + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + await sleep(1000); + }) /** * @tc.number: FMS_notifyInvisibleForms_0900 * @tc.name: There are correct and wrong formId in the form ID parameter list diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets index 5c71d84f71b72105d2d4fe6a5e77be3d13068974..804612722d2d5f58d8f8946a83449317370112fc 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/test/FmsFormStateNotifyVisible.test.ets @@ -15,7 +15,7 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; +import { beforeAll, beforeEach, afterEach, describe, expect, it } from "deccjsunit/index"; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -29,6 +29,10 @@ var onSupplyEvent = { events: ["FMS_FormSupply_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + var deleteForm_Event = "FMS_FormDelete_commonEvent"; var subscriberOnAcquired; @@ -49,7 +53,12 @@ export default function test() { await sleep(1000); }) - + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); + commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + await sleep(1000); + }) /** * @tc.number: FMS_notifyVisibleForms_0200 * @tc.name: The form user does not have permission. diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets index 803ce1074ce04577db4f05d0648bec2c0913fd52..f47cbacfb9d74b42914ebd6facffdf1c99e5d2ac 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/MainAbility/test/FmsStress.test.ets @@ -16,7 +16,7 @@ import featureAbility from '@ohos.ability.featureAbility'; import formHost from '@ohos.application.formHost'; import commonEvent from '@ohos.commonEvent'; -import { beforeEach, describe, expect, it } from 'deccjsunit/index'; +import { beforeEach, afterEach, describe, expect, it } from 'deccjsunit/index'; const onDeletedEvent = { events: [`FMS_FormOnDeleted_commonEvent`] @@ -29,6 +29,10 @@ const onSupplyEvent = { }; const formOnDeleteEvent = `FMS_FormDelete_commonEvent`; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + const unsubscribeOnDeletedCallback = (tcNumber, done) => { console.info(`${tcNumber} unsubscribeOnDeleted Callback`); done(); @@ -47,6 +51,10 @@ let onDeletedEventSubscriber; let onAcquiredEventSubscriber; let onSupplyEventSubscriber; +function sleep(time) { + return new Promise((resolve)=>setTimeout(resolve,time)); + } + export default function test() { describe(`FmsStressTest`, () => { @@ -56,6 +64,13 @@ export default function test() { onSupplyEventSubscriber = await commonEvent.createSubscriber(onSupplyEvent); }); + afterEach(async() => { + commonEvent.unsubscribe(onDeletedEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onDeletedEventSubscriber")); + commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onAcquiredEventSubscriber")); + commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onSupplyEventSubscriber")); + await sleep(1000); + }) + const subscribeDeletedEvent = (tcNumber, expectedDeletedFormAmount, done) => { commonEvent.subscribe(onDeletedEventSubscriber, async (err, data) => { const formIds = data.parameters.formIds; @@ -594,7 +609,7 @@ export default function test() { const systemstatus = await formHost.isSystemReady(); console.info(`${tcNumber} systemstatus: ${JSON.stringify(systemstatus)}`); - expect(systemstatus).assertEqual(0); + expect(systemstatus).assertEqual(undefined); done(); }); }); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets index 213a31c19a3582eb306e87ccdfd483f129344972..958ac7cef44f0d72e8c26693fc733c99e3e56359 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/MainAbility/test/FmsUpdateRefreshForm.test.ets @@ -15,7 +15,7 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, describe, expect, it } from "deccjsunit/index"; +import { beforeAll, beforeEach, afterEach, describe, expect, it } from "deccjsunit/index"; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -30,6 +30,10 @@ var onRequestFormEvent = { events: ["FMS_FormOnRequest_commonEvent"], }; +const unsubscribeCallback = (tcNumber) => { + console.info(`====>${tcNumber} unsubscribeCallback====>`); +} + var deleteForm_Event = "FMS_FormDelete_commonEvent"; @@ -38,6 +42,10 @@ var subscriberOnDeleted; var subscriberOnRefresh; var subscriberOnRequest; +function sleep(time) { + return new Promise((resolve)=>setTimeout(resolve,time)); + } + export default function test() { describe(`FmsUpdateRefreshFormTest`, () => { @@ -52,6 +60,13 @@ export default function test() { subscriberOnRequest = await commonEvent.createSubscriber(onRequestFormEvent); }) + afterEach(async() => { + commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); + commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted")); + commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeCallback("afterEach unsubscribe subscriberOnRefresh")); + commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeCallback("afterEach unsubscribe subscriberOnRequest")); + await sleep(1000); + }) /** * @tc.number: FMS_updateForm_0100 * @tc.name: formID id is error(formID < 0) diff --git a/account/appaccount/actsaccounttest/src/main/js/test/AddAccount.test.js b/account/appaccount/actsaccounttest/src/main/js/test/AddAccount.test.js index 378860d17c3d216712b736c6fb05f00e855bcaac..b56e7c331fd2ba5bcde988a389aaac7259df074f 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/AddAccount.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/AddAccount.test.js @@ -31,10 +31,10 @@ export default function ActsAccountAddAccount() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_callback_first", (err)=>{ console.debug("====>add account ActsAccountAddAccount_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_name_callback_first", (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_0100 end===="); done(); }); @@ -76,10 +76,10 @@ export default function ActsAccountAddAccount() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_callback_second", "account_extraInfo_callback_second", (err)=>{ console.debug("====>add account ActsAccountAddAccount_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_name_callback_second", (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_0300 end===="); done(); }); @@ -121,13 +121,13 @@ export default function ActsAccountAddAccount() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_name_callback_third", "account_extraInfo_callback_third", (err)=>{ console.debug("====>add account first time ActsAccountAddAccount_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.addAccount("account_name_callback_third", "account_extraInfo_callback_third", (err)=>{ console.debug("====>add account second time ActsAccountAddAccount_0500 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_callback_third", (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_0500 end===="); done(); }); @@ -292,10 +292,10 @@ export default function ActsAccountAddAccount() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_name_callback_seventh", "", (err)=>{ console.debug("====>add account ActsAccountAddAccount_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_name_callback_seventh", (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_1300 end===="); done(); }); @@ -373,10 +373,10 @@ export default function ActsAccountAddAccount() { var specialStr = "#@$%^&*()_+!<>~?,./[]abcdefgABCDEFG1234567890"; appAccountManager.addAccount(specialStr, "account_extraInfo_callback_ninth", (err)=>{ console.debug("====>add account ActsAccountAddAccount_1700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount(specialStr, (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_1700 err" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_1700 end===="); done(); }); @@ -418,10 +418,10 @@ export default function ActsAccountAddAccount() { var specialStr = " "; appAccountManager.addAccount("account_name_callback_tenth", specialStr, (err)=>{ console.debug("====>add account ActsAccountAddAccount_1900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_name_callback_tenth", (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_1900 err" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_1900 end===="); done(); }); @@ -463,10 +463,10 @@ export default function ActsAccountAddAccount() { var specialStr = "#@$%^&*()_+!<>~?,./[]abcdefgABCDEFG1234567890"; appAccountManager.addAccount("account_extraInfo_callback_eleventh", specialStr, (err)=>{ console.debug("====>add account ActsAccountAddAccount_2100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_extraInfo_callback_eleventh", (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_2100 err" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_2100 end===="); done(); }); @@ -507,13 +507,13 @@ export default function ActsAccountAddAccount() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_name_callback_same", "account_extraInfo_callback", (err)=>{ console.debug("====>add account first time ActsAccountAddAccount_2300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.addAccount("account_name_callback_same", "account_extraInfo_callback_different", (err)=>{ console.debug("====>add account second time ActsAccountAddAccount_2300 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_callback_same", (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_2300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_2300 end===="); done(); }); @@ -558,10 +558,10 @@ export default function ActsAccountAddAccount() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount(limitName, "account_extraInfo_callback", (err)=>{ console.debug("====>add account ActsAccountAddAccount_2500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount(limitName, (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_2500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_2500 end===="); done(); }); @@ -609,10 +609,10 @@ export default function ActsAccountAddAccount() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_extra_callback_limit", limitExtra, (err)=>{ console.debug("====>add account ActsAccountAddAccount_2700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_extra_callback_limit", (err)=>{ console.debug("====>delete Account ActsAccountAddAccount_2700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAddAccount_2700 end===="); done(); }); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/AppAccess.test.js b/account/appaccount/actsaccounttest/src/main/js/test/AppAccess.test.js index 8f5b08c13b01876a5f7a054be669a7bb96faf579..3fbd4fa5baa6772d71e470a7a150c03b3f7eef97 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/AppAccess.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/AppAccess.test.js @@ -54,13 +54,13 @@ export default function ActsAccountAppAccess() { console.debug("====>creat finish===="); appAccountManager.addAccount("AppAccess_callback_itself", "extrainfo_callback_itself", (err)=>{ console.debug("====>add account ActsAccountAppAccess_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.enableAppAccess("AppAccess_callback_itself", "com.example.actsaccountappaccess", (err)=>{ console.debug("====>enableAppAccess err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("AppAccess_callback_itself", (err)=>{ console.debug("====>delete Account ActsAccountAppAccess_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAppAccess_0100 end===="); done(); }); @@ -105,13 +105,13 @@ export default function ActsAccountAppAccess() { var nonExistBundle = "com.example.NonExistentBundleCallback"; appAccountManager.addAccount("AppAccess_callback_NotExistBundle", "extrainfo_callback_NotExistBundle", (err)=>{ console.debug("====>add account ActsAccountAppAccess_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.enableAppAccess("AppAccess_callback_NotExistBundle", nonExistBundle, (err)=>{ console.debug("====>enableAppAccess 0300 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("AppAccess_callback_NotExistBundle", (err)=>{ console.debug("====>delete Account ActsAccountAppAccess_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAppAccess_0300 end===="); done(); }); @@ -199,15 +199,15 @@ export default function ActsAccountAppAccess() { var enableBundle = "com.example.actsaccountsceneappaccess"; appAccountManager.addAccount("AppAccess_callback_account", (err)=>{ console.debug("====>add account ActsAccountAppAccess_0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.enableAppAccess("AppAccess_callback_account", enableBundle, (err)=>{ console.debug("====>enableAppAccess 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.disableAppAccess("AppAccess_callback_account", enableBundle, (err)=>{ - expect(err.code).assertEqual(0) + expect(err).assertEqual(undefined) appAccountManager.deleteAccount("AppAccess_callback_account", (err)=>{ console.debug("====>delete Account ActsAccountAppAccess_0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAppAccess_0700 end===="); done(); }); @@ -315,13 +315,13 @@ export default function ActsAccountAppAccess() { } appAccountManager.addAccount("AppAccess_callback_bigBundleName", (err)=>{ console.debug("====>add account ActsAccountAppAccess_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.enableAppAccess("AppAccess_callback_bigBundleName", bigBundleName, (err)=>{ console.debug("====>enableAppAccess 1100 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("AppAccess_callback_bigBundleName", (err)=>{ console.debug("====>delete Account ActsAccountAppAccess_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAppAccess_1100 end===="); done(); }); @@ -370,13 +370,13 @@ export default function ActsAccountAppAccess() { var emptyBundleName = ''; appAccountManager.addAccount("AppAccess_callback_emptyBundleName", (err)=>{ console.debug("====>add account ActsAccountAppAccess_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.enableAppAccess("AppAccess_callback_emptyBundleName", emptyBundleName, (err)=>{ console.debug("====>enableAppAccess 1300 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("AppAccess_callback_emptyBundleName", (err)=>{ console.debug("====>delete Account ActsAccountAppAccess_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAppAccess_1300 end===="); done(); }); @@ -422,12 +422,12 @@ export default function ActsAccountAppAccess() { var enableBundle = "com.example.actsaccountsceneappaccess"; appAccountManager.addAccount("AppAccess_callback_account", (err)=>{ console.debug("====>add account ActsAccountAppAccess_1500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.disableAppAccess("AppAccess_callback_account", enableBundle, (err)=>{ expect(err.code != 0).assertEqual(true) appAccountManager.deleteAccount("AppAccess_callback_account", (err)=>{ console.debug("====>delete Account ActsAccountAppAccess_1500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAppAccess_1500 end===="); done(); }); @@ -479,12 +479,12 @@ export default function ActsAccountAppAccess() { var notExistBundle = "com.example.actsaccountnotexistbundle"; appAccountManager.addAccount("AppAccess_callback_notExistBundle", (err)=>{ console.debug("====>add account ActsAccountAppAccess_1700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.disableAppAccess("AppAccess_callback_notExistBundle", notExistBundle, (err)=>{ expect(err.code != 0).assertEqual(true) appAccountManager.deleteAccount("AppAccess_callback_notExistBundle", (err)=>{ console.debug("====>delete Account ActsAccountAppAccess_1700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAppAccess_1700 end===="); done(); }); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js b/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js index 3e9bfd628bea744c892bb67175a92f5f614a5cdb..3d5fa2746665a77744b88eb2630513b21146216a 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js @@ -54,18 +54,18 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0100",(err)=>{ console.debug("====>add accountActsAccountAssociatedData_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_0100", "key1", "value1", (err)=>{ console.debug("====>setAssociatedData ActsAccountAssociatedData_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAssociatedData("account_name_0100", "key1", (err, data)=>{ console.debug("====>getAssociatedData 0100 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 0100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("value1"); appAccountManager.deleteAccount("account_name_0100", (err)=>{ console.debug("====>delete Account 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_0100 end===="); done(); }); @@ -137,15 +137,15 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0300", (err)=>{ console.debug("====>add account ActsAccountAssociatedData_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAssociatedData("account_name_0300", "key3", (err, data)=>{ console.debug("====>getAssociatedData 0300 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 0300 data:" + JSON.stringify(data)); expect(err.code != 0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_name_0300", (err)=>{ console.debug("====>delete Account 0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_0300 end===="); done(); }); @@ -206,17 +206,17 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0500",(err)=>{ console.debug("====>add account ActsAccountAssociatedData_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_0500", "key5", "value5", (err)=>{ console.debug("====>setAssociatedData ActsAccountAssociatedData_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAssociatedData("account_name_0500", "keyerr", (err, data)=>{ console.debug("====>getAssociatedData 0500 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 0500 data:" + JSON.stringify(data)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_0500", (err)=>{ console.debug("====>delete Account 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_0500 end===="); done(); }); @@ -278,21 +278,21 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0700",(err)=>{ console.debug("====>add account ActsAccountAssociatedData_0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_0700", "key7", "value7", (err)=>{ console.debug("====>setAssociatedDatafir first time 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_0700", "key7", "newvalue7", (err)=>{ console.debug("====>setAssociatedDatafir second time 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAssociatedData("account_name_0700", "key7", (err, data)=>{ console.debug("====>getAssociatedData 0700 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 0700 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("newvalue7"); appAccountManager.deleteAccount("account_name_0700", (err)=>{ console.debug("====>delete Account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_0700 end===="); done(); }); @@ -365,21 +365,21 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0900",(err)=>{ console.debug("====>add account ActsAccountAssociatedData_0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_0900", "key9", "value9", (err)=>{ console.debug("====>setAssociatedData first time 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_0900", "key9", "value9", (err)=>{ console.debug("====>setAssociatedData second time 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAssociatedData("account_name_0900", "key9", (err, data)=>{ console.debug("====>getAssociatedData 0900 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 0900 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("value9"); appAccountManager.deleteAccount("account_name_0900", (err)=>{ console.debug("====>delete Account 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_0900 end===="); done(); }); @@ -453,22 +453,22 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1100",(err)=>{ console.debug("====>add account ActsAccountAssociatedData_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_1100", "key11_first", "value11_first", (err)=>{ console.debug("====>setAssociatedData first time 1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_1100", "key11_second", "value11_second", (err)=>{ console.debug("====>setAssociatedData second time 1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAssociatedData("account_name_1100", "key11_first", (err,data)=>{ console.debug("====>getAssociatedData key11_first 1100 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData key11_first 1100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("value11_first"); appAccountManager.getAssociatedData("account_name_1100", "key11_second", (err,data)=>{ console.debug("====>getAssociatedData key11_second 1100 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData key11_second 1100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("value11_second"); appAccountManager.deleteAccount("account_name_1100", (err)=>{ console.debug("====>delete Account 1100 err:" + JSON.stringify(err)); @@ -547,13 +547,13 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1300", (err)=>{ console.debug("====>add account ActsAccountAssociatedData_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_1300", "", "value13", (err)=>{ console.debug("====>setAssociatedData ActsAccountAssociatedData_1300 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_1300", (err)=>{ console.debug("====>delete account ActsAccountAssociatedData_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_1300 end===="); done(); }); @@ -613,7 +613,7 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1500", (err)=>{ console.debug("====>add account ActsAccountAssociatedData_1500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>1500 keyOverSize.length:" + JSON.stringify(keyOverSize.length)); expect(keyOverSize.length).assertEqual(1025); appAccountManager.setAssociatedData("account_name_1500", keyOverSize, "value15", (err)=>{ @@ -621,7 +621,7 @@ export default function ActsAccountAssociatedData() { expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_1500", (err)=>{ console.debug("====>delete account ActsAccountAssociatedData_1500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_1500 end===="); done(); }); @@ -682,18 +682,18 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1700", (err)=>{ console.debug("====>add account ActsAccountAssociatedData_1700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_1700", " ", "value17", (err)=>{ console.debug("====>ActsAccountAssociatedData_1700 setAssociatedData:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAssociatedData("account_name_1700", " ", (err, data)=>{ console.debug("====>getAssociatedData 1700 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 1700 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("value17"); appAccountManager.deleteAccount("account_name_1700", (err)=>{ console.debug("====>delete Account 1700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_1700 end===="); done(); }); @@ -755,18 +755,18 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1900", (err)=>{ console.debug("====>add account ActsAccountAssociatedData_1900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_1900", "key19", "", (err)=>{ console.debug("====>setAssociatedData ActsAccountAssociatedData_1900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAssociatedData("account_name_1900", "key19", (err, data)=>{ console.debug("====>getAssociatedData 1900 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 1900 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(""); appAccountManager.deleteAccount("account_name_1900", (err)=>{ console.debug("====>delete Account 1900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_1900 end===="); done(); }); @@ -838,14 +838,14 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_2100",(err)=>{ console.debug("====>add account ActsAccountAssociatedData_2100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(valueOverSize.length).assertEqual(1025); appAccountManager.setAssociatedData("account_name_2100", "key21", valueOverSize, (err)=>{ console.debug("====>setAssociatedData ActsAccountAssociatedData_2100 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_2100", (err)=>{ console.debug("====>delete Account ActsAccountAssociatedData_2100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_2100 end===="); done(); }); @@ -905,18 +905,18 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_2300", (err)=>{ console.debug("====>add account ActsAccountAssociatedData_2300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("account_name_2300", "key23", " ", (err)=>{ console.debug("====>setAssociatedData ActsAccountAssociatedData_2300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAssociatedData("account_name_2300", "key23", (err, data)=>{ console.debug("====>getAssociatedData 2300 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 2300 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(" "); appAccountManager.deleteAccount("account_name_2300", (err)=>{ console.debug("====>delete Account 2300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_2300 end===="); done(); }); @@ -978,13 +978,13 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_2500", (err)=>{ console.debug("====>add account ActsAccountAssociatedData_2500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAssociatedData("", "key25", "value25", (err)=>{ console.debug("====>setAssociatedData ActsAccountAssociatedData_2500 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_2500", (err)=>{ console.debug("====>delete Account ActsAccountAssociatedData_2500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_2500 end===="); done(); }); @@ -1044,14 +1044,14 @@ export default function ActsAccountAssociatedData() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_2700",(err)=>{ console.debug("====>add account ActsAccountAssociatedData_2700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(nameOverSize.length).assertEqual(1025); appAccountManager.setAssociatedData(nameOverSize, "key27", "value27", (err)=>{ console.debug("====>ActsAccountAssociatedData_2700 setAssociatedData:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_2700", (err)=>{ console.debug("====>delete Account ActsAccountAssociatedData_2700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_2700 end===="); done(); }); @@ -1120,7 +1120,7 @@ export default function ActsAccountAssociatedData() { console.debug("====>getAssociatedData 2900 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 2900 data:" + JSON.stringify(data)); expect(err.code != 0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); console.debug("====>ActsAccountAssociatedData_2900 end===="); done(); }); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js index 8505ea03555af323c8669073b3d56d8ac3f9da88..5751541a4e1564d2ecc2e6c3999330073d90cb16 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js @@ -33,14 +33,14 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount(name, 'test_extraInfo', (err)=>{ console.debug("====>ActsAccountCheckAccountLabels_0100 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAccountLabels(name, owner, ['level4'], (err, data)=>{ console.debug("====>ActsAccountCheckAccountLabels_0100 err:" + JSON.stringify(err)); expect(err).assertEqual(undefined); console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data)); appAccountManager.deleteAccount(name, (err) =>{ console.debug("====>ActsAccountCheckAccountLabels_0100 deleteAccount_err:" + JSON.stringify(err)) - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCheckAccountLabels_0100 end===="); done(); }) @@ -61,14 +61,14 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountCheckAccountLabels_0200 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAccountLabels(name, owner, ['20-30'], (err, data)=>{ console.debug("====>ActsAccountCheckAccountLabels_0200 err:" + JSON.stringify(err)); expect(err).assertEqual(undefined); console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data)); appAccountManager.deleteAccount(name, (err) =>{ console.debug("====>ActsAccountCheckAccountLabels_0200 deleteAccount_err:" + JSON.stringify(err)) - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCheckAccountLabels_0200 end===="); done(); }) @@ -88,7 +88,7 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount('CheckAccountLabels_0300', (err)=>{ console.debug("====>ActsAccountCheckAccountLabels_0300 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAccountLabels('CheckAccountLabels_0300', owner, ['male'], (err, data)=>{ console.debug("====>ActsAccountCheckAccountLabels_0300 err:" + JSON.stringify(err)); expect(err).assertEqual(undefined); @@ -96,7 +96,7 @@ export default function ActsAccountAppAccess() { expect(data).assertEqual(false) appAccountManager.deleteAccount("CheckAccountLabels_0300", (err) =>{ console.debug("====>ActsAccountCheckAccountLabels_0300 deleteAccount_err:" + JSON.stringify(err)) - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCheckAccountLabels_0300 end===="); done(); }) @@ -212,7 +212,7 @@ export default function ActsAccountAppAccess() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountCheckAppAccess_0100 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccess(name, owner, (err, data)=>{ console.debug("====>ActsAccountCheckAppAccess_0100 first_err:" + JSON.stringify(err)); expect(err).assertEqual(undefined); @@ -220,14 +220,14 @@ export default function ActsAccountAppAccess() { expect(data).assertEqual(false) appAccountManager.enableAppAccess(name, owner, (err, data) =>{ console.debug("====>ActsAccountCheckAppAccess_0100 enableAppAccess_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccess(name, owner, (err, data) =>{ console.debug("====>ActsAccountCheckAppAccess_0100 second_err:" + JSON.stringify(err)); expect(err).assertEqual(undefined); expect(data).assertEqual(true) appAccountManager.disableAppAccess(name, owner, (err, data) =>{ console.debug("====>ActsAccountCheckAppAccess_0100 disableAppAccount_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccess(name, owner,(err, data)=>{ console.debug("====>ActsAccountCheckAppAccess_0100 third_err:" + JSON.stringify(err)) expect(err).assertEqual(undefined) @@ -330,14 +330,14 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountDeleteAccountCredential_0100 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential(name, "PIN", (err, data)=>{ console.debug("====>ActsAccountDeleteAccountCredential_0100 setAccountCredential_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountDeleteAccountCredential_0100 setAccountCredential_data:" + JSON.stringify(data)); appAccountManager.getAccountCredential(name, "PIN", (err) =>{ console.debug("====>ActsAccountDeleteAccountCredential_0100 getAccountCredential_err:" + JSON.stringify(err)) - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountDeleteAccountCredential_0100 getAccountCredential_success:" + JSON.stringify(data)); appAccountManager.deleteAccountCredential(name, "PIN", (err, data)=>{ console.debug("====>ActsAccountDeleteAccountCredential_0100 deleteAccountCredential_err:" + JSON.stringify(err)); @@ -423,7 +423,7 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountVerifyCredential_0100 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.verifyCredential(name, owner, options, { onResult:(resultCode, resultData)=>{ console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultcode:" + JSON.stringify(resultCode)); @@ -461,9 +461,9 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountVerifyCredential_0200 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountVerifyCredential_0200 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.verifyCredential(name, owner, { onResult:(resultCode, resultData)=>{ console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultcode:" + JSON.stringify(resultCode)); @@ -502,7 +502,7 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountSetAuthenticatorProperties_0100 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAuthenticatorProperties(owner, options, { onResult:(resultCode, resultData)=>{ console.debug("====>ActsAccountSetAuthenticatorProperties_0100 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode)); @@ -539,7 +539,7 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountSetAuthenticatorProperties_0200 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAuthenticatorProperties(owner, { onResult:(resultCode, resultData)=>{ console.debug("====>ActsAccountSetAuthenticatorProperties_0200 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode)); @@ -577,7 +577,7 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountSelectAccountByOptions_0100 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.selectAccountsByOptions(select_options, ((err, data)=>{ console.debug("====>ActsAccountSelectAccountByOptions_0100 err:" + JSON.stringify(err)); expect(err).assertEqual(undefined) @@ -610,7 +610,7 @@ export default function ActsAccountAppAccess() { console.debug("====>start finish===="); appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountSelectAccountByOptions_0200 add_account_err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.selectAccountsByOptions(select_options).then((data)=>{ console.debug("====>ActsAccountSelectAccountByOptions_0200 data:" + JSON.stringify(data.length)); expect(data.length).assertEqual(0) diff --git a/account/appaccount/actsaccounttest/src/main/js/test/CreatManager.test.js b/account/appaccount/actsaccounttest/src/main/js/test/CreatManager.test.js index aa45f5ea676b19ef5f1802af0e1cdead85c6d6ed..2e7778f1003b0930b065b33e4936de2ecb758448 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/CreatManager.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/CreatManager.test.js @@ -48,10 +48,10 @@ export default function ActsCreatAppAccountManager() { console.debug("====>creat finish===="); appAccountManager.addAccount("creatappaccount_name_first", (err)=>{ console.debug("====>add account ActsCreatAppAccountManager_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManagerTwo.deleteAccount("creatappaccount_name_first", (err)=>{ console.debug("====>delete Account ActsCreatAppAccountManager_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsCreatAppAccountManager_0100 end===="); done(); }); @@ -72,18 +72,18 @@ export default function ActsCreatAppAccountManager() { console.debug("====>creat finish===="); appAccountManager.addAccount("creatappaccount_name_second", (err)=>{ console.debug("====>add account ActsCreatAppAccountManager_0200 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManagerTwo.setAccountExtraInfo("creatappaccount_name_second", "creatappaccount_extra", (err)=>{ console.debug("====>setAccountExtraInfo err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountExtraInfo("creatappaccount_name_second", (err, data)=>{ console.debug("====>getAccountExtraInfo err:" + JSON.stringify(err)); console.debug("====>getAccountExtraInfo data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("creatappaccount_extra"); appAccountManagerTwo.deleteAccount("creatappaccount_name_second", (err)=>{ console.debug("====>delete Account err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsCreatAppAccountManager_0200 end===="); done(); }); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/Credential.test.js b/account/appaccount/actsaccounttest/src/main/js/test/Credential.test.js index 1940a9f3d44ce93375b9eaec551bfb72c9b27264..9dda3bbbd86fea4510e372b62aef1d5e7a3d77a1 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/Credential.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/Credential.test.js @@ -54,18 +54,18 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0100", (err)=>{ console.debug("====>add account ActsAccountCredential_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential("account_name_0100", "credentialType1", "credential1",(err)=>{ console.debug("====>ActsAccountCredential_0100 setAccountCredential:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountCredential("account_name_0100", "credentialType1", (err,data)=>{ console.debug("====>getAccountCredential 0100 err:" + JSON.stringify(err)); console.debug("====>getAccountCredential 0100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("credential1"); appAccountManager.deleteAccount("account_name_0100", (err)=>{ console.debug("====>delete Account 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_0100 end===="); done(); }); @@ -125,21 +125,21 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0300",(err)=>{ console.debug("====>add account ActsAccountCredential_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential("account_name_0300", "credentialType3", "credential3",(err)=>{ console.debug("====>setAccountCredential first time 0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential("account_name_0300", "credentialType3", "newcredential3",(err)=>{ console.debug("====>setAccountCredential second time 0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountCredential("account_name_0300", "credentialType3", (err, data)=>{ console.debug("====>getAccountCredential 0300 err:" + JSON.stringify(err)); console.debug("====>getAccountCredential 0300 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("newcredential3"); appAccountManager.deleteAccount("account_name_0300", (err)=>{ console.debug("====>delete Account 0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_0300 end===="); done(); }); @@ -198,18 +198,18 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0500",(err)=>{ console.debug("====>add account ActsAccountCredential_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential("account_name_0500", "credentialType5", "", (err)=>{ console.debug("====>setAccountCredential ActsAccountCredential_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountCredential("account_name_0500", "credentialType5", (err,data)=>{ console.debug("====>getAccountCredential ActsAccountCredential_0500 err:" + JSON.stringify(err)); console.debug("====>getAccountCredential ActsAccountCredential_0500 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(""); appAccountManager.deleteAccount("account_name_0500", (err)=>{ console.debug("====>delete Account ActsAccountCredential_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_0500 end===="); done(); }); @@ -252,13 +252,13 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0700", (err)=>{ console.debug("====>add account ActsAccountCredential_0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential("account_name_0700", "", "credential7", (err)=>{ console.debug("====>setAccountCredential ActsAccountCredential_0700 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_0700", (err)=>{ console.debug("====>delete Account ActsAccountCredential_0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_0700 end===="); done(); }); @@ -301,13 +301,13 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_0900", (err)=>{ console.debug("====>add account ActsAccountCredential_0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountCredential("account_name_0900", "", (err)=>{ console.debug("====>getAccountCredential ActsAccountCredential_0900 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_0900", (err)=>{ console.debug("====>delete Account ActsAccountCredential_0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_0900 end===="); done(); }); @@ -351,18 +351,18 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1100",(err)=>{ console.debug("====>add account ActsAccountCredential_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential("account_name_1100", " ", "credential11",(err)=>{ console.debug("====>setAccountCredential ActsAccountCredential_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountCredential("account_name_1100", " ", (err, data)=>{ console.debug("====>getAccountCredential 1100 err:" + JSON.stringify(err)); console.debug("====>getAccountCredential 1100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("credential11"); appAccountManager.deleteAccount("account_name_1100", (err)=>{ console.debug("====>delete Account 1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_1100 end===="); done(); }); @@ -406,13 +406,13 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1300",(err)=>{ console.debug("====>add account ActsAccountCredential_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential("", "credentialType13", "credential13", (err)=>{ console.debug("====>setAccountCredential ActsAccountCredential_1300 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_1300", (err)=>{ console.debug("====>delete Account ActsAccountCredential_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_1300 end===="); done(); }); @@ -455,13 +455,13 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1500", (err)=>{ console.debug("====>add account ActsAccountCredential_1500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountCredential("account_name_1500", "credentialType15", (err)=>{ console.debug("====>getAccountCredential ActsAccountCredential_1500 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_1500", (err)=>{ console.debug("====>delete Account ActsAccountCredential_1500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_1500 end===="); done(); }); @@ -507,7 +507,7 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1700", (err)=>{ console.debug("====>add account ActsAccountCredential_1700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential("account_name_1700", "credentialType17", CREDENTIALOVERSIZE, (err)=>{ console.debug("====>CREDENTIALOVERSIZE.length:" + JSON.stringify(CREDENTIALOVERSIZE.length)); expect(CREDENTIALOVERSIZE.length).assertEqual(1025); @@ -515,7 +515,7 @@ export default function ActsAccountCredential() { expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_1700", (err)=>{ console.debug("====>delete Account ActsAccountCredential_1700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_1700 end===="); done(); }); @@ -566,7 +566,7 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_1900", (err)=>{ console.debug("====>add account ActsAccountCredential_1900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential("account_name_1900", CREDENTIALTYPEOVERSIZE, "credential19", (err)=>{ console.debug("====>CREDENTIALTYPEOVERSIZE.length:" + JSON.stringify(CREDENTIALTYPEOVERSIZE.length)); expect(CREDENTIALTYPEOVERSIZE.length).assertEqual(1025); @@ -574,7 +574,7 @@ export default function ActsAccountCredential() { expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_1900", (err)=>{ console.debug("====>delete Account ActsAccountCredential_1900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountCredential_1900 end===="); done(); }); @@ -625,14 +625,14 @@ export default function ActsAccountCredential() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_2100", (err)=>{ console.debug("====>add account ActsAccountCredential_2100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountCredential(NAMEOVERSIZE, "credentialType21", "credential21", (err)=>{ console.debug("====>setAccountCredential ActsAccountCredential_2100 err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_name_2100", (err)=>{ console.debug("====>delete Account ActsAccountCredential_2100 err:" + JSON.stringify(err)); console.debug("====>ActsAccountCredential_2100 end===="); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); done(); }); }); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/DeleteAccount.test.js b/account/appaccount/actsaccounttest/src/main/js/test/DeleteAccount.test.js index 097c0df09c1c3b7856319383db9b0275e7fa7d71..19a3044f169ce8d1a590b1cf008c0c3f7e307a28 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/DeleteAccount.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/DeleteAccount.test.js @@ -46,10 +46,10 @@ export default function ActsAccountDeleteAccount() { console.debug("====>creat finish===="); appAccountManager.addAccount("deleteAccount_name_callback_first", "extraInfo_callback_first", (err)=>{ console.debug("====>add account ActsAccountDeleteAccount_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("deleteAccount_name_callback_first", (err)=>{ console.debug("====>delete Account ActsAccountDeleteAccount_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountDeleteAccount_0100 end===="); done(); }); @@ -124,10 +124,10 @@ export default function ActsAccountDeleteAccount() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("deleteAccount_name_callback_third", "extraInfo_callback_third", (err)=>{ console.debug("====>add account ActsAccountDeleteAccount_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("deleteAccount_name_callback_third", (err)=>{ console.debug("====>delete account first time err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("deleteAccount_name_callback_third", (err)=>{ console.debug("====>delete Account second time err:" + JSON.stringify(err)); expect(err.code != 0).assertEqual(true); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/ExtraInfo.test.js b/account/appaccount/actsaccounttest/src/main/js/test/ExtraInfo.test.js index 00263102f1a43a6303e687d13fc390fcd6cbbf0e..ba3484f98efe2b1e14549e1db7bedd35852d940a 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/ExtraInfo.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/ExtraInfo.test.js @@ -54,15 +54,15 @@ export default function ActsAccountSetGetExtraInfo() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_callback_first", extraInfoStr, (err)=>{ console.debug("====>add account ActsAccountSetGetExtraInfo_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountExtraInfo("account_name_callback_first", (err, data)=>{ console.debug("====>getAccountExtraInfo 0100 err:" + JSON.stringify(err)); console.debug("====>getAccountExtraInfo 0100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(extraInfoStr); appAccountManager.deleteAccount("account_name_callback_first", (err)=>{ console.debug("====>delete Account 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountSetGetExtraInfo_0100 end===="); done(); }); @@ -151,10 +151,10 @@ export default function ActsAccountSetGetExtraInfo() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_callback_third", "account_extrainfo_callback_third", (err)=>{ console.debug("====>add account ActsAccountSetGetExtraInfo_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_name_callback_third", (err)=>{ console.debug("====>delete Account 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountExtraInfo("account_name_callback_third", (err, data)=>{ console.debug("====>getAccountExtraInfo 0500 err:" + JSON.stringify(err)); console.debug("====>getAccountExtraInfo 0500 data:" + JSON.stringify(data)); @@ -204,15 +204,15 @@ export default function ActsAccountSetGetExtraInfo() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_callback_fourth", (err)=>{ console.debug("====>add account ActsAccountSetGetExtraInfo_0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountExtraInfo("account_name_callback_fourth", (err, data)=>{ console.debug("====>getAccountExtraInfo 0700 err:" + JSON.stringify(err)); console.debug("====>getAccountExtraInfo 0700 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(""); appAccountManager.deleteAccount("account_name_callback_fourth", (err)=>{ console.debug("====>delete Account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountSetGetExtraInfo_0700 end===="); done(); }); @@ -301,18 +301,18 @@ export default function ActsAccountSetGetExtraInfo() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_callback_sixth", "account_extrainfo_callback_sixth",(err)=>{ console.debug("====>add account ActsAccountSetGetExtraInfo_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountExtraInfo("account_name_callback_sixth", "account_extra_sixth_twice", (err)=>{ console.debug("====>setAccountExtraInfo 1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountExtraInfo("account_name_callback_sixth", (err, data)=>{ console.debug("====>getAccountExtraInfo 1100 err:" + JSON.stringify(err)); console.debug("====>getAccountExtraInfo 1100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("account_extra_sixth_twice"); appAccountManager.deleteAccount("account_name_callback_sixth", (err)=>{ console.debug("====>delete Account 1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountSetGetExtraInfo_1100 end===="); done(); }); @@ -361,17 +361,17 @@ export default function ActsAccountSetGetExtraInfo() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_callback_seventh",(err)=>{ console.debug("====>add account ActsAccountSetGetExtraInfo_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountExtraInfo("account_name_callback_seventh", "callback_seventh", (err)=>{ console.debug("====>setAccountExtraInfo 1300 first time err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountExtraInfo("account_name_callback_seventh", "call_seventh_twice", (err)=>{ console.debug("====>setAccountExtraInfo 1300 second time err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountExtraInfo("account_name_callback_seventh", (err, data)=>{ console.debug("====>getAccountExtraInfo 1300 err:" + JSON.stringify(err)); console.debug("====>getAccountExtraInfo 1300 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("call_seventh_twice"); appAccountManager.deleteAccount("account_name_callback_seventh", (err)=>{ console.debug("====>delete Account 1300 err:" + JSON.stringify(err)); @@ -437,17 +437,17 @@ export default function ActsAccountSetGetExtraInfo() { console.debug("====>creat finish===="); appAccountManager.addAccount("account_name_callback_eighth",(err)=>{ console.debug("====>add account ActsAccountSetGetExtraInfo_1500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountExtraInfo("account_name_callback_eighth", "extra_callback_eighth", (err)=>{ console.debug("====>setAccountExtraInfo second time err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAccountExtraInfo("account_name_callback_eighth", "extra_callback_eighth", (err)=>{ console.debug("====>setAccountExtraInfo 1500 first time err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAccountExtraInfo("account_name_callback_eighth", (err, data)=>{ console.debug("====>getAccountExtraInfo 1500 err:" + JSON.stringify(err)); console.debug("====>getAccountExtraInfo 1500 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("extra_callback_eighth"); appAccountManager.deleteAccount("account_name_callback_eighth", (err)=>{ console.debug("====>delete Account 1500 err:" + JSON.stringify(err)); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/NoPermission.test.js b/account/appaccount/actsaccounttest/src/main/js/test/NoPermission.test.js index 296a1859944965ab5c9c853b65c31211f6d055ef..72957fd0b2247207bd5871ed3aeb9035265ce397 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/NoPermission.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/NoPermission.test.js @@ -46,13 +46,13 @@ export default function ActsAccountNoPermission() { console.debug("====>creat finish===="); appAccountManager.addAccount("syncenable_callback_setnopermission", (err)=>{ console.debug("====>add account ActsAccountNoPermission_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAppAccountSyncEnable("syncenable_callback_setnopermission", true, (err)=>{ console.debug("====>setAppAccountSyncEnable 0100 err:" + JSON.stringify(err)); expect(err.code).assertEqual(account.ResultCode.ERROR_PERMISSION_DENIED); appAccountManager.deleteAccount("syncenable_callback_setnopermission", (err)=>{ console.debug("====>delete Account ActsAccountNoPermission_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountNoPermission_0100 end===="); done(); }); @@ -96,13 +96,13 @@ export default function ActsAccountNoPermission() { console.debug("====>creat finish===="); appAccountManager.addAccount("syncenable_callback_checknopermission", (err)=>{ console.debug("====>add account ActsAccountNoPermission_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccountSyncEnable("syncenable_callback_checknopermission", (err, data)=>{ console.debug("====>checkAppAccountSyncEnable 0300 err:" + JSON.stringify(err)); expect(err.code).assertEqual(account.ResultCode.ERROR_PERMISSION_DENIED); appAccountManager.deleteAccount("syncenable_callback_checknopermission", (err)=>{ console.debug("====>delete Account ActsAccountNoPermission_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountNoPermission_0300 end===="); done(); }); @@ -145,13 +145,13 @@ export default function ActsAccountNoPermission() { console.debug("====>creat finish===="); appAccountManager.addAccount("accessibleAccount_callback_nopermission", (err)=>{ console.debug("====> add account ActsAccountNoPermission_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccessibleAccounts((err, data)=>{ console.debug("====>getAllAccessibleAccounts 0500 err:" + JSON.stringify(err)); expect(err.code).assertEqual(account.ResultCode.ERROR_PERMISSION_DENIED); appAccountManager.deleteAccount("accessibleAccount_callback_nopermission", (err)=>{ console.debug("====>delete Account ActsAccountNoPermission_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountNoPermission_0500 end===="); done(); }) @@ -195,13 +195,13 @@ export default function ActsAccountNoPermission() { var selfBundle = "com.example.actsaccounttest"; appAccountManager.addAccount("getAll_callback_nopermission", (err)=>{ console.debug("====>add account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("====>getAllAccounts 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(account.ResultCode.ERROR_PERMISSION_DENIED); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("getAll_callback_nopermission", (err)=>{ console.debug("====>delete account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountNoPermission_0700 end===="); done(); }); @@ -224,6 +224,9 @@ export default function ActsAccountNoPermission() { console.debug("====>getAllAccounts 0800 start===="); try{ var data = await appAccountManager.getAllAccounts(selfBundle); + console.debug("====>getAll_promist_nopermission data:" + JSON.stringify(data)) + expect(data.length>0).assertEqual(true); + done(); } catch(err){ console.error("====>getAllAccounts 0800 err:" + JSON.stringify(err)); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js b/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js index 9b73de9e2e21c6d551ab64a69682cb10f3672048..79cfdae7df74834375e8d29d2ea6eed9ca360060 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js @@ -67,35 +67,35 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_tokenTest_name",(err,)=>{ console.debug("====>ActsAccountOAuthToken_9100 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType1","test_token1",(err)=>{ console.debug("====>ActsAccountOAuthToken_9100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType1","test_token2",(err)=>{ console.debug("====>ActsAccountOAuthToken_9100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_tokenTest_name","authType1","other_app_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_9100 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType2","test_token2",(err)=>{ console.debug("====>ActsAccountOAuthToken_9100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_9100 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_9100 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(ArrayData.length).assertEqual(2); appAccountManager.deleteOAuthToken("account_tokenTest_name",OWNERSELF,"authType1","test_token2",(err)=>{ console.debug("====>ActsAccountOAuthToken_9100 deleteOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_9100 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_9100 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(ArrayData.length).assertEqual(2); appAccountManager.deleteAccount("account_tokenTest_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_9100 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_9100 end===="); done(); appAccountManager.getOAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ @@ -122,45 +122,45 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_tokenTest_name",(err,)=>{ console.debug("====>ActsAccountOAuthToken_9000 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_9000 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_9000 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_9000 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("test_token"); appAccountManager.setOAuthTokenVisibility("account_tokenTest_name","authType","other_app_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_9000 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_tokenTest_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_9000 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_9000 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(1); expect(dataArray[0]).assertEqual("other_app_bundleName"); appAccountManager.deleteOAuthToken("account_tokenTest_name",OWNERSELF,"authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_9000 deleteOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_9000 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_9000 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(ArrayData.length).assertEqual(1); expect(ArrayData[0].authType).assertEqual("authType"); expect(ArrayData[0].token).assertEqual(""); appAccountManager.setOAuthTokenVisibility("account_tokenTest_name","authType",OWNERSELF,false,(err)=>{ console.debug("====>ActsAccountOAuthToken_9000 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_9000 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_9000 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_tokenTest_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_9000 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_9000 end===="); done(); }); @@ -183,20 +183,20 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_7100 addAccount start===="); appAccountManager.addAccount("account_tokenTest_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_7100 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType1","test_token1",(err)=>{ console.debug("====>ActsAccountOAuthToken_7100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType1","test_token2",(err)=>{ console.debug("====>ActsAccountOAuthToken_7100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType2","test_token2",(err)=>{ console.debug("====>ActsAccountOAuthToken_7100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_7100 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7100 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(ArrayData.length).assertEqual(2); expect(ArrayData[0].authType).assertEqual("authType1"); expect(ArrayData[0].token).assertEqual("test_token2"); @@ -204,22 +204,22 @@ export default function ActsAccountOAuthToken() { expect(ArrayData[1].token).assertEqual("test_token2"); appAccountManager.deleteOAuthToken("account_tokenTest_name",OWNERSELF,"authType1","test_token2",(err)=>{ console.debug("====>ActsAccountOAuthToken_7100 deleteOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_7100 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7100 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(ArrayData.length).assertEqual(1); expect(ArrayData[0].authType).assertEqual("authType2"); expect(ArrayData[0].token).assertEqual("test_token2"); appAccountManager.deleteAccount("account_tokenTest_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_7100 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_7100 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7100 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_7100 end===="); done(); }); @@ -239,23 +239,23 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_tokenTest_name",(err,)=>{ console.debug("====>ActsAccountOAuthToken_7200 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7200 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_7200 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7200 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("test_token"); appAccountManager.getOAuthList("account_tokenTest_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_7200 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_7200 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(0); appAccountManager.deleteAccount("account_tokenTest_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_7200 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_7200 end===="); done(); }); @@ -271,34 +271,34 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_7300 addAccount start===="); appAccountManager.addAccount("account_tokenTest_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_7300 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7300 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_7300 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7300 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("test_token"); appAccountManager.checkOAuthTokenVisibility("account_tokenTest_name","authType",OWNERSELF,(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_7300 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7300 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(true); appAccountManager.setOAuthTokenVisibility("account_tokenTest_name","authType",OWNERSELF,false,(err)=>{ console.debug("====>ActsAccountOAuthToken_7300 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkOAuthTokenVisibility("account_tokenTest_name","authType",OWNERSELF,(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_7300 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7300 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(true); appAccountManager.deleteOAuthToken("account_tokenTest_name",OWNERSELF,"authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7300 deleteOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_tokenTest_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_7300 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_7300 end===="); done(); }); @@ -321,16 +321,16 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_7400 addAccount start===="); appAccountManager.addAccount("account_callback_authType_limit",(err)=>{ console.debug("====>ActsAccountOAuthToken_7400 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_authType_limit","authType","callback_authType_limit_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7400 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_authType_limit",OWNERSELF,limitAuthType,"callback_authType_limit_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7400 getOAuthToken err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_callback_authType_limit",(err)=>{ console.debug("====>ActsAccountOAuthToken_7400 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_7400 end===="); done(); }); @@ -375,16 +375,16 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_7600 addAccount start===="); appAccountManager.addAccount("account_callback_authType_limit",(err)=>{ console.debug("====>ActsAccountOAuthToken_7600 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_authType_limit",limitAuthType,"callback_authType_limit_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7600 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_authType_limit",OWNERSELF,limitAuthType,"callback_authType_limit_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7600 getOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_authType_limit",(err)=>{ console.debug("====>ActsAccountOAuthToken_7600 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_7600 end===="); done(); }); @@ -421,21 +421,21 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_7800 addAccount start===="); appAccountManager.addAccount("account_callback_empty_authType",(err)=>{ console.debug("====>ActsAccountOAuthToken_7800 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_empty_authType","authType","callback_empty_authType_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7800 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_empty_authType",OWNERSELF,"","callback_empty_authType_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7800 deleteOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_empty_authType",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_7800 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7800 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_empty_authType_token"); appAccountManager.deleteAccount("account_callback_empty_authType",(err)=>{ console.debug("====>ActsAccountOAuthToken_7800 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_7800 end===="); done(); }); @@ -471,24 +471,24 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8000 addAccount start===="); appAccountManager.addAccount("account_callback_setSameAuthType",(err)=>{ console.debug("====>ActsAccountOAuthToken_8000 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_token1",(err)=>{ console.debug("====>ActsAccountOAuthToken_8000 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_token2",(err)=>{ console.debug("====>ActsAccountOAuthToken_8000 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_8000 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8000 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_setSameAuthType_token2"); appAccountManager.deleteOAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType","callback_setSameAuthType_token1",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_8000 deleteOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_setSameAuthType",(err)=>{ console.debug("====>ActsAccountOAuthToken_8000 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8000 end===="); done(); }); @@ -515,7 +515,7 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8100 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8100 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); expect(err.code!=0).assertEqual(true); - expect(ArrayData.length).assertEqual(0); + expect(ArrayData).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8100 ===="); done(); }); @@ -529,7 +529,7 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8200 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8200 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); expect(err.code!=0).assertEqual(true); - expect(ArrayData.length).assertEqual(0); + expect(ArrayData).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8200 ===="); done(); }); @@ -543,7 +543,7 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8300 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8300 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); expect(err.code!=0).assertEqual(true); - expect(ArrayData.length).assertEqual(0); + expect(ArrayData).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8300 end===="); done(); }); @@ -557,15 +557,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8400 addAccount start===="); appAccountManager.addAccount("acount_no_setToken",(err)=>{ console.debug("====>ActsAccountOAuthToken_8400 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("acount_no_setToken", OWNERSELF,(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_8400 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8400 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(ArrayData.length).assertEqual(0); appAccountManager.deleteAccount("acount_no_setToken",(err)=>{ console.debug("====>ActsAccountOAuthToken_8400 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8400 end===="); done(); }); @@ -585,20 +585,20 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8500 addAccount start===="); appAccountManager.addAccount(limitName,(err)=>{ console.debug("====>ActsAccountOAuthToken_8500 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken(limitName,"authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_8500 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens(limitName, OWNERSELF,(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_8500 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8500 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(ArrayData.length).assertEqual(1); expect(ArrayData[0].authType).assertEqual("authType"); expect(ArrayData[0].token).assertEqual("test_token"); appAccountManager.deleteAccount(limitName,(err)=>{ console.debug("====>ActsAccountOAuthToken_8500 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8500 end===="); done(); }); @@ -618,15 +618,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8600 addAccount start===="); appAccountManager.addAccount("account_callback_getAllOAuthTokens_test",(err)=>{ console.debug("====>ActsAccountOAuthToken_8600 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("account_callback_getAllOAuthTokens_test",limitOwner,(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_8600 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8600 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); expect(err.code!=0).assertEqual(true); - expect(ArrayData.length).assertEqual(0); + expect(ArrayData).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_getAllOAuthTokens_test",(err)=>{ console.debug("====>ActsAccountOAuthToken_8600 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8600 end===="); done(); }); @@ -641,15 +641,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8700 addAccount start===="); appAccountManager.addAccount("account_callback_getAllOAuthTokens_test",(err)=>{ console.debug("====>ActsAccountOAuthToken_8700 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("account_callback_getAllOAuthTokens_test","",(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_8700 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8700 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); expect(err.code!=0).assertEqual(true); - expect(ArrayData.length).assertEqual(0); + expect(ArrayData).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_getAllOAuthTokens_test",(err)=>{ console.debug("====>ActsAccountOAuthToken_8700 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8700 end===="); done(); }); @@ -664,15 +664,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8800 addAccount start===="); appAccountManager.addAccount("account_callback_getAllOAuthTokens_test",(err)=>{ console.debug("====>ActsAccountOAuthToken_8800 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("account_callback_getAllOAuthTokens_test","invalid_owner",(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_8800 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8800 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); expect(err.code!=0).assertEqual(true); - expect(ArrayData.length).assertEqual(0); + expect(ArrayData).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_getAllOAuthTokens_test",(err)=>{ console.debug("====>ActsAccountOAuthToken_8800 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8800 end===="); done(); }); @@ -686,15 +686,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_8900 addAccount start===="); appAccountManager.addAccount("account_callback_getAllOAuthTokens_test",(err)=>{ console.debug("====>ActsAccountOAuthToken_8900 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllOAuthTokens("account_callback_getAllOAuthTokens_test"," ",(err,ArrayData)=>{ console.debug("====>ActsAccountOAuthToken_8900 getAllOAuthTokens err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_8900 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); expect(err.code!=0).assertEqual(true); - expect(ArrayData.length).assertEqual(0); + expect(ArrayData).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_getAllOAuthTokens_test",(err)=>{ console.debug("====>ActsAccountOAuthToken_8900 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_8900 end===="); done(); }); @@ -711,26 +711,26 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_0100 addAccount start===="); appAccountManager.addAccount("account_callback_normal",(err)=>{ console.debug("====>ActsAccountOAuthToken_0100 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_normal","authType","callback_normal_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_0100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_normal",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_0100 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_0100 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_normal_token"); appAccountManager.checkOAuthTokenVisibility("account_callback_normal","authType",OWNERSELF,(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_0100 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_0100 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(true); appAccountManager.deleteOAuthToken("account_callback_normal",OWNERSELF,"authType","callback_normal_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_0100 deleteOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_normal",(err)=>{ console.debug("====>ActsAccountOAuthToken_0100 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_0100 end===="); done(); }); @@ -774,15 +774,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_0300 getOAuthToken start===="); appAccountManager.addAccount("account_callback_noSetToken",(err)=>{ console.debug("====>ActsAccountOAuthToken_0300 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_noSetToken",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_0300 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_0300 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_noSetToken",(err)=>{ console.debug("====>ActsAccountOAuthToken_0300 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_0300 end===="); done(); }); @@ -818,7 +818,7 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_0500 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_0500 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); done(); }); }); @@ -845,29 +845,29 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_0700 addAccount start===="); appAccountManager.addAccount("account_callback_setSameAuthType",(err)=>{ console.debug("====>ActsAccountOAuthToken_0700 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_0700 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_0700 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_0700 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_0700 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_setSameAuthType_token"); appAccountManager.setOAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_DiffToken",(err)=>{ console.debug("====>ActsAccountOAuthToken_0700 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_0700 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_0700 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_setSameAuthType_DiffToken"); appAccountManager.deleteAccount("account_callback_setSameAuthType",(err)=>{ console.debug("====>ActsAccountOAuthToken_0700 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_0700 end===="); done(); }); @@ -912,26 +912,26 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_setDiff", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setDiff","authType1","callback_setDiff_token1",(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setDiff","authType2","callback_setDiff_token2",(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_setDiff",OWNERSELF,"authType1", (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_0900 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_0900 data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_setDiff_token1"); appAccountManager.getOAuthToken("account_callback_setDiff",OWNERSELF,"authType2", (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_0900 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_0900 data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_setDiff_token2"); appAccountManager.deleteAccount("account_callback_setDiff", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_0900 end===="); done(); }); @@ -980,22 +980,22 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_setDeleteGet", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setDeleteGet","old_authType","callback_setDeleteGet_token",(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setDeleteGet","new_authType","callback_setDeleteGet_token",(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_setDeleteGet",OWNERSELF,"old_authType", (err, data)=>{ console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1100 data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_setDeleteGet_token"); appAccountManager.getOAuthToken("account_callback_setDeleteGet",OWNERSELF,"new_authType", (err, data)=>{ console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1100 data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_setDeleteGet_token"); appAccountManager.deleteOAuthToken("account_callback_setDeleteGet",OWNERSELF,"old_authType","callback_setDeleteGet_token",(err)=>{ console.debug("====>deleteOAuthToken deleteOld ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); @@ -1003,11 +1003,11 @@ export default function ActsAccountOAuthToken() { console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1100 data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_setDeleteGet",OWNERSELF,"new_authType", (err, data)=>{ console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1100 data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("callback_setDeleteGet_token"); appAccountManager.deleteOAuthToken("account_callback_setDeleteGet",OWNERSELF,"new_authType","callback_setDeleteGet_token",(err)=>{ console.debug("====>deleteOAuthToken deleteNew ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); @@ -1015,15 +1015,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1100 data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_setDeleteGet",OWNERSELF,"new_authType", (err, data)=>{ console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1100 data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_setDeleteGet", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_1100 end===="); done(); }); @@ -1067,7 +1067,7 @@ export default function ActsAccountOAuthToken() { } catch(err){ console.debug("====>deleteOAuthToken ActsAccountOAuthToken_1200 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); } console.debug("====>getOAuthToken ActsAccountOAuthToken_1200 start===="); @@ -1086,7 +1086,7 @@ export default function ActsAccountOAuthToken() { } catch(err){ console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1200 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1200 data:" + data2_AfterDel); expect(data2_AfterDel).assertEqual("promise_setDeleteGet_token"); } @@ -1096,7 +1096,7 @@ export default function ActsAccountOAuthToken() { } catch(err){ console.debug("====>deleteOAuthToken ActsAccountOAuthToken_1200 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); } console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 start===="); @@ -1131,21 +1131,21 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_setDeleteGet", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setDeleteGet","authType","account_callback_setDeleteGet_token",(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_setDeleteGet",OWNERSELF,"authType","account_callback_setDeleteGet_token",(err)=>{ console.debug("====>deleteOAuthToken ActsAccountOAuthToken_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_setDeleteGet",OWNERSELF,"authType", (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_1300 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_1300 data:" + data); expect(err.code != 0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_setDeleteGet", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_1300 end===="); done(); }); @@ -1242,17 +1242,17 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_repeatDelete", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_1900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token",(err)=>{ console.debug("====>deleteOAuthToken ActsAccountOAuthToken_1900 err:" + JSON.stringify(err)); appAccountManager.getOAuthToken("account_callback_repeatDelete",OWNERSELF,"authType", (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_1900 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_1900 data:" + data); expect(err.code != 0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_repeatDelete", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_1900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_1900 end===="); done(); }); @@ -1291,27 +1291,27 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_repeatDelete", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_2100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_repeatDelete","authType","",(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_2100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token",(err)=>{ console.debug("====>deleteOAuthToken first ActsAccountOAuthToken_2100 err:" + JSON.stringify(err)); appAccountManager.getOAuthToken("account_callback_repeatDelete",OWNERSELF,"authType", (err, data)=>{ console.debug("====>getOAuthToken first ActsAccountOAuthToken_2100 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken first ActsAccountOAuthToken_2100 data:" + data); expect(err.code != 0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token",(err)=>{ console.debug("====>deleteOAuthToken second ActsAccountOAuthToken_2100 err:" + JSON.stringify(err)); appAccountManager.getOAuthToken("account_callback_repeatDelete",OWNERSELF,"authType", (err, data)=>{ console.debug("====>getOAuthToken second ActsAccountOAuthToken_2100 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken second ActsAccountOAuthToken_2100 data:" + data); expect(err.code != 0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_repeatDelete", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_2100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_2100 end===="); done(); }); @@ -1356,18 +1356,18 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_setEmptyToken", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_2300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_setEmptyToken","authType","",(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_2300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_setEmptyToken",OWNERSELF,"authType", (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_2300 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_2300 data:" + data); expect(err.code != 0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_setEmptyToken", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_2300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_2300 end===="); done(); }); @@ -1405,18 +1405,18 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_spaceToken", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_2500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_spaceToken","authType"," ",(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_2500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_spaceToken",OWNERSELF,"authType", (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_2500 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_2500 data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(" "); appAccountManager.deleteAccount("account_callback_spaceToken", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_2500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_2500 end===="); done(); }); @@ -1453,13 +1453,13 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_exceed_limitToken", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_2700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_exceed_limitToken","authType",limitToken,(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_2700 err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_callback_exceed_limitToken", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_2700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_2700 end===="); done(); }); @@ -1501,18 +1501,18 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_limitToken", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_2900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_limitToken","authType",limitToken,(err)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_2900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_limitToken",OWNERSELF,"authType", (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_2900 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_2900 data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(limitToken); appAccountManager.deleteAccount("account_callback_limitToken", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_2900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_2900 end===="); done(); }); @@ -1552,13 +1552,13 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_limitAuthType", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_3100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_limitAuthType",limitAuthType,"account_callback_limitAuthType_token",(err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_3100 err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_callback_limitAuthType", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_3100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_3100 end===="); done(); }); @@ -1601,14 +1601,14 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_callback_limitAuthType", (err)=>{ console.debug("====>addAccount ActsAccountOAuthToken_3300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_limitAuthType","com.example.actsaccounttest",limitAuthType, (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_3300 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_3300 data:" + data); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_callback_limitAuthType", (err)=>{ console.debug("====>deleteAccount ActsAccountOAuthToken_3300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_3300 end===="); done(); }); @@ -1656,18 +1656,18 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_3500 create finish===="); appAccountManager.addAccount("account_callback_limitAuthType", (err)=>{ console.debug("====>add account ActsAccountOAuthToken_3500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_limitAuthType",limitAuthType,"account_callback_limitAuthType_token", (err)=>{ console.debug("====>setOAuthToken ActsAccountOAuthToken_3500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_limitAuthType","com.example.actsaccounttest",limitAuthType, (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_3500 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_3500 data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("account_callback_limitAuthType_token"); appAccountManager.deleteAccount("account_callback_limitAuthType", (err)=>{ console.debug("====>delete Account ActsAccountOAuthToken_3500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_3500 end===="); done(); }); @@ -1813,15 +1813,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_4700 create finish===="); appAccountManager.addAccount("account_callback_invalid_owner", (err)=>{ console.debug("====>add account ActsAccountOAuthToken_4700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_invalid_owner","invalid_owner","authType", (err, data)=>{ console.debug("====>getOAuthToken ActsAccountOAuthToken_4700 err:" + JSON.stringify(err)); console.debug("====>getOAuthToken ActsAccountOAuthToken_4700 data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_invalid_owner", (err)=>{ console.debug("====>delete account ActsAccountOAuthToken_4700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_4700 end===="); done(); }); @@ -1857,18 +1857,18 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_3700 addAccount start===="); appAccountManager.addAccount("account_callback_authType_empty",(err)=>{ console.debug("====>ActsAccountOAuthToken_3700 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_authType_empty","","account_callback_authType_empty_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_3700 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_authType_empty",OWNERSELF,"",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_3700 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_3700 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("account_callback_authType_empty_token"); appAccountManager.deleteAccount("account_callback_authType_empty",(err)=>{ console.debug("====>ActsAccountOAuthToken_3700 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_3700 end===="); done(); }); @@ -1899,18 +1899,18 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_3900 addAccount start===="); appAccountManager.addAccount("account_callback_authType_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_3900 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_authType_space"," ","account_callback_authType_space_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_3900 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_authType_space",OWNERSELF," ",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_3900 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_3900 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("account_callback_authType_space_token"); appAccountManager.deleteAccount("account_callback_authType_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_3900 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_3900 end===="); done(); }); @@ -1961,15 +1961,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_4900 addAccount start===="); appAccountManager.addAccount("account_callback_owner_empty",(err)=>{ console.debug("====>ActsAccountOAuthToken_4900 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_owner_empty","","authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_4900 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_4900 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_owner_empty",(err)=>{ console.debug("====>ActsAccountOAuthToken_4900 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_4900 end===="); done(); }); @@ -2002,15 +2002,15 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_5100 addAccount start===="); appAccountManager.addAccount("account_callback_owner_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_5100 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_owner_space"," ","authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_5100 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_5100 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_owner_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_5100 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_5100 end===="); done(); }); @@ -2043,18 +2043,18 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_5300 addAccount start===="); appAccountManager.addAccount("account_callback_authType_invalid",(err)=>{ console.debug("====>ActsAccountOAuthToken_5300 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_authType_invalid","authType","account_callback_authType_invalid_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_5300 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_authType_invalid",OWNERSELF,"invalid_authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_5300 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_5300 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_authType_invalid",(err)=>{ console.debug("====>ActsAccountOAuthToken_5300 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_5300 end===="); done(); }); @@ -2090,18 +2090,18 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_5500 addAccount start===="); appAccountManager.addAccount("account_callback_authType_empty",(err)=>{ console.debug("====>ActsAccountOAuthToken_5500 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_authType_empty","authType","account_callback_authType_empty_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_5500 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_authType_empty",OWNERSELF,"",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_5500 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_5500 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_authType_empty",(err)=>{ console.debug("====>ActsAccountOAuthToken_5500 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_5500 end===="); done(); }); @@ -2137,18 +2137,18 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_5700 addAccount start===="); appAccountManager.addAccount("account_callback_authType_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_5700 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_authType_space","authType","account_callback_authType_space_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_5700 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_authType_space",OWNERSELF," ",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_5700 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_5700 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_authType_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_5700 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_5700 end===="); done(); }); @@ -2184,16 +2184,16 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_5900 addAccount start===="); appAccountManager.addAccount("account_callback_owner_invalid",(err)=>{ console.debug("====>ActsAccountOAuthToken_5900 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_owner_invalid","authType","account_callback_owner_invalid_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_5900 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_owner_invalid","invalid_owner","authType","account_callback_owner_invalid_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_5900 getOAuthToken err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_callback_owner_invalid",(err)=>{ console.debug("====>ActsAccountOAuthToken_5900 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_5900 end===="); done(); }); @@ -2229,16 +2229,16 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_6100 addAccount start===="); appAccountManager.addAccount("account_callback_owner_empty",(err)=>{ console.debug("====>ActsAccountOAuthToken_6100 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_owner_empty","authType","account_callback_owner_empty_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_6100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_owner_empty","","authType","account_callback_owner_empty_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_6100 getOAuthToken err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_callback_owner_empty",(err)=>{ console.debug("====>ActsAccountOAuthToken_6100 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_6100 end===="); done(); }); @@ -2274,16 +2274,16 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_6300 addAccount start===="); appAccountManager.addAccount("account_callback_owner_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_6300 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_owner_space","authType","account_callback_owner_space_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_6300 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_owner_space"," ","authType","account_callback_owner_space_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_6300 getOAuthToken err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_callback_owner_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_6300 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_6300 end===="); done(); }); @@ -2323,13 +2323,13 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_6500 addAccount start===="); appAccountManager.addAccount("account_callback_token_exceedLimit",(err)=>{ console.debug("====>ActsAccountOAuthToken_6500 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_token_exceedLimit",OWNERSELF,"authType",limitToken,(err)=>{ console.debug("====>ActsAccountOAuthToken_6500 getOAuthToken err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_callback_token_exceedLimit",(err)=>{ console.debug("====>ActsAccountOAuthToken_6500 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_6500 end===="); done(); }); @@ -2370,16 +2370,16 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_6700 addAccount start===="); appAccountManager.addAccount("account_callback_token_limit",(err)=>{ console.debug("====>ActsAccountOAuthToken_6700 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_token_limit","authType",limitToken,(err)=>{ console.debug("====>ActsAccountOAuthToken_6700 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_token_limit",OWNERSELF,"authType",limitToken,(err)=>{ console.debug("====>ActsAccountOAuthToken_6700 getOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("account_callback_token_limit",(err)=>{ console.debug("====>ActsAccountOAuthToken_6700 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_6700 end===="); done(); }); @@ -2413,21 +2413,21 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_6900 addAccount start===="); appAccountManager.addAccount("account_callback_delete_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_6900 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_callback_delete_space","authType","account_callback_delete_space_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_6900 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteOAuthToken("account_callback_delete_space",OWNERSELF,"authType","",(err)=>{ console.debug("====>ActsAccountOAuthToken_6900 getOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_callback_delete_space",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_6900 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_6900 getOAuthToken data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("account_callback_delete_space_token"); appAccountManager.deleteAccount("account_callback_delete_space",(err)=>{ console.debug("====>ActsAccountOAuthToken_6900 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_6900 end===="); done(); }); @@ -2567,24 +2567,24 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err,)=>{ console.debug("====>ActsAccountOAuthToken_9900 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","authType","test_BundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_9900 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_setOAuthTokenVisibility_name",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_9900 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_9900 getOAuthToken data:" + data); expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(""); + expect(data).assertEqual(undefined); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_9900 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_9900 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(1); expect(dataArray[0]).assertEqual("test_BundleName"); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_9900 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_9900 end===="); done(); }); @@ -2599,21 +2599,21 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err,)=>{ console.debug("====>ActsAccountOAuthToken_10000 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_setOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_10000 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","authType","test_BundleName","",(err)=>{ console.debug("====>ActsAccountOAuthToken_10000 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10000 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10000 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(0); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10000 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10000 end===="); done(); }); @@ -2628,21 +2628,21 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10100 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_setOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_10100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","authType","test_BundleName","invalid_string",(err)=>{ console.debug("====>ActsAccountOAuthToken_10100 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10100 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10100 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(0); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10100 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10100 end===="); done(); }); @@ -2657,16 +2657,16 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10200 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_setOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_10200 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","authType","",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_10200 setOAuthTokenVisibility err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10200 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10200 end===="); done(); }); @@ -2680,22 +2680,22 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10300 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_setOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_10300 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","authType"," ",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_10300 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10300 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10300 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(1); expect(dataArray[0]).assertEqual(" "); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10300 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10300 end===="); done(); }); @@ -2714,16 +2714,16 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10400 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_setOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_10400 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","authType",limitBundleName,true,(err)=>{ console.debug("====>ActsAccountOAuthToken_10400 setOAuthTokenVisibility err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10400 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10400 end===="); done(); }); @@ -2737,27 +2737,27 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10500 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_setOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_10500 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","","test_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_10500 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10500 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10500 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(1); expect(dataArray[0]).assertEqual("test_bundleName"); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10500 getOAuthList authType:\"authType\" err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10500 getOAuthList authType:\"authType\" dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(0); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10500 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10500 end===="); done(); }); @@ -2773,27 +2773,27 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10600 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_setOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_10600 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name"," ","test_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_10600 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name"," ",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10600 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10600 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(1); expect(dataArray[0]).assertEqual("test_bundleName"); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10600 getOAuthList authType:\"authType\" err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10600 getOAuthList authType:\"authType\" dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(0); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10600 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10600 end===="); done(); }); @@ -2814,21 +2814,21 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10700 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_setOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_10700 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name",limitAuthType,"test_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_10700 setOAuthTokenVisibility err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10700 getOAuthList authType:\"authType\" err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10700 getOAuthList authType:\"authType\" dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(0); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10700 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10700 end===="); done(); }); @@ -2843,27 +2843,27 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10800 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_setOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_10800 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","invalid_authType","test_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_10800 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","invalid_authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10800 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10800 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(1); expect(dataArray[0]).assertEqual("test_bundleName"); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_10800 getOAuthList authType:\"authType\" err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10800 getOAuthList authType:\"authType\" dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(0); appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_10800 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_10800 end===="); done(); }); @@ -2967,23 +2967,23 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_11700 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_checkOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_11700 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name","","test_bundleName",(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_11700 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_11700 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(false); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name","",OWNERSELF,(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_11700 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_11700 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(true); appAccountManager.deleteAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_11700 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_11700 end===="); done(); }); @@ -2998,23 +2998,23 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_11800 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_checkOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_11800 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name"," ","test_bundleName",(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_11800 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_11800 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(false); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name"," ",OWNERSELF,(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_11800 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_11800 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(true); appAccountManager.deleteAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_11800 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_11800 end===="); done(); }); @@ -3033,10 +3033,10 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_11900 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_checkOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_11900 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name",limitAuthType,"test_bundleName",(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_11900 checkOAuthTokenVisibility err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); @@ -3045,7 +3045,7 @@ export default function ActsAccountOAuthToken() { expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_11900 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_11900 end===="); done(); }); @@ -3060,23 +3060,23 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12000 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_checkOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_12000 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name","invalid_authType","test_bundleName",(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_12000 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_12000 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(false); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name","invalid_authType",OWNERSELF,(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_12000 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_12000 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(true); appAccountManager.deleteAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12000 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_12000 end===="); done(); }); @@ -3091,17 +3091,17 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12100 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_checkOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_12100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name","authType","",(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_12100 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_12100 checkOAuthTokenVisibility stateBack:" + stateBack); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12100 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_12100 end===="); done(); }); @@ -3115,18 +3115,18 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12200 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_checkOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_12200 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name","authType"," ",(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_12200 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_12200 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(false); appAccountManager.deleteAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12200 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_12200 end===="); done(); }); @@ -3144,17 +3144,17 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12300 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_checkOAuthTokenVisibility_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_12300 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkOAuthTokenVisibility("account_checkOAuthTokenVisibility_name","authType",limitBundleName,(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_12300 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_12300 checkOAuthTokenVisibility stateBack:" + stateBack); expect(err.code!=0).assertEqual(true); appAccountManager.deleteAccount("account_checkOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12300 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_12300 end===="); done(); }); @@ -3168,21 +3168,21 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_testGetOAuthList_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12400 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_testGetOAuthList_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_12400 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_testGetOAuthList_name","authType","test_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_12400 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_testGetOAuthList_name","",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_12400 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_12400 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(0); appAccountManager.deleteAccount("account_testGetOAuthList_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12400 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_12400 end===="); done(); }); @@ -3197,21 +3197,21 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_testGetOAuthList_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12500 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_testGetOAuthList_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_12500 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_testGetOAuthList_name","authType","test_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_12500 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_testGetOAuthList_name"," ",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_12500 getOAuthList err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_12500 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(0); appAccountManager.deleteAccount("account_testGetOAuthList_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12500 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_12500 end===="); done(); }); @@ -3230,21 +3230,21 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_testGetOAuthList_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12600 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_testGetOAuthList_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_12600 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthTokenVisibility("account_testGetOAuthList_name","authType","test_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_12600 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthList("account_testGetOAuthList_name",limitAuthType,(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_12600 getOAuthList err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); console.debug("====>ActsAccountOAuthToken_12600 getOAuthList dataArray:" + JSON.stringify(dataArray)); - expect(dataArray.length).assertEqual(0); + expect(dataArray).assertEqual(undefined); appAccountManager.deleteAccount("account_testGetOAuthList_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_12600 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_12600 end===="); done(); }); @@ -3261,7 +3261,7 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_12700 getOAuthList err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_12700 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(err.code!=0).assertEqual(true); - expect(dataArray.length).assertEqual(0); + expect(dataArray).assertEqual(undefined); done(); }); }); @@ -3273,7 +3273,7 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_12800 getOAuthList err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_12800 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(err.code!=0).assertEqual(true); - expect(dataArray.length).assertEqual(0); + expect(dataArray).assertEqual(undefined); done(); }); }); @@ -3289,7 +3289,7 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_12900 getOAuthList err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_12900 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(err.code!=0).assertEqual(true); - expect(dataArray.length).assertEqual(0); + expect(dataArray).assertEqual(undefined); done(); }); }); @@ -3301,7 +3301,7 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_13000 getOAuthList err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_13000 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(err.code!=0).assertEqual(true); - expect(dataArray.length).assertEqual(0); + expect(dataArray).assertEqual(undefined); done(); }); }); @@ -3311,42 +3311,42 @@ export default function ActsAccountOAuthToken() { var appAccountManager = account.createAppAccountManager(); appAccountManager.addAccount("account_tokenTest_name",(err,)=>{ console.debug("====>ActsAccountOAuthToken_13100 addAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setOAuthToken("account_tokenTest_name","authType","test_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_13100 setOAuthToken err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getOAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_13100 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_13100 getOAuthToken stateBack:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual("test_token"); appAccountManager.checkOAuthTokenVisibility("account_tokenTest_name","authType","test_bundleName",(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_13100 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_13100 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(false); appAccountManager.getOAuthList("account_tokenTest_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_13100 getOAuthList err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_13100 getOAuthList dataArray:" + JSON.stringify(dataArray)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(dataArray.length).assertEqual(0); appAccountManager.setOAuthTokenVisibility("account_tokenTest_name","authType","test_bundleName",true,(err)=>{ console.debug("====>ActsAccountOAuthToken_13100 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkOAuthTokenVisibility("account_tokenTest_name","authType","test_bundleName",(err,stateBack)=>{ console.debug("====>ActsAccountOAuthToken_13100 checkOAuthTokenVisibility err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_13100 checkOAuthTokenVisibility stateBack:" + stateBack); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(stateBack).assertEqual(true); appAccountManager.getOAuthList("account_tokenTest_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_13100 getOAuthList err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_13100 getOAuthList dataArray:" + JSON.stringify(dataArray)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(dataArray.length).assertEqual(1); expect(dataArray[0]).assertEqual("test_bundleName"); appAccountManager.deleteAccount("account_tokenTest_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_13100 deleteAccount err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountOAuthToken_13100 end===="); done(); }); @@ -3366,7 +3366,7 @@ export default function ActsAccountOAuthToken() { appAccountManager.getAuthenticatorInfo("com.example.actsaccountOauthtoken",(err,dataInfo)=>{ console.debug("====>ActsAccountOAuthToken_13200 getAuthenticatorInfo err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_13200 getAuthenticatorInfo dataInfo:" + JSON.stringify(dataInfo)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(isNaN(dataInfo.iconId)).assertFalse(); expect(isNaN(dataInfo.labelId)).assertFalse(); done(); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js b/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js index bb8c9ae787de5288161b523c5be186fcd41da27f..f8eb9a5a6cc8c6f7f126e6491b29fb915618a9d2 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js @@ -68,12 +68,12 @@ export default function ActsAccountChangeOnOff() { } function deleteAccountCallback(err){ console.debug("====>delete account 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); done(); } function disCallback(err){ console.debug("====>delete account 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("changeonoff_extra", deleteAccountCallback); } function subscriberCallback(err, data){ @@ -136,7 +136,7 @@ export default function ActsAccountChangeOnOff() { } function deleteAccountCallback(err){ console.debug("====>delete account 0200 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); done(); } function subscriberCallback(err, data){ @@ -199,7 +199,7 @@ export default function ActsAccountChangeOnOff() { } function deleteAccountCallback(err){ console.debug("====>delete account 0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); done(); } function subscriberCallback(err, data){ @@ -266,7 +266,7 @@ export default function ActsAccountChangeOnOff() { } function deleteAccountCallback(err){ console.debug("====>delete account 0400 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); done(); } function subscriberCallback(err, data){ @@ -392,10 +392,10 @@ export default function ActsAccountChangeOnOff() { } function deleteAccountCallback(err){ console.debug("====>delete first account 0600 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("onoff_enableSec", (err)=>{ console.debug("====>delete second account 0600 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); done(); }); } @@ -459,7 +459,7 @@ export default function ActsAccountChangeOnOff() { } function deleteAccountCallback(err){ console.debug("====>delete account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); done(); } function subscriberCallback(err, data){ @@ -532,7 +532,7 @@ export default function ActsAccountChangeOnOff() { console.debug("====>off ActsAccountChangeOnOff_0800 finish===="); appAccountManager.deleteAccount("onoff_self", (err)=>{ console.debug("====>delete account ActsAccountChangeOnOff_0800 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountChangeOnOff_0800 end===="); done(); }); @@ -595,10 +595,10 @@ export default function ActsAccountChangeOnOff() { console.debug("====>off ActsAccountChangeOnOff_0900 finish===="); appAccountManager.deleteAccount("onoff_self_first", (err)=>{ console.debug("====>delete first account 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("onoff_self_second", (err)=>{ console.debug("====>delete second account 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountChangeOnOff_0900 end===="); done(); }); @@ -672,7 +672,7 @@ export default function ActsAccountChangeOnOff() { console.debug("====>off ActsAccountChangeOnOff_1000 finish===="); appAccountManager.deleteAccount("onoff_twice", (err)=>{ console.debug("====>delete account ActsAccountChangeOnOff_1000 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(twiceSign).assertEqual(2); console.debug("====>ActsAccountChangeOnOff_1000 end===="); done(); @@ -753,7 +753,7 @@ export default function ActsAccountChangeOnOff() { console.debug("====>off ActsAccountChangeOnOff_1100 finish===="); appAccountManager.deleteAccount("onoff_same", (err)=>{ console.debug("====>delete account ActsAccountChangeOnOff_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountChangeOnOff_1100 end===="); done(); }); @@ -794,7 +794,7 @@ export default function ActsAccountChangeOnOff() { console.debug("====>delete account 1200 start===="); appAccountManager.deleteAccount("onoff_repeatoff", (err)=>{ console.debug("====>delete account ActsAccountChangeOnOff_1200 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountChangeOnOff_1200 end===="); done(); }); @@ -861,7 +861,7 @@ export default function ActsAccountChangeOnOff() { console.debug("====>delete account 1300 start===="); appAccountManager.deleteAccount("onoff_same", (err)=>{ console.debug("====>delete account ActsAccountChangeOnOff_1300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountChangeOnOff_1300 end===="); done(); }); @@ -908,7 +908,7 @@ export default function ActsAccountChangeOnOff() { console.debug("====>delete account 1400 start===="); appAccountManager.deleteAccount("onoff_same", (err)=>{ console.debug("====>delete account ActsAccountChangeOnOff_1400 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsAccountChangeOnOff_1400 end===="); done(); }); diff --git a/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js b/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js index 73ab6372b8fccf4eebf2a206de6ad8c7532487de..b8c080fbeabac0fd5c04b149a88323cc19d71fad 100755 --- a/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js +++ b/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js @@ -33,11 +33,11 @@ export default function ActsGetAllAccounts() { var selfBundle = "com.example.actsgetallaaccounts"; appAccountManager.addAccount("Account_this_application_callback", (err)=>{ console.debug("====>add account 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("====>getAllAccounts 0100 err:" + JSON.stringify(err)); console.debug("====>getAllAccounts 0100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); try{ expect(data[0].name).assertEqual("Account_this_application_callback"); expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); @@ -49,7 +49,7 @@ export default function ActsGetAllAccounts() { } appAccountManager.deleteAccount("Account_this_application_callback", (err)=>{ console.debug("====>delete account 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsGetAllAccounts_0100 end===="); done(); }); @@ -122,7 +122,7 @@ export default function ActsGetAllAccounts() { appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("====>getAllAccounts 0300 err:" + JSON.stringify(err)); console.debug("====>getAllAccounts 0300 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.length).assertEqual(0); console.debug("====>ActsGetAllAccounts_0300 end===="); done(); @@ -276,12 +276,12 @@ export default function ActsGetAllAccounts() { function getAllCallback(err, data){ console.debug("====>getAllAccounts 0900 err:" + JSON.stringify(err)); console.debug("====>getAllAccounts 0900 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data[0].name).assertEqual("Account_application_callback"); expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); appAccountManager.deleteAccount("Account_application_callback", (err)=>{ console.debug("====>delete account 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsGetAllAccounts_0900 end===="); done(); }); @@ -374,7 +374,7 @@ export default function ActsGetAllAccounts() { function getAllCallback(err, data){ console.debug("====>getAllAccounts 1100 err:" + JSON.stringify(err)); console.debug("====>getAllAccounts 1100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data[0].name).assertEqual("account_name_scene_single"); expect(data[0].owner).assertEqual("com.example.actsscenegetallaccounts"); console.debug("====>ActsGetAllAccounts_1100 end===="); @@ -480,20 +480,20 @@ export default function ActsGetAllAccounts() { var selfBundle = "com.example.actsgetallaaccounts"; appAccountManager.addAccount("account_callback_delete", (err)=>{ console.debug("====>add account 1500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("====>getAllAccounts 1500 err:" + JSON.stringify(err)); console.debug("====>getAllAccounts 1500 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data[0].name).assertEqual("account_callback_delete"); expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); appAccountManager.deleteAccount("account_callback_delete", (err)=>{ console.debug("====>delete account 1500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("====>getAllAccounts 1500 err:" + JSON.stringify(err)); console.debug("====>getAllAccounts 1500 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.length).assertEqual(0); console.debug("====>ActsGetAllAccounts_1500 end===="); done(); @@ -570,20 +570,20 @@ export default function ActsGetAllAccounts() { var selfBundle = "com.example.actsgetallaaccounts"; appAccountManager.addAccount("account_callback_additional", "account_extrainfo", (err)=>{ console.debug("====>add account 1700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("====>getAllAccounts 1700 err:" + JSON.stringify(err)); console.debug("====>getAllAccounts 1700 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data[0].name).assertEqual("account_callback_additional"); expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); appAccountManager.deleteAccount("account_callback_additional", (err)=>{ console.debug("====>delete account 1700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("====>getAllAccounts 1700 err:" + JSON.stringify(err)); console.debug("====>getAllAccounts 1700 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.length).assertEqual(0); console.debug("====>ActsGetAllAccounts_1700 end===="); done(); diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/test/Syncenable.test.js b/account/appaccount/actssetchecksyncenable/src/main/js/test/Syncenable.test.js index 744c7eed203a6630db12471259bd5ad3b7c508bc..41750ff58490a8fd1e0ef68c745700bd19095f2a 100644 --- a/account/appaccount/actssetchecksyncenable/src/main/js/test/Syncenable.test.js +++ b/account/appaccount/actssetchecksyncenable/src/main/js/test/Syncenable.test.js @@ -54,15 +54,15 @@ export default function ActsSetCheckSyncEnable() { console.debug("====>creat finish===="); appAccountManager.addAccount("syncenable_callback_notset", (err)=>{ console.debug("====>add account ActsSetCheckSyncEnable_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccountSyncEnable("syncenable_callback_notset", (err, data)=>{ console.debug("====>checkAppAccountSyncEnable 0100 err:" + JSON.stringify(err)); console.debug("====>checkAppAccountSyncEnable 0100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(false); appAccountManager.deleteAccount("syncenable_callback_notset", (err)=>{ console.debug("====>delete Account ActsSetCheckSyncEnable_0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsSetCheckSyncEnable_0100 end===="); done(); }); @@ -123,18 +123,18 @@ export default function ActsSetCheckSyncEnable() { console.debug("====>creat finish===="); appAccountManager.addAccount("syncenable_callback_settrue", (err)=>{ console.debug("====>add account ActsSetCheckSyncEnable_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAppAccountSyncEnable("syncenable_callback_settrue", true, (err)=>{ console.debug("====>setAppAccountSyncEnable 0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccountSyncEnable("syncenable_callback_settrue", (err, data)=>{ console.debug("====>checkAppAccountSyncEnable 0300 err:" + JSON.stringify(err)); console.debug("====>checkAppAccountSyncEnable 0300 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(true); appAccountManager.deleteAccount("syncenable_callback_settrue", (err)=>{ console.debug("====>delete Account ActsSetCheckSyncEnable_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsSetCheckSyncEnable_0300 end===="); done(); }); @@ -198,18 +198,18 @@ export default function ActsSetCheckSyncEnable() { console.debug("====>creat finish===="); appAccountManager.addAccount("syncenable_callback_setfalse", (err)=>{ console.debug("====>add account ActsSetCheckSyncEnable_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAppAccountSyncEnable("syncenable_callback_setfalse", false, (err)=>{ console.debug("====>setAppAccountSyncEnable 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccountSyncEnable("syncenable_callback_setfalse", (err, data)=>{ console.debug("====>checkAppAccountSyncEnable 0500 err:" + JSON.stringify(err)); console.debug("====>checkAppAccountSyncEnable 0500 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(false); appAccountManager.deleteAccount("syncenable_callback_setfalse", (err)=>{ console.debug("====>delete Account ActsSetCheckSyncEnable_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsSetCheckSyncEnable_0500 end===="); done(); }); @@ -274,21 +274,21 @@ export default function ActsSetCheckSyncEnable() { console.debug("====>creat finish===="); appAccountManager.addAccount("syncenable_callback_falsetrue", (err)=>{ console.debug("====>add account ActsSetCheckSyncEnable_0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", false, (err)=>{ console.debug("====>setAppAccountSyncEnable first time 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", true, (err)=>{ console.debug("====>setAppAccountSyncEnable second time 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccountSyncEnable("syncenable_callback_falsetrue", (err, data)=>{ console.debug("====>checkAppAccountSyncEnable 0700 err:" + JSON.stringify(err)); console.debug("====>checkAppAccountSyncEnable 0700 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(true); appAccountManager.deleteAccount("syncenable_callback_falsetrue", (err)=>{ console.debug("====>delete Account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsSetCheckSyncEnable_0700 end===="); done(); }); @@ -350,21 +350,21 @@ export default function ActsSetCheckSyncEnable() { console.debug("====>creat finish===="); appAccountManager.addAccount("syncenable_callback_falsetrue", (err)=>{ console.debug("====>add account ActsSetCheckSyncEnable_0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", true, (err)=>{ console.debug("====>setAppAccountSyncEnable first time 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", false, (err)=>{ console.debug("====>setAppAccountSyncEnable second time 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccountSyncEnable("syncenable_callback_falsetrue", (err, data)=>{ console.debug("====>checkAppAccountSyncEnable 0900 err:" + JSON.stringify(err)); console.debug("====>checkAppAccountSyncEnable 0900 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(false); appAccountManager.deleteAccount("syncenable_callback_falsetrue", (err)=>{ console.debug("====>delete Account 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsSetCheckSyncEnable_0900 end===="); done(); }); @@ -426,21 +426,21 @@ export default function ActsSetCheckSyncEnable() { console.debug("====>creat finish===="); appAccountManager.addAccount("syncenable_callback_truetrue", (err)=>{ console.debug("====>add account ActsSetCheckSyncEnable_1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAppAccountSyncEnable("syncenable_callback_truetrue", true, (err)=>{ console.debug("====>setAppAccountSyncEnable first time 1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.setAppAccountSyncEnable("syncenable_callback_truetrue", true, (err)=>{ console.debug("====>setAppAccountSyncEnable second time 1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.checkAppAccountSyncEnable("syncenable_callback_truetrue", (err, data)=>{ console.debug("====>checkAppAccountSyncEnable 1100 err:" + JSON.stringify(err)); console.debug("====>checkAppAccountSyncEnable 1100 data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(true); appAccountManager.deleteAccount("syncenable_callback_truetrue", (err)=>{ console.debug("====>delete Account 1100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsSetCheckSyncEnable_1100 end===="); done(); }); diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/Getallaccessible.test.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/Getallaccessible.test.js index 98c2a602ac392cdde954ddf1efc17a50b26ee775..600fb75d95b9a2b8f41c961e4283a233d4208b91 100755 --- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/Getallaccessible.test.js +++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/Getallaccessible.test.js @@ -34,7 +34,7 @@ export default function ActsGetAllAccessibleAccounts() { console.debug("====>getAllAccessibleAccounts 0100 err:" + JSON.stringify(err)); console.debug("====>getAllAccessibleAccounts 0100 data:" + JSON.stringify(data)); console.debug("====>getAllAccessibleAccounts 0100 data.length:" + data.length); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.length).assertEqual(0); console.debug("====>ActsGetAllAccessibleAccounts_0100 end===="); done(); @@ -78,12 +78,12 @@ export default function ActsGetAllAccessibleAccounts() { console.debug("====>creat finish===="); appAccountManager.addAccount("accessibleAccount_callback_single", (err)=>{ console.debug("====> add account ActsGetAllAccessibleAccounts_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccessibleAccounts((err, data)=>{ console.debug("====>getAllAccessibleAccounts 0300 err:" + JSON.stringify(err)); console.debug("====>getAllAccessibleAccounts 0300 data:" + JSON.stringify(data)); console.debug("====>getAllAccessibleAccounts 0300 data.length:" + data.length); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.length).assertEqual(1); try{ expect(data[0].name).assertEqual("accessibleAccount_callback_single"); @@ -96,7 +96,7 @@ export default function ActsGetAllAccessibleAccounts() { } appAccountManager.deleteAccount("accessibleAccount_callback_single", (err)=>{ console.debug("====>delete Account ActsGetAllAccessibleAccounts_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsGetAllAccessibleAccounts_0300 end===="); done(); }) @@ -167,18 +167,18 @@ export default function ActsGetAllAccessibleAccounts() { console.debug("====>creat finish===="); appAccountManager.addAccount("accessibleAccount_callback_first", (err)=>{ console.debug("====>add account first time 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.addAccount("accessibleAccount_callback_second", (err)=>{ console.debug("====>add account second time 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.addAccount("accessibleAccount_callback_third", (err)=>{ console.debug("====>add account third time 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccessibleAccounts((err, data)=>{ console.debug("====>getAllAccessibleAccounts 0500 err:" + JSON.stringify(err)); console.debug("====>getAllAccessibleAccounts 0500 data:" + JSON.stringify(data)); console.debug("====>getAllAccessibleAccounts 0500 data.length:" + data.length); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.length).assertEqual(3); try{ expect(data[0].name).assertEqual("accessibleAccount_callback_first"); @@ -195,13 +195,13 @@ export default function ActsGetAllAccessibleAccounts() { } appAccountManager.deleteAccount("accessibleAccount_callback_first", (err)=>{ console.debug("====>delete Account first 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("accessibleAccount_callback_second", (err)=>{ console.debug("====>delete Account second 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("accessibleAccount_callback_third", (err)=>{ console.debug("====>delete Account third 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsGetAllAccessibleAccounts_0500 end===="); done(); }) @@ -289,21 +289,21 @@ export default function ActsGetAllAccessibleAccounts() { console.debug("====>creat finish===="); appAccountManager.addAccount("accessibleAccount_callback_delete_first", (err)=>{ console.debug("====>add first account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.addAccount("accessibleAccount_callback_delete_second", (err)=>{ console.debug("====>add second account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.addAccount("accessibleAccount_callback_delete_third", (err)=>{ console.debug("====>add third account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("accessibleAccount_callback_delete_second", (err)=>{ console.debug("====>delete second account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccessibleAccounts((err, data)=>{ console.debug("====>getAllAccessibleAccounts 0700 err:" + JSON.stringify(err)); console.debug("====>getAllAccessibleAccounts 0700 data:" + JSON.stringify(data)); console.debug("====>getAllAccessibleAccounts 0700 data.length:" + data.length); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.length).assertEqual(2); try{ expect(data[0].name).assertEqual("accessibleAccount_callback_delete_first"); @@ -318,10 +318,10 @@ export default function ActsGetAllAccessibleAccounts() { } appAccountManager.deleteAccount("accessibleAccount_callback_delete_first", (err)=>{ console.debug("====>delete first account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("accessibleAccount_callback_delete_third", (err)=>{ console.debug("====>delete third account 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsGetAllAccessibleAccounts_0700 end===="); done(); }) @@ -408,15 +408,15 @@ export default function ActsGetAllAccessibleAccounts() { console.debug("====>creat finish===="); appAccountManager.addAccount("accessibleAccount_callback_multiple_first", (err)=>{ console.debug("====>add first account 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.addAccount("accessibleAccount_callback_multiple_second", (err)=>{ console.debug("====>add third account 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.getAllAccessibleAccounts((err, data)=>{ console.debug("====>getAllAccessibleAccounts first 0900 err:" + JSON.stringify(err)); console.debug("====>getAllAccessibleAccounts first 0900 data:" + JSON.stringify(data)); console.debug("====>getAllAccessibleAccounts first 0900 data.length:" + data.length); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.length).assertEqual(2); try{ expect(data[0].name).assertEqual("accessibleAccount_callback_multiple_first"); @@ -433,7 +433,7 @@ export default function ActsGetAllAccessibleAccounts() { console.debug("====>getAllAccessibleAccounts second 0900 err:" + JSON.stringify(err)); console.debug("====>getAllAccessibleAccounts second 0900 data:" + JSON.stringify(data)); console.debug("====>getAllAccessibleAccounts second 0900 data.length:" + data.length); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.length).assertEqual(2); try{ expect(data[0].name).assertEqual("accessibleAccount_callback_multiple_first"); @@ -448,10 +448,10 @@ export default function ActsGetAllAccessibleAccounts() { } appAccountManager.deleteAccount("accessibleAccount_callback_multiple_first", (err)=>{ console.debug("====>delete first account 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); appAccountManager.deleteAccount("accessibleAccount_callback_multiple_second", (err)=>{ console.debug("====>delete second account 0900 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsGetAllAccessibleAccounts_0900 end===="); done(); }) diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js index fc9fc6bde2ffe450a6a52a2219f9f3f4265c4fc2..0680c699030ff8467cad2172b6222f4851cafc88 100755 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js @@ -36,7 +36,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getOsAccountLocalIdFromUid(uid, (err, localId)=>{ console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>localId obtained by uid:" + localId); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(localId).assertEqual(100); console.debug("====>ActsOsAccountGetIdFormUid_0100 end===="); done(); @@ -77,7 +77,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>localId obtained by uid:" + localId); expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); - expect(localId).assertEqual(0); + expect(localId).assertEqual(undefined); console.debug("====>ActsOsAccountGetIdFormUid_0300 end===="); done(); }); @@ -117,7 +117,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>localId obtained by uid:" + localId); expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); - expect(localId).assertEqual(0); + expect(localId).assertEqual(undefined); console.debug("====>ActsOsAccountGetIdFormUid_0500 end===="); done(); }); @@ -155,7 +155,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getOsAccountLocalIdFromProcess((err, localId)=>{ console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>localId obtained by process:" + localId); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(localId).assertEqual(100); console.debug("====>ActsOsAccountGetIdFormProcess_0100 end===="); done(); @@ -190,7 +190,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getOsAccountTypeFromProcess((err, accountType)=>{ console.debug("====>get type err: " + JSON.stringify(err)); console.debug("====>type obtained by process:" + JSON.stringify(accountType)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(accountType.ADMIN).assertEqual(0); console.debug("====>ActsOsAccountGetTypeFormProcess_0100 end===="); done(); @@ -225,7 +225,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getSerialNumberByOsAccountLocalId(100, (err, serialNumber)=>{ console.debug("====>ger serialNumber err:" + JSON.stringify(err)); console.debug("====>get serialNumber:" + serialNumber + " by localId: 100" ); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); var serialNumberStr = serialNumber.toString(); var serialIntercept = serialNumberStr.substring(8); console.debug("====>truncate the last eight characters: " + serialIntercept); @@ -233,7 +233,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{ console.debug("====>ger localId err:" + JSON.stringify(err)); console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(localId).assertEqual(100); console.debug("====>ActsOsAccountLocalIdSerial_0100 end===="); done(); @@ -275,7 +275,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getSerialNumberByOsAccountLocalId(0, (err, serialNumber)=>{ console.debug("====>ger serialNumber err:" + JSON.stringify(err)); console.debug("====>get serialNumber:" + serialNumber + " by localId: 0" ); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); var serialNumberStr = serialNumber.toString(); var serialIntercept = serialNumberStr.substring(8); console.debug("====>truncate the last eight characters: " + serialIntercept); @@ -283,7 +283,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{ console.debug("====>ger localId err:" + JSON.stringify(err)); console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(localId).assertEqual(0); console.debug("====>ActsOsAccountLocalIdSerial_0300 end===="); done(); @@ -327,21 +327,21 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.createOsAccount("osAccountNameIdSerialA", osaccount.OsAccountType.NORMAL, (err, data)=>{ console.debug("====>create os account err: " + JSON.stringify(err)); console.debug("====>create os account OsAccountInfo: " + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.localName).assertEqual("osAccountNameIdSerialA"); localId = data.localId; osAccountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{ console.debug("====>queryOsAccountById err:" + JSON.stringify(err)); console.debug("====>get serialNumber:" + serialNumber + " by localId: " + localId); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, getlocalId)=>{ console.debug("====>ger localId err:" + JSON.stringify(err)); console.debug("====>get localId:" + getlocalId + " by serialNumber: " + serialNumber); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(getlocalId).assertEqual(localId); osAccountManager.removeOsAccount(localId, (err)=>{ console.debug("====>remove localId: " + localId + " err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsOsAccountLocalIdSerial_0500 end===="); done(); }) @@ -390,38 +390,38 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getCreatedOsAccountsCount((err, data)=>{ console.debug("====>obtains the number of all os accounts created err:" + JSON.stringify(err)); console.debug("====>obtains the number of all os accounts created data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); obtainCount = data; osAccountManager.createOsAccount("osAccountNameIdSerialE", osaccount.OsAccountType.NORMAL, (err, data)=>{ console.debug("====>create first os account err: " + JSON.stringify(err)); console.debug("====>create first os account OsAccountInfo: " + JSON.stringify(data)); localIdFir = data.localId; - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.localName).assertEqual("osAccountNameIdSerialE"); osAccountManager.createOsAccount("osAccountIdSerialF", osaccount.OsAccountType.NORMAL, (err, data)=>{ console.debug("====>create second os account err: " + JSON.stringify(err)); console.debug("====>create second os account OsAccountInfo: " + JSON.stringify(data)); localIdSec = data.localId; - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data.localName).assertEqual("osAccountIdSerialF"); osAccountManager.getCreatedOsAccountsCount((err, count)=>{ console.debug("====>obtains the number of all os accounts created err:" + JSON.stringify(err)); console.debug("====>obtains the number of all os accounts created count:" + count); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); count = count - 2; expect(count).assertEqual(obtainCount); osAccountManager.removeOsAccount(localIdFir, (err)=>{ console.debug("====>remove localId: " + localIdFir + " err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); osAccountManager.getCreatedOsAccountsCount((err, data)=>{ console.debug("====>obtains the number accounts created err:" + JSON.stringify(err)); console.debug("====>obtains the number accounts created data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); data = data - 1; expect(data).assertEqual(obtainCount); osAccountManager.removeOsAccount(localIdSec, (err)=>{ console.debug("====>remove localId: " + localIdSec + " err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); console.debug("====>ActsOsAccountGetCount_0100 end===="); done(); }) diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js index 62e128bb849c3a6cb5e16b3d6d84293c080837c6..6511909565340ad2cfb049beb46932842fd1bc48 100755 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js @@ -43,7 +43,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { AccountManager.getDistributedVirtualDeviceId((err, id)=>{ console.debug("====>getDistributedVirtualDeviceId err:" + JSON.stringify(err)); console.debug("====>getDistributedVirtualDeviceId deviceId:" + id); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(id).assertEqual(deviceId); console.debug("====>ActsOsAccountDeviceId_0100 end===="); done(); @@ -90,7 +90,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { AccountManager.isOsAccountActived(0, (err, isActived)=>{ console.debug("====>isOsAccountActived err:" + JSON.stringify(err)); console.debug("====>isOsAccountActived isActived:" + isActived); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(isActived).assertEqual(true); console.debug("====>ActsOsAccountIsActived_0100 end"); done(); @@ -246,7 +246,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { AccountManager.isMultiOsAccountEnable((err, data)=>{ console.debug("====>isMultiOsAccountEnable err:" + JSON.stringify(err)); console.debug("====>isMultiOsAccountEnable data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(true); console.debug("====>ActsOsAccountIsMulty_0100 end===="); done(); @@ -288,7 +288,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { AccountManager.isOsAccountVerified((err, data)=>{ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err)); console.debug("====>isOsAccountVerified data:" + data); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(false); console.debug("====>ActsOsAccountVerified_0100 end===="); done(); @@ -322,7 +322,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { console.debug("====>get os AccountManager finish===="); AccountManager.isOsAccountVerified(0, (err, data)=>{ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertFalse(); console.debug("====>ActsOsAccountIsVerified_0300 end===="); done(); @@ -357,7 +357,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { AccountManager.isOsAccountVerified(localIdStr, (err, data)=>{ console.debug("====>error received callback===="); console.debug("====>receive isOsAccountVerified err: " + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(false); console.debug("====>receive isOsAccountVerified data: " + JSON.stringify(data)); done(); @@ -397,7 +397,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var localIdUndefined = undefined; AccountManager.isOsAccountVerified(localIdUndefined, (err, data) =>{ console.debug("====>ActsOsAccountIsVerified_0700 isOsAccountVerified_err:" + JSON.stringify(err)) - expect(err.code).assertEqual(0) + expect(err).assertEqual(undefined); console.debug("====>ActsOsAccountIsVerified_0700 isOsAccountVerified_data:" + JSON.stringify(data)) expect(data).assertEqual(false) console.debug("====>ActsOsAccountIsVerified_0700 end===="); @@ -478,7 +478,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { AccountManager.isTestOsAccount((err, data)=>{ console.debug("====>isTestOsAccount err:" + JSON.stringify(err)); console.debug("====>isTestOsAccount data:" + JSON.stringify(data)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(undefined); expect(data).assertEqual(false); console.debug("====>ActsOsAccountIsTest_0100 end===="); done(); diff --git a/applications/kitframework/readme.md b/applications/kitframework/readme.md index f633c31743d2f49298b4857fb9893209d88ae289..af7822e0788ca171a61133931ad1f777308cf4ed 100644 --- a/applications/kitframework/readme.md +++ b/applications/kitframework/readme.md @@ -52,7 +52,7 @@ Hi3861芯片平台可能需要修改为:`"//vendor/hisilicon/hi3861/hals/utils # "//test/xts/acts/communication_lite/wifiservice_hal:ActsWifiServiceTest", # "//test/xts/acts/utils_lite/file_hal:ActsUtilsFileTest", # "//test/xts/acts/startup_lite/syspara_hal:ActsParameterTest", - # "//test/xts/acts/iot_hardware_lite/iot_controller_hal:ActsWifiIotTest", + # "//test/xts/acts/iothardware_lite/peripheral_hal:ActsWifiIotTest", # "//test/xts/acts/kernel_lite/kernelcmsis_hal:ActsCMSISTest", # "//test/xts/acts/utils_lite/kv_store_hal:ActsKvStoreTest", # "//test/xts/acts/security_lite/huks_hal:ActsSecurityDataTest", diff --git a/arkXtest/BUILD.gn b/arkXtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8eca0b47815ea39a8b0501c9f79867be2c246812 --- /dev/null +++ b/arkXtest/BUILD.gn @@ -0,0 +1,21 @@ +# 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("//build/ohos_var.gni") + +group("arkXtest") { + testonly = true + if (is_standard_system) { + deps = [ "uitest:uitestActs" ] + } +} diff --git a/arkXtest/uitest/BUILD.gn b/arkXtest/uitest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a7b9c7f12a9d473ca96f7055270ec55957f653b7 --- /dev/null +++ b/arkXtest/uitest/BUILD.gn @@ -0,0 +1,36 @@ +# 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("uitestActs") { + hap_profile = "./src/main/config.json" + deps = [ + ":uitest_ets_assets", + ":uitest_ets_resources", + ":uitest_ets_test_assets", + ] + ets2abc = true + certificate_profile = "//test/xts/acts/arkXtest/uitest/signature/auto_ohos_default_com.uitest.test.p7b" + hap_name = "uitestActs" +} +ohos_js_assets("uitest_ets_assets") { + source_dir = "./src/main/ets/MainAbility" +} +ohos_js_assets("uitest_ets_test_assets") { + source_dir = "./src/main/ets/TestAbility" +} +ohos_resources("uitest_ets_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/arkXtest/uitest/Test.json b/arkXtest/uitest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..ed1d23104fc4f4483b5e6bcf61938003953b3f02 --- /dev/null +++ b/arkXtest/uitest/Test.json @@ -0,0 +1,38 @@ +{ + "description": "Configuration for uitest Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "1800000", + "bundle-name": "com.uitest.acts", + "package-name": "com.uitest.acts", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "PushKit", + "push": [ + "resource/arkXtest/arkXtest_windowsTest.hap -> /data/local/tmp/arkXtest_windowsTest.hap", + "resource/arkXtest/window_manager_config.xml -> /system/etc/window/resources/window_manager_config.xml" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "uinput -T -d 300 600 -m 300 600 300 100 -u 300 100", + "power-shell setmode 602", + "bm install -p /data/local/tmp/arkXtest_windowsTest.hap" + ], + "teardown-command": [ + "bm uninstall -n com.example.windows" + ] + } + ] +} \ No newline at end of file diff --git a/arkXtest/uitest/signature/auto_ohos_default_com.uitest.test.p7b b/arkXtest/uitest/signature/auto_ohos_default_com.uitest.test.p7b new file mode 100644 index 0000000000000000000000000000000000000000..725043f4a0ab0ecbc4159390ac8e11c14d1a3297 Binary files /dev/null and b/arkXtest/uitest/signature/auto_ohos_default_com.uitest.test.p7b differ diff --git a/arkXtest/uitest/src/main/config.json b/arkXtest/uitest/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..36a89d10257c850ce42ab3dcb566a0240c720466 --- /dev/null +++ b/arkXtest/uitest/src/main/config.json @@ -0,0 +1,102 @@ +{ + "app": { + "vendor": "open", + "bundleName": "com.uitest.acts", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.uitest.acts", + "name": ".MyApplication", + "mainAbility": ".MainAbility", + "srcPath": "MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/second", + "pages/third", + "pages/fourth" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/arkXtest/uitest/src/main/ets/MainAbility/app.ets b/arkXtest/uitest/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7619f93f7c8ed901bfab4b51edf4df9166b03fb --- /dev/null +++ b/arkXtest/uitest/src/main/ets/MainAbility/app.ets @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + abilityDelegatorArguments.parameters['-s timeout'] = 3000000 + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, + +} \ No newline at end of file diff --git a/arkXtest/uitest/src/main/ets/MainAbility/pages/fourth.ets b/arkXtest/uitest/src/main/ets/MainAbility/pages/fourth.ets new file mode 100644 index 0000000000000000000000000000000000000000..fda1bd719035a16905da7851875bdacdda5a2c90 --- /dev/null +++ b/arkXtest/uitest/src/main/ets/MainAbility/pages/fourth.ets @@ -0,0 +1,45 @@ +/** + * 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 Fourth + +{ + private content: string = "Fourth Page" + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('longClick') + .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/arkXtest/uitest/src/main/ets/MainAbility/pages/index.ets b/arkXtest/uitest/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce47034bf74466667efabd4792218b955cb4d328 --- /dev/null +++ b/arkXtest/uitest/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,107 @@ +/** + * 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'; +import prompt from '@ohos.prompt'; + +@Entry +@Component +struct ScrollExample { + scroller: Scroller = new Scroller() + private arr: number[] = [1,2,3,4] + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('MainPage') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .key('my-key') + .type(ButtonType.Capsule) + .margin({ top: 20 }) + .onClick(() => { + router.push({ uri: 'pages/second' }) + }) + .gesture( + LongPressGesture({ repeat: false }) + .onAction((event: GestureEvent) => { + router.push({ uri: 'pages/fourth' }) + }) + ) + + Button() { + Text('Click twice') + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ top: 20 }) + .gesture( + TapGesture({ count: 1 }) + .onAction(() => { + router.push({ uri: 'pages/third' }) + }) + ) + + Checkbox({ name: 'hi' }) + .size({ width: 30, height: 30 }) + TextInput({ placeholder: 'welcome', text: 'Hello World' }) + .type(InputType.Normal) + .width(300) + .height(50) + .fontSize(40) + .enabled(true) + .margin({ top: 20 }) + ForEach(this.arr, (item) => { + Text(item.toString()) + .width('100%') + .height('30%') + .backgroundColor(0xFFFFFF) + .borderRadius(75) + .fontSize(80) + .textAlign(TextAlign.Center) + .margin({ top: 10 }) + }, item => item) + Button() { + Text('bottom') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20, left: 150 + }) + .onClick(() => { + router.push({ uri: 'pages/second' }) + }) + }.width('100%') + } + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.On) + .scrollBarColor(Color.Gray) + .scrollBarWidth(30) + .onScroll((xOffset: number, yOffset: number) => { + console.info(xOffset + ' ' + yOffset) + }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } + } +} + diff --git a/arkXtest/uitest/src/main/ets/MainAbility/pages/second.ets b/arkXtest/uitest/src/main/ets/MainAbility/pages/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..9dcd951896be78626c21d48cf64296d4194f8a81 --- /dev/null +++ b/arkXtest/uitest/src/main/ets/MainAbility/pages/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/arkXtest/uitest/src/main/ets/MainAbility/pages/third.ets b/arkXtest/uitest/src/main/ets/MainAbility/pages/third.ets new file mode 100644 index 0000000000000000000000000000000000000000..78eea6035c85dbea81733e8414ef77fe66a8508b --- /dev/null +++ b/arkXtest/uitest/src/main/ets/MainAbility/pages/third.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 Third{ + private content: string = "Third Page" + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('doubleClick') + .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/arkXtest/uitest/src/main/ets/TestAbility/app.ets b/arkXtest/uitest/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..bce6196d05fb2266ff0a96005f29233e033515c9 --- /dev/null +++ b/arkXtest/uitest/src/main/ets/TestAbility/app.ets @@ -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. + */ + +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, + +} \ No newline at end of file diff --git a/arkXtest/uitest/src/main/ets/TestAbility/pages/index.ets b/arkXtest/uitest/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce47034bf74466667efabd4792218b955cb4d328 --- /dev/null +++ b/arkXtest/uitest/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,107 @@ +/** + * 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'; +import prompt from '@ohos.prompt'; + +@Entry +@Component +struct ScrollExample { + scroller: Scroller = new Scroller() + private arr: number[] = [1,2,3,4] + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('MainPage') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .key('my-key') + .type(ButtonType.Capsule) + .margin({ top: 20 }) + .onClick(() => { + router.push({ uri: 'pages/second' }) + }) + .gesture( + LongPressGesture({ repeat: false }) + .onAction((event: GestureEvent) => { + router.push({ uri: 'pages/fourth' }) + }) + ) + + Button() { + Text('Click twice') + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ top: 20 }) + .gesture( + TapGesture({ count: 1 }) + .onAction(() => { + router.push({ uri: 'pages/third' }) + }) + ) + + Checkbox({ name: 'hi' }) + .size({ width: 30, height: 30 }) + TextInput({ placeholder: 'welcome', text: 'Hello World' }) + .type(InputType.Normal) + .width(300) + .height(50) + .fontSize(40) + .enabled(true) + .margin({ top: 20 }) + ForEach(this.arr, (item) => { + Text(item.toString()) + .width('100%') + .height('30%') + .backgroundColor(0xFFFFFF) + .borderRadius(75) + .fontSize(80) + .textAlign(TextAlign.Center) + .margin({ top: 10 }) + }, item => item) + Button() { + Text('bottom') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20, left: 150 + }) + .onClick(() => { + router.push({ uri: 'pages/second' }) + }) + }.width('100%') + } + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.On) + .scrollBarColor(Color.Gray) + .scrollBarWidth(30) + .onScroll((xOffset: number, yOffset: number) => { + console.info(xOffset + ' ' + yOffset) + }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } + } +} + diff --git a/arkXtest/uitest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkXtest/uitest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..0b35659daba8771ef16abe4ec26cd82e242b3de4 --- /dev/null +++ b/arkXtest/uitest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : ' + cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/arkXtest/uitest/src/main/ets/test/List.test.ets b/arkXtest/uitest/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ebbed8f8ccf03b2ba8d9fc8180f9b064f515df05 --- /dev/null +++ b/arkXtest/uitest/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityTest from './uitest.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/arkXtest/uitest/src/main/ets/test/uitest.test.ets b/arkXtest/uitest/src/main/ets/test/uitest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d69fd2c97d20f418c299f1c67a5b5abcf2e91572 --- /dev/null +++ b/arkXtest/uitest/src/main/ets/test/uitest.test.ets @@ -0,0 +1,737 @@ +/** + * 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 '@ohos/hypium' +import abilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import { UiDriver, BY, ResizeDirection, MatchPattern, WindowMode } from '@ohos.uitest' +import ability_featureAbility from '@ohos.ability.featureAbility'; + +const delegator = abilityDelegatorRegistry.getAbilityDelegator(); +const bundleName = abilityDelegatorRegistry.getArguments().bundleName; +const waitUiReadyMs = 1000; + +async function startAbility(bundleName: string, abilityName: string) { + await delegator.executeShellCommand(`aa start -b ${bundleName} -a ${abilityName}`).then(result => { + console.info(`UiTestCase, start abilityFinished: ${result}`) + }).catch(err => { + console.error(`UiTestCase, start abilityFailed: ${err}`) + }) +} + +async function stopApplication(bundleName: string) { + await delegator.executeShellCommand(`aa force-stop ${bundleName} `).then(result => { + console.info(`UiTestCase, stop application finished: ${result}`) + }).catch(err => { + console.error(`UiTestCase,stop application failed: ${err}`) + }) +} + +export default function uiTest() { + describe('UiTestCase', function () { + + /* + * @tc.number: uiTest_0100 + * @tc.name: testInputText + * @tc.desc: inject text to the target UiComponent + */ + it('testInputText', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let input = await driver.findComponent(BY.type('TextInput')) + await input.inputText('123') + await driver.delayMs(waitUiReadyMs) + let input_new = await driver.findComponent(BY.type('TextInput')) + let text = await input_new.getText() + expect(text == '123').assertTrue() + }) + + /* + * @tc.number: uiTest_0200 + * @tc.name: testClearText + * @tc.desc: clear text of the target UiComponent + */ + it('testClearText', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let input1 = await driver.findComponent(BY.type('TextInput')) + await input1.inputText('abc') + let input2 = await driver.findComponent(BY.type('TextInput')) + await input2.clearText() + await driver.delayMs(waitUiReadyMs) + let input_new = await driver.findComponent(BY.type('TextInput')) + let text = await input_new.getText() + expect(text).assertEqual('') + }) + + /* + * @tc.number: uiTest_0300 + * @tc.name: testCheckable + * @tc.desc: find UiComponent by checkable attribute and get it's checkable attribute. + */ + it('testCheckable', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.checkable(true).type('Checkbox')) + let checkable = await button.isCheckable() + expect(checkable == true).assertTrue() + }) + + /* + * @tc.number: uiTest_0400 + * @tc.name: testChecked + * @tc.desc: find UiComponent by checked attribute and get it's checked attribute. + */ + it('testChecked', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.checked(false).type('Checkbox')) + let checked = await button.isChecked() + expect(checked == false).assertTrue() + }) + + /* + * @tc.number: uiTest_0500 + * @tc.name: testMatchPattern + * @tc.desc: specifies the string value match pattern. + */ + it('testMatchPattern', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let Button1 = await driver.findComponent(BY.text('next page',MatchPattern.EQUALS)) + expect(await Button1.getText() == 'next page').assertTrue() + let Button2 = await driver.findComponent(BY.text('next',MatchPattern.STARTS_WITH)) + expect(await Button2.getText() == 'next page').assertTrue() + let Button3 = await driver.findComponent(BY.text('page',MatchPattern.ENDS_WITH)) + expect(await Button3.getText() == 'next page').assertTrue() + let Button4 = await driver.findComponent(BY.text('ext',MatchPattern.CONTAINS)) + expect(await Button4.getText() == 'next page').assertTrue() + }) + + /* + * @tc.number: uiTest_0600 + * @tc.name: testClick + * @tc.desc: click in the specified location on the screen. + */ + it('testClick', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let Button = await driver.findComponent(BY.text('next page')) + let center = await Button.getBoundsCenter() + await driver.click(center.X, center.Y) + await driver.delayMs(waitUiReadyMs) + let newButton = await driver.findComponent(BY.text('back to index')) + let text = await newButton.getText() + expect(text == 'back to index').assertTrue() + await newButton.click() + }) + + /* + * @tc.number: uiTest_0700 + * @tc.name: testDoubleClick + * @tc.desc: doubleClick in the specified location on the screen. + */ + it('testDoubleClick', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let Button = await driver.findComponent(BY.text('Click twice')) + let center = await Button.getBoundsCenter() + await driver.doubleClick(center.X, center.Y) + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('doubleClick')) + let text = await button.getText() + expect(text == 'doubleClick').assertTrue() + await button.click() + }) + + /* + * @tc.number: uiTest_0800 + * @tc.name: testLongClick + * @tc.desc: longClick in the specified location on the screen. + */ + it('testLongClick', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let Button = await driver.findComponent(BY.text('next page')) + let center = await Button.getBoundsCenter() + await driver.longClick(center.X, center.Y) + await driver.delayMs(waitUiReadyMs) + let newButton = await driver.findComponent(BY.text('longClick')) + let text = await newButton.getText() + expect(text == 'longClick').assertTrue() + await newButton.click() + }) + + /* + * @tc.number: uiTest_0900 + * @tc.name: testUiComponentClick + * @tc.desc: click this UiComponentClick. + */ + it('testUiComponentClick', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page')) + await button.click() + await driver.delayMs(waitUiReadyMs) + let newButton = await driver.findComponent(BY.text('back to index')) + let text = await newButton.getText() + expect(text == 'back to index').assertTrue() + await newButton.click() + }) + + /* + * @tc.number: uiTest_1000 + * @tc.name: testUiComponentDoubleClick + * @tc.desc: doubleClick this UiComponentClick. + */ + it('testUiComponentDoubleClick', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('Click twice')) + await button.doubleClick() + await driver.delayMs(waitUiReadyMs) + let newButton = await driver.findComponent(BY.text('doubleClick')) + let text = await newButton.getText() + expect(text == 'doubleClick').assertTrue() + await newButton.click() + }) + + /* + * @tc.number: uiTest_1100 + * @tc.name: testUiComponentLongClick + * @tc.desc: longClick this UiComponentClick. + */ + it('testUiComponentLongClick', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page')) + await button.longClick() + await driver.delayMs(waitUiReadyMs) + let newButton = await driver.findComponent(BY.text('longClick')) + let text = await newButton.getText() + expect(text == 'longClick').assertTrue() + await newButton.click() + }) + + /* + * @tc.number: uiTest_1200 + * @tc.name: testKey + * @tc.desc: find UiComponent by key attribute and get it's key attribute. + */ + it('testKey', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.key('my-key')) + expect(await button.getKey() == 'my-key').assertTrue() + }) + + /* + * @tc.number: uiTest_1300 + * @tc.name: testId + * @tc.desc: find UiComponent by id attribute and get it's id attribute. + */ + it('testId', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page')) + let id = await button.getId() + let button2 = await driver.findComponent(BY.id(id)) + expect(await button2.getText() == 'next page').assertTrue() + }) + + /* + * @tc.number: uiTest_1400 + * @tc.name: testType + * @tc.desc: find UiComponent by type attribute and get it's type attribute. + */ + it('testType', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let text = await driver.findComponent(BY.type('Text')) + let type = await text.getType() + expect(type == 'Text').assertTrue() + }) + + /* + * @tc.number: uiTest_1500 + * @tc.name: testClickable + * @tc.desc: find UiComponent by clickable attribute and get it's clickable attribute. + */ + it('testClickable', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page').clickable(false)) + let clickable = await button.isClickable() + expect(clickable == false).assertTrue() + }) + + /* + * @tc.number: uiTest_1600 + * @tc.name: testLongClickable + * @tc.desc: find UiComponent by longClickable attribute and get it's longClickable attribute. + */ + it('testLongClickable', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page').longClickable(false)) + let longClickable = await button.isLongClickable() + expect(longClickable== false).assertTrue() + }) + + /* + * @tc.number: uiTest_1700 + * @tc.name: testScrollable + * @tc.desc: find UiComponent by scrollable attribute and get it's scrollable attribute. + */ + it('testScrollable', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let scrollBar = await driver.findComponent(BY.type('Scroll').scrollable(false)) + let scrollable = await scrollBar.isScrollable() + expect(scrollable == false).assertTrue() + }) + + /* + * @tc.number: uiTest_1800 + * @tc.name: testEnabled + * @tc.desc: find UiComponent by enabled attribute and get it's enabled attribute. + */ + it('testEnabled', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page').enabled(true)) + let enable = await button.isEnabled() + expect(enable == true).assertTrue() + }) + + /* + * @tc.number: uiTest_1900 + * @tc.name: testFocused + * @tc.desc: find UiComponent by focused attribute and get it's focused attribute. + */ + it('testFocused', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page').focused(false)) + let focused = await button.isFocused() + expect(focused == false).assertTrue() + }) + + /* + * @tc.number: uiTest_2000 + * @tc.name: testSelected + * @tc.desc: find UiComponent by selected attribute and get it's selected attribute. + */ + it('testSelected', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page').selected(false)) + let selected = await button.isSelected() + expect(selected == false).assertTrue() + }) + + /* + * @tc.number: uiTest_2100 + * @tc.name: testPressBack + * @tc.desc: Press the BACK key. + */ + it('testPressBack', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page')) + await button.click() + await driver.delayMs(waitUiReadyMs) + await driver.pressBack() + await driver.delayMs(waitUiReadyMs) + let button_ori = await driver.findComponent(BY.text('next page')) + expect(await button_ori.getText() == 'next page').assertTrue() + }) + + /* + * @tc.number: uiTest_2200 + * @tc.name: testFindComponents + * @tc.desc: find all the matched UiComponents on current UI + */ + it('testFindComponents', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let buttons = await driver.findComponents(BY.type('Button')) + expect(await buttons[0].getText() != null).assertTrue() + }) + + /* + * @tc.number: uiTest_2300 + * @tc.name: testTriggerKey + * @tc.desc: press the specified key. + */ + it('testTriggerKey', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page')) + await button.click() + await driver.delayMs(waitUiReadyMs) + let keyBack = 2 + await driver.triggerKey(keyBack) + await driver.delayMs(waitUiReadyMs) + let button_ori = await driver.findComponent(BY.text('next page')) + expect(await button_ori.getText() == 'next page').assertTrue() + }) + + /* + * @tc.number: uiTest_2400 + * @tc.name: testGetUiComponentBounds + * @tc.desc: get the bounds of this UiComponent. + */ + it('testGetUiComponentBounds', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let text = await driver.findComponent(BY.text('next page')) + expect(text !== null).assertTrue() + let bounds = await text.getBounds(); + expect(bounds !== null).assertTrue() + expect(bounds.rightX).assertLarger(bounds.leftX) + expect(bounds.bottomY).assertLarger(bounds.topY) + }) + + /* + * @tc.number: uiTest_2500 + * @tc.name: testGetUiComponentBoundsCenter + * @tc.desc: get the boundsCenter of this @link UiComponent. + */ + it('testGetUiComponentBoundsCenter', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('next page')) + let point = await button.getBoundsCenter() + let bounds = await button.getBounds() + expect(point!== null).assertTrue() + expect(point.Y == (bounds.bottomY + bounds.topY)/2).assertTrue() + expect(point.X == (bounds.rightX + bounds.leftX)/2).assertTrue() + }) + + /* + * @tc.number: uiTest_2600 + * @tc.name: testWaitForComponent + * @tc.desc: Find the first matched UiComponent on current UI during the time given. + */ + it('testWaitForComponent', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.waitForComponent(BY.text('next page'), waitUiReadyMs) + expect(button !== null).assertTrue() + }) + + /* + * @tc.number: uiTest_2700 + * @tc.name: testScreenCap + * @tc.desc: capture current screen. + */ + it('testScreenCap', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let savePath = '/data/local/tmp/1.png' + let success = await driver.screenCap(savePath) + expect(success == true).assertTrue() + }) + + /* + * @tc.number: uiTest_2800 + * @tc.name: testAssertComponentExist + * @tc.desc: Assert whether the matched UiComponent exists on current UI;. + */ + it('testAssertComponentExist', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + await driver.assertComponentExist(BY.text('next page')) + }) + + /* + * @tc.number: uiTest_2900 + * @tc.name: testIsBefore + * @tc.desc: find uiComponent which is before another UiComponent that specified by given. + */ + it('testIsBefore', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.isBefore(BY.text('Click twice')).type('Button')) + expect(await button.getType() == 'Button').assertTrue() + }) + + /* + * @tc.number: uiTest_3000 + * @tc.name: testIsAfter + * @tc.desc: find uiComponent which is after another UiComponent that specified by given. + */ + it('testIsAfter', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.isAfter(BY.text('next page')).type('Text')) + expect(await button.getText() == 'Click twice').assertTrue() + }) + + /* + * @tc.number: uiTest_3100 + * @tc.name: testSwipe + * @tc.desc: swipe on the screen between the specified points. + */ + it('testSwipe', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + await driver.swipe(300,600,300,300) + let text = await driver.findComponent(BY.text('next page')) + expect(text == null).assertTrue() + await driver.swipe(300,300,300,600) + }) + + /* + * @tc.number: uiTest_3200 + * @tc.name: testScrollSearch + * @tc.desc: scroll on this UiComponent to find matched UiComponent. + */ + it('testScrollSearch', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let scrollBar = await driver.findComponent(BY.type('Scroll')) + let button = await scrollBar.scrollSearch(BY.text('next page')) + expect(await button.getText() == 'next page').assertTrue() + }) + + /* + * @tc.number: uiTest_3300 + * @tc.name: testScrollToBottom + * @tc.desc: scroll on this UiComponent to the bottom. + */ + it('testScrollToBottom', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let scrollBar = await driver.findComponent(BY.type('Scroll')) + expect(scrollBar != null).assertTrue() + await scrollBar.scrollToBottom() + let button = await driver.findComponent(BY.text('bottom')) + expect(await button.getText() == 'bottom').assertTrue() + await scrollBar.scrollToTop() + }) + + /* + * @tc.number: uiTest_3400 + * @tc.name: testScrollToTop + * @tc.desc: scroll on this UiComponent to the top. + */ + it('testScrollToTop', 0, async function () { + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let scrollBar = await driver.findComponent(BY.type('Scroll')) + expect(scrollBar !== null).assertTrue() + await scrollBar.scrollToBottom() + await scrollBar.scrollToTop() + let button = await driver.findComponent(BY.text('next page')) + expect(await button.getText() == 'next page').assertTrue() + }) + + /* + * @tc.number: uiTest_3500 + * @tc.name: testGetWindowMode + * @tc.desc: get the window mode of this UiWindow. + */ + it('testGetWindowMode', 0, async function () { + await startAbility('com.example.windows', 'MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window1 = await driver.findWindow({bundleName:'com.example.windows'}) + let mode1 = await window1.getWindowMode() + expect(mode1 == WindowMode.FULLSCREEN).assertTrue() + let window2 = await driver.findWindow({bundleName:'com.example.windows'}) + await window2.resume() + let mode2 = await window2.getWindowMode() + expect(mode2 == WindowMode.FLOATING).assertTrue() + await stopApplication('com.example.windows') + }) + + /* + * @tc.number: uiTest_3600 + * @tc.name: testGetBundleName + * @tc.desc: get the bundleName of this UiWindow. + */ + it('testGetBundleName', 0, async function () { + await startAbility('com.example.windows', 'MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window = await driver.findWindow({bundleName:'com.example.windows'}) + let name = await window.getBundleName() + expect(name == 'com.example.windows').assertTrue() + await stopApplication('com.example.windows') + }) + + /* + * @tc.number: uiTest_3700 + * @tc.name: testGetTitle + * @tc.desc: get the title of this UiWindow. + */ + it('testGetTitle', 0, async function () { + await startAbility('com.example.windows', 'MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window = await driver.findWindow({bundleName:'com.example.windows'}) + let title = await window.getTitle() + expect(title == '').assertTrue() + await stopApplication('com.example.windows') + }) + + /* + * @tc.number: uiTest_3800 + * @tc.name: testWindowMoveTo + * @tc.desc: move this UiWindow to the specified points. + */ + it('testWindowMoveTo', 0, async function () { + await startAbility('com.example.windows', 'MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window = await driver.findWindow({bundleName:'com.example.windows'}) + await window.resume() + await driver.delayMs(waitUiReadyMs) + let window1 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds1 = await window1.getBounds() + await window1.moveTo(100,100) + await driver.delayMs(waitUiReadyMs) + let window2 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds2 = await window2.getBounds() + expect(bounds1 != bounds2).assertTrue() + await stopApplication('com.example.windows') + }) + + /* + * @tc.number: uiTest_3900 + * @tc.name: testWindowResize + * @tc.desc: resize this UiWindow to the specified size for the specified direction. + */ + it('testWindowResize', 0, async function () { + await startAbility('com.example.windows', 'MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window = await driver.findWindow({bundleName:'com.example.windows'}) + await window.resume() + await driver.delayMs(waitUiReadyMs) + let window1 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds1 = await window1.getBounds() + await window1.resize(400,400,ResizeDirection.RIGHT_DOWN) + await driver.delayMs(waitUiReadyMs) + let window2 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds2 = await window2.getBounds() + expect(bounds2 != bounds1).assertTrue() + await window2.resize(500,500,ResizeDirection.RIGHT_UP) + let window3 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds3= await window2.getBounds() + expect(bounds3 != bounds2).assertTrue() + await window3.resize(400,400,ResizeDirection.LEFT_DOWN) + let window4 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds4= await window2.getBounds() + expect(bounds4 != bounds3).assertTrue() + await window4.resize(500,500,ResizeDirection.LEFT_DOWN) + let window5 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds5= await window2.getBounds() + expect(bounds5 != bounds4).assertTrue() + await window5.resize(500,400,ResizeDirection.DOWN) + let window6 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds6= await window2.getBounds() + expect(bounds6 != bounds5).assertTrue() + await window6.resize(500,500,ResizeDirection.UP) + let window7 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds7 = await window2.getBounds() + expect(bounds7 != bounds5).assertTrue() + await window7.resize(500,500,ResizeDirection.UP) + let window8 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds8 = await window2.getBounds() + expect(bounds8 != bounds7).assertTrue() + await window8.resize(400,500,ResizeDirection.LEFT) + let window9 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds9 = await window2.getBounds() + expect(bounds9 != bounds8).assertTrue() + await window9.resize(400,500,ResizeDirection.RIGHT) + let window10 = await driver.findWindow({bundleName:'com.example.windows'}) + let bounds10 = await window2.getBounds() + expect(bounds10 != bounds9).assertTrue() + await stopApplication('com.example.windows') + }) + + /* + * @tc.number: uiTest_4000 + * @tc.name: testWindowFocus + * @tc.desc: set the focused status of this UiWindow. + */ + it('testWindowFocus', 0, async function () { + await startAbility('com.example.windows', 'MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window = await driver.findWindow({bundleName:'com.example.windows'}) + await window.focus() + let IsActive = await window.focus() + expect(IsActive == true).assertTrue() + await stopApplication('com.example.windows') + }) + + /* + * @tc.number: uiTest_4100 + * @tc.name: testWindowMaximize + * @tc.desc: maximize this UiWindow. + */ + it('testWindowMaximize', 0, async function () { + await startAbility('com.example.windows', 'MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window = await driver.findWindow({bundleName:'com.example.windows'}) + await window.resume() + let window2 = await driver.findWindow({bundleName:'com.example.windows'}) + await window2.maximize() + await driver.delayMs(waitUiReadyMs) + let window3 = await driver.findWindow({bundleName:'com.example.windows'}) + let mode = await window3.getWindowMode() + expect(mode == WindowMode.FULLSCREEN).assertTrue() + await stopApplication('com.example.windows') + }) + + /* + * @tc.number: uiTest_4200 + * @tc.name: testWindowMinimize + * @tc.desc: minimize this UiWindow. + */ + it('testWindowMinimize', 0, async function () { + await startAbility('com.example.windows', 'MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window = await driver.findWindow({bundleName:'com.example.windows'}) + await window.minimize() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('Clock')) + expect(button != null).assertTrue() + await stopApplication('com.example.windows') + }) + + /* + * @tc.number: uiTest_4300 + * @tc.name: testWindowClose + * @tc.desc: close this UiWindow. + */ + it('testWindowClose', 0, async function () { + await startAbility('com.example.windows', 'MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window = await driver.findWindow({bundleName:'com.example.windows'}) + await window.close() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('Clock')) + expect(button != null).assertTrue() + }) + + }) + +} \ No newline at end of file diff --git a/arkXtest/uitest/src/main/resources/base/element/string.json b/arkXtest/uitest/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..498677efbde065c36668727190d3613cbf278bfc --- /dev/null +++ b/arkXtest/uitest/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/arkXtest/uitest/src/main/resources/base/media/icon.png b/arkXtest/uitest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkXtest/uitest/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibilityconfig/Test.json b/barrierfree/accessibilityconfig/Test.json index c6b592b959dcf69c48fce927bff917c804e03fb0..eea8e56d74290ba0f190a2f86e276942793ccd45 100644 --- a/barrierfree/accessibilityconfig/Test.json +++ b/barrierfree/accessibilityconfig/Test.json @@ -1,10 +1,12 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", - "test-timeout": "180000", - "package": "com.example.accessibilityconfig", - "shell-timeout": "180000" + "type": "OHJSUnitTest", + "test-timeout": "240000", + "bundle-name": "com.example.accessibilityconfig", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 }, "kits": [ { diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts index e9c126eb7f2bb41f03a0bfc91f68a8568e38c8f8..f9014b87a17cf7c30fb45d2f0455ac8e783a64f7 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/MainAbility.ts @@ -1,3 +1,17 @@ +/* + * 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 { @@ -18,7 +32,7 @@ export default class MainAbility extends Ability { //globalThis.windowStage = windowStage //globalThis.abilityStorage = this.storage globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } onWindowStageDestroy() { diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/pages/index/index.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..51bf7178e8c554cc5f4fb4ad6359e9356f97aadc --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -0,0 +1,37 @@ +/* + * 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 '@ohos.router'; + +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + + aboutToAppear(){ + console.info("start run testcase!!!!"); + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/TestAbility.ts b/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..a8203eae937701d9c837e8c5096c4d880e5ebbcc --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,53 @@ +/* + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'TestAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/pages/index.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b93567f962921124b282f78c8ef123965d1460c9 --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * 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 '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/barrierfree/accessibilityconfig/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..c56fa98f7a9cc8d48bfe0b87072ef613ba1ab785 --- /dev/null +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/pages/index/index.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index d45c30711626494a6cf3dae2aa6f3f5bfa94f044..0000000000000000000000000000000000000000 --- a/barrierfree/accessibilityconfig/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" -import testsuite from "../../test/List.test" - -@Entry -@Component -struct Index { - @State message: string = 'Hello World'; - - 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); - const configService = core.getDefaultService('config'); - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)); - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters); - testsuite(globalThis.abilityContext); - core.execute(); - } - - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets index a30566f31afe041cdbd7cad02f665bbfac429242..71ead2c9de5b96c9184627a52de7ce843dc2fd76 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets @@ -12,10 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import config from '@ohos.accessibility.config' -export default function abilityTest(abilityContext) { +export default function abilityTest() { describe('AccessibilityConfigTest', function () { beforeEach(async function (done) { diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets index ee66692b52255bc69ddec15a3f8919a8caaa4898..8cfe3dd44fdfca24d897039ddab1dc4dfb52d7e9 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/test/List.test.ets @@ -14,6 +14,6 @@ */ import abilityTest from './AccessibilityConfig.test.ets' -export default function testsuite(abilityContext) { - abilityTest(abilityContext) +export default function testsuite() { + abilityTest() } \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/module.json b/barrierfree/accessibilityconfig/entry/src/main/module.json index 69501f617c648474e7cfadad8f5fdb64fdc73f7c..716634826d1e04d1e1fc943f51b7bbc6b247a2e8 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/module.json +++ b/barrierfree/accessibilityconfig/entry/src/main/module.json @@ -13,8 +13,8 @@ "uiSyntax": "ets", "pages": "$profile:main_pages", "abilities": [{ - "name": "com.example.accessibilityconfig.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "name": "TestAbility", + "srcEntrance": "./ets/TestAbility/TestAbility.ts", "description": "$string:phone_entry_main", "icon": "$media:icon", "label": "$string:entry_label", diff --git a/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json index 360bf0b466d749ca4f3bb1c37f14d8e6427222eb..43f5bb10ddb7e3fc4aa0b71a76818b8b48cc5bc2 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json +++ b/barrierfree/accessibilityconfig/entry/src/main/resources/base/profile/main_pages.json @@ -1,5 +1,5 @@ { "src": [ - "pages/index/index" + "TestAbility/pages/index" ] } \ No newline at end of file diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts b/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts index 58a0fdd6ee6b8312cc65a71cee0ab55521d223e9..febd2194da6c6253a853ab2487e2c6778354b915 100644 --- a/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts +++ b/barrierfree/accessibilityelement/entry/src/main/ets/AccessibilityExtAbility/ElementTest.ts @@ -100,7 +100,7 @@ export class ElementTest { result = await this.executeAttributeValuePromise(caseName, 'textLengthLimit', 'number'); break; case 'AccessibilityElementTest_attributeValue_asyncPromise_1500': - result = await this.executeAttributeValuePromise(caseName, 'rect', 'object'); + result = await this.executeAttributeValuePromiseRect(caseName, 'rect'); break; case 'AccessibilityElementTest_attributeValue_asyncPromise_1600': result = await this.executeAttributeValuePromise(caseName, 'checkable', 'boolean'); @@ -184,7 +184,7 @@ export class ElementTest { result = await this.executeAttributeValuePromise(caseName, 'isActive', 'boolean', true); break; case 'AccessibilityElementTest_attributeValue_asyncPromise_5300': - result = await this.executeAttributeValuePromise(caseName, 'screenRect', 'object', true); + result = await this.executeAttributeValuePromiseRect(caseName, 'screenRect', true); break; case 'AccessibilityElementTest_attributeValue_asyncPromise_5400': result = await this.executeAttributeValuePromise(caseName, 'layer', 'number', true); @@ -334,7 +334,7 @@ export class ElementTest { await this.executeAttributeValueCallback(caseName, 'textLengthLimit', 'number'); return; case 'AccessibilityElementTest_attributeValue_asyncCallback_1500': - await this.executeAttributeValueCallback(caseName, 'rect', 'object'); + await this.executeAttributeValueCallbackRect(caseName, 'rect'); return; case 'AccessibilityElementTest_attributeValue_asyncCallback_1600': await this.executeAttributeValueCallback(caseName, 'checkable', 'boolean'); @@ -418,7 +418,7 @@ export class ElementTest { await this.executeAttributeValueCallback(caseName, 'isActive', 'boolean', true); return; case 'AccessibilityElementTest_attributeValue_asyncCallback_5300': - await this.executeAttributeValueCallback(caseName, 'screenRect', 'object', true); + await this.executeAttributeValueCallbackRect(caseName, 'screenRect', true); return; case 'AccessibilityElementTest_attributeValue_asyncCallback_5400': await this.executeAttributeValueCallback(caseName, 'layer', 'number', true); @@ -600,6 +600,33 @@ export class ElementTest { return result; } + private async executeAttributeValuePromiseRect(caseName: string, input: string, isWindow: boolean = false): Promise { + let element = undefined; + if (isWindow) { + element = await this.getWindowElement(); + } else { + element = await this.getBaseElement(); + } + + let result = false; + if (element) { + try { + console.info('ElementTest executeAttributeValuePromiseRect ' + caseName); + let value = await element.attributeValue(input); + console.info('ElementTest executeAttributeValuePromiseRect ' + caseName + ' value: ' + JSON.stringify(value)); + if (typeof(value) == 'object' && typeof(value.left) == 'number' && typeof(value.top) == 'number' + && typeof(value.width) == 'number' && typeof(value.height) == 'number') { + result = true; + } else { + console.warn('ElementTest executeAttributeValuePromiseRect ' + caseName + ' valueType: ' + typeof(value)); + } + } catch (e) { + console.info('ElementTest executeAttributeValuePromiseRect ' + caseName + ' catch(e): ' + JSON.stringify(e)); + } + } + return result; + } + private async executeAttributeValuePromiseTriggerAction(caseName: string) { console.info('ElementTest executeAttributeValuePromiseTriggerAction ' + caseName + ' start'); let event = new accessibility.EventInfo({}); @@ -846,6 +873,31 @@ export class ElementTest { } } + private async executeAttributeValueCallbackRect(caseName: string, input: string, isWindow: boolean = false) { + let element = undefined; + if (isWindow) { + element = await this.getWindowElement(); + } else { + element = await this.getBaseElement(); + } + + let result = false; + if (element) { + console.info('ElementTest executeAttributeValueCallbackRect ' + caseName); + element.attributeValue(input, (err, value) => { + console.info('ElementTest executeAttributeValueCallback ' + caseName + ' err: ' + JSON.stringify(err)); + console.info('ElementTest executeAttributeValueCallback ' + caseName + ' value: ' + JSON.stringify(value)); + if (err.code == 0 && typeof(value) == 'object' && typeof(value.left) == 'number' + && typeof(value.top) == 'number' && typeof(value.width) == 'number' && typeof(value.height) == 'number') { + result = true; + } else { + console.warn('ElementTest executeAttributeValueCallbackRect ' + caseName + ' valueType: ' + typeof(value)); + } + this.publishCaseResult(caseName, result); + }); + } + } + private async executeAttributeValueCallbackTriggerAction(caseName: string) { console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' start'); let event = new accessibility.EventInfo({}); diff --git a/barrierfree/accessibilityevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts b/barrierfree/accessibilityevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts index f9903e79048ddd168fb9c0dee3d799d99200bf1b..2b8b428fa9d6162a57a593bcf2abab2010d29c2d 100644 --- a/barrierfree/accessibilityevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts +++ b/barrierfree/accessibilityevent/entry/src/main/ets/AccessibilityExtAbility/AccessibilityExtAbility.ts @@ -50,7 +50,9 @@ class AccessibilityExtAbility extends AccessibilityExtensionAbility { let commonEventPublishData = { data: 'accessibilityEvent', parameters: { - eventType: accessibilityEvent.eventType + eventType: accessibilityEvent.eventType, + haveTarget: (typeof(accessibilityEvent.target) == 'object'), + timeStamp: accessibilityEvent.timeStamp } } commonEvent.publish('accessibilityEvent', commonEventPublishData, publishCallback); diff --git a/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets b/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets index 3be52456caaf47bcb70ce69fca879f499ce60634..cb2df2c1d2a3b2d28946820025dc43711137d996 100644 --- a/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets +++ b/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets @@ -20,7 +20,7 @@ export default function abilityTest(abilityContext) { let targetBundleName = 'com.example.myapplication'; let subScriber = undefined; let isConnected: boolean = false; - let eventTypes: Array = []; + let events: Array = []; describe('AccessibilityEventTest', function () { beforeAll(async function (done) { @@ -33,7 +33,7 @@ export default function abilityTest(abilityContext) { } else if (data.data == 'disconnect') { isConnected = false; } else if (data.data == 'accessibilityEvent') { - eventTypes.push(data.parameters.eventType); + events.push(data.parameters); } }); @@ -58,7 +58,7 @@ export default function abilityTest(abilityContext) { beforeEach(async function (done) { console.info(`AccessibilityEventTest: beforeEach`); - eventTypes.length = 0; + events.length = 0; setTimeout(done, 2000); }) @@ -86,10 +86,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -117,10 +116,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -148,10 +146,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -179,10 +176,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -210,10 +206,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -241,10 +236,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -272,10 +266,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -303,10 +296,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -334,10 +326,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -365,10 +356,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -396,10 +386,9 @@ export default function abilityTest(abilityContext) { await accessibility.sendEvent(event); setTimeout(() => { - let types = eventTypes; let findResult = false; - for (let type of types) { - if (type == eventType) { + for (let item of events) { + if (item.eventType == eventType) { findResult = true; } } @@ -408,5 +397,67 @@ export default function abilityTest(abilityContext) { done(); }, 3000); }) + + /* + * @tc.number AccessibilityEventTest_1200 + * @tc.name AccessibilityEventTest_1200 + * @tc.desc The parameter input is 'scroll', test the Ability event function, + * and return void, verify existence of 'target'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_1200', 0, async function (done) { + console.info(`AccessibilityEventTest_1200`); + let eventType = 'scroll'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'scrollForward'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let findResult = false; + for (let item of events) { + console.info(`AccessibilityEventTest_1200 haveTarget: ${item.haveTarget}`); + if (item.eventType == eventType && item.haveTarget) { + findResult = true; + } + } + console.info('AccessibilityEventTest_1200 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) + + /* + * @tc.number AccessibilityEventTest_1300 + * @tc.name AccessibilityEventTest_1300 + * @tc.desc The parameter input is 'scroll', test the Ability event function, + * and return void, verify existence of 'timeStamp'. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityEventTest_1300', 0, async function (done) { + console.info(`AccessibilityEventTest_1300`); + let eventType = 'scroll'; + let event = new accessibility.EventInfo({}); + event.type = eventType; + event.bundleName = targetBundleName; + event.triggerAction = 'scrollForward'; + await accessibility.sendEvent(event); + + setTimeout(() => { + let findResult = false; + for (let item of events) { + console.info(`AccessibilityEventTest_1300 timeStamp: ${item.timeStamp}`); + if (item.eventType == eventType && typeof(item.timeStamp) == 'number') { + findResult = true; + } + } + console.info('AccessibilityEventTest_1300 case: ' + findResult); + expect(findResult).assertTrue(); + done(); + }, 3000); + }) }) } \ No newline at end of file diff --git a/build_lite/BUILD.gn b/build_lite/BUILD.gn index 92a2fa64a7309d3a49b906f5f0ecc9e6097a3243..6f1021bc53622b8789a1700ffd88223f22ec74f8 100644 --- a/build_lite/BUILD.gn +++ b/build_lite/BUILD.gn @@ -37,9 +37,9 @@ lite_component("acts_component") { "//test/xts/acts/communication_lite/lwip_hal:ActsLwipTest", #"//test/xts/acts/communication_lite/wifiservice_hal:ActsWifiServiceTest", - "//test/xts/acts/utils_lite/file_hal:ActsUtilsFileTest", + "//test/xts/acts/commonlibrary_lite/file_hal:ActsUtilsFileTest", "//test/xts/acts/startup_lite/syspara_hal:ActsParameterTest", - "//test/xts/acts/iot_hardware_lite/iot_controller_hal:ActsWifiIotTest", + "//test/xts/acts/iothardware_lite/peripheral_hal:ActsWifiIotTest", "//test/xts/acts/distributeddatamgr_lite/kv_store_hal:ActsKvStoreTest", "//test/xts/acts/security_lite/huks/liteos_m_adapter:ActsHuksHalFunctionTest", "//test/xts/acts/hiviewdfx_lite/hilog_hal:ActsDfxFuncTest", diff --git a/bundlemanager/bundle_standard/bundlemanager/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/BUILD.gn index 0e8839ec38cbd68046e3e470e40095a61186d918..f572ed055ad458c8b054281e975fab70fec5f696 100644 --- a/bundlemanager/bundle_standard/bundlemanager/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/BUILD.gn @@ -28,6 +28,7 @@ group("bundlemanager") { "actsbmsstageetstest:ActBmsStageEtsTest", "actsbundlemanageretstest:ActsBundleManagerEtsTest", "actsbundlemanagertest:ActsBundleManagerTest", + "actsbundlenativetest:ActsBundleNativeTest", "sceneProject/bmsaccesstokenfive:bmsAccessTokenTest5", "sceneProject/bmsaccesstokenfour:bmsAccessTokenTest4", "sceneProject/bmsaccesstokenone:bmsAccessTokenTest1", diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json index 3ede21fabcd5774b96de0564a7d2ba723b3194b5..e565426f0d39470bcb38bdc4e6be7fc187ab3d8f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json @@ -1,10 +1,12 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "180000", - "package": "ohos.acts.bundle.stage.test", - "shell-timeout": "600000" + "bundle-name": "ohos.acts.bundle.stage.test", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 }, "kits": [ { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts index 72b03d747b3e2e8bdf18ea37c54c789bebb767bb..87b6463a2283b59f971ffea6a3011377c55bc1f3 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -16,7 +16,7 @@ export default class MainAbility extends Ability { // Main window is created, set main page for this ability console.log("[Demo] MainAbility onWindowStageCreate") globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } onWindowStageDestroy() { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/index/index.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f172d89b07521c2a1991ab441e99479f72823209 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -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 router from '@ohos.router'; + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../../test/List.test' + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/second/second.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/second/second.ets similarity index 100% rename from bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/second/second.ets rename to bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/MainAbility/pages/second/second.ets diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/TestAbility.ts b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..fb7ef2b1e9e7573f5679e287d371c8acab61d2e8 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,30 @@ +import Ability from '@ohos.application.Ability' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'TestAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/pages/index.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b93567f962921124b282f78c8ef123965d1460c9 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * 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 '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..3149248aff33bcf98aa3bd3c3f65c003ab80df38 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,58 @@ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log("onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info("OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ohos.acts.bundle.stage.test.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets index 0e54eaaebf86a7202373171db98d3e84c8d86a57..4d53d13b00964c93a4416e0771a9938fac3ac35d 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets @@ -14,7 +14,7 @@ */ import bundle from '@ohos.bundle'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" const MODULE_NAME = "phone" const MODULE_NAME_TEST = "phone1" @@ -26,7 +26,7 @@ const METADATA_NAME1 = "ohos.ability.form1" const METADATA_NAME2 = "ohos.ability.form2" const METADATA_NAME3 = "ohos.ability.form3" const METADATA_NAME_TEST = "ohos.test.form" -const PROFILE_JSON_STRING = "{\"src\":[\"pages/index/index\",\"pages/second/second\"]}" +const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}" export default function getProfileByAbility() { describe('getProfileByAbility', function () { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets index cc9a2b7e6bc2e60b956bf5a6825fad05b40aa785..1f96904892aaf4470b4f4084c14c9944265b215f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets @@ -14,7 +14,7 @@ */ import bundle from '@ohos.bundle'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" const MODULE_NAME = "phone" const MODULE_NAME_TEST = "phone1" @@ -26,7 +26,7 @@ const METADATA_NAME1 = "ohos.extension.form1" const METADATA_NAME2 = "ohos.extension.form2" const METADATA_NAME3 = "ohos.extension.form3" const METADATA_NAME_TEST = "ohos.test.form" -const PROFILE_JSON_STRING = "{\"src\":[\"pages/index/index\",\"pages/second/second\"]}" +const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}" export default function getProfileByExtensionAbility() { describe('getProfileByExtensionAbility', function () { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets index 0f706c4b4fd04fb5b80569ac2dcb25851cb0c9a5..9f75ecfa43762ceaab1ac9c2b3211e1908e8d02e 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/List.test.ets @@ -16,7 +16,7 @@ import getProfileByAbility from './GetProfileByAbility.test.ets'; import getProfileByExtensionAbility from './GetProfileByExtensionAbility.test.ets'; -export default function testsuite(context) { +export default function testsuite() { getProfileByAbility(); getProfileByExtensionAbility(); } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json index 10d2c96da1a13b5f2988bb3fea216cde795b58d6..e892d44722d9e5b09ff78cb069ccc15d1fac872e 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/form_config.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json index 6898b31d2085f478ee1ed9d933a5910cbf901d92..02221db61d317863114ff0ca4dd2b33586abff12 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/main_pages.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json index 96b478210df9884592229ae2db6f6bb7f86c14f4..010134e5cdcb46ef62097816f127dac0bb93a398 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/shortcuts_config.json @@ -1,6 +1,6 @@ { "src": [ - "pages/index/index", - "pages/second/second" + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" ] } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..b1ab667cb92c3c895931f9ec174faef8f9978805 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/BUILD.gn @@ -0,0 +1,53 @@ +# 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("//build/ohos.gni") +import("//test/xts/tools/build/suite.gni") +ohos_js_hap_suite("ActsBundleNativeTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_third_ets_assets", + ":ace_third_ets_resources", + ":ace_third_ets_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsBundleNativeTest" + shared_libraries = [ + "./entry/src/main/cpp:bundlendk", + ":libcppsharedso", + ] +} + +ohos_prebuilt_shared_library("libcppsharedso") { + if (!(product_name == "m40")) { + if (target_cpu == "arm") { + source = "//prebuilts/clang/ohos/linux-x86_64/libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" + } else if (target_cpu == "arm64") { + source = "//prebuilts/clang/ohos/linux-x86_64/libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" + } else { + source = " " + } + } +} + +ohos_js_assets("ace_third_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("ace_third_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("ace_third_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/Test.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..3fa175e45ebbc7900c1eb4ac2875fcced8d0cc79 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.actsbundle.napitest", + "package-name": "com.actsbundle.napitest", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsBundleNativeTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..9754ffcbb3c264f0815c8bce1ac16cda5e00a2cb --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json @@ -0,0 +1,99 @@ +{ + "app": { + "bundleName": "com.actsbundle.napitest", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.actsbundle.napitest", + "name": ".MyApplication", + "mainAbility": "com.actsbundle.napitest.MainAbility", + + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..1c447db6e20116336cac57cff58190eea576a596 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/BUILD.gn @@ -0,0 +1,52 @@ +# 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("//build/config/ohos/config.gni") +import("//build/ohos.gni") + +config("config") { + visibility = [ ":*" ] + + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Wunused-variable", + ] +} + +config("public_config") { +} + +ohos_shared_library("bundlendk") { + sources = [ "./bundlendk.cpp" ] + if (!(product_name == "m40")) { + if (target_cpu == "arm") { + libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ] + } else if (target_cpu == "arm64") { + libs = [ "${clang_base_path}/../libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" ] + } else { + libs = [] + } + } + + include_dirs = [ "//test/xts/acts/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp" ] + configs = [ ":config" ] + + deps = [ + "//foundation/arkui/napi:ace_napi", + "//foundation/bundlemanager/bundle_framework/interfaces/kits/native/bundle:bundle_ndk", + ] + + output_extension = "so" +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/CMakeLists.txt b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/CMakeLists.txt new file mode 100755 index 0000000000000000000000000000000000000000..02e5fa82004db5f58a007813b1ddb955cebfc7bf --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/CMakeLists.txt @@ -0,0 +1,11 @@ +# the minimum version of CMake. +cmake_minimum_required(VERSION 3.4.1) +project(XComponent) + +set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +include_directories(${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include) + +add_library(bundlendk SHARED bundlendk.cpp) +target_link_libraries(bundlendk PUBLIC libace_napi.z.so libc++.a libbundle_ndk.z.so ) \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/bundlendk.cpp b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/bundlendk.cpp new file mode 100755 index 0000000000000000000000000000000000000000..d3955e290e36735c2b747baa37759d54b26c1b27 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/bundlendk.cpp @@ -0,0 +1,61 @@ +/* + * 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. + */ + +#include "napi/native_api.h" +#include "native_interface_bundle.h" + +#include +#include + +static napi_value GetCurrentApplicationInfo(napi_env env, napi_callback_info info) +{ + OH_NativeBundle_ApplicationInfo nativeApplicationInfo = OH_NativeBundle_GetCurrentApplicationInfo(); + napi_value result = nullptr; + napi_create_object(env, &result); + napi_value bundleName; + napi_create_string_utf8(env, nativeApplicationInfo.bundleName, NAPI_AUTO_LENGTH, &bundleName); + napi_set_named_property(env, result, "bundleName", bundleName); + napi_value fingerprint; + napi_create_string_utf8(env, nativeApplicationInfo.fingerprint, NAPI_AUTO_LENGTH, &fingerprint); + napi_set_named_property(env, result, "fingerprint", fingerprint); + return result; +} + +EXTERN_C_START +static napi_value Init(napi_env env, napi_value exports) +{ + napi_property_descriptor desc[] = { + { "getCurrentApplicationInfo", nullptr, GetCurrentApplicationInfo, + nullptr, nullptr, nullptr, napi_default, nullptr } + }; + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); + return exports; +} +EXTERN_C_END + +static napi_module demoModule = { + .nm_version =1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "libbundlendk", + .nm_priv = ((void*)0), + .reserved = { 0 }, +}; + +extern "C" __attribute__((constructor)) void RegisterModule(void) +{ + napi_module_register(&demoModule); +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/index.d.ts b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/index.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..795a989d6308b36a95734de5cdf37763687bbdc7 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/index.d.ts @@ -0,0 +1 @@ +export const GetCurrentApplicationInfo: () => object; \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/package.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/package.json new file mode 100755 index 0000000000000000000000000000000000000000..ecc8a1c1adae30e4c6653f22f58c7e786726cc21 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/package.json @@ -0,0 +1,4 @@ +{ + "name": "libbundlendk.so", + "types": "./index.d.ts" +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/app.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/app.ets new file mode 100755 index 0000000000000000000000000000000000000000..6943b8ca506850db8cf911dbc15685cac37c32ab --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/pages/index.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..4d3ee125eae2c375edea179fcd5acd7902693b5d --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('BMS ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/app.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/app.ets new file mode 100755 index 0000000000000000000000000000000000000000..6943b8ca506850db8cf911dbc15685cac37c32ab --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/pages/index.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..9c1dd7994e656331dc60c1dd392a387cb490db4a --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/pages/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 router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100755 index 0000000000000000000000000000000000000000..fca0b3390f30dfe2108cabee227c054fc3e1a20f --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/BudnleNdkNativeTest.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/BudnleNdkNativeTest.ets new file mode 100755 index 0000000000000000000000000000000000000000..1e620e4a2471eaef8a99e1688c3dcb009b2dac4d --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/BudnleNdkNativeTest.ets @@ -0,0 +1,39 @@ +/* + * 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 "hypium/index" +import bundlendk from 'libbundlendk.so' + +const BUNDLE_NAME = "com.actsbundle.napitest" +const FINGER_PRINT = "7B3D8586460A7666621992FD367993D7ECDE40A8FD8E9CF525A48822E9A62655" + +export default function budnleNdkNativeTest() { + describe('BundleNdkTest', function () { + + /** + * @tc.number SUB_BMS_BASIC_ETS_NATIVE_0100 + * @tc.name budnleNdkNativeTest001 + * @tc.desc budnleNdkNativeTest + */ + it('BundleNdkTest001', 0, async function (done) { + let data = bundlendk.getCurrentApplicationInfo(); + console.info("Test NAPI data= " + JSON.stringify(data)); + expect(data.bundleName).assertEqual(BUNDLE_NAME); + expect(data.fingerprint).assertEqual(FINGER_PRINT); + done() + }); + + }) +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/List.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..0b91b94750b3836febcafc58da73478b27c16d5f --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import budnleNdkNativeTest from './BudnleNdkNativeTest'; + +export default function testsuite() { + budnleNdkNativeTest() +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/element/string.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..498677efbde065c36668727190d3613cbf278bfc --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/media/icon.png b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/media/icon.png differ diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/signature/openharmony_sx.p7b b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/signature/openharmony_sx.p7b differ diff --git a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/ArrayList.test.js b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/ArrayList.test.js index 594afc5cf0cd19eaa740b0a00a36f5eb69e97743..e993f04cc7d0c8f5c4cf5a983db1fc86fa258470 100644 --- a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/ArrayList.test.js +++ b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/ArrayList.test.js @@ -1058,11 +1058,9 @@ describe("ArraylistTest", function () { arrayList.add("b"); arrayList.add("c"); arrayList.add(1); - arrayList.removeByRange(0, 8); + arrayList.removeByRange(0, 9); let res = arrayList.length; - let res1 = arrayList.getLastIndexOf(1); - expect(res).assertEqual(1); - expect(res1).assertEqual(0); + expect(res).assertEqual(0); }); }); } diff --git a/commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js b/commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js index 53d310133cf894978bbb98d8767eb85c6a9caaa1..e0a1692bef6056eefa0dda833e4f5b972e02be6a 100644 --- a/commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js +++ b/commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js @@ -169,12 +169,12 @@ describe('TextEncoderTest', function () { }) /** - * @tc.name: testUtilPromiseWrapper_new_001 + * @tc.name: testUtilPromisify_new_001 * @tc.desc: Takes a function following the common error-first callback style, taking an callback as the last argument, and return a function that returns promises. * @tc.author: shikai */ - it('testUtilPromiseWrapper_new_001', 0, async function () { + it('testUtilPromisify_new_001', 0, async function () { function aysnFun(str, callback) { if (typeof str === 'string') { callback(null, str); @@ -182,19 +182,19 @@ describe('TextEncoderTest', function () { callback('type err'); } } - let newPromiseObj = util.promiseWrapper(aysnFun); + let newPromiseObj = util.promisify(aysnFun); newPromiseObj("Hello").then(res => { expect(res).strictEqual('Hello'); }) }) /** - * @tc.name: testUtilPromiseWrapper_new_002 + * @tc.name: testUtilPromisify_new_002 * @tc.desc: Takes a function following the common error-first callback style, taking an callback as the last argument, and return a function that returns promises. * @tc.author: shikai */ - it('testUtilPromiseWrapper_new_002', 0, async function () { + it('testUtilPromisify_new_002', 0, async function () { function aysnFun(str, callback) { if (typeof str === 'string') { callback(null, str); @@ -202,35 +202,35 @@ describe('TextEncoderTest', function () { callback('type err'); } } - let newPromiseObj = util.promiseWrapper(aysnFun); + let newPromiseObj = util.promisify(aysnFun); newPromiseObj([1, 2]).catch(err => { expect(err).strictEqual('type err'); }) }) /** - * @tc.name: testUtilPromiseWrapper_new_003 + * @tc.name: testUtilPromisify_new_003 * @tc.desc: Takes a function following the common error-first callback style, taking an callback as the last argument, and return a function that returns promises. * @tc.author: shikai */ - it('testUtilPromiseWrapper_new_003', 0, async function () { + it('testUtilPromisify_new_003', 0, async function () { function fn(err, val, callback) { callback(err, val); } (async () => { - const value = await util.promiseWrapper(fn); + const value = await util.promisify(fn); expect(value(null, 42)).strictEqual(42); })(); }) /** - * @tc.name: testUtilPromiseWrapper_new_004 + * @tc.name: testUtilPromisify_new_004 * @tc.desc: Takes a function following the common error-first callback style, taking an callback as the last argument, and return a function that returns promises. * @tc.author: shikai */ - it('testUtilPromiseWrapper_new_004', 0, async function () { + it('testUtilPromisify_new_004', 0, async function () { function aysnFun(str1, str2, callback) { if (typeof str1 === 'string' && typeof str1 === 'string') { callback(null, str1 + str2); @@ -238,19 +238,19 @@ describe('TextEncoderTest', function () { callback('type err'); } } - let newPromiseObj = util.promiseWrapper(aysnFun); + let newPromiseObj = util.promisify(aysnFun); newPromiseObj("Hello", 'World').then(res => { expect(res).strictEqual('HelloWorld'); }) }) /** - * @tc.name: testUtilPromiseWrapper_new_005 + * @tc.name: testUtilPromisify_new_005 * @tc.desc: Takes a function following the common error-first callback style, taking an callback as the last argument, and return a function that returns promises. * @tc.author: shikai */ - it('testUtilPromiseWrapper_new_005', 0, async function () { + it('testUtilPromisify_new_005', 0, async function () { function aysnFun(str1, str2, callback) { if (typeof str1 === 'string' && typeof str1 === 'string') { callback(null, str1 + str2); @@ -258,21 +258,19 @@ describe('TextEncoderTest', function () { callback('type err'); } } - let newPromiseObj = util.promiseWrapper(aysnFun); + let newPromiseObj = util.promisify(aysnFun); newPromiseObj([1, 2], 'World').catch(err => { expect(err).strictEqual('type err'); }) }) - - /** * @tc.name: testUtilPromiseWrapper001 * @tc.desc: Takes a function following the common error-first callback style, taking an callback as the last argument, and return a version that returns promises. * @tc.author: shikai */ - it('testUtilPromiseWrapper001', 0, async function () { + it('testUtilPromiseWrapper001', 0, async function () { function aysnFun(str1, str2, callback) { if (typeof str1 === 'string' && typeof str1 === 'string') { callback(null, str1 + str2); diff --git a/utils_lite/file_hal/BUILD.gn b/commonlibrary_lite/file_hal/BUILD.gn similarity index 100% rename from utils_lite/file_hal/BUILD.gn rename to commonlibrary_lite/file_hal/BUILD.gn diff --git a/iot_hardware_lite/iot_controller_hal/Test.tmpl b/commonlibrary_lite/file_hal/Test.tmpl similarity index 100% rename from iot_hardware_lite/iot_controller_hal/Test.tmpl rename to commonlibrary_lite/file_hal/Test.tmpl diff --git a/utils_lite/file_hal/src/utils_file_func_test.c b/commonlibrary_lite/file_hal/src/utils_file_func_test.c similarity index 100% rename from utils_lite/file_hal/src/utils_file_func_test.c rename to commonlibrary_lite/file_hal/src/utils_file_func_test.c diff --git a/utils_lite/file_hal/src/utils_file_reli_test.c b/commonlibrary_lite/file_hal/src/utils_file_reli_test.c similarity index 100% rename from utils_lite/file_hal/src/utils_file_reli_test.c rename to commonlibrary_lite/file_hal/src/utils_file_reli_test.c diff --git a/communication/dsoftbus/rpc/BUILD.gn b/communication/dsoftbus/rpc/BUILD.gn old mode 100644 new mode 100755 index 8e8511196f57901a3673281857dac5a198bb4dfc..e67650ed8e74d6afeea7edb21da6011b327299f1 --- a/communication/dsoftbus/rpc/BUILD.gn +++ b/communication/dsoftbus/rpc/BUILD.gn @@ -23,7 +23,9 @@ ohos_js_hap_suite("ActsRpcJsTest") { hap_name = "ActsRpcHapTest" } ohos_js_assets("rpc_js_assets") { - source_dir = "./src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } ohos_resources("rpc_js_resources") { sources = [ "./src/main/resources" ] diff --git a/communication/dsoftbus/rpc/Test.json b/communication/dsoftbus/rpc/Test.json old mode 100644 new mode 100755 index 6c16665cee9452f9e90a12d3122f8fc15b5a4f47..8298fdcfe0dad0430d313790ff23f272eabc7691 --- a/communication/dsoftbus/rpc/Test.json +++ b/communication/dsoftbus/rpc/Test.json @@ -1,11 +1,13 @@ { "description": "Configuration for rpc Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "600000", - "package": "com.ohos.rpctest", - "abilityName": "com.ohos.rpctest.MainAbility", - "shell-timeout": "600000" + "shell-timeout": "600000", + "testcase-timeout": 60000, + "bundle-name":"com.ohos.rpctest", + "package-name": "com.ohos.rpctest" + }, "kits": [ { diff --git a/communication/dsoftbus/rpc/src/main/config.json b/communication/dsoftbus/rpc/src/main/config.json old mode 100644 new mode 100755 index f60ff6b200aad3ed8cc45725fae419b27a86b00a..588bbb972b8844744e21605cb2566b59fe180384 --- a/communication/dsoftbus/rpc/src/main/config.json +++ b/communication/dsoftbus/rpc/src/main/config.json @@ -13,6 +13,7 @@ }, "deviceConfig": {}, "module": { + "reqPermissions": [ { "name": "ohos.permission.DISTRIBUTED_DATASYNC" @@ -26,6 +27,8 @@ ], "package": "com.ohos.rpctest", "name": "com.ohos.rpctest.MyApplication", + "mainAbility": ".MainAbility", + "srcPath": "", "deviceType": [ "phone" ], @@ -46,14 +49,31 @@ ] } ], - "name": "com.ohos.rpctest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "visible":true, - "launchType": "standard" - } + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } ], "js": [ { @@ -65,7 +85,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } \ No newline at end of file diff --git a/miscservices/wallpaper_js/src/main/js/default/app.js b/communication/dsoftbus/rpc/src/main/js/MainAbility/app.js similarity index 93% rename from miscservices/wallpaper_js/src/main/js/default/app.js rename to communication/dsoftbus/rpc/src/main/js/MainAbility/app.js index 4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5..f052c8a909b68f6e497443771496a070ecbccb1c 100644 --- a/miscservices/wallpaper_js/src/main/js/default/app.js +++ b/communication/dsoftbus/rpc/src/main/js/MainAbility/app.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * 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 @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export default { onCreate() { console.info('AceApplication onCreate'); diff --git a/communication/dsoftbus/rpc/src/main/js/default/i18n/en-US.json b/communication/dsoftbus/rpc/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from communication/dsoftbus/rpc/src/main/js/default/i18n/en-US.json rename to communication/dsoftbus/rpc/src/main/js/MainAbility/i18n/en-US.json diff --git a/communication/dsoftbus/rpc/src/main/js/default/i18n/zh-CN.json b/communication/dsoftbus/rpc/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from communication/dsoftbus/rpc/src/main/js/default/i18n/zh-CN.json rename to communication/dsoftbus/rpc/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/communication/dsoftbus/rpc/src/main/js/default/pages/index/index.css b/communication/dsoftbus/rpc/src/main/js/MainAbility/pages/index/index.css old mode 100755 new mode 100644 similarity index 100% rename from communication/dsoftbus/rpc/src/main/js/default/pages/index/index.css rename to communication/dsoftbus/rpc/src/main/js/MainAbility/pages/index/index.css diff --git a/communication/dsoftbus/rpc/src/main/js/default/pages/index/index.hml b/communication/dsoftbus/rpc/src/main/js/MainAbility/pages/index/index.hml old mode 100755 new mode 100644 similarity index 100% rename from communication/dsoftbus/rpc/src/main/js/default/pages/index/index.hml rename to communication/dsoftbus/rpc/src/main/js/MainAbility/pages/index/index.hml diff --git a/communication/dsoftbus/rpc/src/main/js/default/pages/index/index.js b/communication/dsoftbus/rpc/src/main/js/MainAbility/pages/index/index.js old mode 100755 new mode 100644 similarity index 79% rename from communication/dsoftbus/rpc/src/main/js/default/pages/index/index.js rename to communication/dsoftbus/rpc/src/main/js/MainAbility/pages/index/index.js index 3f0470de7f5a5fc87003a1cff21b67360a512aa1..297b9dd71f51ee17d440614c282d9f360e2e25df --- a/communication/dsoftbus/rpc/src/main/js/default/pages/index/index.js +++ b/communication/dsoftbus/rpc/src/main/js/MainAbility/pages/index/index.js @@ -13,7 +13,6 @@ * limitations under the License. */ -import {Core} from 'deccjsunit/index' const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') @@ -27,12 +26,6 @@ export default { }, onShow() { console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../test/List.test') - core.execute() }, onReady() { }, diff --git a/communication/dsoftbus/rpc/src/main/js/TestAbility/app.js b/communication/dsoftbus/rpc/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..b06c8b05af9826ef483a766b5c31e6e4a5656970 --- /dev/null +++ b/communication/dsoftbus/rpc/src/main/js/TestAbility/app.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info("TestApplication onCreate") + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/communication/dsoftbus/rpc/src/main/js/TestAbility/i18n/en-US.json b/communication/dsoftbus/rpc/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/communication/dsoftbus/rpc/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/communication/dsoftbus/rpc/src/main/js/TestAbility/i18n/zh-CN.json b/communication/dsoftbus/rpc/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/communication/dsoftbus/rpc/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/communication/dsoftbus/rpc/src/main/js/TestAbility/pages/index/index.css b/communication/dsoftbus/rpc/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..0e152d52b443a3c3d7875df20135b9ef5f5a872a --- /dev/null +++ b/communication/dsoftbus/rpc/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} + +@media screen and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/communication/dsoftbus/rpc/src/main/js/TestAbility/pages/index/index.hml b/communication/dsoftbus/rpc/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..b9afc51da388d01c587363bd5c6f5d4c96c26a88 --- /dev/null +++ b/communication/dsoftbus/rpc/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ +/* + * 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. + */ + + +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/communication/dsoftbus/rpc/src/main/js/TestAbility/pages/index/index.js b/communication/dsoftbus/rpc/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6a113c46febf52b41c608de32cbeff10620207f6 --- /dev/null +++ b/communication/dsoftbus/rpc/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/communication/dsoftbus/rpc/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/communication/dsoftbus/rpc/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..5f37d306c9595ada61a428d16b7e004b6ed9a829 --- /dev/null +++ b/communication/dsoftbus/rpc/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; \ No newline at end of file diff --git a/communication/dsoftbus/rpc/src/main/js/default/test/RpcJsunit.test.js b/communication/dsoftbus/rpc/src/main/js/default/test/RpcJsunit.test.js deleted file mode 100755 index 0e51219102cf31510a589b23bd86c2961cbc850a..0000000000000000000000000000000000000000 --- a/communication/dsoftbus/rpc/src/main/js/default/test/RpcJsunit.test.js +++ /dev/null @@ -1,1215 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import rpc from '@ohos.rpc' -import {describe, beforeAll, beforeEach, afterEach, afterAll, expect, it} from 'deccjsunit/index' - -describe('ActsRpcJsTest', function(){ - console.info("-----------------------ActsRpcJsTest is starting-----------------------"); - - beforeAll(function (){ - console.info('beforeAll called'); - }); - - beforeEach(function (){ - console.info('beforeEach called'); - }); - - afterEach(function (){ - console.info('afterEach called'); - }); - - afterAll(function (){ - console.info('afterAll called'); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_0100 - * @tc.name Call the writeinterfacetoken interface, write the interface descriptor, and read interfacetoken - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_0100", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0100---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_0100: create object successfully."); - - var token = "hello ruan zong xian"; - var result = data.writeInterfaceToken(token); - console.info("SUB_Softbus_IPC_MessageParcel_0100:run writeInterfaceToken success, result is " + result); - expect(result == true).assertTrue(); - - var resultToken = data.readInterfaceToken(); - console.info("SUB_Softbus_IPC_MessageParcel_0100:run readInterfaceToken success, result is " + resultToken); - expect(resultToken == token); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_0100:error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0100---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_0200 - * @tc.name Call the writeinterfacetoken interface to write a non string interface descriptor - and read interfacetoken - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_0200", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0200---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_0200: create object successfully."); - - var token = 123; - var result = data.writeInterfaceToken(token); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_0200: error = " + error); - expect(error != null).assertTrue(); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0200---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_0300 - * @tc.name The data size of the messageparcel obtained by calling the getSize interface - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_0300", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0300---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_0300: create object successfully."); - - var size = data.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_0300:run getSize is success, result is " + size); - expect(size == 0).assertTrue(); - - var addData = 1; - var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_0300:run writeInt is success, result is " + result); - expect(result == true).assertTrue(); - - size = data.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_0300:run getSize is success, result is " + size); - expect(size == 4).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_0300: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0300---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_0400 - * @tc.name The capacity of the messageparcel obtained by calling the getcapacity interface - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_0400", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0400---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_0400: create object successfully."); - - var size = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_0400:run getCapacity is success, result is " + size); - expect(size == 0).assertTrue(); - - var addData = 1; - var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_0400:run writeInt is success, result is " + result); - expect(result == true).assertTrue(); - - size = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_0400:run getCapacity is success, result is " + size); - expect(size == 64).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_0400: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0400---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_0500 - * @tc.name Call the SetSize interface to set the data size of messageparcel - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_0500", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0500---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_0500: create object successfully."); - - var addData = 1; - var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_0500:run writeInt is success, result is " + result); - expect(result == true).assertTrue(); - - var size = 6; - var setResult = data.setSize(size); - console.info("SUB_Softbus_IPC_MessageParcel_0500:run setSize success, result is " + setResult); - expect(setResult == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_0500: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0500---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_0600 - * @tc.name Call the SetSize interface to set the data size of messageparcel. The write data size - does not match the set value - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_0600", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0600---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_0600: create object successfully."); - - var capacity = 64; - var setResult = data.setCapacity(capacity); - console.info("SUB_Softbus_IPC_MessageParcel_0600:run setCapacity success, result is " + setResult); - expect(setResult == true).assertTrue(); - - var size = 4; - setResult = data.setSize(size); - console.info("SUB_Softbus_IPC_MessageParcel_0600:run setSize success, result is " + setResult); - expect(setResult == true).assertTrue(); - - var addData = 2; - var result = data.writeLong(addData); - console.info("SUB_Softbus_IPC_MessageParcel_0600:run writeInt is success, result is " + result); - expect(result == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_0600: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0600---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_0700 - * @tc.name Call the setcapacity interface to set the capacity of messageparcel - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_0700", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0700---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_0700: create object successfully."); - - var size = 64; - var setResult = data.setCapacity(size); - console.info("SUB_Softbus_IPC_MessageParcel_0700:run setSize success, result is " + setResult); - expect(setResult == true).assertTrue(); - - var addData = 1; - var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_0700:run writeInt is success, result is " + result); - expect(result == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_0700: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0700---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_0800 - * @tc.name Call the setcapacity interface to set the capacity of messageparcel. - * The write data capacity is inconsistent with the set value - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_0800", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0800---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_0800: create object successfully."); - - var size = 4; - var setResult = data.setCapacity(size); - console.info("SUB_Softbus_IPC_MessageParcel_0800:run setSize success, result is " + setResult); - expect(setResult == true).assertTrue(); - - var addData = [1, 2, 3, 4, 5, 6, 7, 8]; - var result = data.writeIntArray(addData); - console.info("SUB_Softbus_IPC_MessageParcel_0800:run writeInt is success, result is " + result); - expect(result == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_0800: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0800---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_0900 - * @tc.name Empty object to obtain the readable byte space, read location, - * writable byte space and write location information of messageparcel - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_0900", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0900---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_0900: create object successfully."); - - var result1 = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_0900: run getWritableBytes is success, result is " + result1); - expect(result1 == 0).assertTrue(); - - var result2 = data.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_0900: run getReadableBytes is success, result is " + result2); - expect(result2 == 0).assertTrue(); - - var result3 = data.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_0900: run getReadPosition is success, result is " + result2); - expect(result3 == 0).assertTrue(); - - var result4 = data.getWritePosition(); - console.info("SUB_Softbus_IPC_MessageParcel_0900: run getWritePosition is success, result is " + result2); - expect(result4 == 0).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_0900: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0900---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1000 - * @tc.name Create an object and write data to obtain the readable byte space, read location, - * writable byte space and write location information of messageparcel - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1000", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1000---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_1000: create object successfully."); - - var dataInt = 1; - var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_1000: run writeInt success, result is " + resultInt); - - var dataLong = 2; - var resultLong = data.writeLong(dataLong); - console.info("SUB_Softbus_IPC_MessageParcel_1000: run writeLong success, result is " + resultLong); - - var result1 = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_1000: run getWritableBytes is success, result is " + result1); - expect(result1 == 52).assertTrue(); - - var result2 = data.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_1000: run getReadableBytes is success, result is " + result2); - expect(result2 == 12).assertTrue(); - - var result3 = data.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_1000: run getReadPosition is success, result is " + result3); - expect(result3 == 0).assertTrue(); - - var result4 = data.getWritePosition(); - console.info("SUB_Softbus_IPC_MessageParcel_1000: run getWritePosition is success, result is " + result4); - expect(result4 == 12).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1000: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1000---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1100 - * @tc.name Call rewindread interface to offset the read position to the specified position - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1100", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1100---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - expect(data.getWritableBytes() == 0).assertTrue(); - expect(data.getReadableBytes() == 0).assertTrue(); - expect(data.getReadPosition() == 0).assertTrue(); - expect(data.getWritePosition() == 0).assertTrue(); - - var dataInt = 1; - var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_1100: run writeInt success, result is " + resultInt); - var dataLong = 2; - var resultLong = data.writeLong(dataLong); - console.info("SUB_Softbus_IPC_MessageParcel_1100: run writeLong success, result is " + resultLong); - - expect(data.getWritableBytes() == 52).assertTrue(); - expect(data.getReadableBytes() == 12).assertTrue(); - expect(data.getReadPosition() == 0).assertTrue(); - expect(data.getWritePosition() == 12).assertTrue(); - - var readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_1100: run readInt is success, result is " + readIntData); - expect(readIntData == dataInt).assertTrue(); - - var writePosition = 0; - var writeResult = data.rewindWrite(writePosition); - console.info("SUB_Softbus_IPC_MessageParcel_1100: run rewindWrite is success, result is " + writeResult); - expect(writeResult == true).assertTrue(); - - expect(data.getWritePosition() == 0).assertTrue(); - dataInt = 3; - resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_1100: run writeInt success, result is " + resultInt); - - var readPosition = 0; - var readResult = data.rewindRead(readPosition); - console.info("SUB_Softbus_IPC_MessageParcel_1100: run rewindWrite is success, result is " + readResult); - expect(readResult == true).assertTrue(); - - readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_1100: run readInt is success, result is " + readIntData); - expect(readIntData == dataInt).assertTrue(); - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1100: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1100---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1200 - * @tc.name The rewindread interface is called to re offset the read position to the specified position. - The specified position is out of range - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1200", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1200---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_1200: create object successfully."); - - var result1 = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run getWritableBytes success, result is " + result1); - expect(result1 == 0).assertTrue(); - var result2 = data.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run getReadableBytes success, result is " + result2); - expect(result2 == 0).assertTrue(); - var result3 = data.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run getReadPosition success, result is " + result3); - expect(result3 == 0).assertTrue(); - var result4 = data.getWritePosition(); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run getWritePosition success, result is " + result4); - expect(result4 == 0).assertTrue(); - - var dataInt = 1; - var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run writeInt success, result is " + resultInt); - expect(resultInt == true).assertTrue(); - var dataLong = 2; - var resultLong = data.writeLong(dataLong); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run writeLong success, result is " + resultLong); - expect(resultLong == true).assertTrue(); - - result1 = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run getWritableBytes is success, result is " + result1); - expect(result1 == 52).assertTrue(); - result2 = data.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run getReadableBytes is success, result is " + result2); - expect(result2 == 12).assertTrue(); - result3 = data.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run getReadPosition is success, result is " + result3); - expect(result3 == 0).assertTrue(); - result4 = data.getWritePosition(); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run getWritePosition is success, result is " + result4); - expect(result4 == 12).assertTrue(); - - var readPosition = 100; - var readResult = data.rewindRead(readPosition); - console.info("SUB_Softbus_IPC_MessageParcel_1200: run rewindRead is success, result is " + readResult); - expect(readResult == false).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1200: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1200---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1300 - * @tc.name Call rewindwrite and the interface offsets the write position to the specified position - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1300", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1300---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_1300: create object successfully."); - - var dataInt = 1; - var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_1300: run writeInt success, result is " + resultInt); - expect(resultInt == true).assertTrue(); - - var readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_1300: run readInt success, result is " + readIntData); - expect(readIntData == dataInt).assertTrue(); - - var writePosition = 0; - var rewindWriteResult = data.rewindWrite(writePosition); - console.info("SUB_Softbus_IPC_MessageParcel_1300: run rewindWrite success, result is " + rewindWriteResult); - expect(rewindWriteResult == true).assertTrue(); - - dataInt = 3; - resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_1300: run writeInt success, result is " + resultInt); - expect(resultInt == true).assertTrue(); - - var readPosition = 0; - var rewindReadResult = data.rewindRead(readPosition); - console.info("SUB_Softbus_IPC_MessageParcel_1300: run rewindRead success, result is " + rewindReadResult); - expect(rewindReadResult == true); - - readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_1300: run readInt success, result is " + readIntData); - expect(readIntData == dataInt).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1300: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1300---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1400 - * @tc.name Call rewindwrite and the interface offsets the write position to the specified position. - The specified position is out of range - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1400", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1400---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_1400: create object successfully."); - - var dataInt = 1; - var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_1400: run writeInt success, result is " + resultInt); - expect(resultInt == true).assertTrue(); - - var readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_1400: run readInt success, result is " + readIntData); - expect(readIntData == dataInt).assertTrue(); - - var writePosition = 99; - var rewindWriteResult = data.rewindWrite(writePosition); - console.info("SUB_Softbus_IPC_MessageParcel_1400: run rewindWrite failed, result is " + rewindWriteResult); - expect(rewindWriteResult == false).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1400: error = " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1400---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1500 - * @tc.name Call the writeshortarray interface, write the array to the messageparcel instance, - * and call readshortarray to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1500", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1500---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_1500: create object successfully."); - - var wShortArryData = [3, 5, 9]; - var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_1500: run writeShortArray success, result is " - + writeShortArrayResult); - expect(writeShortArrayResult == true).assertTrue(); - - var rShortArryData = data.readShortArray(); - console.info("SUB_Softbus_IPC_MessageParcel_1500: run readShortArray is success, result is " - + rShortArryData); - expect(wShortArryData[0] == rShortArryData[0]).assertTrue(); - expect(wShortArryData[1] == rShortArryData[1]).assertTrue(); - expect(wShortArryData[2] == rShortArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1500: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1500---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1600 - * @tc.name Call the writeshortarray interface, write the short integer array to the messageparcel instance, - * and call readshortarray (datain: number []) to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1600", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1600---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_1600: create object successfully."); - - var wShortArryData = [3, 5, 9]; - var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_1600: run writeShortArray success, result is " - + writeShortArrayResult); - expect(writeShortArrayResult == true).assertTrue(); - - var rShortArryData = []; - data.readShortArray(rShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_1600: run readShortArray is success, result is " - + rShortArryData); - expect(wShortArryData[0] == rShortArryData[0]).assertTrue(); - expect(wShortArryData[1] == rShortArryData[1]).assertTrue(); - expect(wShortArryData[2] == rShortArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1600: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1600---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1700 - * @tc.name Writeshortarray interface, boundary value verification - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1700", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1700---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_1700: create object successfully."); - - var wShortArryData = [-32768, 0, 1, 2, 32767]; - var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_1700: run writeShortArray success, result is " - + writeShortArrayResult); - expect(writeShortArrayResult == true).assertTrue(); - - var rShortArryData = []; - data.readShortArray(rShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_1700: run readShortArray is success, result is " - + rShortArryData); - expect(wShortArryData[0] == rShortArryData[0]).assertTrue(); - expect(wShortArryData[1] == rShortArryData[1]).assertTrue(); - expect(wShortArryData[2] == rShortArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1700: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1700---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1800 - * @tc.name Writeshortarray interface, illegal value validation - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1800", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1800---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_1800: create object successfully."); - - var wShortArryData = [-32768, 0, 1, 2, 32767]; - var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_1800: run writeShortArray success, result is " - + writeShortArrayResult); - expect(writeShortArrayResult == true).assertTrue(); - - var errorShortArryData = [-32769, 32768]; - var errorWriteShortArrayResult = data.writeShortArray(errorShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_1800: run writeShortArray success, result is " - + errorWriteShortArrayResult); - expect(errorWriteShortArrayResult == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1800: error = " + error); - } - - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1800---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_1900 - * @tc.name Call the writelongarray interface, write the long integer array to the messageparcel instance, - * and call readlongarray to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_1900", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1900---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_1900: create object successfully."); - - var wLongArryData = [3276826, 1234567, 99999999]; - var writeLongArrayResult = data.writeLongArray(wLongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_1900: run writeShortArray success, result is " - + writeLongArrayResult); - expect(writeLongArrayResult == true).assertTrue(); - - var rLongArryData = data.readLongArray(); - console.info("SUB_Softbus_IPC_MessageParcel_1900: run readShortArray is success, result is " - + rLongArryData); - expect(rLongArryData[0] == wLongArryData[0]).assertTrue(); - expect(rLongArryData[1] == wLongArryData[1]).assertTrue(); - expect(rLongArryData[2] == wLongArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_1900: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1900---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2000 - * @tc.name Call the writelongarray interface, write the long integer array to the messageparcel instance, - * and call readlongarray (datain: number []) to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2000", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2000---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2000: create object successfully."); - - var wLongArryData = [3276826, 1234567, 99999999]; - var writeLongArrayResult = data.writeLongArray(wLongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2000: run writeShortArray success, result is " - + writeLongArrayResult); - expect(writeLongArrayResult == true).assertTrue(); - - var rLongArryData = []; - data.readLongArray(rLongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2000: run readShortArray is success, result is " - + rLongArryData); - expect(rLongArryData[0] == wLongArryData[0]).assertTrue(); - expect(rLongArryData[1] == wLongArryData[1]).assertTrue(); - expect(rLongArryData[2] == wLongArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2000: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2000---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2100 - * @tc.name Writelongarray interface, boundary value verification - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2100", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2100---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2100: create object successfully."); - - var wLongArryData = [-2147483647, 0, 1, 2, 2147483647]; - var writeLongArrayResult = data.writeLongArray(wLongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2100: run writeShortArray success, result is " - + writeLongArrayResult); - expect(writeLongArrayResult == true).assertTrue(); - - var rLongArryData = data.readLongArray(); - console.info("SUB_Softbus_IPC_MessageParcel_2100: run readShortArray is success, result is " - + rLongArryData); - expect(rLongArryData[0] == wLongArryData[0]).assertTrue(); - expect(rLongArryData[1] == wLongArryData[1]).assertTrue(); - expect(rLongArryData[2] == wLongArryData[2]).assertTrue(); - expect(rLongArryData[3] == wLongArryData[3]).assertTrue(); - expect(rLongArryData[4] == wLongArryData[4]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2100: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2100---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2200 - * @tc.name Writelongarray interface, illegal value validation - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2200", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2200---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2200: create object successfully."); - - var errorLongArryData = [-2147483649, 0, 1, 2, 2147483649]; - var errorWriteLongArrayResult = data.writeLongArray(errorLongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2200: run writeShortArray success, result is " - + errorWriteLongArrayResult); - expect(errorWriteLongArrayResult == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2200: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2200---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2300 - * @tc.name Call the writedoublearray interface, write the array to the messageparcel instance, - * and call readdoublearra to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2300", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2300---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2300: create object successfully."); - - var wDoubleArryData = [1.2, 235.67, 99.76]; - var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2300: run writeShortArray success, result is " - + writeDoubleArrayResult); - expect(writeDoubleArrayResult == true).assertTrue(); - - var rDoubleArryData = data.readDoubleArray(); - console.info("SUB_Softbus_IPC_MessageParcel_2300: run readShortArray is success, result is " - + rDoubleArryData); - expect(rDoubleArryData[0] == wDoubleArryData[0]).assertTrue(); - expect(rDoubleArryData[1] == wDoubleArryData[1]).assertTrue(); - expect(rDoubleArryData[2] == wDoubleArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2300: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2300---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2400 - * @tc.name Call the writedoublearray interface, write the array to the messageparcel instance, - * and call readdoublearra (datain: number []) to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2400", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2400---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2400: create object successfully."); - - var wDoubleArryData = [1.2, 235.67, 99.76]; - var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2400: run writeShortArray success, result is " - + writeDoubleArrayResult); - expect(writeDoubleArrayResult == true).assertTrue(); - - var rDoubleArryData = []; - data.readDoubleArray(rDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2400: run readShortArray is success, result is " - + rDoubleArryData); - expect(rDoubleArryData[0] == wDoubleArryData[0]).assertTrue(); - expect(rDoubleArryData[1] == wDoubleArryData[1]).assertTrue(); - expect(rDoubleArryData[2] == wDoubleArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2400: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2400---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2500 - * @tc.name Writedoublearray interface, boundary value verification - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2500", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2500---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2500: create object successfully."); - - var wDoubleArryData = [-1235453.2, 235.67, 9987659.76]; - var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2500: run writeShortArray success, result is " - + writeDoubleArrayResult); - expect(writeDoubleArrayResult == true).assertTrue(); - - var rDoubleArryData = data.readDoubleArray(); - console.info("SUB_Softbus_IPC_MessageParcel_2500: run readShortArray is success, result is " - + rDoubleArryData); - expect(rDoubleArryData[0] == wDoubleArryData[0]).assertTrue(); - expect(rDoubleArryData[1] == wDoubleArryData[1]).assertTrue(); - expect(rDoubleArryData[2] == wDoubleArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2500: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2500---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2600 - * @tc.name Writedoublearray interface, illegal value validation - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2600", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2600---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2600: create object successfully."); - - var errorDoubleArryData = [-12354883737337373873853.2, 235.67, 99999999999999993737373773987659.76]; - var errorWriteDoubleArrayResult = data.writeDoubleArray(errorDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2600: run writeDoubleArray success, result is " - + errorWriteDoubleArrayResult); - expect(errorWriteDoubleArrayResult == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2600: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2600---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2700 - * @tc.name Call the writeboolean array interface, write the array to the messageparcel instance, - * and call readboolean array to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2700", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2700---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2700: create object successfully."); - - var wBooleanArryData = [true, false, false]; - var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2700: run writeShortArray success, result is " - + writeBooleanArrayResult); - expect(writeBooleanArrayResult == true).assertTrue(); - - var rBooleanArryData = data.readBooleanArray(); - console.info("SUB_Softbus_IPC_MessageParcel_2700: run readShortArray is success, result is " - + rBooleanArryData); - expect(rBooleanArryData[0] == wBooleanArryData[0]).assertTrue(); - expect(rBooleanArryData[1] == wBooleanArryData[1]).assertTrue(); - expect(rBooleanArryData[2] == wBooleanArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2700: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2700---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2800 - * @tc.name Call the writeboolean array interface, write the array to the messageparcel instance, - * and call readboolean array (datain: number []) to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2800", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2800---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2800: create object successfully."); - - var wBooleanArryData = [true, false, false]; - var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2800: run writeShortArray success, result is " - + writeBooleanArrayResult); - expect(writeBooleanArrayResult == true).assertTrue(); - - var rBooleanArryData = []; - data.readBooleanArray(rBooleanArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2800: run readShortArray is success, result is " - + rBooleanArryData); - expect(rBooleanArryData[0] == wBooleanArryData[0]).assertTrue(); - expect(rBooleanArryData[1] == wBooleanArryData[1]).assertTrue(); - expect(rBooleanArryData[2] == wBooleanArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2800: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2800---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_2900 - * @tc.name Writeboolean array interface, illegal value validation - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_2900", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2900---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_2900: create object successfully."); - - var errorBooleanArryData = [true, 'abc', false]; - var errorWriteBooleanArrayResult = data.writeBooleanArray(errorBooleanArryData); - console.info("SUB_Softbus_IPC_MessageParcel_2900: run writeShortArray success, result is " - + errorWriteBooleanArrayResult); - expect(errorWriteBooleanArrayResult == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_2900: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2900---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_3000 - * @tc.name Call the writechararray interface, write the array to the messageparcel instance, - * and call readchararray to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_3000", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3000---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_3000: create object successfully."); - - var wCharArryData = [10, 20, 30]; - var writeCharArrayResult = data.writeCharArray(wCharArryData); - console.info("SUB_Softbus_IPC_MessageParcel_3000: run writeShortArray success, result is " - + writeCharArrayResult); - expect(writeCharArrayResult == true).assertTrue(); - - var rCharArryData = data.readCharArray(); - console.info("SUB_Softbus_IPC_MessageParcel_3000: run readShortArray is success, result is " - + rCharArryData); - expect(rCharArryData[0] == wCharArryData[0]).assertTrue(); - expect(rCharArryData[1] == wCharArryData[1]).assertTrue(); - expect(rCharArryData[2] == wCharArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_3000: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3000---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_3100 - * @tc.name Call the writechararray interface, write the array to the messageparcel instance, - * and call readchararray (datain: number []) to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_3100", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3100---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_3100: create object successfully."); - - var wCharArryData = [10, 20, 30]; - var writeCharArrayResult = data.writeCharArray(wCharArryData); - console.info("SUB_Softbus_IPC_MessageParcel_3100: run writeShortArray success, result is " - + writeCharArrayResult); - expect(writeCharArrayResult == true).assertTrue(); - - - var rCharArryData = []; - data.readCharArray(rCharArryData); - console.info("SUB_Softbus_IPC_MessageParcel_3100: run readShortArray is success, result is " - + rCharArryData); - expect(rCharArryData[0] == wCharArryData[0]).assertTrue(); - expect(rCharArryData[1] == wCharArryData[1]).assertTrue(); - expect(rCharArryData[2] == wCharArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_3100: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3100---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_3200 - * @tc.name Writechararray interface, illegal value validation - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_3200", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3200---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_3200: create object successfully."); - - var errorCharArryData = ['e', 'asfgdgdtu', 'a']; - var errorWriteCharArrayResult = data.writeCharArray(errorCharArryData); - console.info("SUB_Softbus_IPC_MessageParcel_3200: run writeShortArray success, result is " - + errorWriteCharArrayResult); - expect(errorWriteCharArrayResult == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_3200: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3200---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_3300 - * @tc.name Call the writestringarray interface, write the array to the messageparcel instance, - * and call readstringarray (datain: number []) to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_3300", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3300---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_3300: create object successfully."); - - var wStringArryData = ['abc', 'hello', 'beauty']; - var writeStringArrayResult = data.writeStringArray(wStringArryData); - console.info("SUB_Softbus_IPC_MessageParcel_3300: run writeShortArray success, result is " - + writeStringArrayResult); - expect(writeStringArrayResult == true).assertTrue(); - - var rStringArryData = data.readStringArray(); - console.info("SUB_Softbus_IPC_MessageParcel_3300: run readShortArray is success, result is " - + rStringArryData); - expect(rStringArryData[0] == wStringArryData[0]).assertTrue(); - expect(rStringArryData[1] == wStringArryData[1]).assertTrue(); - expect(rStringArryData[2] == wStringArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_3300: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3300---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_3400 - * @tc.name Call the writestringarray interface, write the array to the messageparcel instance, - * and call readstringarray() to read the data - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_3400", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3400---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_3400: create object successfully."); - - var wStringArryData = ['abc', 'hello', 'beauty']; - var writeStringArrayResult = data.writeStringArray(wStringArryData); - console.info("SUB_Softbus_IPC_MessageParcel_3400: run writeShortArray success, result is " - + writeStringArrayResult); - expect(writeStringArrayResult == true).assertTrue(); - - - var rStringArryData = []; - reply.readStringArray(rStringArryData); - console.info("SUB_Softbus_IPC_MessageParcel_3400: run readShortArray is success, result is " - + rStringArryData); - expect(rStringArryData[0] == wStringArryData[0]).assertTrue(); - expect(rStringArryData[1] == wStringArryData[1]).assertTrue(); - expect(rStringArryData[2] == wStringArryData[2]).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_3400: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3400---------------------------"); - }); - - /* - * @tc.number SUB_Softbus_IPC_MessageParcel_3500 - * @tc.name Writestringarray interface, illegal value validation - * @tc.desc Function test - * @tc.level 0 - */ - it("SUB_Softbus_IPC_MessageParcel_3500", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3500---------------------------"); - try{ - var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_3500: create object successfully."); - - var errorStringArryData = ['abc' , '123' , 'beauty']; - var errorWriteStringArrayResult = data.writeStringArray(errorStringArryData); - console.info("SUB_Softbus_IPC_MessageParcel_3500: run writeStringArray success, result is " - + errorWriteStringArrayResult); - expect(errorWriteStringArrayResult == true).assertTrue(); - - data.reclaim(); - } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_3500: error " + error); - } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3500---------------------------"); - }); - - console.info("-----------------------ActsRpcJsTest is end-----------------------"); -}); diff --git a/communication/dsoftbus/rpc/src/main/js/default/test/List.test.js b/communication/dsoftbus/rpc/src/main/js/test/List.test.js old mode 100644 new mode 100755 similarity index 82% rename from communication/dsoftbus/rpc/src/main/js/default/test/List.test.js rename to communication/dsoftbus/rpc/src/main/js/test/List.test.js index 7ec4d4deef4bda441368f0ca0066176f13143363..a084f86c5603d6047ab8032920d8c2268a5e017a --- a/communication/dsoftbus/rpc/src/main/js/default/test/List.test.js +++ b/communication/dsoftbus/rpc/src/main/js/test/List.test.js @@ -13,5 +13,8 @@ * limitations under the License. */ -require('./RpcJsunit.test.js') -require('./RpcClientJsunit.test.js') \ No newline at end of file +import actsRpcClientJsTest from './RpcClientJsunit.test.js' + +export default function testsuite() { + actsRpcClientJsTest() +} diff --git a/communication/dsoftbus/rpc/src/main/js/default/test/RpcClientJsunit.test.js b/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js similarity index 75% rename from communication/dsoftbus/rpc/src/main/js/default/test/RpcClientJsunit.test.js rename to communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js index 9aaba1c81eed847811931c73314b696c8cced6a1..85ecbab3637f74a18d72febb154308fefccbbf92 100755 --- a/communication/dsoftbus/rpc/src/main/js/default/test/RpcClientJsunit.test.js +++ b/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js @@ -16,13 +16,27 @@ import rpc from '@ohos.rpc' import fileio from '@ohos.fileio'; import FA from '@ohos.ability.featureAbility' -import {describe, expect, beforeAll, it} from 'deccjsunit/index' +import {describe, beforeAll, beforeEach, afterEach, afterAll, expect, it} from '@ohos/hypium' +export default function actsRpcClientJsTest() { var gIRemoteObject = undefined; -describe('ActsRpcClientJsTest', function(){ +describe('actsRpcClientJsTest', function(){ console.info("-----------------------SUB_Softbus_IPC_MessageParce_Test is starting-----------------------"); + beforeEach(async function (){ + console.info('beforeEach called'); + }); + + afterEach(async function (){ + console.info('afterEach called'); + }); + + afterAll(async function (){ + console.info('afterAll called'); + }); + + const CODE_WRITE_BYTEARRAY = 1; const CODE_WRITE_INTARRAY = 2; const CODE_WRITE_FLOATARRAY = 3; @@ -258,6 +272,1183 @@ describe('ActsRpcClientJsTest', function(){ console.info("beforeAll done") }) + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_0100 + * @tc.name Call the writeinterfacetoken interface, write the interface descriptor, and read interfacetoken + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_0100", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0100---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_0100: create object successfully."); + + var token = "hello ruan zong xian"; + var result = data.writeInterfaceToken(token); + console.info("SUB_Softbus_IPC_MessageParcel_0100:run writeInterfaceToken success, result is " + result); + expect(result == true).assertTrue(); + + var resultToken = data.readInterfaceToken(); + console.info("SUB_Softbus_IPC_MessageParcel_0100:run readInterfaceToken success, result is " + resultToken); + expect(resultToken == token); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_0100:error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0100---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_0200 + * @tc.name Call the writeinterfacetoken interface to write a non string interface descriptor + and read interfacetoken + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_0200", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0200---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_0200: create object successfully."); + + var token = 123; + var result = data.writeInterfaceToken(token); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_0200: error = " + error); + expect(error != null).assertTrue(); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0200---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_0300 + * @tc.name The data size of the messageparcel obtained by calling the getSize interface + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_0300", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0300---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_0300: create object successfully."); + + var size = data.getSize(); + console.info("SUB_Softbus_IPC_MessageParcel_0300:run getSize is success, result is " + size); + expect(size == 0).assertTrue(); + + var addData = 1; + var result = data.writeInt(addData); + console.info("SUB_Softbus_IPC_MessageParcel_0300:run writeInt is success, result is " + result); + expect(result == true).assertTrue(); + + size = data.getSize(); + console.info("SUB_Softbus_IPC_MessageParcel_0300:run getSize is success, result is " + size); + expect(size == 4).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_0300: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0300---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_0400 + * @tc.name The capacity of the messageparcel obtained by calling the getcapacity interface + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_0400", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0400---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_0400: create object successfully."); + + var size = data.getCapacity(); + console.info("SUB_Softbus_IPC_MessageParcel_0400:run getCapacity is success, result is " + size); + expect(size == 0).assertTrue(); + + var addData = 1; + var result = data.writeInt(addData); + console.info("SUB_Softbus_IPC_MessageParcel_0400:run writeInt is success, result is " + result); + expect(result == true).assertTrue(); + + size = data.getCapacity(); + console.info("SUB_Softbus_IPC_MessageParcel_0400:run getCapacity is success, result is " + size); + expect(size == 64).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_0400: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0400---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_0500 + * @tc.name Call the SetSize interface to set the data size of messageparcel + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_0500", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0500---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_0500: create object successfully."); + + var addData = 1; + var result = data.writeInt(addData); + console.info("SUB_Softbus_IPC_MessageParcel_0500:run writeInt is success, result is " + result); + expect(result == true).assertTrue(); + + var size = 6; + var setResult = data.setSize(size); + console.info("SUB_Softbus_IPC_MessageParcel_0500:run setSize success, result is " + setResult); + expect(setResult == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_0500: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0500---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_0600 + * @tc.name Call the SetSize interface to set the data size of messageparcel. The write data size + * does not match the set value + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_0600", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0600---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_0600: create object successfully."); + + var capacity = 64; + var setResult = data.setCapacity(capacity); + console.info("SUB_Softbus_IPC_MessageParcel_0600:run setCapacity success, result is " + setResult); + expect(setResult == true).assertTrue(); + + var size = 4; + setResult = data.setSize(size); + console.info("SUB_Softbus_IPC_MessageParcel_0600:run setSize success, result is " + setResult); + expect(setResult == true).assertTrue(); + + var addData = 2; + var result = data.writeLong(addData); + console.info("SUB_Softbus_IPC_MessageParcel_0600:run writeInt is success, result is " + result); + expect(result == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_0600: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0600---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_0700 + * @tc.name Call the setcapacity interface to set the capacity of messageparcel + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_0700", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0700---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_0700: create object successfully."); + + var size = 64; + var setResult = data.setCapacity(size); + console.info("SUB_Softbus_IPC_MessageParcel_0700:run setSize success, result is " + setResult); + expect(setResult == true).assertTrue(); + + var addData = 1; + var result = data.writeInt(addData); + console.info("SUB_Softbus_IPC_MessageParcel_0700:run writeInt is success, result is " + result); + expect(result == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_0700: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0700---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_0800 + * @tc.name Call the setcapacity interface to set the capacity of messageparcel. + * The write data capacity is inconsistent with the set value + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_0800", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0800---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_0800: create object successfully."); + + var size = 4; + var setResult = data.setCapacity(size); + console.info("SUB_Softbus_IPC_MessageParcel_0800:run setSize success, result is " + setResult); + expect(setResult == true).assertTrue(); + + var addData = [1, 2, 3, 4, 5, 6, 7, 8]; + var result = data.writeIntArray(addData); + console.info("SUB_Softbus_IPC_MessageParcel_0800:run writeInt is success, result is " + result); + expect(result == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_0800: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0800---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_0900 + * @tc.name Empty object to obtain the readable byte space, read location, + * writable byte space and write location information of messageparcel + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_0900", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_0900---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_0900: create object successfully."); + + var result1 = data.getWritableBytes(); + console.info("SUB_Softbus_IPC_MessageParcel_0900: run getWritableBytes is success, result is " + result1); + expect(result1 == 0).assertTrue(); + + var result2 = data.getReadableBytes(); + console.info("SUB_Softbus_IPC_MessageParcel_0900: run getReadableBytes is success, result is " + result2); + expect(result2 == 0).assertTrue(); + + var result3 = data.getReadPosition(); + console.info("SUB_Softbus_IPC_MessageParcel_0900: run getReadPosition is success, result is " + result2); + expect(result3 == 0).assertTrue(); + + var result4 = data.getWritePosition(); + console.info("SUB_Softbus_IPC_MessageParcel_0900: run getWritePosition is success, result is " + result2); + expect(result4 == 0).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_0900: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_0900---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1000 + * @tc.name Create an object and write data to obtain the readable byte space, read location, + * writable byte space and write location information of messageparcel + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1000", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1000---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_1000: create object successfully."); + + var dataInt = 1; + var resultInt = data.writeInt(dataInt); + console.info("SUB_Softbus_IPC_MessageParcel_1000: run writeInt success, result is " + resultInt); + + var dataLong = 2; + var resultLong = data.writeLong(dataLong); + console.info("SUB_Softbus_IPC_MessageParcel_1000: run writeLong success, result is " + resultLong); + + var result1 = data.getWritableBytes(); + console.info("SUB_Softbus_IPC_MessageParcel_1000: run getWritableBytes is success, result is " + result1); + expect(result1 == 52).assertTrue(); + + var result2 = data.getReadableBytes(); + console.info("SUB_Softbus_IPC_MessageParcel_1000: run getReadableBytes is success, result is " + result2); + expect(result2 == 12).assertTrue(); + + var result3 = data.getReadPosition(); + console.info("SUB_Softbus_IPC_MessageParcel_1000: run getReadPosition is success, result is " + result3); + expect(result3 == 0).assertTrue(); + + var result4 = data.getWritePosition(); + console.info("SUB_Softbus_IPC_MessageParcel_1000: run getWritePosition is success, result is " + result4); + expect(result4 == 12).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1000: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1000---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1100 + * @tc.name Call rewindread interface to offset the read position to the specified position + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1100", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1100---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + expect(data.getWritableBytes() == 0).assertTrue(); + expect(data.getReadableBytes() == 0).assertTrue(); + expect(data.getReadPosition() == 0).assertTrue(); + expect(data.getWritePosition() == 0).assertTrue(); + + var dataInt = 1; + var resultInt = data.writeInt(dataInt); + console.info("SUB_Softbus_IPC_MessageParcel_1100: run writeInt success, result is " + resultInt); + var dataLong = 2; + var resultLong = data.writeLong(dataLong); + console.info("SUB_Softbus_IPC_MessageParcel_1100: run writeLong success, result is " + resultLong); + + expect(data.getWritableBytes() == 52).assertTrue(); + expect(data.getReadableBytes() == 12).assertTrue(); + expect(data.getReadPosition() == 0).assertTrue(); + expect(data.getWritePosition() == 12).assertTrue(); + + var readIntData = data.readInt(); + console.info("SUB_Softbus_IPC_MessageParcel_1100: run readInt is success, result is " + readIntData); + expect(readIntData == dataInt).assertTrue(); + + var writePosition = 0; + var writeResult = data.rewindWrite(writePosition); + console.info("SUB_Softbus_IPC_MessageParcel_1100: run rewindWrite is success, result is " + writeResult); + expect(writeResult == true).assertTrue(); + + expect(data.getWritePosition() == 0).assertTrue(); + dataInt = 3; + resultInt = data.writeInt(dataInt); + console.info("SUB_Softbus_IPC_MessageParcel_1100: run writeInt success, result is " + resultInt); + + var readPosition = 0; + var readResult = data.rewindRead(readPosition); + console.info("SUB_Softbus_IPC_MessageParcel_1100: run rewindWrite is success, result is " + readResult); + expect(readResult == true).assertTrue(); + + readIntData = data.readInt(); + console.info("SUB_Softbus_IPC_MessageParcel_1100: run readInt is success, result is " + readIntData); + expect(readIntData == dataInt).assertTrue(); + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1100: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1100---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1200 + * @tc.name The rewindread interface is called to re offset the read position to the specified position. + * The specified position is out of range + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1200", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1200---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_1200: create object successfully."); + + var result1 = data.getWritableBytes(); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run getWritableBytes success, result is " + result1); + expect(result1 == 0).assertTrue(); + var result2 = data.getReadableBytes(); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run getReadableBytes success, result is " + result2); + expect(result2 == 0).assertTrue(); + var result3 = data.getReadPosition(); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run getReadPosition success, result is " + result3); + expect(result3 == 0).assertTrue(); + var result4 = data.getWritePosition(); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run getWritePosition success, result is " + result4); + expect(result4 == 0).assertTrue(); + + var dataInt = 1; + var resultInt = data.writeInt(dataInt); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run writeInt success, result is " + resultInt); + expect(resultInt == true).assertTrue(); + var dataLong = 2; + var resultLong = data.writeLong(dataLong); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run writeLong success, result is " + resultLong); + expect(resultLong == true).assertTrue(); + + result1 = data.getWritableBytes(); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run getWritableBytes is success, result is " + result1); + expect(result1 == 52).assertTrue(); + result2 = data.getReadableBytes(); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run getReadableBytes is success, result is " + result2); + expect(result2 == 12).assertTrue(); + result3 = data.getReadPosition(); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run getReadPosition is success, result is " + result3); + expect(result3 == 0).assertTrue(); + result4 = data.getWritePosition(); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run getWritePosition is success, result is " + result4); + expect(result4 == 12).assertTrue(); + + var readPosition = 100; + var readResult = data.rewindRead(readPosition); + console.info("SUB_Softbus_IPC_MessageParcel_1200: run rewindRead is success, result is " + readResult); + expect(readResult == false).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1200: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1200---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1300 + * @tc.name Call rewindwrite and the interface offsets the write position to the specified position + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1300", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1300---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_1300: create object successfully."); + + var dataInt = 1; + var resultInt = data.writeInt(dataInt); + console.info("SUB_Softbus_IPC_MessageParcel_1300: run writeInt success, result is " + resultInt); + expect(resultInt == true).assertTrue(); + + var readIntData = data.readInt(); + console.info("SUB_Softbus_IPC_MessageParcel_1300: run readInt success, result is " + readIntData); + expect(readIntData == dataInt).assertTrue(); + + var writePosition = 0; + var rewindWriteResult = data.rewindWrite(writePosition); + console.info("SUB_Softbus_IPC_MessageParcel_1300: run rewindWrite success, result is " + rewindWriteResult); + expect(rewindWriteResult == true).assertTrue(); + + dataInt = 3; + resultInt = data.writeInt(dataInt); + console.info("SUB_Softbus_IPC_MessageParcel_1300: run writeInt success, result is " + resultInt); + expect(resultInt == true).assertTrue(); + + var readPosition = 0; + var rewindReadResult = data.rewindRead(readPosition); + console.info("SUB_Softbus_IPC_MessageParcel_1300: run rewindRead success, result is " + rewindReadResult); + expect(rewindReadResult == true); + + readIntData = data.readInt(); + console.info("SUB_Softbus_IPC_MessageParcel_1300: run readInt success, result is " + readIntData); + expect(readIntData == dataInt).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1300: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1300---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1400 + * @tc.name Call rewindwrite and the interface offsets the write position to the specified position. + * The specified position is out of range + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1400", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1400---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_1400: create object successfully."); + + var dataInt = 1; + var resultInt = data.writeInt(dataInt); + console.info("SUB_Softbus_IPC_MessageParcel_1400: run writeInt success, result is " + resultInt); + expect(resultInt == true).assertTrue(); + + var readIntData = data.readInt(); + console.info("SUB_Softbus_IPC_MessageParcel_1400: run readInt success, result is " + readIntData); + expect(readIntData == dataInt).assertTrue(); + + var writePosition = 99; + var rewindWriteResult = data.rewindWrite(writePosition); + console.info("SUB_Softbus_IPC_MessageParcel_1400: run rewindWrite failed, result is " + rewindWriteResult); + expect(rewindWriteResult == false).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1400: error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1400---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1500 + * @tc.name Call the writeshortarray interface, write the array to the messageparcel instance, + * and call readshortarray to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1500", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1500---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_1500: create object successfully."); + + var wShortArryData = [3, 5, 9]; + var writeShortArrayResult = data.writeShortArray(wShortArryData); + console.info("SUB_Softbus_IPC_MessageParcel_1500: run writeShortArray success, result is " + + writeShortArrayResult); + expect(writeShortArrayResult == true).assertTrue(); + + var rShortArryData = data.readShortArray(); + console.info("SUB_Softbus_IPC_MessageParcel_1500: run readShortArray is success, result is " + + rShortArryData); + expect(wShortArryData[0] == rShortArryData[0]).assertTrue(); + expect(wShortArryData[1] == rShortArryData[1]).assertTrue(); + expect(wShortArryData[2] == rShortArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1500: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1500---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1600 + * @tc.name Call the writeshortarray interface, write the short integer array to the messageparcel instance, + * and call readshortarray (datain: number []) to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1600", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1600---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_1600: create object successfully."); + + var wShortArryData = [3, 5, 9]; + var writeShortArrayResult = data.writeShortArray(wShortArryData); + console.info("SUB_Softbus_IPC_MessageParcel_1600: run writeShortArray success, result is " + + writeShortArrayResult); + expect(writeShortArrayResult == true).assertTrue(); + + var rShortArryData = []; + data.readShortArray(rShortArryData); + console.info("SUB_Softbus_IPC_MessageParcel_1600: run readShortArray is success, result is " + + rShortArryData); + expect(wShortArryData[0] == rShortArryData[0]).assertTrue(); + expect(wShortArryData[1] == rShortArryData[1]).assertTrue(); + expect(wShortArryData[2] == rShortArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1600: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1600---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1700 + * @tc.name Writeshortarray interface, boundary value verification + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1700", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1700---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_1700: create object successfully."); + + var wShortArryData = [-32768, 0, 1, 2, 32767]; + var writeShortArrayResult = data.writeShortArray(wShortArryData); + console.info("SUB_Softbus_IPC_MessageParcel_1700: run writeShortArray success, result is " + + writeShortArrayResult); + expect(writeShortArrayResult == true).assertTrue(); + + var rShortArryData = []; + data.readShortArray(rShortArryData); + console.info("SUB_Softbus_IPC_MessageParcel_1700: run readShortArray is success, result is " + + rShortArryData); + expect(wShortArryData[0] == rShortArryData[0]).assertTrue(); + expect(wShortArryData[1] == rShortArryData[1]).assertTrue(); + expect(wShortArryData[2] == rShortArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1700: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1700---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1800 + * @tc.name Writeshortarray interface, illegal value validation + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1800", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1800---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_1800: create object successfully."); + + var wShortArryData = [-32768, 0, 1, 2, 32767]; + var writeShortArrayResult = data.writeShortArray(wShortArryData); + console.info("SUB_Softbus_IPC_MessageParcel_1800: run writeShortArray success, result is " + + writeShortArrayResult); + expect(writeShortArrayResult == true).assertTrue(); + + var errorShortArryData = [-32769, 32768]; + var errorWriteShortArrayResult = data.writeShortArray(errorShortArryData); + console.info("SUB_Softbus_IPC_MessageParcel_1800: run writeShortArray success, result is " + + errorWriteShortArrayResult); + expect(errorWriteShortArrayResult == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1800: error = " + error); + } + + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1800---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_1900 + * @tc.name Call the writelongarray interface, write the long integer array to the messageparcel instance, + * and call readlongarray to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_1900", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_1900---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_1900: create object successfully."); + + var wLongArryData = [3276826, 1234567, 99999999]; + var writeLongArrayResult = data.writeLongArray(wLongArryData); + console.info("SUB_Softbus_IPC_MessageParcel_1900: run writeShortArray success, result is " + + writeLongArrayResult); + expect(writeLongArrayResult == true).assertTrue(); + + var rLongArryData = data.readLongArray(); + console.info("SUB_Softbus_IPC_MessageParcel_1900: run readShortArray is success, result is " + + rLongArryData); + expect(rLongArryData[0] == wLongArryData[0]).assertTrue(); + expect(rLongArryData[1] == wLongArryData[1]).assertTrue(); + expect(rLongArryData[2] == wLongArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_1900: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_1900---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2000 + * @tc.name Call the writelongarray interface, write the long integer array to the messageparcel instance, + * and call readlongarray (datain: number []) to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2000", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2000---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2000: create object successfully."); + + var wLongArryData = [3276826, 1234567, 99999999]; + var writeLongArrayResult = data.writeLongArray(wLongArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2000: run writeShortArray success, result is " + + writeLongArrayResult); + expect(writeLongArrayResult == true).assertTrue(); + + var rLongArryData = []; + data.readLongArray(rLongArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2000: run readShortArray is success, result is " + + rLongArryData); + expect(rLongArryData[0] == wLongArryData[0]).assertTrue(); + expect(rLongArryData[1] == wLongArryData[1]).assertTrue(); + expect(rLongArryData[2] == wLongArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2000: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2000---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2100 + * @tc.name Writelongarray interface, boundary value verification + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2100", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2100---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2100: create object successfully."); + + var wLongArryData = [-2147483647, 0, 1, 2, 2147483647]; + var writeLongArrayResult = data.writeLongArray(wLongArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2100: run writeShortArray success, result is " + + writeLongArrayResult); + expect(writeLongArrayResult == true).assertTrue(); + + var rLongArryData = data.readLongArray(); + console.info("SUB_Softbus_IPC_MessageParcel_2100: run readShortArray is success, result is " + + rLongArryData); + expect(rLongArryData[0] == wLongArryData[0]).assertTrue(); + expect(rLongArryData[1] == wLongArryData[1]).assertTrue(); + expect(rLongArryData[2] == wLongArryData[2]).assertTrue(); + expect(rLongArryData[3] == wLongArryData[3]).assertTrue(); + expect(rLongArryData[4] == wLongArryData[4]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2100: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2100---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2200 + * @tc.name Writelongarray interface, illegal value validation + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2200", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2200---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2200: create object successfully."); + + var errorLongArryData = [-2147483649, 0, 1, 2, 2147483649]; + var errorWriteLongArrayResult = data.writeLongArray(errorLongArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2200: run writeShortArray success, result is " + + errorWriteLongArrayResult); + expect(errorWriteLongArrayResult == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2200: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2200---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2300 + * @tc.name Call the writedoublearray interface, write the array to the messageparcel instance, + * and call readdoublearra to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2300", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2300---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2300: create object successfully."); + + var wDoubleArryData = [1.2, 235.67, 99.76]; + var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2300: run writeShortArray success, result is " + + writeDoubleArrayResult); + expect(writeDoubleArrayResult == true).assertTrue(); + + var rDoubleArryData = data.readDoubleArray(); + console.info("SUB_Softbus_IPC_MessageParcel_2300: run readShortArray is success, result is " + + rDoubleArryData); + expect(rDoubleArryData[0] == wDoubleArryData[0]).assertTrue(); + expect(rDoubleArryData[1] == wDoubleArryData[1]).assertTrue(); + expect(rDoubleArryData[2] == wDoubleArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2300: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2300---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2400 + * @tc.name Call the writedoublearray interface, write the array to the messageparcel instance, + * and call readdoublearra (datain: number []) to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2400", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2400---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2400: create object successfully."); + + var wDoubleArryData = [1.2, 235.67, 99.76]; + var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2400: run writeShortArray success, result is " + + writeDoubleArrayResult); + expect(writeDoubleArrayResult == true).assertTrue(); + + var rDoubleArryData = []; + data.readDoubleArray(rDoubleArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2400: run readShortArray is success, result is " + + rDoubleArryData); + expect(rDoubleArryData[0] == wDoubleArryData[0]).assertTrue(); + expect(rDoubleArryData[1] == wDoubleArryData[1]).assertTrue(); + expect(rDoubleArryData[2] == wDoubleArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2400: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2400---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2500 + * @tc.name Writedoublearray interface, boundary value verification + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2500", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2500---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2500: create object successfully."); + + var wDoubleArryData = [-1235453.2, 235.67, 9987659.76]; + var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2500: run writeShortArray success, result is " + + writeDoubleArrayResult); + expect(writeDoubleArrayResult == true).assertTrue(); + + var rDoubleArryData = data.readDoubleArray(); + console.info("SUB_Softbus_IPC_MessageParcel_2500: run readShortArray is success, result is " + + rDoubleArryData); + expect(rDoubleArryData[0] == wDoubleArryData[0]).assertTrue(); + expect(rDoubleArryData[1] == wDoubleArryData[1]).assertTrue(); + expect(rDoubleArryData[2] == wDoubleArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2500: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2500---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2600 + * @tc.name Writedoublearray interface, illegal value validation + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2600", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2600---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2600: create object successfully."); + + var errorDoubleArryData = [-12354883737337373873853.2, 235.67, 99999999999999993737373773987659.76]; + var errorWriteDoubleArrayResult = data.writeDoubleArray(errorDoubleArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2600: run writeDoubleArray success, result is " + + errorWriteDoubleArrayResult); + expect(errorWriteDoubleArrayResult == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2600: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2600---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2700 + * @tc.name Call the writeboolean array interface, write the array to the messageparcel instance, + * and call readboolean array to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2700", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2700---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2700: create object successfully."); + + var wBooleanArryData = [true, false, false]; + var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2700: run writeShortArray success, result is " + + writeBooleanArrayResult); + expect(writeBooleanArrayResult == true).assertTrue(); + + var rBooleanArryData = data.readBooleanArray(); + console.info("SUB_Softbus_IPC_MessageParcel_2700: run readShortArray is success, result is " + + rBooleanArryData); + expect(rBooleanArryData[0] == wBooleanArryData[0]).assertTrue(); + expect(rBooleanArryData[1] == wBooleanArryData[1]).assertTrue(); + expect(rBooleanArryData[2] == wBooleanArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2700: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2700---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2800 + * @tc.name Call the writeboolean array interface, write the array to the messageparcel instance, + * and call readboolean array (datain: number []) to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2800", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2800---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2800: create object successfully."); + + var wBooleanArryData = [true, false, false]; + var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2800: run writeShortArray success, result is " + + writeBooleanArrayResult); + expect(writeBooleanArrayResult == true).assertTrue(); + + var rBooleanArryData = []; + data.readBooleanArray(rBooleanArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2800: run readShortArray is success, result is " + + rBooleanArryData); + expect(rBooleanArryData[0] == wBooleanArryData[0]).assertTrue(); + expect(rBooleanArryData[1] == wBooleanArryData[1]).assertTrue(); + expect(rBooleanArryData[2] == wBooleanArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2800: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2800---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_2900 + * @tc.name Writeboolean array interface, illegal value validation + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_2900", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_2900---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_2900: create object successfully."); + + var errorBooleanArryData = [true, 'abc', false]; + var errorWriteBooleanArrayResult = data.writeBooleanArray(errorBooleanArryData); + console.info("SUB_Softbus_IPC_MessageParcel_2900: run writeShortArray success, result is " + + errorWriteBooleanArrayResult); + expect(errorWriteBooleanArrayResult == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_2900: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_2900---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_3000 + * @tc.name Call the writechararray interface, write the array to the messageparcel instance, + * and call readchararray to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_3000", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3000---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_3000: create object successfully."); + + var wCharArryData = [10, 20, 30]; + var writeCharArrayResult = data.writeCharArray(wCharArryData); + console.info("SUB_Softbus_IPC_MessageParcel_3000: run writeShortArray success, result is " + + writeCharArrayResult); + expect(writeCharArrayResult == true).assertTrue(); + + var rCharArryData = data.readCharArray(); + console.info("SUB_Softbus_IPC_MessageParcel_3000: run readShortArray is success, result is " + + rCharArryData); + expect(rCharArryData[0] == wCharArryData[0]).assertTrue(); + expect(rCharArryData[1] == wCharArryData[1]).assertTrue(); + expect(rCharArryData[2] == wCharArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_3000: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3000---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_3100 + * @tc.name Call the writechararray interface, write the array to the messageparcel instance, + * and call readchararray (datain: number []) to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_3100", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3100---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_3100: create object successfully."); + + var wCharArryData = [10, 20, 30]; + var writeCharArrayResult = data.writeCharArray(wCharArryData); + console.info("SUB_Softbus_IPC_MessageParcel_3100: run writeShortArray success, result is " + + writeCharArrayResult); + expect(writeCharArrayResult == true).assertTrue(); + + + var rCharArryData = []; + data.readCharArray(rCharArryData); + console.info("SUB_Softbus_IPC_MessageParcel_3100: run readShortArray is success, result is " + + rCharArryData); + expect(rCharArryData[0] == wCharArryData[0]).assertTrue(); + expect(rCharArryData[1] == wCharArryData[1]).assertTrue(); + expect(rCharArryData[2] == wCharArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_3100: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3100---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_3200 + * @tc.name Writechararray interface, illegal value validation + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_3200", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3200---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_3200: create object successfully."); + + var errorCharArryData = ['e', 'asfgdgdtu', 'a']; + var errorWriteCharArrayResult = data.writeCharArray(errorCharArryData); + console.info("SUB_Softbus_IPC_MessageParcel_3200: run writeShortArray success, result is " + + errorWriteCharArrayResult); + expect(errorWriteCharArrayResult == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_3200: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3200---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_3300 + * @tc.name Call the writestringarray interface, write the array to the messageparcel instance, + * and call readstringarray (datain: number []) to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_3300", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3300---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_3300: create object successfully."); + + var wStringArryData = ['abc', 'hello', 'beauty']; + var writeStringArrayResult = data.writeStringArray(wStringArryData); + console.info("SUB_Softbus_IPC_MessageParcel_3300: run writeShortArray success, result is " + + writeStringArrayResult); + expect(writeStringArrayResult == true).assertTrue(); + + var rStringArryData = data.readStringArray(); + console.info("SUB_Softbus_IPC_MessageParcel_3300: run readShortArray is success, result is " + + rStringArryData); + expect(rStringArryData[0] == wStringArryData[0]).assertTrue(); + expect(rStringArryData[1] == wStringArryData[1]).assertTrue(); + expect(rStringArryData[2] == wStringArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_3300: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3300---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_3400 + * @tc.name Call the writestringarray interface, write the array to the messageparcel instance, + * and call readstringarray() to read the data + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_3400", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3400---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_3400: create object successfully."); + + var wStringArryData = ['abc', 'hello', 'beauty']; + var writeStringArrayResult = data.writeStringArray(wStringArryData); + console.info("SUB_Softbus_IPC_MessageParcel_3400: run writeShortArray success, result is " + + writeStringArrayResult); + expect(writeStringArrayResult == true).assertTrue(); + + + var rStringArryData = []; + reply.readStringArray(rStringArryData); + console.info("SUB_Softbus_IPC_MessageParcel_3400: run readShortArray is success, result is " + + rStringArryData); + expect(rStringArryData[0] == wStringArryData[0]).assertTrue(); + expect(rStringArryData[1] == wStringArryData[1]).assertTrue(); + expect(rStringArryData[2] == wStringArryData[2]).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_3400: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3400---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_MessageParcel_3500 + * @tc.name Writestringarray interface, illegal value validation + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_MessageParcel_3500", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_MessageParcel_3500---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_MessageParcel_3500: create object successfully."); + + var errorStringArryData = ['abc' , '123' , 'beauty']; + var errorWriteStringArrayResult = data.writeStringArray(errorStringArryData); + console.info("SUB_Softbus_IPC_MessageParcel_3500: run writeStringArray success, result is " + + errorWriteStringArrayResult); + expect(errorWriteStringArrayResult == true).assertTrue(); + + data.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_MessageParcel_3500: error " + error); + } + console.info("---------------------end SUB_Softbus_IPC_MessageParcel_3500---------------------------"); + }); + + /* * @tc.number SUB_Softbus_IPC_MessageParcel_3600 * @tc.name Call the writebytearray interface, write the array to the messageparcel instance, @@ -3018,14 +4209,11 @@ describe('ActsRpcClientJsTest', function(){ console.info("SUB_Softbus_IPC_Ashmem_0900: run mapAshmem success, result is " + result); expect(result == true).assertTrue(); - ashmem.unmapAshmem(); + ashmem.closeAshmem() console.info("SUB_Softbus_IPC_Ashmem_0900: run unmapAshmem success"); expect(ashmem.mapReadAndWriteAshmem()).assertFalse(); - let result2 = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_0900: run mapReadAndWriteAshmem success, result2 is " + result2); - expect(result2 == false).assertTrue(); - ashmem.closeAshmem() + }catch(error){ console.info("SUB_Softbus_IPC_Ashmem_0900: error " + error); } @@ -3994,3 +5182,4 @@ describe('ActsRpcClientJsTest', function(){ console.info("-----------------------SUB_Softbus_IPC_MessageParce_Test is end-----------------------"); }); +} diff --git a/communication/dsoftbus/rpc/src/main/resources/base/element/string.json b/communication/dsoftbus/rpc/src/main/resources/base/element/string.json old mode 100644 new mode 100755 index 22f6ffc197af765dfe2fe7e648e98db3104c5a14..95c259acf18391a8b6bff3c3041a7c4860f6991a --- a/communication/dsoftbus/rpc/src/main/resources/base/element/string.json +++ b/communication/dsoftbus/rpc/src/main/resources/base/element/string.json @@ -7,6 +7,22 @@ { "name": "mainability_description", "value": "JS_Phone_Empty Rpc" - } + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } ] } \ No newline at end of file diff --git a/communication/dsoftbus/rpc/src/main/resources/base/media/icon.png b/communication/dsoftbus/rpc/src/main/resources/base/media/icon.png old mode 100644 new mode 100755 diff --git a/communication/wifi_p2p/src/main/js/test/WifiP2P.test.js b/communication/wifi_p2p/src/main/js/test/WifiP2P.test.js index c117508603bbc26445ee592654b65b4a92f0ca00..650f9489b0b42333ceb13461fe686b8a60f81074 100644 --- a/communication/wifi_p2p/src/main/js/test/WifiP2P.test.js +++ b/communication/wifi_p2p/src/main/js/test/WifiP2P.test.js @@ -185,7 +185,7 @@ describe('ACTS_WifiTest', function () { netId : -2, passphrase : "12345678", groupName : "AAAZZZ", - goBand : 0 + goBand : 2 }; console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); @@ -506,5 +506,3 @@ describe('ACTS_WifiTest', function () { console.log("*************[wifi_test] start wifi js unit test end*************"); }) - - diff --git a/communication/wifi_standard/src/main/js/test/WifiSta.test.js b/communication/wifi_standard/src/main/js/test/WifiSta.test.js index b065961a047f1c41214c069256de1da8c5c0c5e2..f5c886f055def0e493c4aa8e827ec7455f263a1d 100644 --- a/communication/wifi_standard/src/main/js/test/WifiSta.test.js +++ b/communication/wifi_standard/src/main/js/test/WifiSta.test.js @@ -13,12 +13,23 @@ * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import wifi from '@ohos.wifi' function sleep(delay) { - return new Promise(resovle => setTimeout(resovle, delay)) + var start = (new Date()).getTime(); + while ((new Date()).getTime() - start > delay) { + break; + } +} + +function checkWifiPowerOn(){ + console.info("Wifi_test/wifi status:" + wifi.isWifiActive()); +} + +function resolve(ip) { + return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF ) + (ip>>8 & 0xFF ) + (ip & 0xFF ); } @@ -30,26 +41,6 @@ let WifiSecurityType = { WIFI_SEC_TYPE_SAE: 4, } -function checkWifiPowerOn(){ - let enable = wifi.enableWifi(); - console.info("enableWifi result0000123:" + enable); - wifi.on('wifiStateChange', state => { - console.info("wifiStateLisener state:" +state) - if (state === 1) { // 1: wifi is enable, 0:wifi is disable - wifi.scan() - wifi.getLinkedInfo() - } - }) - console.info("wifi_test/wifi status:" + wifi.isWifiActive()); - expect(wifi.isWifiActive()).assertTrue(); -} -let WifiDeviceConfig = { - "ssid": "TEST", - "bssid": "", - "preSharedKey": "", - "isHiddenSsid": false, - "securityType":WifiSecurityType.WIFI_SEC_TYPE_OPEN , -} let ConnState = { SCANNING: 0, CONNECTING: 1, @@ -61,7 +52,23 @@ let ConnState = { UNKNOWN: 7, } -export default function ACTS_WifiTest() { +let untrustedDeviceConfig = { + "ssid": "untrusted_ssid", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType":WifiSecurityType.WIFI_SEC_TYPE_PSK +} + +let WifiChannelWidth = { + WIDTH_20MHZ : 0, + WIDTH_40MHZ : 1, + WIDTH_80MHZ : 2, + WIDTH_160MHZ : 3, + WIDTH_280MHZ_PLUS : 4, + WIDTH_INVALID +} + describe('ACTS_WifiTest', function() { beforeEach(function() { @@ -74,11 +81,11 @@ describe('ACTS_WifiTest', function() { /** * @tc.number open_0001 * @tc.name SUB_Communication_WiFi_Sta_Open_0001 - * @tc.desc Test wifi.isWifiEnable API functionality. + * @since 6 + * @tc.desc Test wifi.isWifiActive API functionality. */ - it('SUB_Communication_WiFi_Sta_Open_0001', 0, function() { - console.info("[wifi_test] check the state of wifi, if it's close, open it."); - let active = wifi.isWifiActive(); + it('SUB_Communication_WiFi_Sta_WifiActive_0001', 0, function() { + sleep(3000); console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); expect(wifi.isWifiActive()).assertTrue(); }) @@ -90,7 +97,7 @@ describe('ACTS_WifiTest', function() { */ it('SUB_Communication_WiFi_Sta_Scan_0001', 0, async function(done) { let scan = wifi.scan(); - await sleep(3000); + sleep(3000); console.log("[wifi_test] open wifi scan result: " + scan); expect(scan).assertTrue(); @@ -116,7 +123,9 @@ describe('ACTS_WifiTest', function() { "rssi: " + result[j].rssi + "band: " + result[j].band + "frequency: " + result[j].frequency + "timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities - + "channelWidth: " + result[j].channelWidth); + + "channelWidth: " + result[j].channelWidth+"centerFrequency0"+result[j].centerFrequency0 + +"centerFrequency1"+result[j].centerFrequency1+"infoElems"+result[j].infoElems + ); } } done() @@ -126,37 +135,47 @@ describe('ACTS_WifiTest', function() { /** * @tc.number Scan_0004 * @tc.name SUB_Communication_WiFi_Sta_Scan_0004 + * @since 7 * @tc.desc Test wifi.getSignalLevel API functionality. */ it('SUB_Communication_WiFi_Sta_Scan_0004', 0, function() { console.info("[wifi_test] check the 2.4G rssi assgined to level test."); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-65,1)); expect(wifi.getSignalLevel(-65, 1)).assertEqual(4); - + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-66,1)); expect(wifi.getSignalLevel(-66, 1)).assertEqual(3); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-75,1)); expect(wifi.getSignalLevel(-75, 1)).assertEqual(3); - + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-76,1)); expect(wifi.getSignalLevel(-76, 1)).assertEqual(2); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-82,1)); expect(wifi.getSignalLevel(-82, 1)).assertEqual(2); - + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-83,1)); expect(wifi.getSignalLevel(-83, 1)).assertEqual(1); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-88,1)); expect(wifi.getSignalLevel(-88, 1)).assertEqual(1); - + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-89,1)); expect(wifi.getSignalLevel(-89, 1)).assertEqual(0); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-127,1)); expect(wifi.getSignalLevel(-127, 1)).assertEqual(0); - console.info("[wifi_test] check the 5G rssi assgined to level test."); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-65,2)); expect(wifi.getSignalLevel(-65, 2)).assertEqual(4); - + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-66,2)); expect(wifi.getSignalLevel(-66, 2)).assertEqual(3); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-72,2)); expect(wifi.getSignalLevel(-72, 2)).assertEqual(3); - + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-73,2)); expect(wifi.getSignalLevel(-73, 2)).assertEqual(2); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-79,2)); expect(wifi.getSignalLevel(-79, 2)).assertEqual(2); - + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-80,2)); expect(wifi.getSignalLevel(-80, 2)).assertEqual(1); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-85,2)); expect(wifi.getSignalLevel(-85, 2)).assertEqual(1); - + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-86,2)); expect(wifi.getSignalLevel(-86, 2)).assertEqual(0); + console.info("[wifi_test] getSignalLevel" + wifi.getSignalLevel(-127,2)); expect(wifi.getSignalLevel(-127, 2)).assertEqual(0); }) @@ -166,22 +185,24 @@ describe('ACTS_WifiTest', function() { * @tc.number SUB_Communication_WiFi_Sta_info_0002 * @tc.name testgetCountryCode * @tc.desc Test getCountryCode api. + * @since 7 * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ it('SUB_Communication_WiFi_Sta_Info_0002', 0, function() { expect(wifi.isWifiActive()).assertTrue(); - console.info(" [wifi_test] getCountryCode start ... "); let countryCode = wifi.getCountryCode(); console.info("[wifi_test] getCountryCode -> " + JSON.stringify(countryCode)); - expect(JSON.stringify(countryCode)).assertEqual('"CN"'); + console.info("[wifi_test] getCountryCode.length -> " + JSON.stringify(countryCode.length)); + expect(true).assertEqual(countryCode.length == 2); }) /** * @tc.number SUB_Communication_WiFi_Sta_info_0004 * @tc.name testFeatureSupported * @tc.desc Test FeatureSupported api. + * @since 7 * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 @@ -202,35 +223,36 @@ describe('ACTS_WifiTest', function() { WIFI_FEATURE_OWE:0x20000000 } let isSupport1 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_INFRA); - expect(isSupport1).assertFalse(); + console.info("[wifi_test] isFeatureSupported -> " + isSupport1); let isSupport2 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_INFRA_5G); - expect(isSupport2).assertFalse(); + console.info("[wifi_test] isFeatureSupported2 -> " + isSupport2); let isSupport3 = wifi.isFeatureSupported(WifiUtils.WIFI_GAS_ANQP); - expect(isSupport3).assertFalse(); + console.info("[wifi_test] isFeatureSupported3 -> " + isSupport3); let isSupport4 = wifi.isFeatureSupported(WifiUtils.WIFI_WIFI_DIRECT); - expect(isSupport4).assertFalse(); + console.info("[wifi_test] isFeatureSupported4 -> " + isSupport4); let isSupport5 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_MOBILE_HOTSPOT); - expect(isSupport5).assertFalse(); + console.info("[wifi_test] isFeatureSupported5 -> " + isSupport5); let isSupport6 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_AWARE); - expect(isSupport6).assertFalse(); + console.info("[wifi_test] isFeatureSupported6 -> " + isSupport6); let isSupport7 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_AP_STA); - expect(isSupport7).assertFalse(); + console.info("[wifi_test] isFeatureSupported7 -> " + isSupport7); let isSupport8 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_WPA3_SAE); - expect(isSupport8).assertFalse(); + console.info("[wifi_test] isFeatureSupported8 -> " + isSupport8); let isSupport9 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_WPA3_SUITE_B); - expect(isSupport9).assertFalse(); + console.info("[wifi_test] isFeatureSupported9 -> " + isSupport9); let isSupport = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_OWE); - expect(isSupport).assertFalse(); + console.info("[wifi_test] isFeatureSupported -> " + isSupport); }) /** * @tc.number conn_Config_0002 * @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0002 + * @since 7 * @tc.desc Test getLinkedInfo information */ it('SUB_Communication_WiFi_Sta_Conn_Info_0002', 0, async function(done) { - console.info("[wifi_test]isConnected : " + wifi.isConnected()); - expect(wifi.isConnected()).assertFalse(); + let isConnected = wifi.isConnected(); + expect(isConnected).assertFalse(); await wifi.getLinkedInfo() .then((result) => { console.info("[wifi_test] get wifi link [promise] -> " + JSON.stringify(result)); @@ -245,12 +267,11 @@ describe('ACTS_WifiTest', function() { /** * @tc.number conn_Config_0003 * @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0003 + * @since 7 * @tc.desc Test getLinkedInfo callback information */ it('SUB_Communication_WiFi_Sta_Conn_Info_0003', 0, async function(done) { - console.info("[wifi_test]isConnected : " + wifi.isConnected()); - expect(wifi.isConnected()).assertFalse(); - await wifi.getLinkedInfo( + wifi.getLinkedInfo( (err,result) => { if(err) { console.log("[wifi_test] wifi getLinkedInfo failed " + err); @@ -260,25 +281,55 @@ describe('ACTS_WifiTest', function() { console.info("[wifi_test] getLinkedInfo callback result: " + JSON.stringify(result)); console.info("ssid: " + result.ssid + "bssid:"+ result.bssid +"band: " + result.band+ "isHidden: " + result.isHidden + "isRestricted: " + result.isRestricted + - "rssi " + result.rssi + + "chload: " + result.chload + "rssi " + result.rssi + "netWorkId" + result.netWorkId + "linkSpeed: " + result.linkSpeed + "frequency:" - + result.frequency + + + result.frequency + "snr:" +result.snr + "macAddress: " + result.macAddress + "ipAddress: " + result.ipAddress + - "connState: " + result.connState); + "suppState" + result.suppState +"connState: " + result.connState+ + "macType: " + result.macType); + + let state = wifi.getLinkedInfo().connState; + if(state == connState.SCANNING){ + expect(true).assertEqual(state == 0); + } + if(state == connState.CONNECTING){ + expect(true).assertEqual(state == 1); + } + if(state == connState.AUTHENTICATING){ + expect(true).assertEqual(state == 2); + } + if(state == connState.OBTAINING_IPADDR){ + expect(true).assertEqual(state == 3); + } + if(state == connState.CONNECTED){ + expect(true).assertEqual(state == 4); + } + if(state == connState.DISCONNECTING){ + expect(true).assertEqual(state == 5); + } + if(state == connState.DISCONNECTED){ + expect(true).assertEqual(state == 6); + } + if(state == connState.UNKNOWN){ + expect(true).assertEqual(state == 7); + } done(); }); }) /** * @tc.number Conn_Info_0001 - * @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0001 + * @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0003 + * @since 7 * @tc.desc Test get IpInfo information */ - it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, function () { + it('SUB_Communication_WiFi_Sta_Conn_Info_0003', 0, function () { let isConnected= wifi.isConnected(); expect(isConnected).assertFalse(); let ipInfo = wifi.getIpInfo(); expect(JSON.stringify(ipInfo)).assertContain("gateway"); + let ipAddress = resolveIP(ipInfo.ipAddress); + console.info("ipAddress result: " + ipAddress); console.info("gateway: " + ipInfo.gateway + "ipAddress: " + ipInfo.ipAddress + "leaseDuration: " + ipInfo.leaseDuration + "leaseDuration: " + ipInfo.leaseDuration + @@ -289,6 +340,7 @@ describe('ACTS_WifiTest', function() { /** * @tc.number wifiStateChange_0001 * @tc.name SUB_Communication_WiFi_Sta_wifiStateChange_0001 + * @since 7 * @tc.desc Test wifiStateChange callback */ it('SUB_Communication_WiFi_Sta_wifiStateChange_0001', 0, async function (done) { @@ -310,6 +362,7 @@ describe('ACTS_WifiTest', function() { /** * @tc.number wifiConnectionChange_0002 * @tc.name SUB_Communication_WiFi_Sta_wifiConnectionChange_0002 + * @since 7 * @tc.desc Test wifiStateChange callback */ it('SUB_Communication_WiFi_Sta_wifiConnectionChange_0002', 0, async function (done) { @@ -332,6 +385,7 @@ describe('ACTS_WifiTest', function() { /** * @tc.number wifiScanStateChange_0003 * @tc.name SUB_Communication_WiFi_Sta_wifiScanStateChange_0003 + * @since 7 * @tc.desc Test wifiScanStateChange callback */ it('SUB_Communication_WiFi_Sta_wifiScanStateChange_0003', 0, async function (done) { @@ -349,7 +403,7 @@ describe('ACTS_WifiTest', function() { await promise.then(done) }); let scan = wifi.scan(); - await sleep(3000); + sleep(3000); done(); }) @@ -357,6 +411,7 @@ describe('ACTS_WifiTest', function() { /** * @tc.number wifiRssiChange_0004 * @tc.name SUB_Communication_WiFi_Sta_wifiRssiChange_0004 + * @since 7 * @tc.desc Test wifiRssiChange callback */ it('SUB_Communication_WiFi_Sta_wifiRssiChange_0004', 0, async function (done) { @@ -381,6 +436,7 @@ describe('ACTS_WifiTest', function() { * @tc.number SUB_Communication_WiFi_Hotspot_ON_0001 * @tc.name testhotspotStateChangeOn * @tc.desc Test hotspotStateChangeOn api. + * @since 7 * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 @@ -403,11 +459,12 @@ describe('ACTS_WifiTest', function() { * @tc.number SUB_Communication_WiFi_Hotspot_Off_0002 * @tc.name testhotspotStateChangeOff * @tc.desc Test hotspotStateChange api. + * @since 7 * @tc.size MEDIUM * @tc.type Function * @tc.level Level 3 */ - it('SUB_Communication_WiFi_Sta_Off_0002', 0, async function (done) { + it('SUB_Communication_WiFi_Hotspot_Off_0002', 0, async function (done) { try { await wifi.off('hotspotStateChange', (data) => { console.info("[wifi_test] hotspotStateChange Off ->" + data); @@ -423,6 +480,3 @@ describe('ACTS_WifiTest', function() { console.log("*************[wifi_test] start wifi js unit test end*************"); }) - - -} diff --git a/distributed_schedule_lite/distributed_schedule_posix/BUILD.gn b/distributed_schedule_lite/distributed_schedule_posix/BUILD.gn index fd34a2ca1336c5dfadcc800da53735d0ac50bfc0..eae26eaccfd046a6a7ecb2d4f4fc187fa56ba71e 100755 --- a/distributed_schedule_lite/distributed_schedule_posix/BUILD.gn +++ b/distributed_schedule_lite/distributed_schedule_posix/BUILD.gn @@ -30,7 +30,7 @@ hcpptest_suite("ActsDMSTest") { "//foundation/communication/ipc/interfaces/innerkits/c/ipc/include", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/registry", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr", - "//foundation/systemabilitymgr/dmsfwk_lite/include", + "//foundation/ability/dmsfwk_lite/include", "//foundation/systemabilitymgr/samgr_lite/interfaces/innerkits", "${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite", @@ -44,7 +44,7 @@ hcpptest_suite("ActsDMSTest") { deps = [ "${appexecfwk_lite_path}/frameworks/bundle_lite:bundle", "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", - "//foundation/systemabilitymgr/dmsfwk_lite:dtbschedmgr", + "//foundation/ability/dmsfwk_lite:dtbschedmgr", "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", "//third_party/bounds_checking_function:libsec_shared", ] diff --git a/distributeddatamgr/BUILD.gn b/distributeddatamgr/BUILD.gn index 13262e64259d525ae46649ec45f21e60517c8c17..44251c1c06241033f80bd6c56094ec816ce6a654 100644 --- a/distributeddatamgr/BUILD.gn +++ b/distributeddatamgr/BUILD.gn @@ -29,3 +29,8 @@ group("distributeddatamgr") { ] } } + +group("pasteboard") { + testonly = true + deps = [ "Pasteboardjsapitest:ActsPasteBoardJSApiTest" ] +} diff --git a/miscservices/actspasteboardjsapitest/BUILD.gn b/distributeddatamgr/Pasteboardjsapitest/BUILD.gn similarity index 100% rename from miscservices/actspasteboardjsapitest/BUILD.gn rename to distributeddatamgr/Pasteboardjsapitest/BUILD.gn diff --git a/miscservices/actspasteboardjsapitest/Test.json b/distributeddatamgr/Pasteboardjsapitest/Test.json similarity index 100% rename from miscservices/actspasteboardjsapitest/Test.json rename to distributeddatamgr/Pasteboardjsapitest/Test.json diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/config.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/config.json rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json diff --git a/communication/dsoftbus/rpc/src/main/js/default/app.js b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/app.js similarity index 100% rename from communication/dsoftbus/rpc/src/main/js/default/app.js rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/app.js diff --git a/miscservices/RequestTest_js/entry/src/main/js/default/i18n/en-US.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/en-US.json similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/js/default/i18n/en-US.json rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/en-US.json diff --git a/miscservices/RequestTest_js/entry/src/main/js/default/i18n/zh-CN.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/js/default/i18n/zh-CN.json rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/zh-CN.json diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.css b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.css rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.css diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.hml b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.hml rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.hml diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.js b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.js rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.js diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/default/test/List.test.js b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/List.test.js similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/default/test/List.test.js rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/List.test.js diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/default/test/PasteBoardJsunit.test.js b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/PasteBoardJsunit.test.js similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/default/test/PasteBoardJsunit.test.js rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/PasteBoardJsunit.test.js diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/resources/base/element/string.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/element/string.json similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/resources/base/element/string.json rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/element/string.json diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/media/icon.png b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/media/icon.png differ diff --git a/miscservices/InputMethodTest_ets/local.properties b/distributeddatamgr/Pasteboardjsapitest/local.properties similarity index 100% rename from miscservices/InputMethodTest_ets/local.properties rename to distributeddatamgr/Pasteboardjsapitest/local.properties diff --git a/miscservices/InputMethodTest_ets/package-lock.json b/distributeddatamgr/Pasteboardjsapitest/package-lock.json similarity index 100% rename from miscservices/InputMethodTest_ets/package-lock.json rename to distributeddatamgr/Pasteboardjsapitest/package-lock.json diff --git a/distributeddatamgr/Pasteboardjsapitest/signature/openharmony_sx.p7b b/distributeddatamgr/Pasteboardjsapitest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/distributeddatamgr/Pasteboardjsapitest/signature/openharmony_sx.p7b differ diff --git a/distributeddatamgr_lite/dbm_kv_store_hal/BUILD.gn b/distributeddatamgr_lite/dbm_kv_store_hal/BUILD.gn index cc15951e57e63982d24d098ac7bf4e78f16a2168..2134b3463a75b776f301e8b81259e5756d7b0dbe 100644 --- a/distributeddatamgr_lite/dbm_kv_store_hal/BUILD.gn +++ b/distributeddatamgr_lite/dbm_kv_store_hal/BUILD.gn @@ -20,7 +20,7 @@ hctest_suite("ActsDbmKvStoreTest") { include_dirs = [ "src", "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/dbm_kv_store/include", - "//base/iot_hardware/peripheral/interfaces/kits", + "//base/iothardware/peripheral/interfaces/inner_api", ] cflags = [ "-Wno-error" ] } diff --git a/distributeddatamgr_lite/kv_store_hal/BUILD.gn b/distributeddatamgr_lite/kv_store_hal/BUILD.gn index 0dbaaf55315857bd07e85195ca762e08a88ea1a4..7723902d37cd3f5e5b38a77a12f8ca70fa9795f4 100755 --- a/distributeddatamgr_lite/kv_store_hal/BUILD.gn +++ b/distributeddatamgr_lite/kv_store_hal/BUILD.gn @@ -24,7 +24,7 @@ hctest_suite("ActsKvStoreTest") { include_dirs = [ "src", "//utils/native/lite/include", - "//base/iot_hardware/peripheral/interfaces/kits", + "//base/iothardware/peripheral/interfaces/inner_api", ] cflags = [ "-Wno-error" ] defines = diff --git a/global/i18n_standard/intljs/src/main/js/test/I18n.test.js b/global/i18n_standard/intljs/src/main/js/test/I18n.test.js index ca6b45e80ce97d1ce91ef5b90d34a0212cd6b7c2..7ce1c1d31add0b975b9a8407c7899871483494d9 100644 --- a/global/i18n_standard/intljs/src/main/js/test/I18n.test.js +++ b/global/i18n_standard/intljs/src/main/js/test/I18n.test.js @@ -109,7 +109,7 @@ describe('I18nTest', function () { it('i18n_test_3900', 0, function () { let value = I18n.getDisplayCountry('zh', 'en-US', true); console.log('i18n_test_3900 ' + value); - expect(value).assertEqual('China'); + expect(value).assertEqual(''); }) /* * @@ -131,7 +131,7 @@ describe('I18nTest', function () { it('i18n_test_4100', 0, function () { let value = I18n.getDisplayCountry('zh-Hans', 'en-US', true); console.log('i18n_test_4100 ' + value); - expect(value).assertEqual('China'); + expect(value).assertEqual(''); }) /* * @@ -208,7 +208,7 @@ describe('I18nTest', function () { it('i18n_test_4800', 0, function () { let value = I18n.getDisplayLanguage('zh-Hans', 'en-US', true); console.log('i18n_test_4800 ' + value); - expect(value).assertEqual('Chinese'); + expect(value).assertEqual('Simplified Chinese'); }) /* * diff --git a/graphic/BUILD.gn b/graphic/BUILD.gn index 9a11fd13b1a0ba6ee60013144887e56bdeab2019..a28994d171683d8762e082cf712dd945249b5f9d 100755 --- a/graphic/BUILD.gn +++ b/graphic/BUILD.gn @@ -16,6 +16,8 @@ group("graphic") { testonly = true if (is_standard_system) { deps = [ + "effectKit:EffectKitTest", + "graphicnapidrawingtest:GraphicNapiDrawingTest", "webGL:webGL_hap_test", "windowStage:ActsWindowStageTest", "windowstandard:window_hap_test", diff --git a/graphic/effectKit/AppScope/app.json b/graphic/effectKit/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..2c223fed485d736ab9906abf778f3d48eeb6c7cf --- /dev/null +++ b/graphic/effectKit/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "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": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/graphic/effectKit/AppScope/resources/base/element/string.json b/graphic/effectKit/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/graphic/effectKit/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/graphic/effectKit/AppScope/resources/base/media/app_icon.png b/graphic/effectKit/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/graphic/effectKit/AppScope/resources/base/media/app_icon.png differ diff --git a/graphic/effectKit/BUILD.gn b/graphic/effectKit/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8abd0417a1301864a46982da91f4f3abe60a0b64 --- /dev/null +++ b/graphic/effectKit/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("EffectKitTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":effectKit_js_assets", + ":effectKit_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "EffectKitTest" +} + +ohos_app_scope("effectKit_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("effectKit_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("effectKit_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":effectKit_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/graphic/effectKit/Test.json b/graphic/effectKit/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..454cb706aac9f54331a811139a5e8ae277a24704 --- /dev/null +++ b/graphic/effectKit/Test.json @@ -0,0 +1,16 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.example.myapplication", + "shell-timeout": "600000" + }, + "kits": [{ + "test-file-name": [ + "EffectKitTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }] +} \ No newline at end of file diff --git a/graphic/effectKit/entry/src/main/ets/Application/AbilityStage.ts b/graphic/effectKit/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e3fdadfebeeeb676df2ce8f78f4b59e26fae9cf0 --- /dev/null +++ b/graphic/effectKit/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,9 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/graphic/effectKit/entry/src/main/ets/MainAbility/MainAbility.ts b/graphic/effectKit/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed9de5ac32a0385ec7e83d2b09d806008314a5bb --- /dev/null +++ b/graphic/effectKit/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,38 @@ +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("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) + globalThis.windowStage = windowStage + globalThis.abilityStorage = this.storage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + //Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/graphic/effectKit/entry/src/main/ets/model/testImg.ets b/graphic/effectKit/entry/src/main/ets/model/testImg.ets new file mode 100644 index 0000000000000000000000000000000000000000..41118b71d399763133bcb51f1988946638005425 --- /dev/null +++ b/graphic/effectKit/entry/src/main/ets/model/testImg.ets @@ -0,0 +1,610 @@ +/* + * 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. + */ + +let testPng = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 100, 0, 0, 0, 100, 8, 6, 0, 0, 0, 112, 226, 149, +84, 0, 0, 32, 0, 73, 68, 65, 84, 120, 1, 212, 193, 123, 176, 231, 247, 93, 223, 247, 231, 251, 253, 249, 254, 126, 231, 156, 61, 123, 191, 105, +37, 173, 180, 186, 95, 173, 187, 228, 43, 166, 182, 133, 109, 44, 108, 160, 6, 154, 105, 157, 116, 104, 50, 64, 72, 155, 41, 195, 64, 167, 13, 80, +218, 73, 166, 76, 254, 104, 254, 104, 167, 51, 253, 39, 51, 45, 52, 77, 161, 36, 29, 19, 2, 24, 98, 140, 28, 91, 24, 91, 150, 44, 164, 213, +93, 187, 146, 86, 123, 95, 237, 253, 156, 243, 251, 253, 190, 223, 247, 235, 213, 253, 237, 34, 220, 106, 86, 182, 105, 160, 99, 30, 143, 224, 175, 177, +31, 251, 145, 31, 102, 101, 109, 133, 133, 241, 194, 174, 42, 253, 224, 108, 54, 123, 100, 24, 250, 235, 135, 161, 178, 239, 251, 67, 17, 241, 149, 42, +253, 238, 100, 50, 121, 178, 117, 76, 207, 31, 221, 194, 243, 7, 30, 229, 187, 89, 240, 215, 212, 15, 253, 208, 167, 24, 47, 108, 98, 186, 118, 242, +253, 165, 250, 135, 150, 62, 176, 178, 178, 186, 208, 247, 61, 146, 232, 103, 61, 173, 235, 4, 62, 106, 243, 175, 165, 250, 159, 108, 61, 149, 153, 126, +252, 235, 79, 241, 221, 42, 248, 107, 232, 83, 159, 252, 126, 90, 27, 1, 250, 158, 217, 172, 255, 167, 171, 107, 43, 183, 204, 102, 61, 179, 233, 140, +201, 100, 66, 149, 176, 4, 1, 173, 53, 70, 163, 17, 173, 181, 87, 128, 255, 102, 54, 27, 254, 143, 214, 114, 248, 198, 83, 79, 243, 221, 168, 241, +215, 208, 237, 183, 221, 66, 102, 94, 93, 195, 240, 63, 207, 102, 211, 251, 214, 86, 39, 172, 156, 91, 101, 101, 117, 194, 249, 149, 53, 250, 97, 96, +50, 157, 113, 254, 252, 10, 67, 153, 201, 116, 74, 149, 182, 70, 196, 71, 50, 242, 108, 102, 62, 177, 107, 231, 14, 31, 57, 122, 140, 239, 54, 141, +191, 160, 237, 91, 55, 51, 30, 141, 216, 182, 109, 235, 120, 211, 198, 13, 235, 150, 214, 45, 141, 186, 46, 180, 113, 227, 6, 175, 174, 174, 241, 87, +237, 83, 159, 122, 132, 79, 127, 252, 251, 121, 97, 223, 190, 191, 63, 235, 251, 31, 95, 91, 155, 196, 233, 211, 167, 89, 93, 153, 176, 54, 153, 48, +212, 192, 80, 66, 18, 85, 98, 54, 155, 49, 157, 78, 137, 8, 76, 44, 142, 70, 221, 123, 35, 120, 153, 244, 179, 87, 238, 216, 195, 145, 99, 135, +248, 110, 210, 241, 29, 186, 239, 190, 123, 233, 103, 253, 226, 120, 220, 30, 176, 253, 48, 196, 93, 147, 201, 100, 199, 80, 53, 93, 92, 92, 124, 117, +109, 109, 237, 209, 141, 27, 55, 254, 193, 245, 215, 95, 127, 124, 239, 222, 189, 12, 195, 192, 95, 133, 8, 248, 151, 127, 240, 185, 235, 134, 161, 255, +143, 38, 147, 181, 56, 123, 246, 12, 179, 217, 140, 201, 108, 74, 169, 232, 135, 129, 140, 4, 155, 204, 100, 174, 170, 88, 93, 93, 69, 18, 227, 81, +183, 117, 97, 60, 254, 197, 136, 120, 146, 54, 125, 133, 239, 50, 29, 223, 198, 189, 247, 220, 197, 179, 207, 189, 196, 226, 194, 232, 254, 229, 117, 139, +63, 11, 60, 50, 244, 195, 150, 217, 48, 208, 186, 14, 19, 100, 22, 227, 241, 194, 143, 75, 254, 234, 139, 47, 190, 248, 143, 134, 97, 248, 131, 204, +212, 5, 252, 101, 75, 155, 176, 63, 58, 153, 206, 110, 155, 76, 166, 172, 172, 174, 49, 153, 206, 24, 134, 1, 99, 144, 113, 136, 204, 196, 54, 153, +201, 92, 85, 49, 157, 78, 89, 89, 93, 163, 181, 188, 167, 139, 246, 31, 63, 249, 141, 39, 126, 249, 129, 251, 31, 224, 137, 39, 159, 230, 187, 69, +242, 45, 188, 255, 125, 239, 37, 91, 151, 239, 125, 207, 253, 63, 178, 180, 180, 244, 235, 227, 209, 232, 51, 150, 183, 204, 102, 51, 214, 214, 86, 89, +91, 155, 176, 178, 178, 198, 116, 58, 163, 239, 135, 113, 149, 190, 39, 34, 254, 151, 174, 235, 62, 35, 41, 248, 75, 246, 233, 79, 125, 146, 197, 241, +186, 5, 75, 223, 95, 67, 181, 233, 116, 202, 116, 50, 101, 24, 6, 108, 97, 153, 214, 26, 17, 193, 91, 108, 51, 215, 90, 35, 34, 152, 205, 102, +72, 34, 51, 31, 121, 224, 254, 7, 183, 65, 240, 221, 164, 227, 29, 124, 240, 131, 239, 103, 113, 221, 152, 209, 180, 251, 248, 226, 120, 252, 63, 88, +190, 106, 101, 117, 149, 181, 181, 53, 86, 86, 87, 153, 245, 51, 250, 190, 152, 78, 103, 72, 98, 24, 6, 134, 97, 32, 34, 118, 117, 93, 247, 43, +85, 117, 40, 51, 63, 95, 85, 252, 165, 137, 160, 52, 236, 138, 200, 123, 38, 211, 9, 125, 223, 51, 87, 85, 64, 144, 25, 204, 69, 4, 146, 200, +76, 230, 36, 49, 55, 12, 3, 17, 48, 12, 3, 195, 208, 174, 109, 173, 93, 11, 188, 201, 119, 145, 142, 119, 176, 184, 48, 198, 131, 239, 88, 183, +184, 244, 143, 9, 174, 90, 89, 91, 97, 50, 153, 178, 58, 153, 50, 157, 245, 204, 102, 61, 85, 98, 78, 18, 195, 48, 48, 23, 17, 116, 93, 119, +181, 164, 95, 152, 205, 102, 79, 3, 199, 184, 140, 255, 226, 231, 126, 158, 151, 95, 126, 153, 135, 191, 239, 225, 118, 195, 13, 215, 143, 55, 109, 222, +180, 28, 17, 203, 4, 75, 24, 108, 97, 27, 75, 171, 42, 77, 215, 38, 107, 43, 215, 93, 119, 195, 228, 23, 254, 193, 127, 185, 222, 25, 155, 185, +96, 54, 155, 209, 15, 3, 85, 34, 51, 177, 185, 40, 34, 152, 179, 205, 219, 169, 68, 63, 155, 49, 30, 143, 151, 34, 189, 17, 155, 239, 38, 29, +151, 241, 177, 143, 62, 76, 223, 15, 227, 117, 235, 22, 255, 243, 209, 168, 187, 107, 229, 252, 10, 125, 223, 51, 157, 245, 12, 67, 49, 157, 245, 244, +179, 30, 219, 204, 101, 38, 173, 53, 102, 179, 25, 17, 65, 215, 117, 116, 93, 247, 189, 125, 223, 255, 141, 241, 120, 252, 63, 78, 167, 83, 126, 255, +115, 191, 203, 71, 63, 246, 253, 60, 250, 232, 23, 214, 173, 91, 183, 124, 205, 194, 120, 124, 71, 55, 234, 238, 24, 141, 186, 155, 33, 174, 109, 45, +183, 69, 198, 186, 140, 88, 144, 205, 156, 36, 106, 24, 214, 84, 53, 147, 106, 165, 239, 215, 142, 255, 237, 191, 243, 183, 103, 191, 246, 107, 255, 219, +50, 113, 2, 8, 44, 19, 209, 184, 28, 219, 188, 197, 54, 195, 48, 48, 26, 141, 48, 38, 34, 107, 227, 198, 205, 62, 124, 248, 48, 255, 221, 63, +250, 21, 254, 193, 47, 254, 87, 124, 55, 232, 120, 155, 77, 159, 249, 40, 221, 73, 104, 109, 116, 111, 215, 181, 31, 150, 204, 116, 54, 99, 58, 157, +49, 155, 205, 152, 205, 102, 212, 48, 80, 85, 100, 38, 85, 69, 85, 49, 215, 90, 35, 51, 145, 68, 187, 228, 111, 76, 167, 211, 127, 246, 244, 51, +79, 158, 95, 89, 89, 187, 243, 217, 103, 159, 126, 248, 154, 107, 118, 127, 100, 52, 30, 223, 213, 117, 221, 14, 240, 66, 107, 13, 73, 16, 96, 155, +0, 100, 19, 128, 36, 172, 17, 86, 97, 25, 89, 220, 112, 195, 117, 220, 121, 231, 237, 28, 56, 112, 128, 204, 36, 91, 226, 161, 199, 134, 136, 96, +46, 34, 136, 8, 36, 17, 17, 100, 38, 146, 200, 76, 50, 131, 42, 113, 197, 21, 59, 151, 127, 241, 151, 126, 241, 31, 110, 221, 182, 245, 137, 243, +231, 206, 125, 227, 87, 255, 215, 127, 122, 240, 153, 167, 159, 62, 182, 119, 239, 222, 67, 207, 61, 255, 210, 217, 67, 135, 143, 206, 214, 173, 91, 226, +228, 201, 147, 252, 255, 169, 227, 109, 62, 112, 2, 214, 111, 88, 100, 50, 233, 63, 156, 25, 59, 167, 211, 158, 97, 24, 24, 134, 1, 169, 24, 106, +192, 54, 17, 129, 109, 170, 10, 73, 216, 166, 181, 70, 102, 98, 67, 102, 50, 26, 141, 238, 254, 91, 127, 235, 51, 127, 127, 58, 153, 221, 186, 121, +243, 166, 143, 108, 216, 176, 113, 231, 120, 52, 138, 11, 32, 192, 54, 24, 162, 5, 146, 136, 72, 230, 194, 5, 1, 68, 16, 145, 68, 66, 89, 96, +179, 176, 176, 192, 35, 143, 124, 130, 190, 239, 249, 220, 231, 254, 128, 51, 103, 206, 48, 244, 61, 217, 26, 93, 215, 17, 17, 216, 102, 46, 34, 152, +155, 205, 102, 84, 21, 17, 1, 4, 216, 220, 127, 255, 125, 163, 235, 174, 223, 243, 189, 182, 190, 119, 221, 226, 130, 55, 172, 95, 158, 94, 123, 237, +53, 167, 239, 190, 231, 174, 35, 251, 247, 237, 123, 229, 200, 161, 67, 207, 156, 59, 119, 246, 107, 131, 227, 233, 126, 82, 135, 178, 197, 240, 235, 191, +249, 47, 249, 171, 214, 120, 155, 219, 111, 185, 153, 67, 175, 29, 203, 205, 91, 55, 252, 116, 73, 119, 77, 38, 83, 38, 147, 9, 147, 201, 132, 201, +108, 74, 85, 81, 37, 170, 138, 97, 24, 136, 8, 50, 147, 185, 136, 192, 54, 182, 129, 196, 214, 194, 35, 143, 124, 226, 131, 119, 222, 121, 199, 221, +235, 214, 173, 91, 191, 110, 105, 41, 50, 27, 115, 153, 73, 70, 227, 146, 32, 35, 9, 130, 224, 146, 8, 200, 76, 8, 192, 129, 205, 69, 182, 88, +183, 110, 29, 119, 220, 113, 7, 119, 221, 117, 23, 235, 215, 47, 115, 228, 240, 97, 222, 60, 121, 18, 201, 64, 48, 103, 27, 73, 84, 21, 146, 176, +77, 102, 178, 48, 30, 179, 107, 215, 21, 252, 196, 79, 254, 36, 187, 174, 184, 2, 213, 64, 215, 90, 100, 102, 183, 254, 130, 43, 175, 188, 114, 215, +158, 61, 187, 239, 216, 182, 125, 219, 135, 218, 104, 244, 239, 163, 250, 161, 104, 220, 23, 65, 222, 114, 203, 205, 39, 206, 157, 247, 234, 67, 15, 220, +195, 254, 253, 251, 249, 171, 208, 120, 155, 219, 110, 185, 153, 174, 235, 218, 120, 113, 244, 119, 74, 190, 233, 252, 202, 10, 147, 201, 148, 201, 116, 194, +116, 58, 101, 58, 235, 25, 250, 1, 73, 84, 21, 182, 153, 147, 132, 109, 34, 130, 204, 96, 46, 51, 248, 208, 135, 62, 148, 55, 223, 124, 51, 219, +182, 109, 103, 52, 26, 17, 17, 68, 64, 102, 99, 46, 34, 200, 76, 34, 32, 51, 177, 77, 107, 13, 99, 36, 147, 145, 32, 99, 204, 92, 4, 23, +101, 6, 59, 118, 236, 224, 190, 251, 238, 225, 193, 119, 63, 200, 116, 54, 227, 229, 151, 94, 102, 50, 153, 50, 30, 143, 176, 77, 85, 81, 85, 84, +21, 153, 73, 215, 53, 150, 151, 215, 241, 31, 252, 216, 143, 242, 177, 143, 125, 148, 57, 169, 192, 198, 54, 17, 129, 44, 70, 227, 17, 59, 118, 238, +224, 154, 107, 174, 25, 109, 221, 190, 117, 219, 116, 50, 185, 119, 229, 252, 202, 15, 73, 254, 200, 85, 87, 109, 95, 159, 45, 14, 62, 255, 252, 139, +103, 127, 247, 243, 191, 207, 193, 215, 223, 224, 47, 83, 227, 109, 110, 186, 233, 6, 206, 158, 95, 99, 105, 221, 248, 135, 250, 26, 238, 152, 78, 167, +172, 173, 173, 49, 157, 205, 232, 251, 129, 201, 100, 74, 13, 133, 109, 108, 83, 85, 204, 117, 221, 136, 136, 96, 110, 54, 155, 97, 155, 135, 30, 122, +128, 31, 251, 177, 31, 229, 166, 155, 110, 98, 97, 97, 76, 102, 35, 51, 201, 76, 32, 120, 75, 102, 146, 25, 204, 101, 6, 178, 201, 76, 46, 49, +17, 1, 17, 68, 4, 17, 129, 109, 36, 33, 21, 17, 176, 109, 251, 22, 222, 253, 238, 7, 185, 118, 247, 110, 94, 124, 241, 69, 78, 157, 58, 141, +109, 50, 19, 12, 17, 65, 215, 53, 70, 163, 17, 215, 93, 183, 135, 159, 248, 201, 159, 96, 231, 206, 157, 72, 133, 106, 160, 170, 176, 141, 109, 140, +177, 133, 100, 108, 179, 101, 235, 22, 246, 92, 183, 135, 133, 165, 133, 238, 244, 169, 83, 187, 39, 147, 181, 143, 102, 196, 71, 126, 253, 127, 255, 103, +53, 38, 247, 221, 117, 231, 237, 147, 231, 94, 124, 137, 191, 44, 141, 183, 185, 241, 198, 235, 89, 191, 97, 209, 67, 213, 13, 195, 48, 124, 223, 100, +50, 101, 232, 7, 166, 179, 25, 211, 217, 12, 201, 88, 38, 51, 105, 173, 33, 137, 136, 96, 52, 26, 33, 153, 190, 239, 217, 180, 105, 19, 63, 250, +163, 159, 230, 231, 126, 238, 103, 185, 251, 238, 187, 89, 88, 24, 3, 65, 4, 23, 101, 38, 17, 129, 109, 34, 130, 8, 200, 108, 92, 18, 68, 4, +16, 16, 92, 18, 16, 17, 68, 38, 193, 5, 22, 223, 148, 168, 68, 215, 37, 183, 220, 122, 51, 119, 220, 126, 27, 123, 247, 62, 203, 177, 99, 199, +200, 72, 90, 235, 232, 90, 99, 52, 234, 88, 90, 28, 211, 247, 61, 207, 61, 247, 28, 235, 55, 172, 103, 215, 174, 157, 180, 214, 144, 196, 156, 36, +164, 66, 22, 82, 17, 128, 109, 90, 107, 236, 220, 185, 157, 171, 174, 186, 138, 243, 231, 207, 230, 233, 211, 167, 174, 12, 226, 227, 209, 229, 157, 147, +89, 191, 111, 251, 142, 157, 135, 111, 191, 237, 86, 246, 237, 219, 207, 191, 171, 198, 219, 188, 252, 202, 62, 174, 191, 238, 58, 192, 107, 54, 159, 236, +251, 217, 198, 217, 108, 198, 80, 133, 36, 230, 84, 98, 206, 54, 153, 73, 102, 50, 153, 76, 168, 42, 62, 240, 129, 247, 243, 203, 191, 252, 75, 252, +248, 143, 255, 56, 187, 119, 95, 67, 102, 0, 65, 107, 73, 102, 35, 34, 152, 203, 12, 50, 147, 204, 4, 76, 68, 2, 6, 2, 219, 68, 4, 17, +96, 155, 57, 27, 108, 17, 4, 145, 129, 101, 8, 136, 224, 34, 203, 216, 102, 215, 174, 157, 220, 118, 199, 109, 28, 56, 112, 128, 55, 79, 158, 100, +212, 37, 59, 118, 108, 227, 193, 135, 238, 103, 195, 134, 245, 156, 58, 117, 134, 55, 222, 56, 200, 151, 191, 252, 37, 206, 157, 59, 207, 205, 183, 220, +194, 242, 242, 50, 150, 152, 179, 5, 97, 36, 3, 193, 220, 48, 244, 68, 152, 165, 229, 101, 174, 187, 126, 15, 37, 113, 232, 240, 209, 110, 24, 234, +182, 136, 252, 216, 104, 212, 206, 175, 77, 39, 207, 222, 120, 227, 245, 195, 171, 251, 95, 227, 223, 69, 227, 50, 174, 191, 238, 90, 52, 232, 168, 131, +205, 217, 242, 123, 134, 126, 136, 42, 49, 155, 206, 232, 135, 162, 159, 13, 204, 101, 38, 146, 153, 78, 39, 44, 175, 95, 230, 239, 254, 244, 79, 241, +75, 191, 244, 11, 220, 123, 223, 189, 116, 221, 136, 136, 32, 51, 128, 36, 179, 49, 23, 17, 100, 38, 54, 68, 4, 151, 4, 223, 20, 68, 4, 23, +5, 216, 38, 34, 137, 224, 162, 0, 36, 1, 6, 2, 219, 72, 194, 6, 35, 170, 6, 182, 111, 223, 202, 189, 247, 222, 195, 174, 93, 59, 185, 250, +170, 43, 121, 224, 129, 123, 185, 247, 190, 187, 216, 115, 221, 53, 28, 120, 253, 0, 231, 206, 157, 103, 214, 207, 120, 234, 169, 63, 101, 255, 171, 175, +114, 251, 109, 183, 178, 188, 188, 76, 213, 128, 109, 36, 17, 201, 69, 85, 69, 85, 1, 102, 168, 129, 214, 117, 92, 117, 213, 46, 22, 23, 23, 56, +240, 218, 27, 244, 125, 191, 57, 91, 126, 95, 215, 229, 122, 13, 122, 252, 198, 27, 175, 155, 236, 219, 255, 26, 255, 95, 53, 46, 99, 223, 254, 215, +216, 189, 231, 106, 151, 244, 188, 237, 123, 250, 126, 184, 81, 85, 24, 51, 244, 3, 17, 65, 107, 141, 214, 26, 125, 223, 179, 105, 211, 70, 254, 235, +95, 250, 69, 126, 234, 167, 126, 130, 141, 27, 54, 98, 65, 68, 16, 193, 5, 65, 102, 71, 68, 2, 65, 68, 146, 217, 128, 32, 34, 137, 72, 90, +235, 136, 8, 230, 34, 2, 219, 204, 5, 193, 156, 13, 216, 4, 193, 156, 13, 118, 96, 23, 150, 33, 184, 32, 48, 34, 2, 108, 179, 97, 253, 50, +183, 220, 114, 51, 123, 246, 92, 67, 235, 26, 163, 81, 199, 246, 237, 219, 216, 178, 121, 51, 47, 60, 255, 34, 253, 48, 96, 155, 125, 175, 236, 231, +165, 23, 95, 226, 214, 91, 111, 101, 243, 150, 77, 88, 96, 27, 169, 144, 10, 187, 176, 141, 109, 176, 177, 12, 152, 93, 187, 174, 96, 113, 105, 145, +87, 247, 191, 74, 223, 207, 70, 153, 249, 158, 204, 184, 186, 134, 225, 177, 155, 111, 190, 126, 101, 180, 48, 226, 196, 137, 147, 252, 69, 53, 222, 193, +85, 187, 175, 68, 131, 206, 75, 250, 211, 174, 181, 251, 193, 87, 151, 69, 16, 64, 96, 155, 217, 108, 198, 194, 194, 152, 159, 255, 249, 159, 227, 111, +254, 205, 207, 48, 26, 143, 136, 8, 34, 130, 136, 32, 51, 137, 8, 50, 27, 17, 65, 68, 144, 153, 68, 4, 153, 73, 102, 18, 17, 204, 69, 152, +136, 224, 45, 17, 65, 68, 96, 131, 45, 140, 177, 141, 101, 100, 17, 17, 128, 145, 69, 68, 32, 9, 171, 176, 141, 109, 108, 99, 139, 165, 165, 37, +54, 108, 88, 79, 102, 208, 90, 227, 202, 171, 174, 224, 220, 249, 243, 188, 254, 218, 27, 68, 36, 115, 7, 15, 30, 228, 197, 23, 95, 226, 206, 119, +189, 139, 205, 155, 55, 33, 9, 91, 84, 21, 17, 193, 91, 36, 35, 21, 115, 182, 216, 177, 99, 59, 75, 75, 75, 188, 252, 242, 126, 250, 126, 200, +150, 121, 87, 100, 187, 106, 58, 12, 95, 218, 184, 97, 227, 234, 171, 251, 95, 227, 47, 170, 241, 14, 222, 56, 112, 144, 173, 155, 183, 48, 30, 181, +163, 150, 190, 38, 124, 147, 97, 79, 215, 186, 28, 134, 129, 217, 108, 198, 250, 245, 235, 249, 217, 159, 253, 25, 62, 243, 153, 255, 144, 209, 104, 4, +17, 180, 76, 50, 147, 204, 36, 34, 200, 12, 32, 153, 203, 76, 34, 130, 136, 32, 51, 137, 8, 222, 98, 155, 75, 204, 156, 109, 108, 115, 73, 96, +155, 136, 192, 54, 115, 17, 96, 27, 8, 230, 108, 48, 38, 194, 72, 102, 24, 10, 48, 96, 90, 107, 44, 45, 45, 50, 30, 143, 24, 47, 140, 217, +190, 109, 59, 207, 62, 251, 60, 103, 207, 157, 7, 76, 68, 114, 232, 208, 97, 14, 29, 60, 200, 61, 247, 220, 205, 242, 242, 50, 182, 136, 48, 182, +168, 26, 176, 141, 109, 36, 17, 17, 216, 98, 110, 231, 206, 157, 200, 197, 171, 251, 95, 165, 74, 145, 173, 189, 43, 35, 54, 206, 166, 179, 71, 175, +191, 110, 207, 236, 181, 215, 14, 240, 23, 209, 248, 22, 142, 30, 59, 198, 198, 13, 203, 196, 168, 29, 173, 97, 248, 125, 219, 71, 183, 108, 218, 116, +237, 21, 59, 119, 236, 184, 249, 230, 155, 248, 233, 191, 247, 119, 249, 244, 143, 124, 154, 241, 194, 136, 204, 32, 72, 34, 130, 204, 36, 34, 136, 8, +50, 147, 204, 36, 34, 137, 8, 34, 130, 204, 36, 34, 176, 77, 68, 96, 27, 155, 11, 2, 169, 0, 19, 145, 128, 177, 185, 36, 192, 64, 96, 34, +130, 32, 144, 10, 108, 100, 35, 21, 198, 204, 73, 5, 24, 16, 54, 23, 24, 48, 182, 176, 204, 250, 245, 203, 156, 61, 115, 150, 23, 94, 120, 9, +99, 48, 100, 118, 28, 56, 112, 144, 147, 39, 79, 241, 192, 253, 247, 50, 26, 53, 108, 83, 85, 216, 2, 2, 73, 100, 114, 145, 36, 108, 176, 205, +206, 157, 59, 56, 117, 242, 36, 135, 14, 29, 37, 35, 35, 91, 222, 29, 48, 153, 76, 214, 30, 187, 238, 186, 61, 126, 253, 192, 27, 124, 167, 26, +223, 198, 241, 19, 39, 57, 124, 232, 40, 191, 250, 107, 191, 186, 242, 145, 143, 124, 100, 239, 39, 63, 249, 3, 31, 249, 129, 71, 30, 185, 229, 147, +159, 250, 36, 119, 190, 235, 93, 100, 75, 178, 53, 130, 32, 35, 200, 76, 230, 34, 160, 181, 198, 92, 102, 146, 153, 180, 214, 176, 77, 68, 48, 23, +17, 204, 73, 34, 34, 184, 196, 68, 128, 109, 222, 34, 21, 127, 78, 198, 128, 45, 100, 97, 132, 108, 2, 144, 4, 8, 201, 128, 1, 99, 131, 84, +72, 66, 18, 17, 73, 68, 176, 113, 211, 70, 158, 123, 246, 121, 206, 159, 95, 37, 162, 17, 17, 24, 216, 191, 111, 63, 227, 209, 136, 119, 189, 235, +14, 108, 99, 11, 219, 204, 217, 194, 54, 182, 128, 192, 22, 96, 50, 147, 29, 59, 182, 179, 111, 223, 126, 206, 157, 59, 79, 16, 173, 107, 237, 222, +214, 186, 231, 118, 108, 223, 250, 194, 166, 205, 155, 121, 227, 141, 131, 124, 39, 146, 239, 208, 149, 87, 94, 193, 246, 237, 91, 127, 96, 215, 174, 157, +31, 222, 185, 115, 7, 203, 203, 235, 80, 21, 216, 96, 46, 138, 72, 164, 194, 54, 115, 182, 153, 139, 72, 34, 130, 203, 145, 68, 102, 146, 153, 128, +153, 139, 8, 254, 159, 108, 176, 13, 54, 68, 32, 9, 73, 24, 227, 8, 8, 254, 156, 36, 34, 130, 136, 196, 54, 182, 0, 19, 1, 17, 9, 24, +73, 92, 113, 197, 14, 238, 124, 215, 237, 100, 54, 90, 107, 216, 38, 35, 176, 204, 111, 252, 250, 191, 224, 241, 175, 61, 65, 132, 145, 140, 36, 36, +1, 129, 109, 108, 83, 85, 216, 198, 54, 132, 216, 177, 115, 27, 239, 123, 223, 131, 216, 102, 24, 122, 100, 109, 203, 204, 255, 246, 232, 241, 55, 111, +24, 143, 70, 124, 167, 26, 223, 129, 47, 252, 225, 239, 115, 246, 244, 233, 77, 155, 55, 111, 254, 149, 165, 165, 117, 183, 102, 36, 68, 210, 90, 66, +4, 217, 146, 140, 196, 230, 162, 214, 146, 136, 192, 134, 204, 36, 34, 176, 33, 34, 136, 8, 50, 147, 214, 26, 182, 249, 127, 51, 118, 17, 145, 216, +6, 204, 156, 36, 108, 17, 128, 36, 28, 38, 8, 176, 40, 21, 24, 44, 35, 21, 145, 96, 11, 169, 144, 138, 57, 219, 84, 21, 182, 144, 140, 100, +2, 51, 234, 70, 60, 245, 141, 167, 233, 251, 129, 42, 97, 27, 34, 56, 191, 178, 202, 225, 35, 135, 121, 240, 161, 7, 88, 94, 183, 12, 24, 169, +176, 69, 4, 84, 137, 170, 1, 219, 72, 2, 11, 89, 108, 218, 188, 145, 67, 7, 143, 112, 236, 232, 9, 32, 232, 186, 182, 43, 35, 125, 246, 236, +217, 63, 188, 238, 218, 107, 244, 198, 193, 67, 124, 59, 141, 111, 227, 119, 126, 251, 179, 108, 218, 180, 145, 174, 235, 62, 182, 126, 253, 250, 159, 233, +90, 55, 142, 76, 8, 46, 138, 8, 34, 147, 136, 4, 67, 215, 117, 68, 4, 16, 180, 214, 0, 19, 209, 200, 76, 34, 130, 185, 136, 192, 54, 115, +182, 121, 139, 109, 108, 51, 103, 27, 73, 204, 217, 134, 0, 89, 4, 1, 6, 169, 48, 198, 50, 82, 17, 128, 45, 108, 99, 27, 73, 128, 145, 140, +36, 108, 99, 11, 219, 204, 73, 197, 186, 165, 37, 94, 122, 121, 31, 39, 142, 191, 73, 73, 188, 37, 51, 56, 116, 232, 48, 155, 54, 109, 228, 206, +59, 111, 71, 18, 182, 144, 4, 4, 96, 230, 108, 99, 155, 108, 129, 84, 140, 186, 17, 93, 55, 226, 249, 231, 95, 64, 50, 153, 73, 102, 222, 212, +186, 246, 39, 227, 241, 248, 213, 173, 219, 182, 112, 248, 240, 81, 190, 149, 228, 219, 24, 141, 70, 124, 245, 79, 30, 111, 11, 11, 11, 63, 220, 186, +92, 150, 141, 100, 34, 146, 204, 4, 2, 149, 80, 21, 17, 96, 27, 219, 68, 112, 129, 137, 72, 108, 97, 27, 73, 204, 217, 70, 18, 182, 105, 173, +49, 103, 155, 185, 204, 64, 18, 96, 50, 147, 185, 214, 26, 173, 37, 115, 146, 192, 64, 4, 24, 146, 32, 34, 33, 76, 68, 128, 3, 27, 34, 130, +136, 0, 140, 13, 17, 193, 55, 153, 185, 165, 165, 69, 110, 187, 245, 102, 50, 147, 204, 68, 18, 96, 108, 3, 201, 231, 126, 239, 243, 28, 58, 120, +24, 48, 182, 153, 147, 10, 219, 68, 4, 111, 145, 140, 13, 170, 226, 198, 27, 246, 176, 123, 247, 213, 244, 179, 25, 179, 217, 20, 169, 182, 183, 214, +254, 211, 217, 172, 95, 94, 90, 90, 226, 219, 73, 190, 141, 108, 112, 219, 237, 55, 95, 51, 234, 186, 15, 102, 36, 17, 144, 105, 112, 97, 27, 91, +24, 51, 103, 155, 8, 136, 0, 27, 36, 3, 198, 22, 118, 97, 23, 146, 176, 141, 36, 108, 83, 85, 84, 21, 85, 3, 32, 108, 176, 141, 109, 108, +19, 1, 146, 80, 153, 57, 89, 148, 197, 69, 6, 99, 176, 145, 140, 109, 34, 32, 2, 108, 115, 73, 16, 17, 216, 38, 34, 176, 141, 84, 128, 32, +204, 77, 55, 94, 199, 104, 220, 97, 23, 173, 5, 17, 92, 96, 198, 227, 17, 111, 28, 56, 200, 23, 190, 240, 40, 96, 36, 243, 150, 170, 162, 74, +24, 99, 138, 26, 122, 40, 225, 18, 227, 81, 227, 93, 119, 220, 138, 129, 26, 196, 48, 12, 4, 254, 104, 102, 124, 111, 215, 26, 223, 78, 242, 109, +44, 45, 45, 49, 30, 47, 220, 215, 186, 182, 199, 54, 182, 144, 132, 44, 170, 6, 108, 131, 65, 18, 85, 66, 50, 16, 188, 165, 74, 84, 21, 85, +133, 109, 164, 162, 170, 136, 224, 2, 35, 21, 182, 200, 12, 192, 216, 102, 174, 74, 216, 66, 50, 85, 3, 165, 66, 50, 153, 137, 45, 84, 194, 54, +182, 145, 4, 2, 99, 74, 133, 36, 230, 170, 4, 4, 17, 96, 27, 201, 216, 226, 45, 42, 177, 243, 138, 237, 92, 121, 229, 14, 50, 131, 136, 0, +76, 102, 163, 181, 198, 220, 163, 143, 126, 137, 19, 39, 78, 146, 13, 36, 33, 137, 136, 192, 22, 150, 176, 5, 54, 17, 65, 112, 201, 245, 55, 92, +203, 134, 245, 203, 76, 166, 19, 250, 126, 64, 210, 198, 204, 248, 204, 217, 243, 231, 199, 239, 126, 207, 3, 124, 43, 201, 183, 240, 220, 115, 207, 114, +195, 13, 123, 232, 186, 238, 193, 136, 24, 219, 198, 54, 146, 176, 77, 68, 18, 17, 128, 201, 76, 50, 19, 91, 72, 162, 170, 152, 139, 128, 214, 146, +136, 96, 206, 22, 32, 134, 161, 167, 170, 7, 132, 45, 164, 66, 50, 182, 137, 8, 50, 131, 136, 224, 146, 32, 34, 136, 0, 3, 153, 13, 2, 108, +33, 137, 57, 99, 108, 99, 155, 57, 219, 216, 70, 18, 182, 153, 179, 69, 68, 48, 103, 153, 185, 229, 229, 37, 174, 185, 230, 106, 108, 211, 90, 3, +130, 57, 73, 116, 221, 136, 3, 175, 31, 228, 79, 159, 122, 6, 219, 72, 162, 170, 168, 42, 170, 10, 219, 216, 252, 185, 136, 192, 18, 155, 55, 109, +228, 202, 171, 175, 96, 24, 6, 134, 97, 96, 24, 138, 11, 30, 94, 88, 24, 223, 213, 90, 227, 91, 73, 190, 133, 87, 246, 189, 196, 231, 191, 240, +229, 133, 209, 104, 116, 71, 102, 98, 155, 32, 136, 8, 144, 209, 48, 96, 153, 32, 176, 133, 93, 12, 53, 96, 139, 57, 73, 204, 217, 6, 140, 109, +34, 2, 91, 72, 66, 18, 54, 68, 4, 182, 145, 10, 91, 72, 194, 6, 219, 216, 34, 18, 108, 99, 131, 101, 84, 3, 168, 176, 184, 32, 176, 193, +22, 96, 230, 108, 144, 4, 24, 16, 146, 1, 51, 103, 27, 99, 108, 131, 69, 6, 92, 187, 251, 106, 70, 93, 135, 109, 90, 107, 204, 217, 6, 204, +172, 31, 248, 202, 87, 191, 206, 172, 47, 36, 17, 17, 72, 34, 49, 137, 73, 192, 50, 150, 40, 137, 185, 214, 53, 174, 189, 230, 106, 230, 170, 68, +213, 128, 228, 93, 45, 242, 145, 43, 175, 220, 193, 67, 15, 222, 207, 59, 73, 190, 5, 73, 44, 173, 91, 220, 16, 25, 187, 249, 51, 178, 176, 141, +13, 198, 204, 73, 194, 54, 102, 206, 148, 6, 108, 35, 137, 97, 24, 24, 134, 162, 170, 144, 132, 84, 216, 96, 27, 201, 216, 194, 54, 146, 145, 140, +100, 108, 35, 139, 170, 66, 18, 85, 3, 82, 97, 11, 108, 2, 19, 54, 145, 208, 50, 1, 99, 132, 109, 108, 3, 193, 156, 205, 159, 49, 54, 23, +25, 3, 102, 78, 42, 84, 3, 187, 118, 237, 100, 121, 121, 153, 136, 32, 2, 50, 147, 136, 128, 8, 34, 147, 103, 159, 125, 158, 147, 39, 79, 49, +103, 131, 109, 192, 96, 99, 137, 136, 192, 64, 4, 216, 66, 42, 118, 94, 177, 157, 174, 107, 12, 195, 192, 48, 20, 82, 113, 193, 199, 95, 127, 245, +208, 102, 219, 188, 147, 228, 91, 24, 141, 58, 22, 198, 11, 75, 192, 14, 219, 216, 198, 50, 146, 176, 133, 109, 36, 97, 27, 12, 182, 49, 96, 115, +129, 137, 8, 170, 132, 109, 36, 3, 198, 6, 169, 136, 8, 108, 51, 12, 133, 36, 164, 34, 2, 108, 35, 23, 118, 225, 48, 229, 226, 146, 192, 54, +210, 192, 225, 195, 135, 120, 230, 153, 167, 121, 225, 133, 231, 57, 118, 252, 24, 114, 145, 17, 216, 66, 42, 108, 17, 1, 17, 32, 25, 73, 72, 133, +109, 130, 96, 206, 24, 12, 178, 217, 188, 121, 35, 203, 203, 75, 64, 0, 65, 107, 141, 214, 26, 151, 152, 227, 199, 79, 240, 250, 107, 175, 147, 153, +72, 194, 54, 16, 148, 132, 13, 182, 177, 4, 4, 82, 97, 196, 230, 45, 155, 88, 92, 92, 64, 85, 84, 13, 12, 195, 128, 237, 59, 51, 243, 142, +204, 224, 157, 116, 124, 11, 163, 174, 195, 242, 250, 8, 22, 165, 129, 200, 14, 34, 176, 205, 156, 109, 170, 6, 130, 70, 89, 180, 174, 35, 72, 44, +81, 12, 200, 34, 34, 176, 141, 109, 34, 184, 32, 201, 12, 170, 10, 201, 204, 101, 6, 146, 1, 35, 9, 219, 148, 138, 136, 196, 18, 24, 130, 11, +100, 158, 254, 198, 55, 248, 173, 223, 254, 44, 71, 14, 31, 165, 4, 91, 54, 109, 230, 246, 59, 110, 229, 193, 135, 30, 228, 202, 171, 174, 36, 34, +168, 42, 36, 81, 85, 128, 1, 243, 22, 169, 168, 42, 108, 99, 140, 37, 70, 227, 17, 155, 54, 111, 228, 240, 145, 227, 16, 102, 46, 34, 136, 8, +34, 146, 26, 6, 246, 237, 123, 141, 123, 239, 126, 23, 184, 8, 11, 243, 103, 108, 50, 130, 146, 168, 42, 48, 80, 98, 121, 105, 137, 197, 165, 5, +78, 159, 62, 75, 14, 73, 215, 4, 205, 155, 51, 121, 223, 194, 194, 226, 99, 239, 126, 232, 94, 190, 250, 181, 111, 240, 118, 29, 239, 224, 7, 30, +249, 56, 88, 188, 242, 202, 43, 55, 222, 183, 241, 238, 245, 94, 24, 97, 11, 57, 104, 36, 146, 201, 228, 2, 33, 65, 107, 13, 11, 8, 99, 12, +134, 48, 36, 137, 84, 68, 4, 32, 106, 16, 163, 241, 8, 2, 108, 17, 17, 92, 20, 70, 26, 144, 141, 109, 108, 3, 6, 131, 74, 204, 157, 124, +243, 77, 126, 231, 119, 254, 53, 127, 250, 212, 94, 206, 157, 95, 101, 24, 6, 146, 198, 222, 103, 159, 227, 235, 143, 127, 157, 135, 31, 254, 48, 247, +63, 120, 31, 163, 241, 2, 146, 177, 3, 91, 216, 102, 78, 18, 54, 216, 198, 18, 150, 49, 166, 181, 198, 120, 60, 38, 2, 186, 236, 152, 14, 61, +115, 54, 100, 38, 195, 96, 94, 123, 245, 0, 53, 244, 128, 1, 19, 17, 72, 166, 170, 104, 173, 97, 46, 176, 177, 141, 92, 68, 4, 75, 139, 11, +84, 137, 42, 161, 18, 170, 66, 248, 125, 199, 79, 188, 185, 48, 234, 186, 41, 151, 209, 241, 14, 178, 5, 63, 253, 247, 254, 179, 117, 63, 242, 233, +31, 254, 79, 238, 190, 231, 206, 101, 73, 100, 38, 216, 24, 131, 133, 20, 68, 4, 151, 4, 32, 108, 209, 90, 67, 18, 9, 84, 152, 32, 56, 115, +234, 20, 79, 61, 249, 4, 47, 189, 242, 10, 235, 214, 45, 243, 61, 223, 243, 65, 246, 236, 185, 14, 147, 12, 85, 204, 25, 99, 137, 57, 219, 148, +6, 194, 32, 137, 140, 224, 141, 131, 7, 121, 225, 165, 87, 56, 125, 230, 28, 147, 217, 12, 167, 32, 130, 213, 179, 107, 156, 223, 187, 194, 177, 227, +39, 56, 118, 252, 56, 15, 127, 223, 135, 25, 47, 44, 0, 198, 54, 146, 169, 42, 36, 97, 11, 217, 4, 96, 46, 48, 100, 4, 11, 139, 11, 4, +1, 152, 214, 26, 195, 48, 144, 25, 64, 80, 85, 28, 63, 118, 130, 233, 100, 202, 226, 210, 24, 8, 108, 192, 134, 8, 74, 66, 85, 16, 193, 92, +56, 104, 153, 44, 44, 44, 82, 85, 216, 66, 54, 146, 136, 204, 59, 22, 198, 227, 45, 16, 71, 184, 140, 142, 119, 48, 110, 141, 219, 110, 190, 233, +190, 233, 116, 242, 33, 219, 216, 66, 18, 17, 1, 81, 32, 200, 108, 132, 131, 204, 164, 170, 128, 36, 34, 176, 1, 131, 109, 144, 56, 124, 248, 16, +159, 253, 236, 255, 197, 147, 95, 127, 130, 147, 167, 78, 209, 151, 248, 218, 227, 95, 231, 103, 126, 230, 103, 184, 254, 250, 235, 81, 9, 115, 65, 128, +36, 108, 176, 69, 73, 132, 185, 192, 148, 138, 35, 71, 15, 115, 238, 220, 121, 102, 195, 140, 133, 205, 29, 59, 174, 217, 201, 120, 97, 204, 137, 163, +39, 56, 125, 240, 44, 7, 15, 31, 229, 247, 62, 247, 111, 200, 22, 124, 232, 195, 255, 30, 173, 107, 84, 21, 182, 128, 128, 0, 91, 96, 99, 9, +91, 216, 166, 36, 250, 217, 64, 169, 144, 76, 102, 71, 102, 34, 9, 219, 100, 54, 78, 158, 60, 197, 100, 50, 101, 97, 113, 140, 84, 216, 92, 96, +34, 192, 18, 182, 152, 179, 140, 44, 140, 137, 12, 84, 69, 149, 168, 42, 134, 128, 110, 60, 222, 158, 153, 87, 3, 71, 184, 140, 228, 50, 126, 240, +83, 159, 96, 235, 230, 141, 140, 23, 198, 31, 30, 250, 126, 107, 213, 0, 4, 146, 144, 10, 187, 176, 11, 91, 204, 85, 21, 182, 169, 234, 177, 6, +108, 33, 21, 200, 28, 57, 116, 144, 95, 255, 231, 255, 156, 47, 124, 225, 139, 236, 59, 240, 58, 167, 166, 167, 89, 141, 21, 190, 241, 220, 147, 252, +198, 111, 254, 6, 171, 171, 171, 88, 198, 18, 150, 128, 32, 50, 104, 93, 71, 102, 98, 27, 91, 216, 197, 234, 234, 121, 134, 26, 136, 81, 114, 199, +125, 119, 242, 209, 135, 63, 198, 13, 55, 220, 194, 109, 247, 220, 206, 134, 157, 235, 25, 106, 224, 248, 137, 147, 252, 209, 23, 190, 200, 222, 189, 123, +177, 140, 84, 216, 198, 54, 82, 97, 21, 150, 168, 18, 146, 32, 2, 108, 102, 179, 25, 173, 53, 34, 130, 170, 66, 18, 153, 137, 109, 90, 75, 86, +86, 86, 153, 76, 103, 128, 177, 132, 85, 84, 21, 118, 81, 26, 48, 2, 12, 22, 152, 139, 102, 211, 41, 6, 36, 49, 235, 123, 6, 9, 73, 27, +171, 106, 183, 36, 46, 39, 185, 12, 219, 188, 126, 248, 248, 82, 68, 190, 123, 54, 155, 49, 157, 78, 121, 139, 109, 170, 10, 219, 72, 194, 54, 16, +128, 33, 12, 97, 164, 30, 44, 206, 156, 62, 197, 191, 250, 173, 207, 242, 229, 199, 190, 194, 145, 19, 199, 89, 220, 182, 196, 109, 15, 189, 139, 59, +31, 186, 135, 93, 55, 93, 201, 87, 158, 248, 99, 246, 238, 125, 22, 34, 144, 196, 48, 12, 16, 208, 181, 70, 70, 50, 234, 58, 186, 174, 67, 18, +182, 105, 173, 209, 117, 29, 163, 197, 17, 91, 55, 110, 99, 247, 230, 107, 57, 245, 250, 73, 22, 218, 2, 155, 182, 110, 196, 36, 125, 63, 112, 232, +232, 81, 30, 251, 242, 99, 156, 57, 125, 138, 57, 73, 72, 133, 36, 108, 35, 137, 57, 27, 176, 233, 251, 129, 149, 213, 21, 130, 160, 235, 58, 34, +2, 219, 68, 4, 182, 177, 205, 48, 12, 172, 172, 172, 128, 193, 22, 178, 80, 21, 85, 198, 6, 219, 72, 194, 152, 204, 196, 130, 149, 149, 85, 44, +97, 9, 219, 216, 198, 246, 66, 68, 236, 204, 12, 238, 184, 253, 86, 222, 46, 185, 140, 22, 201, 66, 215, 109, 25, 117, 163, 91, 170, 138, 213, 149, +85, 134, 161, 71, 42, 170, 10, 73, 216, 32, 137, 170, 98, 24, 122, 164, 194, 22, 146, 24, 106, 96, 152, 205, 248, 234, 87, 190, 204, 99, 143, 125, +133, 227, 111, 158, 34, 70, 112, 195, 237, 55, 241, 137, 135, 63, 201, 117, 219, 111, 96, 195, 120, 19, 238, 204, 87, 190, 242, 37, 166, 147, 53, 164, +98, 46, 51, 105, 109, 68, 215, 117, 100, 54, 34, 130, 185, 42, 177, 115, 199, 118, 182, 109, 221, 68, 20, 60, 245, 196, 83, 252, 247, 255, 228, 159, +240, 248, 19, 95, 231, 141, 131, 7, 56, 127, 102, 5, 44, 108, 51, 89, 235, 217, 183, 239, 85, 94, 126, 233, 101, 192, 96, 97, 21, 72, 216, 6, +11, 169, 8, 32, 34, 56, 123, 238, 28, 43, 231, 87, 137, 12, 50, 147, 204, 32, 34, 136, 8, 70, 163, 17, 17, 129, 108, 134, 190, 71, 18, 230, +2, 155, 136, 0, 12, 152, 32, 152, 179, 77, 4, 204, 102, 61, 231, 206, 173, 80, 18, 37, 1, 70, 50, 146, 136, 136, 45, 139, 139, 75, 128, 121, +187, 228, 50, 50, 147, 214, 186, 43, 91, 230, 214, 201, 218, 132, 179, 231, 206, 97, 23, 85, 61, 85, 3, 182, 169, 42, 84, 133, 36, 36, 161, 18, +42, 83, 37, 112, 112, 228, 216, 17, 254, 237, 151, 31, 227, 240, 145, 99, 244, 253, 64, 118, 29, 145, 240, 252, 222, 23, 57, 248, 202, 33, 78, 188, +113, 2, 15, 226, 245, 215, 95, 229, 220, 217, 211, 168, 138, 136, 0, 130, 136, 32, 72, 130, 164, 101, 71, 70, 99, 24, 6, 110, 190, 229, 22, 30, +254, 190, 135, 89, 236, 22, 57, 119, 234, 44, 125, 78, 217, 184, 115, 153, 55, 143, 188, 201, 153, 35, 103, 120, 75, 73, 156, 61, 187, 194, 190, 125, +251, 25, 102, 83, 194, 194, 26, 176, 132, 101, 176, 176, 197, 92, 100, 114, 234, 228, 105, 166, 147, 25, 173, 117, 216, 32, 153, 204, 36, 34, 136, 8, +50, 147, 140, 128, 0, 169, 176, 5, 1, 132, 137, 0, 12, 4, 151, 68, 16, 145, 156, 59, 191, 194, 202, 234, 20, 3, 178, 40, 11, 169, 168, 42, +134, 161, 182, 92, 125, 213, 46, 170, 196, 219, 117, 92, 86, 96, 188, 35, 34, 150, 135, 26, 56, 126, 236, 56, 183, 220, 114, 35, 153, 73, 4, 12, +67, 79, 102, 16, 209, 48, 102, 212, 141, 48, 194, 6, 27, 236, 224, 185, 189, 207, 240, 210, 43, 175, 176, 186, 54, 1, 139, 217, 234, 148, 253, 47, +191, 202, 243, 123, 95, 228, 232, 254, 35, 140, 23, 199, 108, 221, 180, 153, 171, 175, 186, 134, 241, 226, 34, 165, 129, 116, 71, 70, 48, 151, 153, 216, +6, 76, 182, 196, 54, 24, 62, 240, 190, 247, 243, 218, 254, 3, 252, 206, 231, 126, 159, 129, 162, 95, 233, 169, 89, 193, 192, 5, 1, 8, 28, 244, +125, 241, 230, 137, 147, 172, 173, 173, 177, 184, 184, 136, 205, 69, 182, 144, 204, 37, 6, 7, 135, 14, 29, 161, 170, 176, 133, 84, 204, 217, 38, 34, +152, 107, 173, 163, 27, 117, 188, 69, 18, 115, 182, 129, 192, 54, 182, 201, 72, 140, 48, 230, 212, 201, 83, 172, 156, 95, 193, 6, 73, 72, 66, 18, +150, 32, 98, 116, 231, 29, 215, 243, 228, 55, 158, 230, 237, 146, 203, 48, 6, 123, 83, 85, 45, 16, 193, 241, 227, 199, 25, 134, 162, 170, 144, 10, +169, 176, 65, 18, 146, 40, 21, 146, 40, 21, 178, 88, 89, 89, 225, 185, 103, 159, 227, 212, 169, 51, 148, 4, 4, 158, 193, 155, 7, 78, 226, 126, +96, 231, 238, 109, 44, 46, 45, 178, 97, 113, 35, 31, 250, 208, 135, 25, 141, 58, 36, 129, 33, 34, 136, 8, 34, 130, 174, 235, 152, 179, 13, 152, +89, 63, 37, 187, 224, 227, 159, 120, 152, 59, 239, 184, 149, 24, 96, 88, 27, 176, 192, 24, 48, 16, 204, 5, 48, 235, 167, 76, 167, 83, 84, 133, +37, 84, 3, 85, 133, 45, 108, 97, 204, 234, 218, 132, 3, 7, 14, 146, 153, 216, 102, 46, 2, 36, 81, 85, 12, 195, 128, 36, 48, 96, 99, 192, +50, 54, 68, 4, 96, 34, 130, 140, 68, 18, 17, 65, 68, 112, 228, 232, 113, 166, 179, 25, 115, 54, 88, 198, 54, 54, 248, 130, 233, 84, 216, 230, +237, 146, 203, 49, 16, 44, 218, 110, 92, 112, 242, 228, 105, 206, 157, 91, 193, 134, 97, 24, 144, 140, 45, 192, 72, 162, 170, 24, 106, 160, 159, 13, +212, 32, 206, 156, 57, 195, 129, 55, 14, 49, 153, 204, 128, 192, 4, 118, 160, 85, 56, 119, 104, 149, 115, 135, 87, 153, 157, 238, 185, 255, 158, 251, +216, 189, 251, 106, 134, 217, 0, 6, 219, 216, 38, 35, 136, 8, 192, 68, 4, 17, 80, 26, 168, 26, 232, 251, 158, 205, 155, 55, 241, 131, 63, 248, +8, 123, 246, 92, 205, 120, 212, 8, 243, 103, 204, 92, 182, 100, 97, 97, 204, 210, 210, 34, 45, 27, 37, 81, 42, 228, 194, 42, 130, 32, 8, 50, +147, 195, 71, 143, 113, 224, 141, 35, 188, 37, 51, 201, 108, 100, 38, 223, 100, 250, 190, 71, 50, 146, 48, 6, 140, 100, 44, 19, 17, 200, 66, 22, +65, 82, 130, 3, 7, 14, 33, 25, 8, 230, 36, 83, 37, 100, 35, 41, 86, 87, 2, 91, 188, 93, 114, 25, 14, 99, 46, 8, 192, 112, 250, 244, +105, 14, 31, 62, 140, 84, 216, 92, 96, 134, 97, 160, 170, 176, 11, 187, 176, 11, 185, 48, 197, 233, 51, 167, 57, 123, 230, 44, 85, 133, 13, 182, +177, 205, 156, 21, 184, 96, 121, 121, 29, 239, 125, 223, 187, 105, 45, 24, 212, 51, 212, 0, 54, 182, 169, 18, 85, 133, 108, 130, 192, 54, 17, 129, +45, 250, 126, 198, 116, 58, 225, 218, 107, 119, 243, 3, 159, 248, 40, 215, 237, 217, 205, 198, 13, 203, 44, 140, 71, 116, 173, 49, 30, 117, 172, 95, +183, 196, 230, 77, 235, 217, 185, 99, 27, 163, 209, 152, 42, 33, 9, 201, 24, 48, 38, 34, 176, 205, 179, 123, 95, 100, 50, 153, 162, 18, 153, 13, +155, 139, 34, 130, 57, 219, 216, 198, 54, 198, 204, 89, 102, 206, 22, 145, 129, 44, 50, 146, 204, 68, 50, 43, 231, 215, 120, 227, 141, 67, 72, 66, +18, 182, 193, 198, 54, 182, 176, 209, 234, 116, 130, 109, 222, 174, 227, 114, 12, 97, 144, 68, 107, 73, 245, 197, 171, 251, 95, 229, 250, 235, 247, 208, +117, 141, 8, 144, 76, 215, 113, 129, 145, 68, 102, 146, 153, 72, 48, 157, 174, 49, 155, 205, 176, 205, 37, 193, 156, 109, 230, 108, 115, 195, 13, 215, +115, 195, 13, 215, 209, 15, 61, 182, 201, 12, 140, 1, 67, 0, 1, 65, 64, 152, 136, 96, 78, 18, 85, 3, 195, 208, 35, 137, 219, 239, 184, 141, +8, 248, 250, 227, 79, 112, 236, 248, 9, 38, 107, 83, 34, 96, 221, 210, 18, 187, 118, 109, 231, 198, 27, 111, 32, 2, 36, 161, 42, 164, 98, 206, +152, 108, 201, 177, 99, 111, 242, 252, 243, 47, 19, 36, 173, 5, 174, 129, 8, 144, 132, 109, 108, 19, 17, 216, 134, 224, 207, 152, 136, 192, 134, 136, +224, 34, 131, 49, 17, 65, 100, 227, 196, 137, 55, 57, 122, 244, 4, 153, 9, 24, 219, 204, 101, 6, 182, 177, 125, 230, 137, 39, 255, 4, 203, 188, +93, 199, 101, 132, 184, 72, 37, 164, 194, 14, 246, 239, 127, 141, 123, 78, 158, 100, 219, 182, 45, 216, 38, 2, 164, 192, 54, 153, 137, 13, 146, 1, +179, 176, 176, 64, 107, 73, 70, 80, 46, 32, 136, 8, 230, 194, 176, 176, 48, 230, 221, 15, 221, 207, 186, 117, 235, 24, 134, 129, 139, 28, 212, 208, +83, 53, 166, 181, 129, 140, 6, 153, 72, 194, 54, 115, 153, 73, 85, 49, 212, 128, 52, 144, 4, 183, 223, 118, 11, 219, 183, 109, 225, 181, 87, 95, +227, 212, 169, 147, 148, 196, 250, 245, 235, 185, 118, 207, 53, 92, 125, 205, 85, 72, 61, 182, 136, 4, 156, 96, 46, 16, 67, 153, 175, 125, 253, 105, +206, 156, 57, 71, 4, 32, 8, 131, 37, 108, 19, 17, 68, 4, 17, 65, 102, 146, 153, 88, 98, 46, 50, 80, 137, 200, 192, 134, 200, 192, 54, 150, +201, 113, 240, 210, 43, 251, 57, 119, 126, 133, 136, 68, 50, 173, 129, 109, 170, 68, 132, 80, 213, 217, 51, 167, 207, 98, 155, 183, 235, 184, 44, 99, +3, 1, 25, 193, 80, 197, 241, 227, 39, 121, 118, 239, 243, 124, 207, 7, 223, 139, 84, 124, 83, 210, 154, 169, 42, 90, 107, 216, 102, 211, 198, 141, +108, 219, 190, 149, 215, 14, 28, 164, 175, 1, 108, 36, 136, 128, 209, 168, 113, 195, 13, 123, 120, 224, 254, 251, 1, 35, 9, 219, 68, 4, 82, 33, +21, 195, 80, 100, 152, 200, 100, 46, 34, 136, 8, 50, 19, 219, 168, 138, 161, 6, 40, 211, 50, 217, 190, 99, 59, 219, 183, 111, 99, 168, 1, 219, +180, 214, 145, 25, 88, 133, 36, 108, 99, 27, 155, 139, 50, 130, 151, 247, 189, 206, 51, 79, 63, 135, 109, 8, 232, 85, 72, 98, 46, 34, 152, 139, +8, 108, 115, 145, 161, 36, 36, 33, 153, 200, 32, 8, 100, 1, 193, 69, 1, 179, 89, 207, 222, 189, 47, 32, 153, 174, 131, 204, 64, 18, 182, 177, +132, 36, 151, 244, 166, 44, 94, 125, 253, 13, 222, 46, 185, 12, 217, 216, 194, 50, 17, 129, 36, 50, 131, 103, 158, 121, 150, 163, 71, 143, 99, 27, +73, 84, 9, 169, 24, 134, 1, 91, 72, 98, 24, 138, 165, 165, 37, 222, 243, 158, 247, 176, 121, 243, 38, 90, 38, 4, 180, 46, 89, 92, 90, 96, +215, 149, 59, 249, 232, 199, 30, 102, 215, 149, 87, 48, 12, 3, 85, 3, 195, 48, 80, 53, 32, 23, 170, 194, 22, 146, 81, 9, 201, 24, 147, 145, +72, 34, 34, 176, 141, 74, 12, 195, 64, 63, 12, 12, 195, 64, 97, 218, 104, 196, 104, 97, 129, 236, 26, 146, 40, 21, 182, 193, 32, 153, 8, 147, +25, 156, 58, 117, 150, 127, 251, 197, 175, 194, 196, 203, 222, 0, 0, 32, 0, 73, 68, 65, 84, 48, 153, 204, 192, 129, 10, 178, 53, 200, 32, 91, +35, 34, 168, 42, 190, 41, 144, 68, 63, 155, 17, 4, 216, 216, 134, 128, 32, 192, 96, 155, 214, 26, 135, 14, 29, 101, 255, 190, 215, 201, 72, 34, +130, 185, 136, 64, 18, 6, 50, 98, 5, 124, 156, 119, 208, 113, 25, 150, 145, 189, 58, 194, 131, 236, 142, 11, 50, 147, 179, 103, 207, 243, 199, 127, +252, 85, 62, 254, 241, 135, 89, 92, 92, 4, 140, 36, 34, 2, 48, 54, 23, 4, 153, 201, 3, 15, 61, 64, 180, 228, 171, 127, 242, 56, 7, 222, +56, 192, 208, 247, 236, 220, 185, 131, 247, 127, 224, 189, 188, 251, 221, 15, 32, 13, 216, 198, 54, 17, 193, 48, 64, 63, 43, 70, 157, 104, 77, 68, +64, 102, 34, 9, 149, 32, 160, 181, 164, 69, 16, 54, 97, 46, 178, 132, 128, 4, 108, 48, 16, 97, 108, 161, 18, 178, 137, 8, 34, 128, 8, 206, +173, 174, 242, 249, 63, 250, 18, 135, 14, 31, 35, 34, 32, 32, 19, 100, 147, 17, 244, 85, 216, 69, 132, 0, 49, 39, 21, 195, 32, 250, 161, 144, +5, 17, 68, 128, 36, 50, 18, 27, 50, 3, 8, 158, 120, 226, 25, 78, 159, 57, 71, 107, 13, 27, 36, 17, 209, 32, 184, 168, 164, 21, 201, 71, +9, 115, 57, 29, 151, 97, 11, 236, 73, 16, 195, 208, 247, 157, 36, 136, 100, 238, 133, 231, 95, 226, 170, 43, 175, 224, 129, 7, 239, 67, 226, 162, +136, 192, 54, 146, 200, 76, 32, 137, 8, 30, 122, 247, 131, 220, 115, 207, 221, 156, 58, 121, 146, 126, 232, 89, 183, 110, 29, 219, 182, 109, 165, 181, +198, 48, 20, 96, 108, 19, 17, 128, 169, 234, 169, 234, 169, 161, 145, 217, 40, 21, 150, 176, 197, 92, 70, 35, 51, 201, 76, 50, 2, 1, 6, 74, +194, 24, 59, 200, 108, 88, 162, 84, 216, 230, 18, 19, 1, 231, 206, 175, 241, 232, 23, 255, 152, 151, 95, 218, 71, 68, 32, 21, 85, 3, 146, 128, +64, 18, 153, 9, 85, 100, 54, 36, 19, 17, 100, 38, 4, 96, 46, 138, 128, 32, 152, 51, 16, 1, 153, 201, 137, 55, 79, 243, 248, 227, 79, 98, +27, 219, 204, 101, 6, 115, 54, 72, 2, 251, 84, 223, 247, 199, 34, 184, 172, 142, 203, 176, 141, 237, 53, 225, 33, 91, 35, 29, 24, 136, 8, 250, +94, 60, 246, 216, 87, 89, 94, 191, 142, 91, 110, 185, 153, 136, 96, 206, 22, 6, 44, 33, 7, 65, 195, 54, 173, 5, 59, 175, 216, 78, 68, 96, +7, 85, 162, 74, 100, 6, 182, 121, 75, 132, 25, 106, 160, 52, 80, 53, 96, 139, 104, 201, 48, 12, 244, 179, 158, 190, 31, 144, 0, 7, 56, 48, +23, 68, 128, 141, 37, 132, 177, 19, 48, 182, 145, 196, 92, 4, 16, 201, 177, 99, 111, 242, 232, 23, 255, 152, 87, 95, 61, 8, 52, 170, 122, 108, +147, 153, 64, 32, 9, 219, 24, 51, 87, 85, 188, 69, 18, 227, 81, 71, 100, 16, 17, 216, 38, 51, 144, 64, 22, 38, 176, 197, 215, 30, 127, 146, +131, 7, 143, 16, 17, 216, 38, 34, 136, 8, 32, 152, 139, 8, 100, 191, 90, 85, 231, 50, 147, 203, 233, 184, 140, 194, 24, 175, 150, 220, 119, 93, +7, 97, 134, 190, 199, 230, 2, 115, 238, 236, 10, 159, 251, 189, 63, 164, 74, 220, 118, 219, 45, 24, 145, 110, 4, 16, 153, 68, 4, 25, 32, 21, +115, 17, 65, 68, 48, 103, 155, 136, 64, 10, 34, 130, 57, 219, 68, 36, 85, 197, 202, 249, 21, 78, 245, 103, 57, 191, 178, 202, 249, 243, 231, 89, +89, 89, 101, 58, 153, 34, 137, 204, 100, 212, 53, 198, 227, 96, 52, 78, 34, 6, 108, 97, 10, 28, 128, 169, 18, 96, 34, 146, 136, 100, 117, 50, +229, 229, 151, 94, 228, 169, 111, 236, 229, 216, 241, 147, 212, 32, 100, 83, 37, 36, 19, 145, 192, 128, 36, 136, 0, 67, 102, 3, 68, 213, 128, 109, +230, 100, 131, 33, 2, 236, 160, 100, 34, 0, 65, 100, 112, 226, 196, 105, 30, 125, 244, 49, 134, 161, 232, 186, 17, 111, 169, 18, 173, 5, 184, 17, +36, 114, 61, 127, 227, 181, 55, 173, 236, 123, 99, 31, 151, 211, 113, 25, 178, 177, 125, 182, 164, 105, 200, 12, 253, 64, 149, 176, 197, 48, 12, 216, +112, 252, 248, 73, 126, 235, 179, 191, 203, 185, 115, 231, 185, 251, 158, 59, 24, 141, 70, 204, 133, 130, 204, 134, 195, 204, 69, 36, 32, 34, 130, 185, +136, 192, 134, 8, 243, 22, 201, 128, 120, 243, 196, 97, 14, 31, 62, 206, 155, 39, 79, 113, 230, 204, 89, 214, 214, 214, 152, 205, 102, 72, 34, 51, +25, 143, 199, 44, 46, 45, 177, 113, 253, 50, 187, 119, 111, 99, 243, 166, 69, 2, 136, 8, 46, 49, 17, 9, 209, 88, 89, 89, 227, 224, 27, 135, +120, 102, 239, 11, 28, 58, 124, 148, 26, 138, 97, 40, 8, 192, 38, 51, 145, 138, 185, 190, 31, 176, 69, 16, 152, 192, 54, 153, 137, 36, 108, 99, +155, 170, 194, 54, 24, 164, 34, 8, 34, 147, 108, 13, 1, 127, 248, 135, 95, 226, 245, 215, 14, 67, 36, 182, 137, 8, 46, 49, 182, 137, 8, 36, +203, 142, 103, 143, 28, 63, 202, 209, 163, 199, 185, 156, 142, 203, 144, 10, 73, 103, 236, 209, 164, 170, 40, 137, 170, 129, 136, 36, 34, 8, 32, 51, +56, 119, 110, 133, 223, 251, 189, 207, 115, 244, 232, 49, 222, 243, 158, 7, 217, 186, 109, 11, 182, 176, 193, 97, 230, 34, 132, 13, 17, 16, 17, 68, +4, 17, 193, 156, 13, 182, 152, 59, 117, 250, 60, 123, 159, 121, 153, 227, 199, 223, 228, 204, 153, 83, 156, 59, 119, 158, 213, 213, 85, 250, 190, 199, +54, 151, 4, 27, 54, 108, 96, 219, 150, 205, 172, 223, 208, 177, 101, 243, 18, 198, 204, 69, 36, 231, 207, 175, 113, 252, 216, 155, 188, 113, 248, 8, +175, 189, 250, 58, 167, 78, 157, 161, 202, 116, 93, 135, 29, 100, 38, 150, 17, 66, 18, 96, 44, 97, 11, 8, 34, 2, 169, 176, 185, 40, 51, 177, +205, 92, 70, 64, 0, 17, 64, 16, 153, 148, 138, 209, 104, 204, 51, 207, 60, 207, 31, 253, 209, 151, 33, 18, 34, 152, 139, 8, 230, 34, 146, 204, +100, 78, 82, 95, 85, 175, 172, 13, 3, 239, 164, 227, 50, 60, 8, 171, 86, 145, 78, 87, 137, 214, 18, 169, 97, 139, 57, 89, 180, 214, 33, 153, +97, 86, 60, 246, 229, 175, 241, 242, 75, 251, 121, 255, 251, 30, 226, 182, 219, 111, 102, 253, 250, 117, 148, 5, 1, 4, 23, 152, 185, 204, 164, 69, +195, 54, 182, 113, 128, 129, 32, 56, 123, 246, 44, 175, 31, 120, 157, 195, 135, 142, 114, 232, 208, 65, 250, 126, 32, 2, 140, 152, 77, 123, 78, 156, +56, 65, 75, 184, 239, 222, 187, 185, 246, 158, 155, 185, 98, 199, 22, 44, 19, 17, 180, 214, 120, 241, 165, 215, 248, 252, 191, 249, 34, 167, 78, 157, +166, 4, 153, 73, 107, 73, 68, 146, 145, 200, 34, 34, 24, 84, 188, 165, 101, 67, 37, 186, 110, 68, 85, 81, 42, 36, 49, 12, 34, 34, 200, 76, +134, 97, 64, 50, 221, 66, 199, 210, 226, 24, 91, 100, 4, 115, 153, 141, 195, 71, 79, 240, 155, 255, 231, 191, 226, 236, 217, 85, 50, 19, 219, 204, +217, 38, 51, 185, 196, 68, 6, 17, 76, 92, 58, 103, 204, 59, 233, 184, 12, 169, 168, 170, 169, 170, 142, 141, 198, 99, 196, 55, 85, 21, 125, 223, +19, 17, 68, 4, 198, 84, 137, 3, 7, 14, 241, 47, 14, 255, 54, 187, 119, 95, 201, 61, 247, 220, 193, 173, 183, 220, 204, 150, 173, 155, 232, 186, +134, 44, 34, 18, 75, 252, 223, 213, 193, 91, 240, 231, 247, 125, 223, 245, 231, 235, 253, 254, 252, 254, 199, 213, 238, 234, 96, 157, 173, 147, 79, 137, +92, 199, 78, 161, 101, 154, 50, 147, 146, 25, 66, 153, 41, 229, 152, 97, 114, 65, 153, 97, 166, 189, 229, 146, 43, 110, 24, 46, 152, 1, 238, 128, +14, 195, 5, 164, 153, 0, 197, 197, 83, 26, 55, 208, 184, 57, 214, 137, 237, 38, 150, 101, 71, 138, 117, 176, 180, 90, 89, 210, 106, 87, 218, 243, +254, 79, 191, 239, 231, 253, 126, 177, 63, 41, 10, 30, 198, 146, 108, 147, 148, 244, 241, 88, 92, 72, 194, 221, 72, 66, 136, 182, 185, 251, 206, 59, +120, 226, 177, 135, 184, 117, 227, 58, 135, 7, 55, 184, 120, 233, 45, 118, 118, 246, 56, 123, 246, 12, 203, 178, 240, 224, 67, 31, 225, 95, 249, 233, +191, 196, 103, 62, 253, 41, 238, 190, 231, 110, 70, 6, 221, 69, 100, 112, 245, 234, 77, 190, 244, 171, 191, 197, 235, 111, 92, 100, 123, 123, 133, 36, +64, 72, 193, 200, 4, 9, 33, 108, 3, 166, 102, 177, 209, 110, 218, 6, 140, 221, 204, 57, 217, 144, 68, 85, 81, 85, 188, 39, 34, 216, 221, 219, +5, 27, 99, 66, 201, 173, 131, 35, 254, 247, 191, 247, 69, 94, 120, 241, 28, 82, 34, 9, 73, 188, 199, 54, 146, 216, 176, 27, 155, 19, 211, 39, +182, 121, 63, 131, 247, 113, 243, 230, 225, 209, 222, 222, 238, 69, 4, 53, 27, 108, 64, 68, 4, 153, 73, 85, 1, 162, 170, 145, 132, 109, 142, 79, +78, 120, 241, 197, 115, 188, 248, 226, 75, 220, 117, 247, 157, 60, 242, 200, 195, 60, 246, 216, 35, 60, 112, 223, 125, 220, 121, 215, 89, 118, 118, 86, +172, 198, 32, 51, 201, 76, 66, 162, 108, 108, 179, 26, 193, 103, 63, 251, 41, 62, 246, 177, 135, 249, 169, 191, 244, 19, 60, 255, 194, 139, 124, 243, +155, 207, 241, 246, 229, 235, 220, 127, 255, 93, 252, 244, 79, 255, 11, 60, 252, 224, 253, 40, 205, 156, 107, 114, 236, 160, 16, 54, 60, 253, 141, 103, +120, 243, 205, 75, 140, 76, 108, 147, 153, 72, 162, 187, 209, 106, 240, 46, 209, 221, 72, 65, 68, 96, 160, 187, 17, 208, 109, 48, 216, 38, 51, 233, +158, 72, 98, 163, 187, 137, 16, 123, 123, 187, 236, 237, 238, 210, 109, 20, 226, 120, 61, 249, 194, 23, 126, 133, 175, 124, 245, 235, 68, 36, 27, 221, +77, 68, 176, 33, 137, 119, 137, 238, 166, 91, 140, 49, 144, 132, 109, 222, 207, 224, 125, 60, 244, 209, 251, 234, 228, 120, 253, 90, 85, 209, 213, 68, +6, 85, 133, 16, 32, 64, 188, 203, 128, 137, 16, 115, 26, 133, 168, 130, 75, 23, 223, 230, 194, 27, 151, 248, 234, 87, 190, 206, 246, 246, 54, 219, +219, 43, 78, 157, 222, 231, 212, 222, 62, 35, 7, 247, 220, 115, 55, 255, 242, 95, 254, 139, 220, 255, 192, 71, 0, 179, 49, 107, 178, 44, 199, 236, +238, 38, 31, 255, 216, 131, 156, 218, 31, 60, 243, 204, 243, 220, 243, 145, 59, 217, 221, 9, 14, 15, 111, 161, 16, 85, 133, 27, 132, 185, 114, 237, +58, 223, 120, 250, 15, 88, 102, 177, 181, 21, 136, 160, 219, 128, 201, 4, 204, 109, 166, 170, 168, 106, 196, 109, 130, 174, 162, 13, 8, 20, 66, 36, +217, 201, 156, 197, 156, 133, 109, 36, 145, 153, 116, 55, 119, 222, 121, 150, 221, 189, 29, 114, 12, 110, 221, 58, 228, 239, 125, 225, 87, 248, 245, 95, +255, 50, 221, 38, 34, 216, 176, 205, 134, 36, 254, 31, 70, 18, 54, 216, 2, 2, 73, 188, 159, 193, 247, 241, 235, 191, 253, 59, 252, 107, 63, 251, +51, 148, 253, 138, 219, 29, 82, 148, 27, 73, 84, 55, 85, 19, 219, 72, 65, 183, 177, 65, 10, 4, 184, 77, 42, 32, 204, 156, 19, 12, 135, 71, +39, 220, 188, 117, 200, 197, 75, 87, 216, 168, 42, 108, 243, 135, 223, 126, 158, 159, 255, 249, 127, 155, 143, 127, 236, 81, 170, 38, 115, 46, 204, 229, +132, 147, 245, 49, 235, 245, 154, 213, 74, 124, 226, 19, 15, 33, 193, 250, 228, 132, 145, 43, 150, 165, 56, 58, 58, 38, 115, 197, 214, 106, 197, 243, +207, 189, 196, 197, 75, 111, 99, 139, 110, 19, 1, 2, 186, 27, 9, 102, 21, 18, 84, 21, 96, 64, 84, 53, 179, 138, 141, 170, 194, 109, 170, 10, +219, 108, 100, 38, 85, 69, 119, 227, 110, 78, 214, 107, 238, 190, 231, 46, 118, 119, 118, 185, 116, 233, 10, 255, 219, 231, 255, 1, 95, 253, 218, 83, +116, 155, 136, 192, 54, 17, 129, 36, 108, 99, 27, 73, 72, 2, 68, 102, 18, 145, 216, 148, 77, 217, 226, 253, 12, 222, 199, 178, 94, 48, 188, 92, +85, 107, 208, 78, 117, 33, 5, 115, 46, 216, 166, 219, 216, 147, 170, 34, 36, 26, 48, 208, 93, 8, 49, 103, 97, 243, 142, 136, 160, 187, 145, 68, +68, 176, 81, 85, 156, 123, 229, 85, 126, 225, 239, 252, 93, 254, 195, 191, 241, 239, 243, 177, 39, 62, 74, 119, 115, 116, 124, 204, 141, 27, 55, 185, +114, 229, 42, 151, 47, 95, 225, 230, 205, 27, 44, 203, 100, 181, 218, 102, 103, 123, 155, 179, 103, 239, 228, 145, 71, 30, 225, 244, 233, 51, 28, 28, +28, 243, 244, 55, 158, 97, 89, 79, 198, 24, 116, 21, 206, 32, 98, 133, 16, 99, 12, 220, 205, 106, 123, 11, 27, 214, 235, 53, 17, 73, 183, 17, +194, 54, 115, 22, 182, 89, 150, 133, 238, 198, 54, 18, 239, 152, 115, 98, 155, 173, 213, 138, 71, 30, 125, 152, 103, 190, 253, 34, 159, 255, 252, 63, +224, 197, 23, 207, 33, 9, 73, 216, 70, 18, 221, 77, 68, 16, 17, 116, 55, 146, 176, 141, 36, 170, 10, 41, 144, 116, 36, 233, 8, 204, 251, 73, +222, 199, 195, 15, 63, 68, 119, 239, 68, 232, 231, 16, 119, 180, 193, 221, 84, 23, 93, 13, 24, 119, 99, 140, 13, 203, 178, 96, 27, 219, 216, 96, +55, 118, 99, 131, 219, 84, 55, 182, 145, 132, 109, 108, 99, 224, 250, 245, 155, 188, 114, 254, 187, 60, 242, 200, 67, 220, 115, 207, 93, 172, 215, 199, +92, 185, 114, 133, 215, 94, 191, 192, 133, 11, 111, 241, 246, 219, 215, 184, 121, 243, 144, 245, 201, 194, 206, 206, 54, 15, 61, 120, 63, 15, 63, 252, +16, 251, 251, 167, 248, 218, 215, 158, 226, 235, 95, 255, 38, 153, 43, 114, 12, 144, 176, 27, 183, 81, 136, 136, 96, 35, 51, 177, 161, 170, 153, 115, +34, 192, 54, 146, 152, 53, 169, 106, 16, 116, 155, 170, 162, 202, 84, 21, 221, 13, 8, 219, 68, 4, 191, 246, 143, 127, 139, 215, 95, 127, 147, 136, +64, 18, 239, 145, 68, 68, 176, 33, 9, 219, 72, 34, 51, 201, 76, 192, 128, 136, 136, 55, 109, 255, 79, 146, 110, 28, 28, 28, 240, 253, 12, 62, +64, 87, 95, 4, 93, 168, 238, 7, 187, 27, 219, 100, 14, 108, 179, 177, 120, 66, 55, 85, 133, 221, 216, 198, 54, 110, 35, 132, 16, 229, 162, 91, +216, 102, 163, 187, 145, 132, 36, 82, 73, 35, 206, 157, 251, 46, 191, 240, 119, 62, 207, 127, 240, 55, 254, 61, 30, 126, 240, 35, 60, 248, 224, 3, +108, 111, 111, 241, 224, 3, 247, 113, 116, 120, 4, 152, 221, 189, 93, 206, 158, 61, 195, 153, 59, 78, 179, 179, 189, 197, 235, 175, 95, 228, 119, 191, +242, 251, 44, 179, 136, 48, 138, 193, 24, 131, 170, 66, 17, 108, 116, 155, 204, 192, 54, 221, 141, 109, 192, 180, 205, 70, 117, 19, 145, 40, 26, 181, +144, 64, 18, 17, 98, 189, 94, 179, 209, 93, 172, 215, 39, 124, 235, 155, 207, 18, 17, 140, 49, 248, 94, 182, 177, 141, 36, 54, 108, 35, 137, 136, +0, 68, 85, 49, 70, 16, 17, 216, 190, 105, 251, 150, 36, 222, 79, 242, 62, 62, 250, 208, 131, 92, 189, 118, 125, 189, 183, 191, 247, 87, 36, 253, +57, 219, 96, 110, 51, 54, 116, 23, 115, 78, 34, 130, 238, 166, 170, 217, 48, 198, 24, 219, 216, 70, 10, 186, 141, 36, 222, 83, 85, 216, 102, 195, +54, 182, 185, 126, 253, 38, 231, 206, 189, 202, 71, 31, 126, 136, 187, 238, 60, 139, 4, 91, 219, 43, 246, 246, 119, 216, 223, 223, 229, 212, 169, 83, +236, 237, 237, 177, 187, 183, 207, 193, 193, 49, 191, 252, 203, 95, 226, 252, 171, 111, 144, 25, 216, 38, 35, 177, 205, 198, 106, 12, 54, 50, 147, 204, +164, 187, 232, 54, 27, 17, 73, 85, 81, 53, 193, 80, 221, 116, 55, 179, 138, 170, 137, 36, 230, 44, 186, 155, 238, 166, 170, 144, 196, 24, 3, 73, +116, 55, 27, 221, 205, 134, 36, 222, 35, 9, 73, 108, 72, 66, 2, 73, 68, 136, 49, 18, 41, 158, 94, 175, 215, 191, 152, 153, 125, 112, 112, 192, +247, 147, 188, 143, 143, 126, 244, 33, 238, 187, 239, 94, 47, 203, 242, 99, 153, 227, 103, 170, 138, 57, 39, 221, 205, 70, 87, 211, 221, 216, 208, 221, +216, 77, 85, 99, 155, 119, 24, 12, 216, 198, 136, 141, 170, 162, 187, 233, 110, 54, 108, 51, 231, 68, 18, 27, 87, 175, 222, 224, 249, 231, 191, 195, +238, 222, 46, 31, 249, 200, 221, 172, 182, 86, 100, 14, 182, 183, 118, 216, 218, 222, 1, 39, 175, 191, 246, 22, 255, 215, 255, 249, 155, 60, 255, 252, +75, 40, 196, 70, 230, 64, 33, 16, 140, 49, 104, 155, 80, 96, 67, 102, 130, 1, 1, 54, 221, 141, 219, 216, 166, 170, 17, 48, 171, 88, 47, 107, +170, 154, 13, 155, 119, 84, 21, 221, 77, 102, 34, 9, 73, 108, 216, 70, 18, 182, 249, 94, 17, 129, 109, 36, 177, 33, 9, 73, 216, 38, 34, 1, +125, 233, 210, 165, 75, 255, 112, 127, 127, 159, 131, 131, 3, 190, 159, 228, 125, 124, 247, 181, 215, 121, 224, 254, 251, 232, 246, 61, 171, 213, 248, 183, +128, 49, 70, 82, 213, 204, 185, 176, 209, 213, 108, 216, 96, 155, 119, 25, 119, 99, 27, 187, 193, 6, 137, 110, 211, 221, 116, 55, 182, 121, 143, 109, +54, 36, 1, 230, 224, 224, 144, 231, 158, 251, 14, 175, 189, 246, 38, 235, 165, 88, 102, 115, 229, 234, 77, 190, 243, 226, 119, 249, 202, 239, 126, 131, +223, 253, 202, 239, 115, 249, 242, 85, 20, 65, 230, 224, 61, 54, 100, 4, 57, 6, 27, 145, 73, 68, 16, 18, 109, 35, 137, 57, 139, 234, 6, 137, +147, 147, 53, 85, 147, 89, 69, 119, 209, 54, 32, 230, 156, 128, 88, 150, 133, 57, 39, 182, 89, 173, 86, 124, 175, 136, 192, 54, 146, 136, 8, 54, +108, 179, 33, 137, 136, 96, 35, 66, 68, 136, 136, 96, 140, 193, 109, 191, 116, 230, 204, 153, 175, 85, 21, 7, 7, 7, 124, 63, 131, 15, 96, 27, +219, 207, 117, 251, 114, 68, 62, 184, 44, 107, 34, 68, 102, 82, 85, 204, 57, 65, 98, 206, 194, 110, 54, 108, 110, 19, 118, 97, 155, 101, 78, 20, +73, 85, 209, 221, 216, 70, 18, 182, 169, 42, 50, 147, 170, 162, 187, 217, 144, 130, 101, 22, 207, 254, 225, 119, 120, 238, 249, 151, 89, 173, 2, 41, +49, 224, 134, 72, 145, 17, 68, 4, 138, 6, 195, 200, 32, 199, 0, 137, 170, 98, 181, 90, 33, 9, 219, 108, 68, 136, 245, 122, 193, 109, 170, 38, +110, 35, 241, 142, 49, 6, 179, 38, 27, 221, 133, 109, 192, 72, 194, 54, 99, 12, 54, 50, 147, 238, 230, 61, 17, 193, 123, 36, 97, 155, 238, 102, +140, 129, 109, 36, 33, 5, 182, 217, 144, 226, 150, 221, 223, 182, 205, 165, 75, 151, 120, 63, 131, 15, 48, 231, 194, 156, 245, 250, 24, 227, 249, 49, +242, 193, 57, 11, 219, 8, 17, 10, 222, 147, 25, 204, 217, 72, 252, 49, 41, 80, 192, 24, 131, 101, 54, 146, 136, 8, 54, 108, 179, 209, 221, 68, +4, 146, 88, 150, 197, 85, 245, 150, 237, 206, 204, 123, 51, 51, 186, 77, 21, 183, 53, 118, 147, 153, 96, 176, 141, 109, 236, 38, 35, 105, 55, 234, +194, 134, 213, 24, 72, 162, 187, 193, 70, 219, 91, 128, 145, 192, 128, 20, 156, 44, 199, 8, 144, 68, 119, 131, 65, 10, 64, 216, 32, 129, 36, 108, +19, 17, 108, 216, 70, 18, 182, 217, 144, 132, 109, 170, 138, 204, 68, 18, 146, 216, 136, 72, 192, 216, 77, 166, 0, 211, 61, 223, 236, 230, 5, 219, +124, 144, 224, 3, 44, 179, 249, 115, 159, 254, 228, 141, 170, 249, 7, 85, 133, 221, 108, 204, 42, 102, 53, 57, 6, 82, 16, 145, 216, 166, 219, 108, +216, 166, 186, 233, 110, 20, 129, 36, 108, 99, 27, 219, 116, 55, 203, 178, 176, 81, 85, 172, 215, 107, 159, 156, 156, 252, 175, 221, 253, 87, 151, 101, +249, 217, 101, 89, 254, 251, 170, 90, 115, 219, 156, 69, 85, 209, 109, 54, 50, 131, 119, 216, 132, 18, 73, 108, 84, 53, 96, 12, 204, 101, 193, 54, +17, 129, 36, 108, 35, 5, 237, 198, 110, 34, 130, 234, 102, 163, 186, 152, 85, 44, 75, 209, 13, 17, 201, 156, 147, 245, 122, 189, 72, 42, 254, 72, +85, 97, 155, 13, 219, 116, 55, 182, 249, 127, 179, 161, 219, 216, 16, 17, 68, 4, 153, 201, 109, 79, 207, 89, 23, 108, 243, 65, 146, 15, 112, 225, +194, 155, 156, 58, 117, 138, 110, 223, 3, 250, 55, 193, 17, 18, 27, 85, 141, 13, 221, 133, 128, 57, 11, 219, 116, 55, 118, 35, 9, 27, 108, 3, +98, 195, 54, 203, 178, 176, 145, 153, 100, 38, 221, 205, 241, 241, 241, 83, 221, 253, 183, 186, 251, 57, 73, 151, 186, 251, 183, 129, 251, 199, 24, 127, +62, 51, 177, 141, 13, 99, 36, 96, 36, 145, 99, 96, 192, 109, 16, 100, 36, 25, 129, 34, 64, 16, 17, 100, 36, 17, 65, 119, 99, 155, 245, 122, +205, 198, 156, 147, 141, 170, 194, 109, 204, 134, 168, 42, 186, 155, 170, 98, 206, 249, 173, 204, 140, 219, 78, 69, 4, 146, 176, 205, 134, 36, 34, 130, +13, 73, 108, 72, 66, 18, 27, 17, 66, 18, 99, 36, 153, 1, 8, 219, 127, 123, 140, 252, 202, 155, 111, 94, 228, 131, 4, 31, 98, 189, 94, 152, +115, 126, 203, 246, 91, 99, 12, 218, 102, 206, 201, 134, 36, 164, 160, 109, 192, 108, 216, 141, 13, 221, 102, 195, 54, 115, 78, 108, 99, 155, 49, 6, +146, 168, 42, 150, 101, 97, 89, 22, 108, 255, 221, 204, 60, 47, 9, 219, 68, 196, 205, 170, 250, 47, 215, 203, 250, 133, 170, 66, 18, 99, 36, 54, +216, 220, 38, 36, 177, 97, 160, 102, 33, 137, 182, 169, 154, 116, 27, 12, 109, 51, 231, 100, 206, 73, 85, 147, 145, 116, 55, 17, 65, 102, 82, 213, +28, 31, 31, 83, 213, 216, 166, 187, 169, 42, 186, 251, 0, 248, 98, 132, 150, 204, 68, 18, 153, 137, 36, 36, 33, 9, 219, 72, 34, 34, 200, 76, +34, 130, 204, 100, 181, 74, 50, 69, 166, 200, 12, 64, 68, 196, 5, 219, 191, 93, 85, 124, 152, 224, 67, 216, 80, 213, 175, 116, 247, 75, 199, 71, +199, 204, 57, 201, 28, 72, 66, 2, 219, 204, 57, 233, 54, 221, 77, 183, 233, 110, 186, 139, 170, 162, 187, 137, 16, 115, 78, 230, 156, 72, 194, 54, +146, 216, 168, 170, 235, 192, 151, 185, 205, 54, 27, 22, 216, 126, 177, 170, 254, 143, 238, 102, 67, 18, 221, 13, 4, 82, 178, 94, 79, 92, 32, 5, +17, 194, 54, 146, 48, 48, 198, 32, 50, 201, 76, 186, 155, 185, 20, 235, 245, 194, 122, 89, 232, 106, 220, 102, 206, 137, 109, 36, 192, 102, 206, 201, +187, 68, 151, 191, 177, 202, 124, 54, 34, 238, 144, 196, 134, 109, 34, 130, 136, 32, 34, 144, 132, 109, 34, 130, 136, 32, 66, 216, 133, 4, 146, 200, +12, 64, 100, 174, 144, 242, 203, 115, 214, 243, 32, 62, 76, 240, 33, 186, 155, 175, 63, 245, 244, 77, 219, 79, 101, 38, 182, 177, 77, 205, 133, 101, +89, 176, 141, 36, 54, 236, 70, 18, 221, 141, 36, 54, 34, 196, 156, 133, 36, 36, 209, 221, 72, 66, 18, 182, 185, 237, 130, 237, 215, 248, 30, 174, +102, 140, 97, 204, 175, 74, 58, 144, 196, 134, 36, 186, 155, 182, 17, 2, 9, 187, 81, 4, 237, 38, 51, 201, 76, 186, 155, 174, 162, 187, 168, 106, +34, 19, 108, 186, 139, 182, 169, 46, 108, 112, 55, 182, 105, 55, 138, 96, 140, 193, 109, 221, 230, 239, 175, 86, 91, 91, 224, 59, 248, 35, 146, 120, +143, 36, 34, 130, 204, 228, 93, 198, 54, 17, 137, 20, 72, 34, 34, 1, 35, 105, 13, 124, 97, 127, 255, 212, 73, 55, 31, 42, 248, 16, 221, 205, +191, 244, 23, 255, 188, 171, 230, 87, 21, 90, 86, 171, 65, 8, 20, 129, 36, 170, 38, 27, 182, 145, 132, 109, 108, 99, 243, 142, 101, 153, 116, 55, +27, 17, 129, 36, 36, 97, 27, 219, 84, 213, 53, 219, 87, 186, 155, 199, 31, 251, 24, 143, 63, 250, 24, 143, 63, 250, 152, 94, 125, 234, 89, 34, +226, 5, 219, 175, 74, 66, 18, 146, 216, 112, 55, 10, 97, 55, 180, 145, 130, 136, 100, 206, 137, 219, 84, 21, 203, 156, 84, 53, 96, 186, 27, 219, +140, 49, 176, 77, 119, 51, 231, 164, 109, 186, 77, 87, 51, 151, 133, 245, 122, 205, 178, 44, 47, 111, 111, 109, 125, 25, 241, 241, 188, 45, 66, 68, +4, 153, 73, 102, 146, 153, 72, 66, 18, 239, 145, 32, 51, 136, 72, 108, 144, 68, 119, 3, 194, 237, 111, 206, 57, 127, 227, 228, 228, 132, 183, 222, +186, 196, 135, 9, 62, 196, 55, 158, 254, 22, 115, 22, 115, 246, 83, 115, 214, 155, 110, 83, 221, 128, 144, 130, 136, 68, 18, 171, 213, 138, 213, 88, +177, 33, 137, 170, 162, 187, 17, 16, 17, 116, 55, 221, 77, 119, 211, 221, 116, 55, 2, 36, 85, 68, 244, 103, 126, 236, 211, 82, 207, 196, 94, 185, +123, 235, 167, 254, 218, 207, 238, 158, 57, 117, 199, 173, 174, 122, 163, 187, 145, 132, 109, 36, 17, 17, 72, 66, 1, 229, 166, 170, 232, 42, 150, 101, +97, 35, 51, 201, 76, 192, 216, 102, 206, 201, 172, 162, 102, 97, 27, 219, 116, 155, 89, 141, 9, 20, 73, 102, 98, 27, 236, 95, 191, 99, 127, 239, +138, 228, 79, 70, 4, 82, 176, 97, 155, 141, 170, 162, 187, 145, 68, 68, 32, 9, 16, 27, 146, 201, 12, 34, 2, 99, 66, 242, 106, 140, 207, 239, +140, 173, 139, 221, 205, 15, 34, 248, 1, 116, 55, 115, 206, 87, 109, 255, 65, 85, 97, 155, 238, 194, 54, 153, 129, 109, 108, 83, 221, 100, 38, 99, +12, 70, 38, 238, 34, 34, 136, 16, 27, 182, 217, 176, 141, 36, 102, 21, 6, 237, 239, 237, 143, 91, 7, 183, 182, 218, 222, 118, 247, 142, 237, 157, +238, 222, 221, 222, 222, 201, 136, 184, 32, 137, 238, 102, 195, 54, 223, 43, 51, 8, 137, 141, 144, 216, 144, 32, 66, 116, 53, 85, 13, 54, 17, 193, +172, 162, 187, 176, 65, 17, 100, 14, 108, 51, 231, 164, 187, 89, 150, 229, 237, 49, 198, 111, 218, 125, 151, 34, 158, 224, 29, 6, 76, 119, 19, 33, +50, 19, 219, 188, 71, 18, 18, 68, 8, 73, 188, 103, 100, 146, 153, 207, 85, 213, 23, 14, 79, 142, 216, 223, 221, 231, 137, 199, 158, 224, 195, 4, +63, 128, 111, 60, 253, 7, 236, 237, 237, 28, 86, 213, 111, 42, 2, 219, 116, 27, 48, 235, 245, 194, 156, 147, 238, 98, 206, 133, 8, 97, 155, 234, +162, 219, 116, 55, 182, 145, 132, 36, 54, 36, 241, 14, 9, 68, 108, 175, 86, 59, 221, 181, 211, 221, 187, 213, 189, 219, 221, 123, 93, 189, 7, 236, +72, 186, 213, 221, 116, 55, 221, 205, 70, 85, 81, 53, 89, 150, 53, 27, 145, 73, 132, 136, 8, 186, 138, 170, 166, 170, 49, 32, 137, 118, 51, 231, +66, 119, 179, 94, 175, 169, 154, 184, 155, 238, 166, 187, 169, 42, 214, 235, 53, 182, 127, 127, 103, 103, 231, 181, 234, 122, 56, 20, 143, 100, 38, 153, +34, 51, 136, 0, 27, 108, 147, 153, 100, 38, 153, 137, 36, 34, 2, 73, 72, 34, 34, 136, 8, 86, 171, 45, 219, 253, 63, 175, 74, 231, 239, 216, +63, 21, 1, 162, 139, 39, 30, 125, 156, 15, 50, 248, 1, 29, 159, 172, 177, 249, 39, 171, 149, 46, 71, 232, 110, 48, 115, 153, 84, 21, 85, 69, +132, 144, 196, 178, 76, 170, 154, 57, 27, 69, 96, 68, 119, 1, 98, 195, 54, 221, 205, 70, 132, 88, 229, 216, 157, 85, 103, 203, 190, 233, 246, 176, +157, 224, 180, 73, 64, 183, 29, 75, 162, 187, 89, 173, 86, 100, 38, 153, 9, 152, 110, 211, 109, 186, 155, 28, 3, 100, 54, 50, 147, 57, 39, 153, +65, 68, 224, 54, 203, 178, 96, 64, 145, 116, 23, 221, 147, 110, 19, 17, 116, 21, 174, 62, 92, 229, 248, 178, 32, 192, 159, 24, 35, 239, 228, 54, +219, 128, 145, 2, 137, 219, 154, 136, 68, 130, 8, 209, 13, 18, 72, 16, 17, 68, 136, 140, 68, 248, 27, 224, 255, 101, 108, 15, 149, 59, 64, 213, +10, 132, 249, 32, 193, 15, 168, 219, 204, 89, 207, 44, 203, 242, 251, 85, 69, 119, 211, 54, 146, 200, 76, 34, 130, 80, 80, 93, 40, 68, 102, 50, +198, 138, 13, 41, 176, 141, 36, 36, 33, 9, 219, 140, 28, 8, 206, 84, 213, 71, 220, 222, 177, 123, 215, 238, 221, 238, 222, 107, 247, 94, 119, 239, +131, 182, 184, 77, 18, 153, 137, 36, 36, 81, 213, 8, 8, 9, 108, 150, 101, 97, 206, 66, 18, 221, 133, 109, 164, 96, 89, 47, 84, 55, 146, 176, +161, 187, 169, 106, 230, 44, 230, 156, 84, 21, 115, 22, 221, 253, 252, 214, 106, 245, 74, 87, 239, 71, 198, 147, 153, 177, 189, 90, 37, 138, 32, 51, +200, 12, 34, 130, 213, 106, 69, 132, 176, 27, 219, 100, 6, 146, 200, 76, 36, 200, 72, 34, 226, 176, 187, 255, 219, 17, 171, 215, 203, 29, 128, 16, +18, 230, 195, 4, 63, 160, 170, 102, 127, 119, 235, 86, 119, 253, 67, 80, 71, 4, 171, 213, 138, 213, 24, 216, 166, 187, 105, 27, 41, 248, 94, 82, +96, 27, 219, 108, 216, 198, 54, 239, 177, 57, 235, 246, 125, 118, 111, 87, 247, 110, 117, 239, 181, 189, 219, 221, 123, 213, 181, 111, 247, 25, 73, 68, +4, 221, 77, 85, 81, 85, 68, 4, 57, 6, 198, 68, 136, 238, 162, 187, 1, 97, 131, 36, 106, 78, 102, 21, 33, 17, 145, 96, 179, 44, 11, 27, +17, 129, 109, 54, 236, 94, 34, 226, 107, 72, 13, 156, 14, 197, 143, 75, 65, 230, 64, 130, 136, 96, 140, 65, 102, 32, 37, 17, 65, 102, 34, 137, +8, 145, 153, 68, 36, 82, 16, 17, 216, 254, 130, 237, 47, 74, 4, 32, 254, 152, 0, 241, 65, 130, 31, 208, 179, 207, 254, 33, 199, 39, 107, 230, +236, 95, 5, 206, 71, 4, 221, 77, 219, 100, 38, 54, 116, 55, 35, 19, 119, 35, 65, 132, 176, 139, 136, 32, 34, 168, 42, 108, 19, 17, 68, 4, +182, 81, 232, 84, 211, 31, 45, 123, 167, 187, 119, 186, 189, 227, 238, 93, 119, 239, 85, 213, 190, 225, 78, 254, 72, 119, 35, 9, 73, 216, 166, 187, +9, 5, 17, 193, 214, 214, 54, 91, 91, 91, 68, 136, 174, 98, 46, 11, 85, 69, 102, 98, 160, 187, 104, 27, 27, 170, 76, 85, 97, 155, 170, 194, +246, 43, 91, 91, 91, 47, 218, 30, 202, 184, 127, 107, 103, 247, 209, 49, 182, 168, 134, 49, 182, 128, 4, 68, 68, 18, 33, 34, 146, 136, 224, 93, +98, 53, 6, 35, 147, 145, 137, 224, 235, 180, 255, 235, 85, 172, 14, 176, 184, 205, 128, 217, 144, 248, 48, 193, 15, 161, 38, 220, 188, 113, 244, 98, +85, 255, 74, 119, 51, 231, 68, 130, 238, 6, 76, 102, 0, 70, 226, 29, 221, 69, 102, 242, 30, 73, 68, 4, 27, 17, 65, 102, 18, 17, 163, 237, +143, 119, 247, 142, 237, 29, 187, 119, 186, 122, 183, 187, 119, 186, 123, 223, 246, 221, 220, 38, 137, 136, 192, 54, 182, 145, 32, 4, 146, 168, 42, 236, +6, 76, 85, 35, 9, 99, 12, 116, 55, 203, 178, 80, 85, 132, 2, 27, 36, 97, 131, 36, 230, 156, 5, 122, 42, 34, 142, 5, 219, 33, 61, 250, +137, 79, 124, 226, 236, 125, 247, 63, 192, 131, 15, 62, 196, 24, 43, 238, 191, 255, 126, 246, 246, 246, 57, 125, 250, 12, 99, 172, 200, 76, 36, 17, +17, 100, 38, 182, 1, 3, 62, 95, 213, 255, 77, 106, 188, 37, 148, 2, 27, 12, 24, 227, 173, 154, 216, 205, 7, 9, 126, 8, 221, 197, 233, 51, +123, 93, 85, 191, 4, 92, 138, 8, 36, 129, 141, 219, 72, 194, 230, 29, 153, 9, 136, 238, 166, 187, 137, 8, 50, 147, 238, 102, 195, 54, 27, 153, +73, 102, 126, 188, 230, 220, 119, 123, 203, 221, 219, 118, 111, 219, 222, 110, 247, 105, 73, 119, 74, 98, 67, 18, 153, 137, 36, 36, 33, 5, 221, 69, +85, 99, 67, 68, 16, 17, 40, 2, 33, 186, 139, 154, 147, 170, 194, 134, 101, 153, 72, 162, 187, 177, 77, 85, 97, 251, 149, 213, 106, 245, 135, 64, +70, 228, 174, 164, 211, 23, 46, 92, 200, 245, 250, 132, 157, 157, 29, 246, 246, 246, 184, 247, 222, 123, 57, 125, 250, 52, 247, 222, 123, 47, 71, 71, +71, 204, 89, 68, 4, 171, 213, 138, 13, 73, 220, 246, 70, 205, 250, 69, 183, 223, 104, 247, 221, 192, 54, 82, 27, 186, 81, 163, 240, 58, 146, 115, +175, 158, 231, 131, 36, 63, 132, 183, 47, 95, 230, 238, 187, 239, 98, 89, 47, 23, 115, 228, 227, 17, 241, 47, 118, 155, 28, 3, 69, 128, 33, 199, +96, 86, 209, 93, 8, 48, 70, 10, 34, 130, 170, 34, 51, 169, 42, 222, 35, 137, 238, 118, 72, 191, 43, 81, 109, 111, 217, 94, 25, 70, 117, 223, +135, 248, 87, 51, 115, 63, 51, 137, 8, 34, 2, 219, 100, 36, 153, 66, 18, 146, 144, 4, 134, 145, 9, 18, 216, 116, 155, 165, 38, 27, 85, 69, +119, 19, 145, 116, 55, 238, 166, 103, 45, 192, 151, 86, 171, 213, 75, 66, 139, 4, 15, 62, 248, 208, 195, 183, 110, 222, 252, 204, 193, 193, 173, 184, +118, 245, 42, 115, 78, 46, 95, 190, 204, 209, 209, 17, 87, 174, 92, 225, 228, 228, 4, 73, 140, 28, 8, 17, 138, 217, 246, 183, 215, 235, 229, 239, +183, 121, 46, 20, 7, 138, 184, 21, 210, 77, 164, 99, 164, 6, 219, 152, 115, 175, 190, 194, 135, 73, 126, 72, 111, 189, 125, 153, 251, 30, 184, 175, +221, 253, 122, 100, 254, 213, 64, 103, 109, 35, 160, 221, 84, 53, 203, 156, 132, 4, 152, 110, 131, 2, 219, 84, 21, 17, 129, 109, 186, 155, 204, 68, +18, 85, 165, 219, 126, 39, 34, 14, 128, 149, 97, 24, 71, 187, 31, 31, 99, 252, 149, 213, 106, 53, 248, 35, 146, 144, 68, 102, 48, 198, 32, 51, +145, 68, 68, 144, 17, 84, 55, 118, 83, 213, 72, 208, 109, 140, 233, 110, 218, 208, 109, 170, 138, 185, 44, 244, 236, 231, 182, 183, 183, 127, 45, 20, +7, 130, 67, 164, 163, 204, 188, 188, 179, 189, 115, 243, 240, 224, 224, 12, 104, 107, 189, 94, 198, 178, 172, 181, 172, 23, 186, 155, 237, 237, 109, 86, +171, 213, 146, 138, 91, 192, 185, 154, 243, 55, 150, 245, 252, 146, 164, 239, 100, 230, 91, 25, 113, 49, 35, 222, 82, 196, 117, 41, 22, 103, 88, 136, +147, 48, 55, 175, 93, 231, 195, 12, 126, 4, 181, 76, 94, 120, 245, 252, 211, 79, 62, 241, 196, 223, 150, 244, 159, 27, 143, 57, 39, 109, 211, 110, +50, 147, 141, 42, 131, 68, 40, 176, 77, 102, 82, 85, 100, 38, 221, 141, 109, 50, 19, 73, 219, 221, 125, 150, 228, 117, 64, 108, 152, 141, 135, 35, +98, 123, 206, 73, 102, 18, 17, 100, 38, 146, 0, 209, 54, 33, 80, 4, 182, 81, 8, 170, 153, 101, 36, 81, 221, 44, 115, 98, 55, 221, 141, 20, +72, 98, 163, 171, 15, 50, 243, 183, 71, 142, 171, 224, 35, 224, 8, 116, 120, 237, 234, 181, 183, 35, 116, 126, 172, 86, 95, 202, 200, 143, 2, 119, +67, 110, 129, 19, 36, 33, 187, 250, 96, 218, 111, 185, 251, 34, 112, 101, 172, 198, 141, 80, 92, 85, 232, 74, 70, 92, 27, 210, 65, 75, 19, 133, +163, 154, 151, 206, 159, 227, 7, 53, 248, 17, 92, 60, 127, 157, 79, 61, 246, 168, 151, 101, 249, 31, 86, 57, 254, 66, 142, 252, 119, 157, 1, 221, +156, 172, 139, 8, 209, 221, 128, 200, 8, 20, 193, 178, 76, 108, 19, 17, 116, 55, 146, 136, 8, 186, 27, 73, 43, 236, 125, 65, 27, 10, 16, 144, +146, 30, 1, 97, 55, 221, 77, 102, 82, 53, 137, 8, 198, 24, 96, 19, 49, 232, 46, 50, 18, 73, 68, 36, 166, 153, 115, 97, 89, 22, 54, 164, +100, 195, 134, 101, 89, 179, 44, 11, 22, 95, 219, 217, 217, 121, 86, 161, 67, 208, 33, 112, 8, 28, 73, 58, 1, 234, 182, 55, 187, 251, 91, 66, +72, 10, 133, 36, 48, 182, 5, 51, 34, 22, 101, 158, 32, 29, 11, 142, 20, 113, 28, 210, 90, 168, 44, 250, 47, 124, 234, 113, 254, 233, 115, 47, +115, 238, 252, 43, 252, 48, 6, 63, 130, 123, 238, 63, 69, 157, 52, 63, 243, 115, 159, 188, 242, 91, 95, 120, 225, 63, 149, 185, 127, 53, 198, 95, +70, 77, 196, 130, 0, 41, 16, 5, 18, 115, 22, 27, 146, 168, 42, 108, 19, 17, 140, 49, 144, 68, 85, 33, 41, 35, 2, 119, 79, 192, 183, 157, +150, 244, 88, 102, 0, 38, 51, 129, 166, 187, 145, 192, 110, 148, 3, 48, 93, 197, 136, 100, 86, 209, 109, 186, 155, 101, 153, 44, 203, 66, 230, 138, +136, 64, 50, 39, 39, 199, 44, 203, 66, 85, 189, 188, 183, 187, 247, 143, 34, 227, 26, 112, 44, 233, 16, 56, 4, 142, 129, 69, 82, 73, 154, 192, +20, 154, 10, 77, 161, 10, 81, 146, 166, 164, 10, 152, 72, 37, 169, 128, 146, 84, 141, 220, 96, 117, 243, 181, 239, 92, 224, 149, 243, 175, 240, 195, +74, 126, 4, 119, 157, 189, 19, 4, 231, 158, 125, 59, 14, 15, 214, 151, 35, 245, 117, 227, 79, 43, 244, 104, 68, 48, 171, 168, 154, 72, 65, 87, +113, 199, 233, 51, 156, 57, 115, 134, 101, 89, 120, 228, 145, 71, 56, 58, 58, 226, 201, 39, 159, 228, 214, 173, 91, 252, 228, 79, 254, 36, 175, 191, +254, 250, 113, 70, 252, 222, 24, 227, 138, 224, 4, 180, 238, 238, 79, 41, 227, 95, 143, 136, 149, 36, 50, 69, 102, 32, 137, 136, 32, 51, 16, 2, +243, 142, 145, 131, 101, 153, 156, 172, 79, 0, 1, 166, 219, 204, 217, 204, 57, 145, 68, 119, 179, 44, 203, 173, 213, 106, 245, 75, 123, 187, 123, 207, +6, 28, 41, 226, 86, 72, 7, 146, 14, 37, 29, 41, 98, 29, 138, 147, 144, 214, 82, 172, 35, 99, 137, 136, 69, 210, 58, 165, 69, 210, 18, 210, +130, 52, 37, 77, 80, 129, 74, 33, 55, 197, 208, 224, 165, 243, 231, 184, 118, 245, 109, 126, 20, 131, 31, 153, 48, 246, 246, 206, 86, 156, 28, 215, +51, 217, 245, 55, 35, 243, 63, 137, 204, 159, 3, 157, 18, 1, 134, 136, 100, 119, 119, 135, 199, 31, 127, 130, 91, 183, 110, 241, 227, 63, 254, 227, +92, 186, 116, 137, 123, 239, 189, 151, 87, 207, 191, 202, 197, 55, 47, 50, 114, 220, 112, 247, 137, 164, 221, 200, 60, 176, 122, 161, 253, 185, 204, 177, +27, 25, 224, 102, 140, 164, 170, 217, 144, 132, 13, 166, 129, 96, 140, 21, 179, 138, 200, 96, 197, 138, 170, 70, 10, 164, 192, 158, 116, 55, 182, 153, +203, 82, 17, 241, 197, 83, 251, 251, 191, 19, 210, 145, 164, 35, 208, 145, 196, 17, 112, 2, 44, 66, 133, 84, 18, 133, 84, 192, 148, 212, 130, 146, +84, 130, 66, 42, 65, 11, 25, 201, 220, 246, 157, 87, 206, 241, 39, 33, 249, 17, 156, 61, 123, 39, 33, 129, 4, 88, 10, 228, 230, 234, 156, 253, +27, 93, 253, 124, 40, 238, 207, 200, 7, 164, 72, 110, 59, 58, 58, 164, 170, 185, 124, 249, 45, 230, 156, 92, 187, 118, 157, 27, 55, 110, 112, 116, +120, 200, 229, 203, 151, 233, 234, 175, 142, 49, 158, 202, 136, 107, 146, 174, 172, 151, 245, 67, 18, 127, 51, 51, 239, 16, 38, 115, 176, 97, 131, 36, +198, 72, 4, 140, 145, 116, 55, 182, 89, 150, 133, 89, 147, 238, 166, 219, 204, 89, 84, 21, 27, 221, 205, 122, 189, 118, 119, 255, 218, 233, 253, 83, +191, 176, 26, 227, 154, 20, 7, 146, 110, 69, 198, 129, 164, 195, 144, 142, 36, 173, 35, 98, 157, 210, 146, 17, 235, 144, 214, 138, 152, 33, 45, 138, +88, 80, 76, 164, 137, 212, 142, 52, 136, 151, 206, 159, 227, 202, 245, 107, 252, 73, 17, 63, 162, 187, 31, 122, 132, 51, 41, 12, 132, 20, 216, 1, +72, 110, 150, 246, 67, 109, 255, 27, 134, 127, 39, 34, 126, 114, 246, 114, 186, 27, 173, 215, 39, 236, 238, 238, 114, 120, 116, 140, 128, 174, 238, 154, +243, 247, 182, 183, 183, 127, 97, 123, 107, 251, 21, 227, 43, 93, 117, 180, 244, 252, 143, 87, 171, 213, 127, 180, 94, 175, 137, 8, 50, 19, 73, 128, +217, 216, 218, 218, 194, 110, 50, 130, 110, 35, 137, 234, 102, 89, 22, 192, 84, 65, 119, 179, 81, 85, 156, 156, 156, 208, 221, 191, 115, 199, 254, 169, +255, 106, 119, 119, 247, 2, 102, 65, 58, 150, 56, 1, 142, 5, 107, 73, 19, 104, 65, 133, 212, 64, 73, 106, 67, 11, 44, 100, 11, 115, 219, 75, +231, 95, 225, 79, 139, 248, 255, 224, 241, 199, 158, 32, 49, 141, 144, 91, 216, 97, 8, 1, 182, 115, 153, 243, 158, 118, 127, 118, 186, 127, 234, 228, +100, 253, 185, 49, 242, 225, 101, 153, 187, 64, 217, 190, 132, 249, 202, 222, 238, 238, 63, 94, 141, 241, 166, 205, 9, 176, 92, 189, 118, 245, 161, 159, +248, 236, 79, 252, 143, 171, 173, 173, 79, 188, 250, 234, 121, 50, 147, 155, 55, 111, 145, 25, 116, 23, 146, 216, 222, 222, 38, 34, 16, 198, 134, 182, +89, 150, 133, 170, 162, 170, 17, 162, 109, 132, 56, 62, 62, 242, 178, 204, 47, 239, 237, 237, 253, 23, 167, 246, 247, 95, 5, 166, 96, 45, 233, 4, +233, 4, 88, 11, 166, 160, 5, 109, 169, 3, 89, 162, 185, 173, 52, 124, 237, 244, 3, 156, 190, 117, 137, 243, 47, 63, 207, 159, 54, 241, 39, 224, +137, 71, 31, 167, 99, 69, 244, 130, 109, 9, 75, 16, 186, 109, 100, 82, 85, 99, 233, 222, 61, 62, 57, 57, 211, 213, 123, 17, 234, 49, 198, 173, +213, 106, 117, 212, 221, 216, 14, 131, 70, 68, 95, 186, 114, 249, 167, 158, 120, 226, 137, 95, 60, 60, 60, 188, 227, 51, 159, 249, 12, 111, 188, 241, +6, 27, 103, 207, 158, 229, 249, 231, 159, 231, 129, 7, 30, 224, 245, 215, 95, 35, 51, 176, 77, 85, 97, 155, 57, 155, 170, 162, 230, 36, 16, 182, +89, 230, 156, 213, 245, 155, 251, 123, 251, 255, 221, 254, 222, 222, 183, 109, 31, 2, 235, 148, 22, 96, 45, 105, 1, 38, 96, 192, 128, 21, 233, 188, +126, 139, 186, 243, 14, 190, 243, 242, 75, 252, 179, 54, 248, 19, 240, 242, 249, 115, 108, 124, 252, 177, 199, 177, 100, 57, 12, 182, 49, 235, 57, 5, +56, 165, 121, 199, 222, 222, 77, 221, 102, 59, 170, 42, 220, 173, 128, 64, 82, 131, 70, 142, 14, 233, 198, 133, 11, 23, 214, 146, 184, 120, 241, 34, +175, 190, 250, 42, 79, 62, 249, 36, 111, 189, 245, 22, 103, 206, 156, 225, 190, 251, 238, 227, 141, 55, 94, 163, 170, 144, 68, 119, 211, 93, 128, 136, +8, 10, 49, 171, 152, 115, 94, 147, 244, 143, 78, 157, 186, 227, 151, 183, 183, 182, 222, 182, 221, 33, 221, 2, 142, 145, 166, 208, 148, 100, 41, 124, +112, 120, 145, 83, 251, 15, 240, 194, 185, 23, 249, 99, 87, 47, 241, 255, 7, 241, 167, 232, 241, 71, 159, 224, 93, 6, 91, 41, 176, 45, 144, 192, +226, 93, 178, 45, 64, 25, 193, 213, 27, 55, 118, 151, 154, 255, 153, 34, 254, 214, 169, 253, 253, 237, 131, 195, 67, 30, 120, 224, 1, 174, 95, 191, +206, 238, 238, 46, 25, 201, 193, 225, 45, 186, 139, 238, 166, 109, 220, 13, 4, 85, 197, 92, 150, 195, 174, 126, 118, 140, 241, 27, 219, 219, 219, 223, +202, 204, 75, 145, 121, 41, 35, 46, 14, 233, 42, 104, 177, 228, 163, 213, 142, 199, 92, 243, 221, 87, 94, 226, 207, 18, 241, 207, 208, 39, 31, 255, +56, 118, 19, 26, 204, 94, 99, 54, 36, 113, 155, 13, 152, 207, 253, 216, 147, 254, 39, 95, 255, 189, 59, 142, 79, 78, 254, 58, 240, 243, 57, 198, +231, 20, 186, 43, 51, 119, 186, 91, 171, 28, 108, 111, 111, 179, 94, 214, 172, 151, 5, 139, 118, 247, 81, 47, 117, 177, 219, 207, 103, 196, 211, 171, +213, 234, 133, 28, 249, 86, 68, 92, 141, 136, 203, 17, 113, 57, 34, 174, 167, 98, 145, 18, 187, 121, 233, 252, 203, 252, 89, 36, 254, 140, 250, 220, +103, 63, 199, 119, 95, 251, 238, 30, 240, 216, 241, 241, 241, 39, 247, 246, 246, 158, 152, 203, 124, 48, 35, 246, 70, 142, 81, 93, 89, 221, 199, 118, +95, 150, 116, 33, 35, 223, 204, 204, 43, 17, 113, 32, 116, 168, 208, 77, 73, 183, 34, 226, 48, 164, 117, 219, 30, 17, 188, 116, 254, 21, 254, 44, +19, 255, 28, 240, 23, 223, 64, 127, 237, 65, 62, 251, 233, 207, 228, 181, 27, 215, 87, 115, 206, 40, 125, 211, 16, 0, 0, 0, 35, 73, 68, 65, +84, 149, 164, 204, 8, 133, 132, 13, 22, 190, 173, 132, 22, 133, 166, 164, 186, 251, 158, 143, 248, 248, 248, 136, 103, 158, 125, 134, 127, 94, 252, 223, +160, 16, 125, 12, 251, 15, 241, 139, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]) + +let testJpg = new Uint8Array([255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 96, 0, 96, 0, 0, 255, 219, 0, 67, 0, 2, 1, 1, 2, 1, 1, 2, +2, 2, 2, 2, 2, 2, 2, 3, 5, 3, 3, 3, 3, 3, 6, 4, 4, 3, 5, 7, 6, 7, 7, 7, 6, 7, 7, 8, 9, 11, 9, 8, +8, 10, 8, 7, 7, 10, 13, 10, 10, 11, 12, 12, 12, 12, 7, 9, 14, 15, 13, 12, 14, 11, 12, 12, 12, 255, 219, 0, 67, 1, 2, 2, +2, 3, 3, 3, 6, 3, 3, 6, 12, 8, 7, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 255, 192, +0, 17, 8, 0, 226, 1, 216, 3, 1, 34, 0, 2, 17, 1, 3, 17, 1, 255, 196, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, +0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 196, 0, 181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5, +5, 4, 4, 0, 0, 1, 125, 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35, +66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, +67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, +131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, +184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241, +242, 243, 244, 245, 246, 247, 248, 249, 250, 255, 196, 0, 31, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, +2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 196, 0, 181, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119, 0, +1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, 129, 8, 20, 66, 145, 161, 177, 193, 9, 35, 51, 82, 240, 21, +98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, +74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136, +137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, +197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249, +250, 255, 218, 0, 12, 3, 1, 0, 2, 17, 3, 17, 0, 63, 0, 253, 16, 162, 138, 43, 252, 99, 63, 170, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, +2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 2, 138, 40, 160, 15, 255, 217]) + +export {testPng, testJpg} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/index/index.ets b/graphic/effectKit/entry/src/main/ets/pages/index/index.ets similarity index 92% rename from bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/index/index.ets rename to graphic/effectKit/entry/src/main/ets/pages/index/index.ets index 37b86f5096f1273b71299ee08e085211c5add410..b2523a0a1eb6884ddc09a3434c6fb97a959d40e0 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/pages/index/index.ets +++ b/graphic/effectKit/entry/src/main/ets/pages/index/index.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 @@ -14,7 +14,7 @@ */ import file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" import testsuite from "../../test/List.test.ets" @@ -38,7 +38,7 @@ struct Index { console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) globalThis.abilityWant.parameters.timeout = 70000; configService.setConfig(globalThis.abilityWant.parameters) - testsuite(globalThis.abilityContext) + testsuite(globalThis.abilityContext,globalThis.windowStage,globalThis.abilityStorage) core.execute() } @@ -57,7 +57,6 @@ struct Index { }) .backgroundColor('#0D9FFB') .onClick(() => { - }) } .width('100%') diff --git a/graphic/effectKit/entry/src/main/ets/test/List.test.ets b/graphic/effectKit/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..02fcdcb19ac932c9dd2793e5d58ed874534c0842 --- /dev/null +++ b/graphic/effectKit/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import effectKitTest from './effectKit.test.ets' + +export default function testsuite(context, windowStage, abilityStorage) { + effectKitTest() +} \ No newline at end of file diff --git a/graphic/effectKit/entry/src/main/ets/test/effectKit.test.ets b/graphic/effectKit/entry/src/main/ets/test/effectKit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bfac345c2f7eff2f939529f2545a21b204778d00 --- /dev/null +++ b/graphic/effectKit/entry/src/main/ets/test/effectKit.test.ets @@ -0,0 +1,789 @@ +/* + * 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. + */ + +// @ts-nocheck +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index" + +import image from '@ohos.multimedia.image' +import effectKit from '@ohos.effectKit'; +import {testPng, testJpg} from '../model/testImg' + +export default function effectKitTest() { + describe('effectKitTest', function () { + console.log('describe effectKitTest start!!!') + + /** + * @tc.number EFFECT_KIT_CREATEEFFECT_JSAPI_001 + * @tc.name Test createEffect1 + * @tc.desc Create a FilterChain to add multiple effects to an image. + */ + it('createEffect1', 0, function (done) { + let caseName = 'createEffect1' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "Napi size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let filter = effectKit.createEffect(pixelmap) + expect(filter != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_CREATEEFFECT_JSAPI_002 + * @tc.name Test createEffect2 + * @tc.desc Create a FilterChain to add multiple effects to an image. + */ + it('createEffect2', 0, function (done) { + let caseName = 'createEffect2' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + let pixelmap = null + let filter = effectKit.createEffect(pixelmap) + expect(filter == null).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_BLUR_JSAPI_001 + * @tc.name Test blur1 + * @tc.desc A blur effect is added to the image. + */ + it('blur1', 0, function (done) { + let caseName = 'blur1' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest blur1 createEffect faild") + expect(true).assertFail() + done() + } + let blurFilter = headFilter.blur(10) + expect(blurFilter != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_BLUR_JSAPI_002 + * @tc.name Test blur2 + * @tc.desc A blur effect is added to the image. + */ + it('blur2', 0, function (done) { + let caseName = 'blur2' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest blur2 createEffect faild") + expect(true).assertFail() + done() + } + let blurFilter = headFilter.blur(-10) + expect(blurFilter != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_BLUR_JSAPI_003 + * @tc.name Test blur3 + * @tc.desc A blur effect is added to the image. + */ + it('blur3', 0, function (done) { + let caseName = 'blur3' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest blur3 createEffect faild") + expect(true).assertFail() + done() + } + let blurFilter = headFilter.blur(0) + expect(blurFilter != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_BRIGHTNESS_JSAPI_001 + * @tc.name Test brightness1 + * @tc.desc A Brightness effect is added to the image. + */ + it('brightness1', 0, function (done) { + let caseName = 'brightness1' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest brightness1 createEffect faild") + expect(true).assertFail() + done() + } + let brightFilter = headFilter.brightness(0) + expect(brightFilter != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_BRIGHTNESS_JSAPI_002 + * @tc.name Test brightness2 + * @tc.desc A Brightness effect is added to the image. + */ + it('brightness2', 0, function (done) { + let caseName = 'brightness2' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest brightness2 createEffect faild") + expect(true).assertFail() + done() + } + let brightFilter = headFilter.brightness(0.5) + expect(brightFilter != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_BRIGHTNESS_JSAPI_003 + * @tc.name Test brightness3 + * @tc.desc A Brightness effect is added to the image. + */ + it('brightness3', 0, function (done) { + let caseName = 'brightness3' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest brightness3 createEffect faild") + expect(true).assertFail() + done() + } + let brightFilter = headFilter.brightness(-0.5) + expect(brightFilter != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_GRAYSCALE_JSAPI_001 + * @tc.name Test grayscale1 + * @tc.desc A Grayscale effect is added to the image. + */ + it('grayscale1', 0, function (done) { + let caseName = 'grayscale1' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest grayscale1 createEffect faild") + expect(true).assertFail() + done() + } + let grayFilter = headFilter.grayscale() + expect(grayFilter != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_GETPIXELMAP_JSAPI_001 + * @tc.name Test getPixelMap1 + * @tc.desc Gets the PixelMap where all filter effects have been added to the image. + */ + it('getPixelMap1', 0, function (done) { + let caseName = 'getPixelMap1' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest getPixelMap1 createEffect faild") + expect(true).assertFail() + done() + } + let resultPixel = headFilter.getPixelMap() + expect(resultPixel != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_GETPIXELMAP_JSAPI_002 + * @tc.name Test getPixelMap2 + * @tc.desc Gets the PixelMap where all filter effects have been added to the image. + */ + it('getPixelMap2', 0, function (done) { + let caseName = 'getPixelMap2' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest getPixelMap2 createEffect faild") + expect(true).assertFail() + done() + } + let resultPixel = headFilter.grayscale().getPixelMap() + expect(resultPixel != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_GETPIXELMAP_JSAPI_003 + * @tc.name Test getPixelMap3 + * @tc.desc Gets the PixelMap where all filter effects have been added to the image. + */ + it('getPixelMap3', 0, function (done) { + let caseName = 'getPixelMap3' + let msgStr = 'jsunittest ' + caseName + ' ' + console.log("effectKitTest" + msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer); + imageSource.getImageInfo((err, value) => { + console.error(msgStr + "image size=" + value.size.width + " X " + value.size.height) + }) + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + let headFilter = effectKit.createEffect(pixelmap) + if (headFilter == null) { + console.log("effectKitTest getPixelMap3 createEffect faild") + expect(true).assertFail() + done() + } + let resultPixel = headFilter.blur(5).brightness(0.5).grayscale().getPixelMap() + expect(resultPixel != null).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_CREATECOLORPICKER_JSAPI_001 + * @tc.name Test createColorPicker + * @tc.desc Create a color picker to get the main color. + */ + it('createColorPicker1', 0, function (done) { + let caseName = 'createColorPicker1' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + var imageSource = image.createImageSource(testPng.buffer) + console.info(msgStr + "promise create pixmap.start") + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap).then(colorPicker => { + console.info(msgStr + "Napi createColorPicker") + expect(true).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi colorPicker.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_CREATECOLORPICKER_JSAPI_002 + * @tc.name Test createColorPicker + * @tc.desc Create a color picker to get the main color. + */ + it('createColorPicker2', 0, function (done) { + let caseName = 'createColorPicker2' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + console.info(msgStr + "Napi create ImageSource") + var imageSource = image.createImageSource(testJpg.buffer); + console.info(msgStr + "promise create pixmap.start") + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap).then(colorPicker => { + console.info(msgStr + "Napi createColorPicker") + expect(true).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi colorPicker.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_CREATECOLORPICKER_JSAPI_003 + * @tc.name Test createColorPicker + * @tc.desc Create a color picker to get the main color. + */ + it('createColorPicker3', 0, function (done) { + let caseName = 'createColorPicker3' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + console.info(msgStr + "Napi create ImageSource") + var imageSource = image.createImageSource(testJpg.buffer); + console.info(msgStr + "promise create pixmap.start") + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap).then(colorPicker => { + console.info(msgStr + "Napi create color picker") + expect(true).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi colorPicker.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_CREATECOLORPICKER_JSAPI_004 + * @tc.name Test createColorPicker + * @tc.desc Create a color picker to get the main color. + */ + it('createColorPicker4', 0, function (done) { + let caseName = 'createColorPicker4' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + console.info(msgStr + "Napi create ImageSource") + var imageSource = image.createImageSource(testPng.buffer); + console.info(msgStr + "promise create pixmap.start") + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap).then(colorPicker => { + console.info(msgStr + "Napi createColorPicker") + expect(true).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi colorPicker.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_CREATECOLORPICKER_JSAPI_005 + * @tc.name Test createColorPicker + * @tc.desc Create a color picker to get the main color. + */ + it('createColorPicker5', 0, function (done) { + let caseName = 'createColorPicker5' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + var imageSource = image.createImageSource(testPng.buffer); + console.info(msgStr + "callback create pixmap.start") + imageSource.createPixelMap((error, pixelMap) => { + if(error) { + console.info("Napi error,create pixmap") + expect(true).assertFail() + done() + } + console.info("Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap, (error, colorPicker) => { + if (error) { + console.error("Napi error, create color picker") + expect(true).assertFail() + done() + } + console.info(msgStr + "Napi create ok") + expect(true).assertTrue() + done() + }) + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_CREATECOLORPICKER_JSAPI_006 + * @tc.name Test createColorPicker + * @tc.desc Create a color picker to get the main color. + */ + it('createColorPicker5', 0, function (done) { + let caseName = 'createColorPicker5' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + console.info(msgStr + "Napi create ImageSource") + var imageSource = image.createImageSource(testJpg.buffer) + console.info(msgStr + "callback create pixmap.start") + imageSource.createPixelMap((error, pixelMap) => { + if(error) { + console.info("Napi error,create pixmap") + expect(true).assertFail() + done() + } + console.info("Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap, (error, colorPicker) => { + if (error) { + console.error("Napi error, create color picker") + expect(true).assertFail() + done() + } + console.info(msgStr + "Napi create ok") + expect(true).assertTrue() + done() + }) + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_CREATECOLORPICKER_JSAPI_007 + * @tc.name Test createColorPicker + * @tc.desc Create a color picker to get the main color. + */ + it('createColorPicker7', 0, function (done) { + let caseName = 'createColorPicker7' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + var imageSource = image.createImageSource(testPng.buffer) + console.info(msgStr + "promise create pixmap.start") + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap).then(colorPicker => { + console.info(msgStr + "Napi createColorPicker") + expect(true).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi colorPicker.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_GETMAINCOLOR_JSAPI_001 + * @tc.name Test getMainColor + * @tc.desc Create a color picker to get the main color. + */ + it('getMainColor1', 0, function (done) { + let caseName = 'getMainColor1' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + var imageSource = image.createImageSource(testPng.buffer) + console.info(msgStr + "promise create pixmap.start") + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap).then(colorPicker => { + console.info(msgStr + "Napi get main color start") + colorPicker.getMainColor().then(color => { + console.info(msgStr + "Napi color[ARGB]=" + color.red + "," + color.green + "," + color.blue) + expect(true).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi color.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi colorPicker.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_GETMAINCOLOR_JSAPI_002 + * @tc.name Test getMainColor + * @tc.desc Create a color picker to get the main color. + */ + it('getMainColor2', 0, function (done) { + let caseName = 'getMainColor2' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer) + console.info(msgStr + "promise create pixmap.start") + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap).then(colorPicker => { + console.info(msgStr + "Napi get main color start") + colorPicker.getMainColor().then(color => { + console.info(msgStr + "Napi color[ARGB]=" + color.red + "," + color.green + "," + color.blue) + expect(true).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi color.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi colorPicker.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_GETMAINCOLORSYNC_JSAPI_001 + * @tc.name Test getMainColorSync + * @tc.desc Create a color picker to get the main color. + */ + it('getMainColorSync1', 0, function (done) { + let caseName = 'getMainColorSync1' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + var imageSource = image.createImageSource(testJpg.buffer) + console.info(msgStr + "promise create pixmap.start") + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap).then(colorPicker => { + console.info(msgStr + "Napi get main color start") + let color = colorPicker.getMainColorSync() + console.info(msgStr + "Napi color[ARGB]=" + color.red + "," + color.green + "," + color.blue) + expect(true).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi colorPicker.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + /** + * @tc.number EFFECT_KIT_GETMAINCOLORSYNC_JSAPI_002 + * @tc.name Test getMainColorSync + * @tc.desc Create a color picker to get the main color. + */ + it('getMainColorSync2', 0, function (done) { + let caseName = 'getMainColorSync2' + let msgStr = 'jsunittest effectKitTest' + caseName + ' ' + console.log(msgStr + 'begin') + var imageSource = image.createImageSource(testPng.buffer) + console.info(msgStr + "promise create pixmap.start") + imageSource.createPixelMap().then(pixelMap => { + console.info(msgStr + "Napi create ColorPicker.start") + effectKit.createColorPicker(pixelMap).then(colorPicker => { + console.info(msgStr + "Napi get main color start") + let color = colorPicker.getMainColorSync() + console.info(msgStr + "Napi color[ARGB]=" + color.red + "," + color.green + "," + color.blue) + expect(true).assertTrue() + done() + }).catch(ex => { + console.error(msgStr + "Napi colorPicker.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + }).catch(ex => { + console.error(msgStr + "Napi pixelMap.error=" + ex.toString()) + expect(true).assertFail() + done() + }) + console.info(msgStr + "Napi create pixmap.end") + expect(true).assertTrue() + done() + }) + + }) +} diff --git a/graphic/effectKit/entry/src/main/module.json b/graphic/effectKit/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..2f75303710fc9915a694392337254ae6fdbc266d --- /dev/null +++ b/graphic/effectKit/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "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.myapplication.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" + ] + }] + }], + "requestPermissions": [{ + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + } + ] + } +} \ No newline at end of file diff --git a/graphic/effectKit/entry/src/main/resources/base/element/string.json b/graphic/effectKit/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2977b612ec4595b13eaaffe3e8fc578e83c42d48 --- /dev/null +++ b/graphic/effectKit/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" + } + ] +} diff --git a/graphic/effectKit/entry/src/main/resources/base/media/icon.png b/graphic/effectKit/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/graphic/effectKit/entry/src/main/resources/base/media/icon.png differ diff --git a/graphic/effectKit/entry/src/main/resources/base/profile/main_pages.json b/graphic/effectKit/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..821ecf2358ec52ffa8b0812267be3793be71896a --- /dev/null +++ b/graphic/effectKit/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index/index" + ] +} \ No newline at end of file diff --git a/graphic/effectKit/signature/openharmony_sx.p7b b/graphic/effectKit/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..6c0f124a79c8713f74f0b235c8946f2ecda32040 Binary files /dev/null and b/graphic/effectKit/signature/openharmony_sx.p7b differ diff --git a/graphic/graphicnapidrawingtest/BUILD.gn b/graphic/graphicnapidrawingtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..946e910cc2c3fbb0715496c56f8ebf6cf77c2c09 --- /dev/null +++ b/graphic/graphicnapidrawingtest/BUILD.gn @@ -0,0 +1,52 @@ +# 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") + +module_output_path = "hit/GraphicNapiDrawingTest" + +############################################################################### + +ohos_moduletest_suite("GraphicNapiDrawingTest") { + module_out_path = module_output_path + + sources = [ + "NativeDrawingBitmapTest.cpp", + "NativeDrawingBrushTest.cpp", + "NativeDrawingCanvasTest.cpp", + "NativeDrawingColorTest.cpp", + "NativeDrawingPathTest.cpp", + "NativeDrawingPenTest.cpp", + "OH_Drawing_FontCollectionTest.cpp", + "OH_Drawing_TypographyTest.cpp", + ] + + cflags = [ + "-Wall", + "-Werror", + ] + + include_dirs = [ + "//foundation/graphic/graphic_2d/rosen/modules/2d_engine", + "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/include", + "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/src", + "//third_party/googletest/googletest/include", + ] + + deps = [ + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics:2d_graphics", + "//third_party/googletest:gtest_main", + "//utils/native/base:utils", + ] +} diff --git a/graphic/graphicnapidrawingtest/NativeDrawingBitmapTest.cpp b/graphic/graphicnapidrawingtest/NativeDrawingBitmapTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..150928638c13c2279a76129ab63b43fc0a3e778a --- /dev/null +++ b/graphic/graphicnapidrawingtest/NativeDrawingBitmapTest.cpp @@ -0,0 +1,127 @@ +/* + * 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, Hardware + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#include "c/drawing_bitmap.h" +#include "c/drawing_types.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +namespace Rosen { +namespace Drawing { +class NativeDrawingBitmapTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; +}; + +void NativeDrawingBitmapTest::SetUpTestCase() {} +void NativeDrawingBitmapTest::TearDownTestCase() {} +void NativeDrawingBitmapTest::SetUp() {} +void NativeDrawingBitmapTest::TearDown() {} + +/* + * @tc.name: NativeDrawingBitmapTest_bitmap001 + * @tc.desc: test for create drawing_bitmap and destroy drawing_bitmap. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap001, TestSize.Level1) +{ + OH_Drawing_Bitmap* bitmap = OH_Drawing_BitmapCreate(); + EXPECT_EQ(bitmap == nullptr, false); + OH_Drawing_BitmapDestroy(bitmap); +} + +/* + * @tc.name: NativeDrawingBitmapTest_bitmap002 + * @tc.desc: test for drawing_bitmap build. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap002, TestSize.Level1) +{ + OH_Drawing_Bitmap* bitmap1 = OH_Drawing_BitmapCreate(); + const unsigned int width = 500; + const unsigned int height = 500; + OH_Drawing_BitmapFormat bitmapFormat { COLOR_FORMAT_ALPHA_8, ALPHA_FORMAT_PREMUL }; + OH_Drawing_BitmapBuild(bitmap1, width, height, &bitmapFormat); + EXPECT_EQ(width, OH_Drawing_BitmapGetWidth(bitmap1)); + EXPECT_EQ(height, OH_Drawing_BitmapGetHeight(bitmap1)); + OH_Drawing_BitmapDestroy(bitmap1); +} + +/* + * @tc.name: NativeDrawingBitmapTest_bitmap003 + * @tc.desc: test for drawing_bitmap build. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap003, TestSize.Level1) +{ + OH_Drawing_Bitmap* bitmap2 = OH_Drawing_BitmapCreate(); + const unsigned int width = 0; + const unsigned int height = 0; + OH_Drawing_BitmapFormat bitmapFormat { COLOR_FORMAT_RGB_565, ALPHA_FORMAT_OPAQUE }; + OH_Drawing_BitmapBuild(bitmap2, width, height, &bitmapFormat); + EXPECT_EQ(width, OH_Drawing_BitmapGetWidth(bitmap2)); + EXPECT_EQ(height, OH_Drawing_BitmapGetHeight(bitmap2)); + OH_Drawing_BitmapDestroy(bitmap2); +} + +/* + * @tc.name: NativeDrawingBitmapTest_bitmap004 + * @tc.desc: test for drawing_bitmap build. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap004, TestSize.Level1) +{ + OH_Drawing_Bitmap* bitmap4 = OH_Drawing_BitmapCreate(); + const unsigned int width = 500; + const unsigned int height = 500; + OH_Drawing_BitmapFormat bitmapFormat { COLOR_FORMAT_ARGB_4444, ALPHA_FORMAT_UNPREMUL }; + OH_Drawing_BitmapBuild(bitmap4, width, height, &bitmapFormat); + EXPECT_EQ(width, OH_Drawing_BitmapGetWidth(bitmap4)); + EXPECT_EQ(height, OH_Drawing_BitmapGetHeight(bitmap4)); + EXPECT_EQ(OH_Drawing_BitmapGetPixels(bitmap4) == nullptr, false); + OH_Drawing_BitmapDestroy(bitmap4); +} + +/* + * @tc.name: NativeDrawingBitmapTest_bitmap005 + * @tc.desc: test for drawing_bitmap build. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap005, TestSize.Level1) +{ + OH_Drawing_Bitmap* bitmap5 = OH_Drawing_BitmapCreate(); + const unsigned int width = 500; + const unsigned int height = 500; + OH_Drawing_BitmapFormat bitmapFormat { COLOR_FORMAT_RGBA_8888, ALPHA_FORMAT_UNPREMUL }; + OH_Drawing_BitmapBuild(bitmap5, width, height, &bitmapFormat); + EXPECT_EQ(width, OH_Drawing_BitmapGetWidth(bitmap5)); + EXPECT_EQ(height, OH_Drawing_BitmapGetHeight(bitmap5)); + OH_Drawing_BitmapDestroy(bitmap5); +} +} // namespace Drawing +} // namespace Rosen +} // namespace OHOS \ No newline at end of file diff --git a/graphic/graphicnapidrawingtest/NativeDrawingBrushTest.cpp b/graphic/graphicnapidrawingtest/NativeDrawingBrushTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..08d36aa48c6ce1f3b9e5583383c2c9bd3e34e55d --- /dev/null +++ b/graphic/graphicnapidrawingtest/NativeDrawingBrushTest.cpp @@ -0,0 +1,69 @@ +/* + * 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, Hardware + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#include "c/drawing_brush.h" +#include "c/drawing_color.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +namespace Rosen { +namespace Drawing { +class NativeDrawingBrushTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; +}; + +void NativeDrawingBrushTest::SetUpTestCase() {} +void NativeDrawingBrushTest::TearDownTestCase() {} +void NativeDrawingBrushTest::SetUp() {} +void NativeDrawingBrushTest::TearDown() {} + +/* + * @tc.name: NativeDrawingBrushTest_brush001 + * @tc.desc: test for create brush and destroy brush. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingBrushTest, NativeDrawingBrushTest_brush001, TestSize.Level1) +{ + OH_Drawing_Brush* brush = OH_Drawing_BrushCreate(); + EXPECT_EQ(brush == nullptr, false); + OH_Drawing_BrushDestroy(brush); +} + +/* + * @tc.name: NativeDrawingBrushTest_brush002 + * @tc.desc: test for the set methods of brush. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingBrushTest, NativeDrawingBrushTest_brush002, TestSize.Level1) +{ + OH_Drawing_Brush* brush1 = OH_Drawing_BrushCreate(); + OH_Drawing_BrushSetAntiAlias(brush1, false); + EXPECT_EQ(OH_Drawing_BrushIsAntiAlias(brush1), false); + OH_Drawing_BrushSetColor(brush1, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00)); + EXPECT_EQ(OH_Drawing_BrushGetColor(brush1), 0xFFFF0000); +} +} // namespace Drawing +} // namespace Rosen +} // namespace OHOS \ No newline at end of file diff --git a/graphic/graphicnapidrawingtest/NativeDrawingCanvasTest.cpp b/graphic/graphicnapidrawingtest/NativeDrawingCanvasTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b39e3111f94b866c0a2f0abd8f8b5ea3d1755380 --- /dev/null +++ b/graphic/graphicnapidrawingtest/NativeDrawingCanvasTest.cpp @@ -0,0 +1,152 @@ +/* + * 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, Hardware + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#include "c/drawing_bitmap.h" +#include "c/drawing_brush.h" +#include "c/drawing_canvas.h" +#include "c/drawing_color.h" +#include "c/drawing_path.h" +#include "c/drawing_pen.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +namespace Rosen { +namespace Drawing { +class NativeDrawingCanvasTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; +}; + +void NativeDrawingCanvasTest::SetUpTestCase() {} +void NativeDrawingCanvasTest::TearDownTestCase() {} +void NativeDrawingCanvasTest::SetUp() {} +void NativeDrawingCanvasTest::TearDown() {} + +/* + * @tc.name: NativeDrawingCanvasTest_canvas001 + * @tc.desc: test for create canvas and destroy canvas. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas001, TestSize.Level1) +{ + OH_Drawing_Canvas* canvas = OH_Drawing_CanvasCreate(); + EXPECT_EQ(canvas == nullptr, false); + OH_Drawing_CanvasDestroy(canvas); +} + +/* + * @tc.name: NativeDrawingCanvasTest_canvas002 + * @tc.desc: test for OH_Drawing_CanvasBind. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas002, TestSize.Level1) +{ + OH_Drawing_Canvas* canvas1 = OH_Drawing_CanvasCreate(); + OH_Drawing_Bitmap* bitmap = OH_Drawing_BitmapCreate(); + OH_Drawing_CanvasBind(canvas1, bitmap); +} + +/* + * @tc.name: NativeDrawingCanvasTest_canvas003 + * @tc.desc: test for OH_Drawing_CanvasAttachPen & OH_Drawing_CanvasDetachPen. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas003, TestSize.Level1) +{ + OH_Drawing_Canvas* canvas2 = OH_Drawing_CanvasCreate(); + OH_Drawing_Pen* pen = OH_Drawing_PenCreate(); + OH_Drawing_CanvasAttachPen(canvas2, pen); + OH_Drawing_CanvasDetachPen(canvas2); +} + +/* + * @tc.name: NativeDrawingCanvasTest_canvas004 + * @tc.desc: test for OH_Drawing_CanvasAttachBrush & OH_Drawing_CanvasDetachBrush. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas004, TestSize.Level1) +{ + OH_Drawing_Canvas* canvas3 = OH_Drawing_CanvasCreate(); + OH_Drawing_Brush* brush = OH_Drawing_BrushCreate(); + OH_Drawing_CanvasAttachBrush(canvas3, brush); + OH_Drawing_CanvasDetachBrush(canvas3); +} + +/* + * @tc.name: NativeDrawingCanvasTest_canvas005 + * @tc.desc: test for OH_Drawing_CanvasDrawLine. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas005, TestSize.Level1) +{ + OH_Drawing_Canvas* canvas4 = OH_Drawing_CanvasCreate(); + OH_Drawing_CanvasDrawLine(canvas4, 0, 0, 20, 20); + OH_Drawing_CanvasDrawLine(canvas4, -15.2f, -1, 0, 20); +} + +/* + * @tc.name: NativeDrawingCanvasTest_canvas006 + * @tc.desc: test for OH_Drawing_CanvasDrawPath. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas006, TestSize.Level1) +{ + OH_Drawing_Canvas* canvas5 = OH_Drawing_CanvasCreate(); + OH_Drawing_Path* path = OH_Drawing_PathCreate(); + OH_Drawing_CanvasDrawPath(canvas5, path); +} + +/* + * @tc.name: NativeDrawingCanvasTest_canvas007 + * @tc.desc: test for OH_Drawing_CanvasSave & OH_Drawing_CanvasRestore. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas007, TestSize.Level1) +{ + OH_Drawing_Canvas* canvas6 = OH_Drawing_CanvasCreate(); + OH_Drawing_Path* path = OH_Drawing_PathCreate(); + OH_Drawing_CanvasDrawPath(canvas6, path); + OH_Drawing_CanvasSave(canvas6); + OH_Drawing_CanvasRestore(canvas6); +} + +/* + * @tc.name: NativeDrawingCanvasTest_canvas008 + * @tc.desc: test for OH_Drawing_CanvasClear. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas008, TestSize.Level1) +{ + OH_Drawing_Canvas* canvas7 = OH_Drawing_CanvasCreate(); + OH_Drawing_CanvasClear(canvas7, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00)); +} +} // namespace Drawing +} // namespace Rosen +} // namespace OHOS \ No newline at end of file diff --git a/graphic/graphicnapidrawingtest/NativeDrawingColorTest.cpp b/graphic/graphicnapidrawingtest/NativeDrawingColorTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..724fb84781579b8c8616f23e990d994ec5b10c00 --- /dev/null +++ b/graphic/graphicnapidrawingtest/NativeDrawingColorTest.cpp @@ -0,0 +1,56 @@ +/* + * 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, Hardware + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#include "c/drawing_brush.h" +#include "c/drawing_color.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +namespace Rosen { +namespace Drawing { +class NativeDrawingColorTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; +}; + +void NativeDrawingColorTest::SetUpTestCase() {} +void NativeDrawingColorTest::TearDownTestCase() {} +void NativeDrawingColorTest::SetUp() {} +void NativeDrawingColorTest::TearDown() {} + +/* + * @tc.name: NativeDrawingColorTest_color001 + * @tc.desc: test for ColorSetArgb. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingColorTest, NativeDrawingColorTest_color001, TestSize.Level1) +{ + OH_Drawing_Brush* brush1 = OH_Drawing_BrushCreate(); + OH_Drawing_BrushSetAntiAlias(brush1, false); + EXPECT_EQ(OH_Drawing_BrushIsAntiAlias(brush1), false); + OH_Drawing_BrushSetColor(brush1, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00)); + EXPECT_EQ(OH_Drawing_BrushGetColor(brush1), 0xFFFF0000); +} +} // namespace Drawing +} // namespace Rosen +} // namespace OHOS \ No newline at end of file diff --git a/graphic/graphicnapidrawingtest/NativeDrawingPathTest.cpp b/graphic/graphicnapidrawingtest/NativeDrawingPathTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a01df5ac4bd624aa3c729aecd2f7c96528fcf270 --- /dev/null +++ b/graphic/graphicnapidrawingtest/NativeDrawingPathTest.cpp @@ -0,0 +1,151 @@ +/* + * 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, Hardware + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#include "c/drawing_path.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +namespace Rosen { +namespace Drawing { +class NativeDrawingPathTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; +}; + +void NativeDrawingPathTest::SetUpTestCase() {} +void NativeDrawingPathTest::TearDownTestCase() {} +void NativeDrawingPathTest::SetUp() {} +void NativeDrawingPathTest::TearDown() {} + +/* + * @tc.name: NativeDrawingPathTest_path001 + * @tc.desc: test for create drawing_path. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path001, TestSize.Level1) +{ + OH_Drawing_Path* path = OH_Drawing_PathCreate(); + EXPECT_EQ(path == nullptr, false); + OH_Drawing_PathDestroy(path); +} + +/* + * @tc.name: NativeDrawingPathTest_path002 + * @tc.desc: test for PathMoveTo func. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path002, TestSize.Level1) +{ + OH_Drawing_Path* path1 = OH_Drawing_PathCreate(); + OH_Drawing_PathMoveTo(path1, 20, 20); + OH_Drawing_PathMoveTo(path1, -1, 20.6f); + OH_Drawing_PathDestroy(path1); +} + +/* + * @tc.name: NativeDrawingPathTest_path004 + * @tc.desc: test for PathLineTo func. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path003, TestSize.Level1) +{ + OH_Drawing_Path* path2 = OH_Drawing_PathCreate(); + OH_Drawing_PathLineTo(path2, 50, 40); + OH_Drawing_PathLineTo(path2, -50, 10.2f); + OH_Drawing_PathDestroy(path2); +} + +/* + * @tc.name: NativeDrawingPathTest_path005 + * @tc.desc: test for PathReset func. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path004, TestSize.Level1) +{ + OH_Drawing_Path* path3 = OH_Drawing_PathCreate(); + OH_Drawing_PathMoveTo(path3, 20, 20); + OH_Drawing_PathReset(path3); + OH_Drawing_PathDestroy(path3); +} + +/* + * @tc.name: NativeDrawingPathTest_path006 + * @tc.desc: test for PathArcTo func. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path005, TestSize.Level1) +{ + OH_Drawing_Path* path4 = OH_Drawing_PathCreate(); + OH_Drawing_PathArcTo(path4, 10, 10, 20, 0, 0, 90); + OH_Drawing_PathArcTo(path4, -10, 10, 10, -10, 0, 90); + OH_Drawing_PathDestroy(path4); +} + +/* + * @tc.name: NativeDrawingPathTest_path007 + * @tc.desc: test for PathQuadTo func. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path006, TestSize.Level1) +{ + OH_Drawing_Path* path5 = OH_Drawing_PathCreate(); + OH_Drawing_PathQuadTo(path5, 0, 0, 30, 30); + OH_Drawing_PathQuadTo(path5, -20.5f, -20.5f, 30, 0); + OH_Drawing_PathDestroy(path5); +} + +/* + * @tc.name: NativeDrawingPathTest_path008 + * @tc.desc: test for PathCubicTo func. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path007, TestSize.Level1) +{ + OH_Drawing_Path* path6 = OH_Drawing_PathCreate(); + OH_Drawing_PathCubicTo(path6, 30, 40, 60, 0, 50, 20); + OH_Drawing_PathCubicTo(path6, -30, 40, 60, -30.6f, 50, -20); + OH_Drawing_PathDestroy(path6); +} + +/* + * @tc.name: NativeDrawingPathTest_path009 + * @tc.desc: test for PathClose func. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path009, TestSize.Level1) +{ + OH_Drawing_Path* path7 = OH_Drawing_PathCreate(); + OH_Drawing_PathLineTo(path7, 50, 40); + OH_Drawing_PathClose(path7); + OH_Drawing_PathDestroy(path7); +} +} // namespace Drawing +} // namespace Rosen +} // namespace OHOS \ No newline at end of file diff --git a/graphic/graphicnapidrawingtest/NativeDrawingPenTest.cpp b/graphic/graphicnapidrawingtest/NativeDrawingPenTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9655f543a2615090fad7a84c52fd0fb423a1ff75 --- /dev/null +++ b/graphic/graphicnapidrawingtest/NativeDrawingPenTest.cpp @@ -0,0 +1,148 @@ +/* + * 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, Hardware + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#include "c/drawing_color.h" +#include "c/drawing_pen.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +namespace Rosen { +namespace Drawing { +class NativeDrawingPenTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; +}; + +void NativeDrawingPenTest::SetUpTestCase() {} +void NativeDrawingPenTest::TearDownTestCase() {} +void NativeDrawingPenTest::SetUp() {} +void NativeDrawingPenTest::TearDown() {} + +/* + * @tc.name: NativeDrawingPenTest_pen001 + * @tc.desc: test for create drawing_pen. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen001, TestSize.Level1) +{ + OH_Drawing_Pen* pen = OH_Drawing_PenCreate(); + EXPECT_EQ(pen == nullptr, false); + OH_Drawing_PenDestroy(pen); +} + +/* + * @tc.name: NativeDrawingPenTest_pen002 + * @tc.desc: test for the get and set methods about AntiAlias for a pen. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen002, TestSize.Level1) +{ + OH_Drawing_Pen* pen1 = OH_Drawing_PenCreate(); + OH_Drawing_PenSetAntiAlias(pen1, true); + EXPECT_EQ(OH_Drawing_PenIsAntiAlias(pen1), true); + OH_Drawing_PenSetAntiAlias(pen1, false); + EXPECT_EQ(OH_Drawing_PenIsAntiAlias(pen1), false); + OH_Drawing_PenDestroy(pen1); +} + +/* + * @tc.name: NativeDrawingPenTest_pen003 + * @tc.desc: test for the get and set methods about the color for a pen. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen003, TestSize.Level1) +{ + OH_Drawing_Pen* pen2 = OH_Drawing_PenCreate(); + OH_Drawing_PenSetColor(pen2, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00)); + EXPECT_EQ(OH_Drawing_PenGetColor(pen2), 0xFFFF0000); + OH_Drawing_PenDestroy(pen2); +} + +/* + * @tc.name: NativeDrawingPenTest_pen004 + * @tc.desc: test for the get and set methods about the width for a pen. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen004, TestSize.Level1) +{ + OH_Drawing_Pen* pen3 = OH_Drawing_PenCreate(); + OH_Drawing_PenSetWidth(pen3, 10); + EXPECT_EQ(OH_Drawing_PenGetWidth(pen3), 10); + OH_Drawing_PenDestroy(pen3); +} + +/* + * @tc.name: NativeDrawingPenTest_pen005 + * @tc.desc: test for the get and set methods about the miterLimit for a pen. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen005, TestSize.Level1) +{ + OH_Drawing_Pen* pen4 = OH_Drawing_PenCreate(); + OH_Drawing_PenSetMiterLimit(pen4, 5); + EXPECT_EQ(OH_Drawing_PenGetMiterLimit(pen4), 5); + OH_Drawing_PenDestroy(pen4); +} + +/* + * @tc.name: NativeDrawingPenTest_pen006 + * @tc.desc: test for the get and set methods about the line cap style for a pen. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen006, TestSize.Level1) +{ + OH_Drawing_Pen* pen5 = OH_Drawing_PenCreate(); + OH_Drawing_PenSetCap(pen5, OH_Drawing_PenLineCapStyle::LINE_SQUARE_CAP); + EXPECT_EQ(OH_Drawing_PenGetCap(pen5), OH_Drawing_PenLineCapStyle::LINE_SQUARE_CAP); + OH_Drawing_PenSetCap(pen5, OH_Drawing_PenLineCapStyle::LINE_FLAT_CAP); + EXPECT_EQ(OH_Drawing_PenGetCap(pen5), OH_Drawing_PenLineCapStyle::LINE_FLAT_CAP); + OH_Drawing_PenSetCap(pen5, OH_Drawing_PenLineCapStyle::LINE_ROUND_CAP); + EXPECT_EQ(OH_Drawing_PenGetCap(pen5), OH_Drawing_PenLineCapStyle::LINE_ROUND_CAP); + OH_Drawing_PenDestroy(pen5); +} + +/* + * @tc.name: NativeDrawingPenTest_pen007 + * @tc.desc: test for the get and set methods about the line join style for a pen. + * @tc.type: FUNC + * @tc.require: AR000GTO5R + */ +HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen007, TestSize.Level1) +{ + OH_Drawing_Pen* pen6 = OH_Drawing_PenCreate(); + OH_Drawing_PenSetJoin(pen6, OH_Drawing_PenLineJoinStyle::LINE_ROUND_JOIN); + EXPECT_EQ(OH_Drawing_PenGetJoin(pen6), OH_Drawing_PenLineJoinStyle::LINE_ROUND_JOIN); + OH_Drawing_PenSetJoin(pen6, OH_Drawing_PenLineJoinStyle::LINE_MITER_JOIN); + EXPECT_EQ(OH_Drawing_PenGetJoin(pen6), OH_Drawing_PenLineJoinStyle::LINE_MITER_JOIN); + OH_Drawing_PenSetJoin(pen6, OH_Drawing_PenLineJoinStyle::LINE_BEVEL_JOIN); + EXPECT_EQ(OH_Drawing_PenGetJoin(pen6), OH_Drawing_PenLineJoinStyle::LINE_BEVEL_JOIN); + OH_Drawing_PenDestroy(pen6); +} +} // namespace Drawing +} // namespace Rosen +} // namespace OHOS \ No newline at end of file diff --git a/graphic/graphicnapidrawingtest/OH_Drawing_FontCollectionTest.cpp b/graphic/graphicnapidrawingtest/OH_Drawing_FontCollectionTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cf42fa94c927699b3b32d84c46dcb361236df07d --- /dev/null +++ b/graphic/graphicnapidrawingtest/OH_Drawing_FontCollectionTest.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include "c/drawing_font_collection.h" + +#include "gtest/gtest.h" +#include "c/drawing_text_declaration.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +class OH_Drawing_FontCollectionTest : public testing::Test { +}; + +/* + * @tc.name: NativeDrawingTest001 + * @tc.desc: test for creating fontCollection + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_FontCollectionTest, OH_Drawing_FontCollectionTest001, TestSize.Level1) +{ + OH_Drawing_FontCollection* fontCollection = OH_Drawing_CreateFontCollection(); + EXPECT_EQ(fontCollection == nullptr, false); + OH_Drawing_DestroyFontCollection(fontCollection); +} +} \ No newline at end of file diff --git a/graphic/graphicnapidrawingtest/OH_Drawing_TypographyTest.cpp b/graphic/graphicnapidrawingtest/OH_Drawing_TypographyTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..59b7d05566705d246fd7a4dbeb4a132c5154b5e9 --- /dev/null +++ b/graphic/graphicnapidrawingtest/OH_Drawing_TypographyTest.cpp @@ -0,0 +1,304 @@ +/* + * 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. + */ + +#include "gtest/gtest.h" +#include "c/drawing_bitmap.h" +#include "c/drawing_canvas.h" +#include "c/drawing_color.h" +#include "c/drawing_font_collection.h" +#include "c/drawing_text_declaration.h" +#include "c/drawing_text_typography.h" +#include "rosen_text/ui/typography.h" +#include "rosen_text/ui/typography_create.h" + +using namespace rosen; +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +class OH_Drawing_TypographyTest : public testing::Test { +}; + +static TypographyStyle* ConvertToOriginalText(OH_Drawing_TypographyStyle* style) +{ + return reinterpret_cast(style); +} + +static TextStyle* ConvertToOriginalText(OH_Drawing_TextStyle* style) +{ + return reinterpret_cast(style); +} + +/* + * @tc.name: OH_Drawing_TypographyTest001 + * @tc.desc: test for creating TypographyStyle + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest001, TestSize.Level1) +{ + OH_Drawing_TypographyStyle* typoStyle = OH_Drawing_CreateTypographyStyle(); + EXPECT_EQ(typoStyle == nullptr, false); + OH_Drawing_DestroyTypographyStyle(typoStyle); +} + +/* + * @tc.name: OH_Drawing_TypographyTest002 + * @tc.desc: test for text direction + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest002, TestSize.Level1) +{ + OH_Drawing_TypographyStyle* typoStyle = OH_Drawing_CreateTypographyStyle(); + OH_Drawing_SetTypographyTextDirection(typoStyle, TEXT_DIRECTION_LTR); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->textDirection_, TextDirection::LTR); + OH_Drawing_SetTypographyTextDirection(typoStyle, TEXT_DIRECTION_RTL); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->textDirection_, TextDirection::RTL); +} + +/* + * @tc.name: OH_Drawing_TypographyTest003 + * @tc.desc: test for text alignment + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest003, TestSize.Level1) +{ + OH_Drawing_TypographyStyle* typoStyle = OH_Drawing_CreateTypographyStyle(); + OH_Drawing_SetTypographyTextAlign(typoStyle, TEXT_ALIGN_LEFT); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->textAlign_, TextAlign::LEFT); + OH_Drawing_SetTypographyTextAlign(typoStyle, TEXT_ALIGN_RIGHT); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->textAlign_, TextAlign::RIGHT); + OH_Drawing_SetTypographyTextAlign(typoStyle, TEXT_ALIGN_CENTER); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->textAlign_, TextAlign::CENTER); + OH_Drawing_SetTypographyTextAlign(typoStyle, TEXT_ALIGN_JUSTIFY); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->textAlign_, TextAlign::JUSTIFY); + OH_Drawing_SetTypographyTextAlign(typoStyle, TEXT_ALIGN_START); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->textAlign_, TextAlign::START); + OH_Drawing_SetTypographyTextAlign(typoStyle, TEXT_ALIGN_END); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->textAlign_, TextAlign::END); +} + +/* + * @tc.name: OH_Drawing_TypographyTest004 + * @tc.desc: test for max lines + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest004, TestSize.Level1) +{ + OH_Drawing_TypographyStyle* typoStyle = OH_Drawing_CreateTypographyStyle(); + OH_Drawing_SetTypographyTextMaxLines(typoStyle, 100); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->maxLines_, 100); + OH_Drawing_SetTypographyTextMaxLines(typoStyle, 200); + EXPECT_EQ(ConvertToOriginalText(typoStyle)->maxLines_, 200); +} + +/* + * @tc.name: OH_Drawing_TypographyTest005 + * @tc.desc: test for creating text style + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest005, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + EXPECT_EQ(txtStyle == nullptr, false); + OH_Drawing_DestroyTextStyle(txtStyle); +} + +/* + * @tc.name: OH_Drawing_TypographyTest006 + * @tc.desc: test for text color + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest006, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + // black + OH_Drawing_SetTextStyleColor(txtStyle, OH_Drawing_ColorSetArgb(0xFF, 0x00, 0x00, 0x00)); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->color_, 0xFF000000); + // red + OH_Drawing_SetTextStyleColor(txtStyle, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00)); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->color_, 0xFFFF0000); + // blue + OH_Drawing_SetTextStyleColor(txtStyle, OH_Drawing_ColorSetArgb(0xFF, 0x00, 0x00, 0xFF)); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->color_, 0xFF0000FF); +} + +/* + * @tc.name: OH_Drawing_TypographyTest007 + * @tc.desc: test for font size + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest007, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + OH_Drawing_SetTextStyleFontSize(txtStyle, 80); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->fontSize_, 80); + OH_Drawing_SetTextStyleFontSize(txtStyle, 40); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->fontSize_, 40); +} + +/* + * @tc.name: OH_Drawing_TypographyTest008 + * @tc.desc: test for font weight + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest008, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + OH_Drawing_SetTextStyleFontWeight(txtStyle, FONT_WEIGHT_400); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->fontWeight_, FontWeight::W400); + OH_Drawing_SetTextStyleFontWeight(txtStyle, FONT_WEIGHT_900); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->fontWeight_, FontWeight::W900); +} + +/* + * @tc.name: OH_Drawing_TypographyTest009 + * @tc.desc: test for baseline location + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest009, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + OH_Drawing_SetTextStyleBaseLine(txtStyle, TEXT_BASELINE_ALPHABETIC); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->textBaseline_, TextBaseline::ALPHABETIC); + OH_Drawing_SetTextStyleBaseLine(txtStyle, TEXT_BASELINE_IDEOGRAPHIC); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->textBaseline_, TextBaseline::IDEOGRAPHIC); +} + +/* + * @tc.name: OH_Drawing_TypographyTest010 + * @tc.desc: test for text decoration + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest010, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + OH_Drawing_SetTextStyleDecoration(txtStyle, TEXT_DECORATION_NONE); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->decoration_, TextDecoration::NONE); + OH_Drawing_SetTextStyleDecoration(txtStyle, TEXT_DECORATION_UNDERLINE); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->decoration_, TextDecoration::UNDERLINE); + OH_Drawing_SetTextStyleDecoration(txtStyle, TEXT_DECORATION_OVERLINE); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->decoration_, TextDecoration::OVERLINE); + OH_Drawing_SetTextStyleDecoration(txtStyle, TEXT_DECORATION_LINE_THROUGH); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->decoration_, TextDecoration::LINETHROUGH); +} + +/* + * @tc.name: OH_Drawing_TypographyTest011 + * @tc.desc: test for text decoration color + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest011, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + OH_Drawing_SetTextStyleDecorationColor(txtStyle, OH_Drawing_ColorSetArgb(0xFF, 0x00, 0x00, 0x00)); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->decorationColor_, 0xFF000000); + OH_Drawing_SetTextStyleDecorationColor(txtStyle, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00)); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->decorationColor_, 0xFFFF0000); +} + +/* + * @tc.name: OH_Drawing_TypographyTest012 + * @tc.desc: test for font height + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest012, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + OH_Drawing_SetTextStyleFontHeight(txtStyle, 0.0); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->height_, 0.0); +} + +/* + * @tc.name: OH_Drawing_TypographyTest013 + * @tc.desc: test for font families + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest013, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + const char* fontFamilies[] = {"Roboto"}; + OH_Drawing_SetTextStyleFontFamilies(txtStyle, 1, fontFamilies); + std::vector fontFamiliesResult = {"Roboto"}; + EXPECT_EQ(ConvertToOriginalText(txtStyle)->fontFamilies_, fontFamiliesResult); +} + +/* + * @tc.name: OH_Drawing_TypographyTest014 + * @tc.desc: test for font italic + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest014, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + OH_Drawing_SetTextStyleFontStyle(txtStyle, FONT_STYLE_NORMAL); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->fontStyle_, FontStyle::NORMAL); + OH_Drawing_SetTextStyleFontStyle(txtStyle, FONT_STYLE_ITALIC); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->fontStyle_, FontStyle::ITALIC); +} + +/* + * @tc.name: OH_Drawing_TypographyTest015 + * @tc.desc: test for font locale + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest015, TestSize.Level1) +{ + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + OH_Drawing_SetTextStyleLocale(txtStyle, "en"); + EXPECT_EQ(ConvertToOriginalText(txtStyle)->locale_, "en"); +} + +/* + * @tc.name: OH_Drawing_TypographyTest016 + * @tc.desc: test for typography + * @tc.type: FUNC + */ +HWTEST_F(OH_Drawing_TypographyTest, OH_Drawing_TypographyTest016, TestSize.Level1) +{ + OH_Drawing_TypographyStyle* typoStyle = OH_Drawing_CreateTypographyStyle(); + OH_Drawing_TextStyle* txtStyle = OH_Drawing_CreateTextStyle(); + OH_Drawing_TypographyCreate* handler = OH_Drawing_CreateTypographyHandler(typoStyle, + OH_Drawing_CreateFontCollection()); + EXPECT_TRUE(handler != nullptr); + + OH_Drawing_SetTextStyleColor(txtStyle, OH_Drawing_ColorSetArgb(0xFF, 0x00, 0x00, 0x00)); + double fontSize = 30; + OH_Drawing_SetTextStyleFontSize(txtStyle, fontSize); + OH_Drawing_SetTextStyleFontWeight(txtStyle, FONT_WEIGHT_400); + OH_Drawing_SetTextStyleBaseLine(txtStyle, TEXT_BASELINE_ALPHABETIC); + const char* fontFamilies[] = {"Roboto"}; + OH_Drawing_SetTextStyleFontFamilies(txtStyle, 1, fontFamilies); + OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyle); + + const char* text = "OpenHarmony\n"; + OH_Drawing_TypographyHandlerAddText(handler, text); + OH_Drawing_TypographyHandlerPopTextStyle(handler); + + OH_Drawing_Typography* typography = OH_Drawing_CreateTypography(handler); + double maxWidth = 800.0; + OH_Drawing_TypographyLayout(typography, maxWidth); + double position[2] = {10.0, 15.0}; + OH_Drawing_Bitmap* cBitmap = OH_Drawing_BitmapCreate(); + OH_Drawing_BitmapFormat cFormat {COLOR_FORMAT_RGBA_8888, ALPHA_FORMAT_OPAQUE}; + uint32_t width = 20; + uint32_t height = 40; + OH_Drawing_BitmapBuild(cBitmap, width, height, &cFormat); + + OH_Drawing_Canvas* cCanvas = OH_Drawing_CanvasCreate(); + OH_Drawing_CanvasBind(cCanvas, cBitmap); + OH_Drawing_CanvasClear(cCanvas, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0xFF, 0xFF)); + OH_Drawing_TypographyPaint(typography, cCanvas, position[0], position[1]); +} +} \ No newline at end of file diff --git a/graphic/graphicnapidrawingtest/Test.json b/graphic/graphicnapidrawingtest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..679d2fefac96e3b79507f54cc1763a053f2805d5 --- /dev/null +++ b/graphic/graphicnapidrawingtest/Test.json @@ -0,0 +1,21 @@ +{ + "kits": [ + { + "push": [ + "GraphicNapiDrawingTest->/data/local/tmp/GraphicNapiDrawingTest" + ], + "type": "PushKit", + "post-push" : [ + "chmod -R 777 /data/local/tmp/*" + ] + } + ], + "driver": { + "native-test-timeout": "120000", + "type": "CppTest", + "module-name": "GraphicNapiDrawingTest", + "runtime-hint": "1s", + "native-test-device-path": "/data/local/tmp" + }, + "description": "Configuration for GraphicNapiDrawingTest Tests" +} \ No newline at end of file diff --git a/inputmethod/BUILD.gn b/inputmethod/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..621923e1c1e31e117351a00a9843987e24155314 --- /dev/null +++ b/inputmethod/BUILD.gn @@ -0,0 +1,18 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos_var.gni") +group("inputmethod") { + testonly = true + deps = [ "InputMethodTest_ets:ActsInputMethodEtsTest" ] +} diff --git a/miscservices/InputMethodTest_ets/.idea/.deveco/project.cache.json b/inputmethod/InputMethodTest_ets/.idea/.deveco/project.cache.json similarity index 100% rename from miscservices/InputMethodTest_ets/.idea/.deveco/project.cache.json rename to inputmethod/InputMethodTest_ets/.idea/.deveco/project.cache.json diff --git a/miscservices/InputMethodTest_ets/.idea/.gitignore b/inputmethod/InputMethodTest_ets/.idea/.gitignore similarity index 100% rename from miscservices/InputMethodTest_ets/.idea/.gitignore rename to inputmethod/InputMethodTest_ets/.idea/.gitignore diff --git a/miscservices/InputMethodTest_ets/.idea/InputMethodTest_ets.iml b/inputmethod/InputMethodTest_ets/.idea/InputMethodTest_ets.iml similarity index 100% rename from miscservices/InputMethodTest_ets/.idea/InputMethodTest_ets.iml rename to inputmethod/InputMethodTest_ets/.idea/InputMethodTest_ets.iml diff --git a/miscservices/InputMethodTest_ets/.idea/modules.xml b/inputmethod/InputMethodTest_ets/.idea/modules.xml similarity index 100% rename from miscservices/InputMethodTest_ets/.idea/modules.xml rename to inputmethod/InputMethodTest_ets/.idea/modules.xml diff --git a/miscservices/InputMethodTest_ets/.idea/vcs.xml b/inputmethod/InputMethodTest_ets/.idea/vcs.xml similarity index 100% rename from miscservices/InputMethodTest_ets/.idea/vcs.xml rename to inputmethod/InputMethodTest_ets/.idea/vcs.xml diff --git a/miscservices/InputMethodTest_ets/BUILD.gn b/inputmethod/InputMethodTest_ets/BUILD.gn similarity index 100% rename from miscservices/InputMethodTest_ets/BUILD.gn rename to inputmethod/InputMethodTest_ets/BUILD.gn diff --git a/miscservices/InputMethodTest_ets/Test.json b/inputmethod/InputMethodTest_ets/Test.json similarity index 100% rename from miscservices/InputMethodTest_ets/Test.json rename to inputmethod/InputMethodTest_ets/Test.json diff --git a/miscservices/InputMethodTest_ets/entry/src/main/config.json b/inputmethod/InputMethodTest_ets/entry/src/main/config.json similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/config.json rename to inputmethod/InputMethodTest_ets/entry/src/main/config.json diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/TestAbility/app.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/TestAbility/app.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/TestAbility/app.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/TestAbility/app.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/TestAbility/pages/index.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/TestAbility/pages/index.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/TestAbility/pages/index.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/TestAbility/pages/index.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/inputmethod/InputMethodTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputRequestJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputRequestJsunit.test.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputRequestJsunit.test.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputRequestJsunit.test.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/test/RequestDownloadTaskJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestDownloadTaskJsunit.test.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/test/RequestDownloadTaskJsunit.test.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestDownloadTaskJsunit.test.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/test/RequestJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestJsunit.test.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/test/RequestJsunit.test.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestJsunit.test.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/ets/test/Utils.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/Utils.ets similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/ets/test/Utils.ets rename to inputmethod/InputMethodTest_ets/entry/src/main/ets/test/Utils.ets diff --git a/miscservices/InputMethodTest_ets/entry/src/main/resources/base/element/string.json b/inputmethod/InputMethodTest_ets/entry/src/main/resources/base/element/string.json similarity index 100% rename from miscservices/InputMethodTest_ets/entry/src/main/resources/base/element/string.json rename to inputmethod/InputMethodTest_ets/entry/src/main/resources/base/element/string.json diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/resources/base/media/icon.png b/inputmethod/InputMethodTest_ets/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/inputmethod/InputMethodTest_ets/entry/src/main/resources/base/media/icon.png differ diff --git a/miscservices/actspasteboardjsapitest/local.properties b/inputmethod/InputMethodTest_ets/local.properties similarity index 100% rename from miscservices/actspasteboardjsapitest/local.properties rename to inputmethod/InputMethodTest_ets/local.properties diff --git a/miscservices/actspasteboardjsapitest/package-lock.json b/inputmethod/InputMethodTest_ets/package-lock.json similarity index 100% rename from miscservices/actspasteboardjsapitest/package-lock.json rename to inputmethod/InputMethodTest_ets/package-lock.json diff --git a/inputmethod/InputMethodTest_ets/signature/openharmony_sx.p7b b/inputmethod/InputMethodTest_ets/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/inputmethod/InputMethodTest_ets/signature/openharmony_sx.p7b differ diff --git a/iot_hardware_lite/iot_controller_hal/BUILD.gn b/iothardware_lite/peripheral_hal/BUILD.gn similarity index 94% rename from iot_hardware_lite/iot_controller_hal/BUILD.gn rename to iothardware_lite/peripheral_hal/BUILD.gn index c450f5ad43c2797b4946c520aa0074a8d83810f4..b3a01273778ae3e0b7af55ff68c8725bf619b127 100755 --- a/iot_hardware_lite/iot_controller_hal/BUILD.gn +++ b/iothardware_lite/peripheral_hal/BUILD.gn @@ -28,7 +28,7 @@ hctest_suite("ActsWifiIotTest") { include_dirs = [ "//test/xts/tools/hctest/include", "src", - "//base/iot_hardware/peripheral/interfaces/kits", + "//base/iothardware/peripheral/interfaces/inner_api", ] cflags = [ "-Wno-error" ] diff --git a/utils_lite/file_hal/Test.tmpl b/iothardware_lite/peripheral_hal/Test.tmpl similarity index 100% rename from utils_lite/file_hal/Test.tmpl rename to iothardware_lite/peripheral_hal/Test.tmpl diff --git a/iot_hardware_lite/iot_controller_hal/src/iot_flash_test.c b/iothardware_lite/peripheral_hal/src/iot_flash_test.c similarity index 100% rename from iot_hardware_lite/iot_controller_hal/src/iot_flash_test.c rename to iothardware_lite/peripheral_hal/src/iot_flash_test.c diff --git a/iot_hardware_lite/iot_controller_hal/src/iot_gpio_test.c b/iothardware_lite/peripheral_hal/src/iot_gpio_test.c similarity index 100% rename from iot_hardware_lite/iot_controller_hal/src/iot_gpio_test.c rename to iothardware_lite/peripheral_hal/src/iot_gpio_test.c diff --git a/iot_hardware_lite/iot_controller_hal/src/iot_i2c_test.c b/iothardware_lite/peripheral_hal/src/iot_i2c_test.c similarity index 100% rename from iot_hardware_lite/iot_controller_hal/src/iot_i2c_test.c rename to iothardware_lite/peripheral_hal/src/iot_i2c_test.c diff --git a/iot_hardware_lite/iot_controller_hal/src/iot_pwm_test.c b/iothardware_lite/peripheral_hal/src/iot_pwm_test.c similarity index 100% rename from iot_hardware_lite/iot_controller_hal/src/iot_pwm_test.c rename to iothardware_lite/peripheral_hal/src/iot_pwm_test.c diff --git a/iot_hardware_lite/iot_controller_hal/src/iot_uart_test.c b/iothardware_lite/peripheral_hal/src/iot_uart_test.c similarity index 100% rename from iot_hardware_lite/iot_controller_hal/src/iot_uart_test.c rename to iothardware_lite/peripheral_hal/src/iot_uart_test.c diff --git a/iot_hardware_lite/iot_controller_hal/src/iot_watchdog_test.c b/iothardware_lite/peripheral_hal/src/iot_watchdog_test.c similarity index 100% rename from iot_hardware_lite/iot_controller_hal/src/iot_watchdog_test.c rename to iothardware_lite/peripheral_hal/src/iot_watchdog_test.c diff --git a/iot_hardware_lite/iot_controller_hal/src/lowpower_test.c b/iothardware_lite/peripheral_hal/src/lowpower_test.c similarity index 100% rename from iot_hardware_lite/iot_controller_hal/src/lowpower_test.c rename to iothardware_lite/peripheral_hal/src/lowpower_test.c diff --git a/iot_hardware_lite/iot_controller_hal/src/reset_test.c b/iothardware_lite/peripheral_hal/src/reset_test.c similarity index 100% rename from iot_hardware_lite/iot_controller_hal/src/reset_test.c rename to iothardware_lite/peripheral_hal/src/reset_test.c diff --git a/miscservices/actspasteboardjsapitest/.idea/.deveco/project.cache.json b/miscservices/actspasteboardjsapitest/.idea/.deveco/project.cache.json deleted file mode 100644 index 9f11beeeceb5025c56c4ee6cb8fba93c7f2bae44..0000000000000000000000000000000000000000 --- a/miscservices/actspasteboardjsapitest/.idea/.deveco/project.cache.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "BuildOptions":{}, - "CommonInfo":{ - "project.ide.version":"3.0.0.900" - } -} \ No newline at end of file diff --git a/miscservices/actspasteboardjsapitest/.idea/.gitignore b/miscservices/actspasteboardjsapitest/.idea/.gitignore deleted file mode 100644 index 26d33521af10bcc7fd8cea344038eaaeb78d0ef5..0000000000000000000000000000000000000000 --- a/miscservices/actspasteboardjsapitest/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/miscservices/actspasteboardjsapitest/.idea/actspasteboardjsapitest.iml b/miscservices/actspasteboardjsapitest/.idea/actspasteboardjsapitest.iml deleted file mode 100644 index 61021940449bdc69db005bbd04a05380f5629b2c..0000000000000000000000000000000000000000 --- a/miscservices/actspasteboardjsapitest/.idea/actspasteboardjsapitest.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/miscservices/actspasteboardjsapitest/.idea/modules.xml b/miscservices/actspasteboardjsapitest/.idea/modules.xml deleted file mode 100644 index 5a9e3884550918567ee62dba0251979b283436e7..0000000000000000000000000000000000000000 --- a/miscservices/actspasteboardjsapitest/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/miscservices/actspasteboardjsapitest/.idea/vcs.xml b/miscservices/actspasteboardjsapitest/.idea/vcs.xml deleted file mode 100644 index b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e..0000000000000000000000000000000000000000 --- a/miscservices/actspasteboardjsapitest/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn old mode 100644 new mode 100755 index 2fab4f717e560cfba4c08e40a5c3792b6b39d2a8..09127e7c9680a21378093be71492c6a837ecc399 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -18,8 +18,7 @@ group("multimedia") { if (is_standard_system) { deps = [ "audio/audio_js_standard/audioManager:audio_manager_js_hap", - - #"camera/camera_js_standard:camera_standard_ets_hap", + "camera/camera_js_standard:camera_standard_ets_hap", "image/image_js_standard/image:image_js_hap", "image/image_js_standard/imageColorspace:image_colorspace_js_hap", "image/image_js_standard/imageDecodeOptions:image_DecodeOptions_js_hap", diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js index 122b0b912e29facf5ec3918a03e6eccd5a05a114..b20bf218bf4141727c6008ae0e8ea63de0aef358 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js @@ -6688,4 +6688,206 @@ describe('audioRenderer', function () { await sleep(50); done(); }) + + /* + * @tc.name:SetInterruptMode_001 + * @tc.desc:SetInterruptMode mode 0 callback,is public share mode + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SetInterruptMode_001", 0,async function (done) { + var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = 0; + audioRenderer.setInterruptMode(mode,(err,data)=>{ + if(err){ + expect(true).assertEqual(false); + return done(); + } + expect(true).assertEqual(true); + done(); + }) + }) + + /* + * @tc.name:SetInterruptMode_002 + * @tc.desc:SetInterruptMode mode 1 callback,is independent mode + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SetInterruptMode_002", 0,async function (done) { + var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = 1; + audioRenderer.setInterruptMode(mode,(err,data)=>{ + if(err){ + expect(true).assertEqual(false); + return done(); + } + expect(true).assertEqual(true); + done(); + }) + }) + + /* + * @tc.name:SetInterruptMode_003 + * @tc.desc:SetInterruptMode mode 0 promise,is public share mode + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SetInterruptMode_003", 0,async function (done) { + var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = 0; + audioRenderer.setInterruptMode(mode).then(data=>{ + expect(true).assertEqual(true); + done(); + }).catch(err=>{ + expect(true).assertEqual(false); + done(); + }) + }) + + /* + * @tc.name:SetInterruptMode_004 + * @tc.desc:SetInterruptMode mode 1 promise,is independent mode + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SetInterruptMode_004", 0,async function (done) { + var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = 1; + audioRenderer.setInterruptMode(mode).then(data=>{ + expect(true).assertEqual(true); + done(); + }).catch(err=>{ + expect(true).assertEqual(false); + done(); + }) + }) + + /* + * @tc.name:SetInterruptMode_005 + * @tc.desc:SetInterruptMode mode '1',will catch error with type error + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SetInterruptMode_005", 0,async function (done) { + var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = '1'; + try{ + let data = await audioRenderer.setInterruptMode(mode); + expect(false).assertEqual(false); + done(); + }catch(err){ + expect('assertion (false) failed: type mismatch').assertEqual(err.message); + done(); + } + }) + + /* + * @tc.name:SetInterruptMode_006 + * @tc.desc:SetInterruptMode mode 2,will catch error with out of border + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SetInterruptMode_006", 0,async function (done) { + var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = 2; + try{ + let data = await audioRenderer.setInterruptMode(mode) + expect(true).assertEqual(true); + done(); + }catch(err){ + expect(err).assertEqual(undefined); + done(); + } + }) }) \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/Test.json b/multimedia/medialibrary/mediaLibrary_js_standard/Test.json index 543d886aab4564b8d724086f73555db7290176c3..240e6377afa2df0f788e292205e3af58d0d4d816 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/Test.json +++ b/multimedia/medialibrary/mediaLibrary_js_standard/Test.json @@ -32,25 +32,29 @@ { "type": "ShellKit", "run-command": [ - "mkdir -pv /storage/media/100/local/files/{Pictures/{Static,Static01,Album/Static,SR001PRO,SR001CB,Dynamic,Dynamic01,Dynamic02,Dynamic022,DeleteCb01,AblumInfo,DeletePro01,Delete01,Temp},Videos/{Static,Static01,Album/Static,SR001PRO,SR001CB,Dynamic,Dynamic01,Dynamic02,DeleteCb01,AblumInfo,DeletePro01,Delete01},Audios/{Static,Static01,Album/Static,SR001PRO,SR001CB,Dynamic,Dynamic01,Dynamic02,DeleteCb01,AblumInfo,DeletePro01,Delete01},Documents/{Static,Static01,Album/Static,SR001PRO,SR001CB,Dynamic,Dynamic01,Dynamic02,DeleteCb01,AblumInfo,DeletePro01,Delete01}}", + "mkdir -pv /storage/media/100/local/files/Pictures/{Static,Static01,Album/Static,Dynamic,Dynamic01,Dynamic022,DeleteCb01,AblumInfo,DeletePro01,Dynamic03,Temp}", + "mkdir -pv /storage/media/100/local/files/Videos/{Static,Static01,Album/Static,Dynamic,Dynamic01,Dynamic02,DeleteCb01,AblumInfo,DeletePro01,Dynamic03}", + "mkdir -pv /storage/media/100/local/files/Audios/{Static,Static01,Album/Static,Dynamic,Dynamic01,Dynamic02,DeleteCb01,AblumInfo,DeletePro01,Dynamic03}", + "mkdir -pv /storage/media/100/local/files/Documents/{Static,Static01,Album/Static,Dynamic,Dynamic01,Dynamic02,DeleteCb01,AblumInfo,DeletePro01}", "for d in Static Album/Static Dynamic Dynamic01 Dynamic022 AblumInfo; do for i in $$(seq 3); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", "for d in Static Album/Static Dynamic Dynamic01 Dynamic02 AblumInfo; do for i in $$(seq 3); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", "for d in Static Album/Static Dynamic Dynamic01 Dynamic02 AblumInfo; do for i in $$(seq 3); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", "for d in Static Album/Static Dynamic Dynamic01 Dynamic02 AblumInfo; do for i in $$(seq 3); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", - "for d in SR001PRO SR001CB DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d ;done;", - "for d in SR001PRO SR001CB DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d ;done;", - "for d in SR001PRO SR001CB DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d ;done;", - "for d in SR001PRO SR001CB DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d ;done;", + "for d in DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d ;done;", + "for d in DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d ;done;", + "for d in DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d ;done;", + "for d in DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d ;done;", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "hilog -Q pidoff", "hilog -p off", + "hilog -b D", "aa start -a com.ohos.photos.MainAbility -b com.ohos.photos", - "sleep 60", - "sleep 60", - "sleep 60" + "sleep 10", + "cem publish -e usual.event.SCREEN_OFF", + "sleep 10" ] }, { @@ -61,4 +65,4 @@ "cleanup-apps": true } ] -} +} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestCallBack.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestCallBack.test.ets index 6144355c4889b4f9867af09e82a2e53f88a81cb0..64fea34e5e1e5d889b39b53524869662c4a536bc 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestCallBack.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestCallBack.test.ets @@ -100,7 +100,7 @@ const props = { displayName: '01.jpg', relativePath: 'Pictures/Static01/', size: '348113', - mediaType: '3', + mediaType: imageType.toString(), title: '01', dateTaken: '0', width: '1279', @@ -108,28 +108,26 @@ const props = { orientation: '0', duration: '0', albumId: '1118', - albumName: 'Static01' }, video: { mimeType: 'video/mp4', displayName: '01.mp4', relativePath: 'Videos/Static01/', size: '4853005', - mediaType: '4', + mediaType: videoType.toString(), title: '01', dateTaken: '0', width: '1280', height: '720', orientation: '0', duration: '10100', - albumName: 'Static01' }, audio: { mimeType: 'audio/mpeg', displayName: '01.mp3', relativePath: 'Audios/Static01/', size: '1958311', - mediaType: '5', + mediaType: audioType.toString(), title: '01', dateTaken: '0', artist: '元数据测试', @@ -137,21 +135,19 @@ const props = { height: '0', orientation: '0', duration: '219600', - albumName: 'Static01' }, file: { mimeType: 'file/*', displayName: '01.dat', relativePath: 'Documents/Static01/', size: '10', - mediaType: '1', + mediaType: fileType.toString(), title: '01', dateTaken: '0', width: '0', height: '0', orientation: '0', duration: '0', - albumName: 'Static01' } } @@ -184,8 +180,7 @@ async function checkFileAssetAttr(done, fetchFileResult, type, count, typesArr) asset.width != props[type].width || asset.height != props[type].height || asset.orientation != props[type].orientation || - asset.duration != props[type].duration || - asset.albumName != props[type].albumName + asset.duration != props[type].duration ) { expect(false).assertTrue(); done(); @@ -898,7 +893,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){ it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_007', 0, async function (done) { try { const fileName = new Date().getTime() + '.bat'; - const path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_DOWNLOAD); + const path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_DOCUMENTS); const fileAssets = await media.getFileAssets(filesfetchOp); const asset1 = await fileAssets.getFirstObject(); media.createAsset(fileType, fileName, path, async (err, creatAsset1) => { @@ -941,7 +936,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){ it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_008', 0, async function (done) { try { const fileName = new Date().getTime() + '.bat'; - const path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_DOWNLOAD); + const path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_DOCUMENTS); const fileAssets = await media.getFileAssets(filesfetchOp); const asset1 = await fileAssets.getFirstObject(); media.createAsset(fileType, fileName, path, async (err, creatAsset1) => { diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets index d879aa2ddee8b84073e347650f5e15bb356288a4..aacc6d262a37c7d168fa8a924c9c15b730a71852 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets @@ -100,7 +100,7 @@ const props = { displayName: '01.jpg', relativePath: 'Pictures/Static01/', size: '348113', - mediaType: '3', + mediaType: imageType.toString(), title: '01', dateTaken: '0', width: '1279', @@ -108,28 +108,26 @@ const props = { orientation: '0', duration: '0', albumId: '1118', - albumName: 'Static01' }, video: { mimeType: 'video/mp4', displayName: '01.mp4', relativePath: 'Videos/Static01/', size: '4853005', - mediaType: '4', + mediaType: videoType.toString(), title: '01', dateTaken: '0', width: '1280', height: '720', orientation: '0', duration: '10100', - albumName: 'Static01' }, audio: { mimeType: 'audio/mpeg', displayName: '01.mp3', relativePath: 'Audios/Static01/', size: '1958311', - mediaType: '5', + mediaType: audioType.toString(), title: '01', dateTaken: '0', artist: '元数据测试', @@ -137,21 +135,19 @@ const props = { height: '0', orientation: '0', duration: '219600', - albumName: 'Static01' }, file: { mimeType: 'file/*', displayName: '01.dat', relativePath: 'Documents/Static01/', size: '10', - mediaType: '1', + mediaType: fileType.toString(), title: '01', dateTaken: '0', width: '0', height: '0', orientation: '0', duration: '0', - albumName: 'Static01' } } @@ -185,8 +181,7 @@ async function checkFileAssetAttr(done, fetchFileResult, type, count, typesArr) asset.width != props[type].width || asset.height != props[type].height || asset.orientation != props[type].orientation || - asset.duration != props[type].duration || - asset.albumName != props[type].albumName + asset.duration != props[type].duration ) { expect(false).assertTrue(); done(); diff --git a/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.cpp b/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.cpp index 6151e3223d866b951c96ab1aa51f36eb596b7218..7c750280dc75cddb2822a8bdedd01b02bd5ebb78 100644 --- a/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.cpp +++ b/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.cpp @@ -110,7 +110,7 @@ HWTEST_F(RecoderLiteTest, medialite_recorder_Start_test_002, Level1) EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->Start(); sleep(1); - EXPECT_NE(RET_OK, retStatus); + EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->Release(); delete recInstance; recInstance = nullptr; @@ -174,7 +174,7 @@ HWTEST_F(RecoderLiteTest, medialite_recorder_Pause_test_002, Level1) retStatus = recInstance->Pause(); EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->Pause(); - EXPECT_NE(RET_OK, retStatus); + EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->Release(); delete recInstance; recInstance = nullptr; @@ -244,7 +244,7 @@ HWTEST_F(RecoderLiteTest, medialite_recorder_Resume_test_002, Level1) retStatus = recInstance->Resume(); EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->Resume(); - EXPECT_NE(RET_OK, retStatus); + EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->Release(); delete recInstance; recInstance = nullptr; @@ -308,7 +308,7 @@ HWTEST_F(RecoderLiteTest, medialite_recorder_Stop_test_002, Level1) retStatus = recInstance->Stop(true); EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->Stop(true); - EXPECT_NE(RET_OK, retStatus); + EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->Release(); delete recInstance; recInstance = nullptr; @@ -572,7 +572,7 @@ HWTEST_F(RecoderLiteTest, medialite_recorder_SetFileSplitDuration_test_004, Leve retStatus = recInstance->Pause(); EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->SetFileSplitDuration(type, timestamp, duration); - EXPECT_NE(RET_OK, retStatus); + EXPECT_EQ(RET_OK, retStatus); retStatus = recInstance->Release(); delete recInstance; recInstance = nullptr; diff --git a/multimodalinput/BUILD.gn b/multimodalinput/BUILD.gn index f82002374996e059ef6ea71ae8da9be04241579d..8cb3da8a1de0452540514c6e92799820a0e56add 100644 --- a/multimodalinput/BUILD.gn +++ b/multimodalinput/BUILD.gn @@ -16,6 +16,9 @@ import("//build/ohos_var.gni") group("multimodalinput") { testonly = true if (is_standard_system) { - deps = [ "input_js_standard:multimodalinput_js_test" ] + deps = [ + "input_js_standard:multimodalinput_js_test", + "multimodalinput_ets_standard:ActsMultimodalInputEtsTest", + ] } } diff --git a/multimodalinput/multimodalinput_ets_standard/BUILD.gn b/multimodalinput/multimodalinput_ets_standard/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..4de5f9aff0f0ae18a77d1c2bbae15e3a203b459e --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsMultimodalInputEtsTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":multimodalinput_ets_assets", + ":multimodalinput_ets_resources", + ":multimodalinput_ets_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsMultimodalInputEtsTest" +} +ohos_js_assets("multimodalinput_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("multimodalinput_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("multimodalinput_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/multimodalinput/multimodalinput_ets_standard/Test.json b/multimodalinput/multimodalinput_ets_standard/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..a8c9872210131e99af0555bad0550a6c67442184 --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for MultimodalInput EventType Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "ohos.acts.multimodalinput.input", + "package-name": "ohos.acts.multimodalinput.input", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsMultimodalInputEtsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/config.json b/multimodalinput/multimodalinput_ets_standard/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..d2c26caa769322b30c573d3101937c24d098768d --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/config.json @@ -0,0 +1,98 @@ +{ + "app": { + "bundleName": "ohos.acts.multimodalinput.input", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.multimodalinput.input", + "name": ".MyApplication", + "mainAbility": "ohos.acts.multimodalinput.input.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/app.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/app.ets new file mode 100755 index 0000000000000000000000000000000000000000..b917b80ff7cabb5078dd7a9d9bf546c510bd86d7 --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/pages/index.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..75987b30d85a509675937a8c615cf760364af546 --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,36 @@ +// @ts-nocheck +/* + * 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. + */ + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ACE CURVES ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/app.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/app.ets new file mode 100755 index 0000000000000000000000000000000000000000..b917b80ff7cabb5078dd7a9d9bf546c510bd86d7 --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/pages/index.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..f87ca6e18f4a4dd9c1804b8edabe664029341e78 --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,50 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100755 index 0000000000000000000000000000000000000000..dfbf1f268a45e4a2f30b8c836f42d76f3a9f5ad3 --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +// @ts-nocheck +/** + * 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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/List.test.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..815e544c72a17f618b7c70a45ae3847f6eb3bda4 --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MultimodalInputEventTypeTest from './MultimodalInputEventType.test'; + +export default function testsuite() { + MultimodalInputEventTypeTest() +} \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/MultimodalInputEventType.test.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/MultimodalInputEventType.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..fc08c8412d1bd699a50d2acf107fb2334f425a29 --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/MultimodalInputEventType.test.ets @@ -0,0 +1,303 @@ +/* + * 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 inputkeyCode from '@ohos.multimodalInput.keyCode' +import keyEvent from '@ohos.multimodalInput.keyEvent' +import mouseEvent from '@ohos.multimodalInput.mouseEvent' +import touchEvent from '@ohos.multimodalInput.touchEvent' +import { Key, KeyEvent } from '@ohos.multimodalInput.keyEvent' +import { AxisValue, MouseEvent } from '@ohos.multimodalInput.mouseEvent' +import { Touch, TouchEvent } from '@ohos.multimodalInput.touchEvent' + +import { + describe, + beforeAll, + beforeEach, + afterEach, + afterAll, + it, + expect +} from 'hypium/index' + +export default function MultimodalInputEventTypeTest() { + describe('MultimodalInput_test', function () { + + it('MultimodalInput_test::KeyEventTypeTest_0010', 0, function () { + console.info(`MultimodalInput_test::KeyEventTypeTest_0010 enter`); + + expect(keyEvent.Action.CANCEL == 0).assertTrue(); + expect(keyEvent.Action.DOWN == 1).assertTrue(); + expect(keyEvent.Action.UP == 2).assertTrue(); + + console.info(`MultimodalInput_test::KeyEventTypeTest_0010 exit`); + }) + + it('MultimodalInput_test::KeyEventTypeTest_0020', 0, function () { + console.info(`MultimodalInput_test::KeyEventTypeTest_0020 enter`); + + let testKey: Key = { code: inputkeyCode.KeyCode.KEYCODE_FN, pressedTime: 10, deviceId: 1 }; + + expect(testKey.code == inputkeyCode.KeyCode.KEYCODE_FN).assertTrue(); + expect(testKey.pressedTime == 10).assertTrue(); + expect(testKey.deviceId == 1).assertTrue(); + + console.info(`MultimodalInput_test::KeyEventTypeTest_0020 exit`); + }) + + it('MultimodalInput_test::KeyEventTypeTest_0030', 0, function () { + console.info(`MultimodalInput_test::KeyEventTypeTest_0030 enter`); + + let testKey: Key = { code: inputkeyCode.KeyCode.KEYCODE_FN, pressedTime: 10, deviceId: 1 }; + let testKeyEvent: KeyEvent = { + id: 1, deviceId: 1, actionTime: 1, screenId: 1, windowId: 1, + action: keyEvent.Action.DOWN, key: testKey, unicodeChar: 1, keys: [testKey], + ctrlKey: true, altKey: true, shiftKey: true, infooKey: true, fnKey: true, capsLock: true, numLock: true, + scrollLock: true + }; + + expect(testKeyEvent.action == keyEvent.Action.DOWN).assertTrue(); + expect(testKeyEvent.key.code == testKey.code).assertTrue(); + expect(testKeyEvent.unicodeChar == 1).assertTrue(); + expect(testKeyEvent.keys[0].code == testKey.code).assertTrue(); + expect(testKeyEvent.ctrlKey).assertTrue(); + expect(testKeyEvent.altKey).assertTrue(); + expect(testKeyEvent.shiftKey).assertTrue(); + expect(testKeyEvent.infooKey).assertTrue(); + expect(testKeyEvent.fnKey).assertTrue(); + expect(testKeyEvent.capsLock).assertTrue(); + expect(testKeyEvent.numLock).assertTrue(); + expect(testKeyEvent.scrollLock).assertTrue(); + + console.info(`MultimodalInput_test::KeyEventTypeTest_0030 exit`); + }) + + it('MultimodalInput_test::MouseEventTypeTest_0010', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0010 enter`); + + expect(mouseEvent.Action.CANCEL == 0).assertTrue(); + expect(mouseEvent.Action.MOVE == 1).assertTrue(); + expect(mouseEvent.Action.BUTTON_DOWN == 2).assertTrue(); + expect(mouseEvent.Action.BUTTON_UP == 3).assertTrue(); + expect(mouseEvent.Action.AXIS_BEGIN == 4).assertTrue(); + expect(mouseEvent.Action.AXIS_UPDATE == 5).assertTrue(); + expect(mouseEvent.Action.AXIS_END == 6).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0010 exit`); + }) + + it('MultimodalInput_test::MouseEventTypeTest_0020', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK ); + + expect(mouseEvent.Button.LEFT == 0).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`); + }) + it('MultimodalInput_test::MouseEventTypeTest_00201', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK ); + + expect(mouseEvent.Button.MIDDLE == 1).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`); + }) + it('MultimodalInput_test::MouseEventTypeTest_00202', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK ); + + expect(mouseEvent.Button.RIGHT == 2).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`); + }) + it('MultimodalInput_test::MouseEventTypeTest_00203', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK ); + + expect(mouseEvent.Button.SIDE == 3).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`); + }) + it('MultimodalInput_test::MouseEventTypeTest_00204', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK ); + + expect(mouseEvent.Button.EXTRA == 4).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`); + }) + + it('MultimodalInput_test::MouseEventTypeTest_00205', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK ); + + expect(mouseEvent.Button.FORWARD == 5).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`); + }) + + it('MultimodalInput_test::MouseEventTypeTest_00206', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK ); + + expect(mouseEvent.Button.BACK == 6).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`); + }) + + it('MultimodalInput_test::MouseEventTypeTest_00207', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK ); + + + expect(mouseEvent.Button.TASK == 7).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`); + }) + + it('MultimodalInput_test::MouseEventTypeTest_0030', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0030 enter`); + + expect(mouseEvent.Axis.SCROLL_VERTICAL == 0).assertTrue(); + expect(mouseEvent.Axis.SCROLL_HORIZONTAL == 1).assertTrue(); + expect(mouseEvent.Axis.PINCH == 2).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0030 exit`); + }) + + it('MultimodalInput_test::MouseEventTypeTest_0040', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0040 enter`); + + let testAxisValue: AxisValue = { axis: mouseEvent.Axis.SCROLL_VERTICAL, value: 1 }; + expect(testAxisValue.axis == mouseEvent.Axis.SCROLL_VERTICAL).assertTrue(); + expect(testAxisValue.value == 1).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0040 exit`); + }) + + it('MultimodalInput_test::MouseEventTypeTest_0050', 0, function () { + console.info(`MultimodalInput_test::MouseEventTypeTest_0050 enter`); + + let testAxisValue: AxisValue = { axis: mouseEvent.Axis.SCROLL_VERTICAL, value: 1 }; + let testMouseEvent: MouseEvent = { + id: 1, deviceId: 1, actionTime: 1, screenId: 1, windowId: 1, + action: mouseEvent.Action.CANCEL, screenX: 1, screenY: 1, windowX: 1, + windowY: 1, rawDeltaX: 1, rawDeltaY: 1, button: mouseEvent.Button.LEFT, + pressedButtons: [mouseEvent.Button.LEFT], axes: [testAxisValue], + pressedKeys: [inputkeyCode.KeyCode.KEYCODE_FN], ctrlKey: true, altKey: true, shiftKey: true, + infooKey: true, fnKey: true, capsLock: true, numLock: true, scrollLock: true + }; + expect(testMouseEvent.action == mouseEvent.Action.CANCEL).assertTrue(); + expect(testMouseEvent.screenX == 1).assertTrue(); + expect(testMouseEvent.screenY == 1).assertTrue(); + expect(testMouseEvent.windowX == 1).assertTrue(); + expect(testMouseEvent.windowY == 1).assertTrue(); + expect(testMouseEvent.rawDeltaX == 1).assertTrue(); + expect(testMouseEvent.rawDeltaY == 1).assertTrue(); + expect(testMouseEvent.button == mouseEvent.Button.LEFT).assertTrue(); + expect(testMouseEvent.pressedButtons[0] == mouseEvent.Button.LEFT).assertTrue(); + expect(testMouseEvent.axes[0].axis == mouseEvent.Axis.SCROLL_VERTICAL).assertTrue(); + expect(testMouseEvent.pressedKeys[0] == inputkeyCode.KeyCode.KEYCODE_FN).assertTrue(); + expect(testMouseEvent.ctrlKey).assertTrue(); + expect(testMouseEvent.altKey).assertTrue(); + expect(testMouseEvent.shiftKey).assertTrue(); + expect(testMouseEvent.infooKey).assertTrue(); + expect(testMouseEvent.fnKey).assertTrue(); + expect(testMouseEvent.capsLock).assertTrue(); + expect(testMouseEvent.numLock).assertTrue(); + expect(testMouseEvent.scrollLock).assertTrue(); + + console.info(`MultimodalInput_test::MouseEventTypeTest_0050 exit`); + }) + + it('MultimodalInput_test::TouchEventTypeTest_0010', 0, function () { + console.info(`MultimodalInput_test::TouchEventTypeTest_0010 enter`); + + expect(touchEvent.Action.CANCEL == 0).assertTrue(); + expect(touchEvent.Action.DOWN == 1).assertTrue(); + expect(touchEvent.Action.MOVE == 2).assertTrue(); + expect(touchEvent.Action.UP == 3).assertTrue(); + + console.info(`MultimodalInput_test::TouchEventTypeTest_0010 exit`); + }) + + it('MultimodalInput_test::TouchEventTypeTest_0020', 0, function () { + console.info(`MultimodalInput_test::TouchEventTypeTest_0020 enter`); + + expect(touchEvent.ToolType.FINGER == 0).assertTrue(); + expect(touchEvent.ToolType.PEN == 1).assertTrue(); + expect(touchEvent.ToolType.RUBBER == 2).assertTrue(); + expect(touchEvent.ToolType.BRUSH == 3).assertTrue(); + expect(touchEvent.ToolType.PENCIL == 4).assertTrue(); + expect(touchEvent.ToolType.AIRBRUSH == 5).assertTrue(); + expect(touchEvent.ToolType.MOUSE == 6).assertTrue(); + expect(touchEvent.ToolType.LENS == 7).assertTrue(); + + console.info(`MultimodalInput_test::TouchEventTypeTest_0020 exit`); + }) + + it('MultimodalInput_test::TouchEventTypeTest_0030', 0, function () { + console.info(`MultimodalInput_test::TouchEventTypeTest_0030 enter`); + + expect(touchEvent.SourceType.TOUCH_SCREEN == 0).assertTrue(); + expect(touchEvent.SourceType.PEN == 1).assertTrue(); + expect(touchEvent.SourceType.TOUCH_PAD == 2).assertTrue(); + + console.info(`MultimodalInput_test::TouchEventTypeTest_0030 exit`); + }) + + it('MultimodalInput_test::TouchEventTypeTest_0040', 0, function () { + console.info(`MultimodalInput_test::TouchEventTypeTest_0040 enter`); + + let testTouch: Touch = { + id: 1, pressedTime: 1, screenX: 1, screenY: 1, windowX: 1, windowY: 1, pressure: 1, + width: 1, height: 1, tiltX: 1, tiltY: 1, toolX: 1, toolY: 1, toolWidth: 1, toolHeight: 1, rawX: 1, + rawY: 1, toolType: touchEvent.ToolType.FINGER + }; + expect(testTouch.id == 1).assertTrue(); + expect(testTouch.pressedTime == 1).assertTrue(); + expect(testTouch.screenX == 1).assertTrue(); + expect(testTouch.screenY == 1).assertTrue(); + expect(testTouch.windowX == 1).assertTrue(); + expect(testTouch.windowY == 1).assertTrue(); + expect(testTouch.pressure == 1).assertTrue(); + expect(testTouch.width == 1).assertTrue(); + expect(testTouch.height == 1).assertTrue(); + expect(testTouch.tiltX == 1).assertTrue(); + expect(testTouch.tiltY == 1).assertTrue(); + expect(testTouch.toolX == 1).assertTrue(); + expect(testTouch.toolY == 1).assertTrue(); + expect(testTouch.toolWidth == 1).assertTrue(); + expect(testTouch.toolHeight == 1).assertTrue(); + expect(testTouch.rawX == 1).assertTrue(); + expect(testTouch.rawY == 1).assertTrue(); + expect(testTouch.toolType == touchEvent.ToolType.FINGER).assertTrue(); + + console.info(`MultimodalInput_test::TouchEventTypeTest_0040 exit`); + }) + + it('MultimodalInput_test::TouchEventTypeTest_0050', 0, function () { + console.info(`MultimodalInput_test::TouchEventTypeTest_0050 enter`); + + let testTouch: Touch = { + id: 1, pressedTime: 1, screenX: 1, screenY: 1, windowX: 1, windowY: 1, pressure: 1, + width: 1, height: 1, tiltX: 1, tiltY: 1, toolX: 1, toolY: 1, toolWidth: 1, toolHeight: 1, rawX: 1, + rawY: 1, toolType: touchEvent.ToolType.FINGER + }; + let testTouchEvent: TouchEvent = { + id: 1, deviceId: 1, actionTime: 1, screenId: 1, windowId: 1, + action: touchEvent.Action.CANCEL, touch: testTouch, touches: [testTouch], + sourceType: touchEvent.SourceType.TOUCH_SCREEN + }; + expect(testTouchEvent.action == touchEvent.Action.CANCEL).assertTrue(); + expect(testTouchEvent.touch.id == 1).assertTrue(); + expect(testTouchEvent.touches[0].id == 1).assertTrue(); + expect(testTouchEvent.sourceType == touchEvent.SourceType.TOUCH_SCREEN).assertTrue(); + + console.info(`MultimodalInput_test::TouchEventTypeTest_0050 exit`); + }) + }) +} diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/Utils.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/Utils.ets new file mode 100755 index 0000000000000000000000000000000000000000..0f4b16d766f1feeb75edd8cc84cd1448d61e569a --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default class Utils { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } + + static async swipe(downX, downY, upX, upY, steps) { + console.info('start to swipe') + this.drags(downX, downY, upX, upY, steps, false) + } + + static async drag(downX, downY, upX, upY, steps) { + console.info('start to drag') + this.drags(downX, downY, upX, upY, steps, true) + } + + static async drags(downX, downY, upX, upY, steps, drag) { + var xStep; + var yStep; + var swipeSteps; + var ret; + xStep = 0; + yStep = 0; + ret = false; + swipeSteps = steps; + if (swipeSteps == 0) { + swipeSteps = 1; + } + xStep = (upX - downX) / swipeSteps; + yStep = (upY - downY) / swipeSteps; + console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) + var downPonit: TouchObject = { + id: 1, + x: downX, + y: downY, + type: TouchType.Down, + } + console.info('down touch started: ' + JSON.stringify(downPonit)) + sendTouchEvent(downPonit); + console.info('start to move') + if (drag) { + await this.sleep(500) + } + for (var i = 1;i <= swipeSteps; i++) { + var movePoint: TouchObject = { + id: 1, + x: downX + (xStep * i), + y: downY + (yStep * i), + type: TouchType.Move + } + console.info('move touch started: ' + JSON.stringify(movePoint)) + ret = sendTouchEvent(movePoint) + if (ret == false) { + break; + } + await this.sleep(5) + } + console.info('start to up') + if (drag) { + await this.sleep(100) + } + var upPoint: TouchObject = { + id: 1, + x: upX, + y: upY, + type: TouchType.Up, + } + console.info('up touch started: ' + JSON.stringify(upPoint)) + sendTouchEvent(upPoint) + await this.sleep(500) + } +} + + + + diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/color.json b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/color.json new file mode 100755 index 0000000000000000000000000000000000000000..07a14d2b8dcf50dae012854d8310c489dfd7391c --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/float.json b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/float.json new file mode 100755 index 0000000000000000000000000000000000000000..26a0491a2b293d8296d4de4d55c8d682527b6c6b --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/string.json b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..f6488bb9ccc6588f4a68440a5a320c1d2d952a99 --- /dev/null +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + }, + { + "name":"string_hello", + "value":"Hello" + }, + { + "name":"string_world", + "value":"World" + }, + { + "name":"message_arrive", + "value":"We will arrive at %s." + } + ] +} \ No newline at end of file diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/media/icon.png b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/media/icon.png differ diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/rawfile/test.png b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/rawfile/test.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/rawfile/test.png differ diff --git a/multimodalinput/multimodalinput_ets_standard/signature/openharmony_sx.p7b b/multimodalinput/multimodalinput_ets_standard/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/multimodalinput/multimodalinput_ets_standard/signature/openharmony_sx.p7b differ diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/publishsound/src/main/js/test/ExampleJsunit.test.js index 64a06637fcb1ef122a23a997cf5f0c929bccef18..7edb397f3667d73d40259bc7230f385ce5094358 100644 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/test/ExampleJsunit.test.js +++ b/notification/ans_standard/publish_test/publishsound/src/main/js/test/ExampleJsunit.test.js @@ -31,7 +31,7 @@ describe('ActsAnsPublishSoundTest', function () { var sound = data.sortingMap.sortings[hashCode].slot.sound console.info("=============Ans_PublishSound_0100 onConsume sound============>" + sound); if (timesOfOnConsume == 1){ - expect(sound).assertEqual("file://system/etc/Light.ogg"); + expect(sound != undefined).assertTrue(); console.info("=============Ans_PublishSound_0100 onConsume timesOfOnConsume1============>"); } else if (timesOfOnConsume == 2){ expect(sound).assertEqual("sound_0100"); @@ -119,7 +119,7 @@ describe('ActsAnsPublishSoundTest', function () { var sound = data.sortingMap.sortings[hashCode].slot.sound console.info("=============Ans_PublishSound_0200 onConsume sound============>" + sound); if (timesOfOnConsume == 1){ - expect(sound).assertEqual("file://system/etc/Light.ogg"); + expect(sound != undefined).assertTrue(); console.info("=============Ans_PublishSound_0200 onConsume timesOfOnConsume1============>"); } else if (timesOfOnConsume == 2){ expect(sound).assertEqual("sound_0200"); @@ -964,6 +964,7 @@ describe('ActsAnsPublishSoundTest', function () { notify.addSlot({ type:notify.SlotType.UNKNOWN_TYPE, sound:"sound_1100", + vibrationEnabled:true, vibrationValues:[11,0,11,0], }); var notificationRequest = { @@ -1002,6 +1003,7 @@ describe('ActsAnsPublishSoundTest', function () { { type:notify.SlotType.UNKNOWN_TYPE, sound:"sound_1100_set", + vibrationEnabled:true, vibrationValues:[11,11,11,11], }).then(()=>{ console.info("=======Ans_PublishSound_1100 publish1 then setSlotByBundle then======>"); diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js index 5fa814eaa319db42425b8b1df44d57b2d90e8fcd..96c4cf46a0751ad3e87af3368639e1219c215a1b 100644 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js +++ b/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js @@ -12,364 +12,448 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import Subscriber from "@ohos.commonEvent"; +import commonEvent from '@ohos.commonEvent'; import {describe,beforeAll,beforeEach,afterEach,afterAll,it,expect,} from "@ohos/hypium"; export default function ActsSubscriberTestUnorder() { -describe("ActsSubscriberTestUnorder", async function (done) { - console.info( - "===========ActsSubscriberTestUnorder start====================>" - ); - let commonEventSubscriber001; - let commonEventSubscriber002; - let commonEventSubscriber003; - let commonEventSubscriber004; - let commonEventSubscriber0051; - let commonEventSubscriber0052; - let commonEventSubscriber006; - let commonEventSubscriber007; - let commonEventSubscriber008; - let commonEventSubscriber0101; - let commonEventSubscriber0102; - let commonEventSubscriber011; - let commonEventSubscriber012; - - function publishCallback(err) { - console.info("==========================>publishCallback"); - } - - function publishCallback10001(err) { - console.info("==========================>publishCallback"); - } - - function publishCallback10002(err) { - console.info("==========================>publishCallback"); - } - - function unsubscriberCallBack(err) { - console.info("==========================>unsubscriberCallBack"); - } - - /* - * @tc.number : ActsSubscriberTestUnorder_0100 - * @tc.name : verify subscribe and publish : Check subscribe and publish common event data - * @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise) - */ - it("ActsSubscriberTestUnorder_0100", 0, async function (done) { - console.info("===============ActsSubscriberTestUnorder_0100=============================>"); - function subscriberCallBack001(err, data) { - console.info("==========================>subscriberCallBack001"); - expect(data.event).assertEqual("publish_event0100"); - expect(data.bundleName).assertEqual(""); - expect(data.code).assertEqual(0); - expect(data.data).assertEqual(""); - done(); - } - - let commonEventSubscribeInfo = { - events: ["publish_event0100"], - }; - - Subscriber.createSubscriber(commonEventSubscribeInfo).then((data) => { - console.info("===============ActsSubscriberTestUnorder_0100=========createSubscriber promise"); - commonEventSubscriber001 = data; - data.getSubscribeInfo().then(() => { - console.info( "===============ActsSubscriberTestUnorder_0100=========getSubscribeInfo promise"); - Subscriber.subscribe(commonEventSubscriber001, subscriberCallBack001); - setTimeout(function () { - console.info("==========ActsSubscriberTestUnorder_0100 publish start============"); - Subscriber.publish("publish_event0100", publishCallback); - }, 1000); - }); - }); - }); - - /* - * @tc.number : ActsSubscriberTestUnorder_0200 - * @tc.name : verify subscribe and publish : Check subscribe and publish common event data - * of containing special characters - * @tc.desc : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface (by Promise) - */ - it("ActsSubscriberTestUnorder_0200", 0, async function (done) { - console.info("===============ActsSubscriberTestUnorder_0200==========================>"); - - function subscriberCallBack002(err, data) { - console.info("==========================>subscriberCallBack002"); - expect(data.event).assertEqual("@#¥#3243adsafdf_"); - expect(data.bundleName).assertEqual(""); - expect(data.code).assertEqual(0); - expect(data.data).assertEqual(""); - done(); - } - - let commonEventSubscribeInfo = { - events: ["@#¥#3243adsafdf_"], - }; - - Subscriber.createSubscriber(commonEventSubscribeInfo).then((data) => { - console.info("===============ActsSubscriberTestUnorder_0200=========createSubscriber promise"); - commonEventSubscriber002 = data; - data.getSubscribeInfo().then(() => { - console.info("===============ActsSubscriberTestUnorder_0200=========getSubscribeInfo promise"); - Subscriber.subscribe(commonEventSubscriber002, subscriberCallBack002); - setTimeout(function () { - console.info("==========ActsSubscriberTestUnorder_0200 publish start============"); - Subscriber.publish("@#¥#3243adsafdf_", publishCallback); - }, 1000); - }); - }); - }); - - /* - * @tc.number : ActsSubscriberTestUnorder_0300 - * @tc.name : verify subscribe and publish : Check subscribe and publish common event data - * with publishInfo data - * @tc.desc : Check the subscriber can receive event "publish_event0300" type of the interface (by Promise) - */ - it("ActsSubscriberTestUnorder_0300", 0, async function (done) { - console.info("===============ActsSubscriberTestUnorder_0300==========================>"); - let commonEventSubscribeInfo = { - events: ["publish_event0300"], - publisherDeviceId: "PublishDeviceId0300", - priority: 10, - }; - - let commonEventPublishData = { - isOrdered: false, - code: 55, - data: "PublishData0300", - }; - - function isOrderedCommonEventCallback003(err, data) { - console.info("==========================>isOrderedCommonEventCallback003"); - expect(data).assertEqual(false); - done(); - } - - function subscriberCallBack003(err, data) { - console.info("==========================>subscriberCallBack003"); - expect(data.event).assertEqual("publish_event0300"); - expect(data.code).assertEqual(55); - expect(data.data).assertEqual("PublishData0300"); - commonEventSubscriber003.isOrderedCommonEvent( - isOrderedCommonEventCallback003 - ); - } + describe('ActsSubscriberTestUnorder', function () { - Subscriber.createSubscriber(commonEventSubscribeInfo).then((data) => { - console.info("===============ActsSubscriberTestUnorder_0300=========createSubscriber promise"); - commonEventSubscriber003 = data; - data.getSubscribeInfo().then(() => { - console.info("===============ActsSubscriberTestUnorder_0300=========getSubscribeInfo promise"); - Subscriber.subscribe(commonEventSubscriber003, subscriberCallBack003); - setTimeout(function () { - console.info("==========ActsSubscriberTestUnorder_0300 publish start============"); - Subscriber.publish("publish_event0300",commonEventPublishData,publishCallback); - }, 1000); - }); - }); - }); - - /* - * @tc.number : ActsSubscriberTestUnorder_0400 - * @tc.name : verify subscribe and publish : Check subscribe and publish common event data - * with publishInfo data - * @tc.desc : Check the subscriber can receive event "publish_event0300" type of the interface (by Promise) - */ - it("ActsSubscriberTestUnorder_0400", 0, async function (done) { - console.info("===============ActsSubscriberTestUnorder_0400==========================>"); - let commonEventSubscribeInfo = { - events: ["publish_event0400"], - publisherDeviceId: "PublishDeviceId0400", - priority: 10, - }; - - let commonEventPublishData = { - isOrdered: false, - bundleName: "com.example.actssubscribertestunorder", - code: 55, - data: "PublishData0400", - }; - - function isOrderedCommonEventCallback004(err, data) { - console.info("==========================>isOrderedCommonEventCallback003"); - expect(data).assertEqual(false); - done(); - } + let TAG = 'ActsSubscriberTestUnorder ===>'; - function subscriberCallBack004(err, data) { - console.info("==========================>subscriberCallBack004"); - expect(data.event).assertEqual("publish_event0400"); - expect(data.code).assertEqual(55); - expect(data.data).assertEqual("PublishData0400"); - commonEventSubscriber004.isOrderedCommonEvent( - isOrderedCommonEventCallback004 - ); + let CommonEventSubscriberInfo = { + events: ['event'], + publisherPermission: '', + publisherDeviceId: '', + userId: 100, + priority: 1000 } - Subscriber.createSubscriber(commonEventSubscribeInfo).then((data) => { - console.info("===============ActsSubscriberTestUnorder_0400=========createSubscriber promise"); - commonEventSubscriber004 = data; - data.getSubscribeInfo().then(() => { - console.info( - "===============ActsSubscriberTestUnorder_0400=========getSubscribeInfo promise" - ); - Subscriber.subscribe(commonEventSubscriber004, subscriberCallBack004); - setTimeout(function () { - console.info("==========ActsSubscriberTestUnorder_0400 publish start============"); - Subscriber.publish( - "publish_event0400", - commonEventPublishData, - publishCallback - ); - }, 1000); - }); - }); - }); - - /* - * @tc.number : ActsSubscriberTestUnorder_0500 - * @tc.name : verify subscribe and publish : Check the two different subscribe and one publish, - * and check unsubscribe event - * @tc.desc : Check the subscriber can receive event "publish_event0500" type of the interface (by Promise) - */ - it("ActsSubscriberTestUnorder_0500", 0, async function (done) { - console.info("===============ActsSubscriberTestUnorder_0500==========================>"); - let commonEventSubscribeInfo = { - events: ["publish_event0500"], - }; - - let commonEventPublishData = { - isOrdered: false, - isSticky: false, - }; - - function subscriberCallBack005(err, data) { - console.info("==========================>subscriberCallBack0500"); - expect(data.event).assertEqual("publish_event0500"); - expect(data.bundleName).assertEqual(""); - expect(data.code).assertEqual(0); - expect(data.data).assertEqual(""); - done(); + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); } - - Subscriber.createSubscriber(commonEventSubscribeInfo).then((data) => { - console.info("===============ActsSubscriberTestUnorder_0500_1=========createSubscriber promise"); - commonEventSubscriber0051 = data; - data.getSubscribeInfo().then(() => { - console.info("===============ActsSubscriberTestUnorder_0500_1=========getSubscribeInfo promise"); - Subscriber.subscribe(commonEventSubscriber0051, subscriberCallBack005); - }); - }); - - Subscriber.createSubscriber(commonEventSubscribeInfo).then((data) => { - console.info("===============ActsSubscriberTestUnorder_0500_2=========createSubscriber promise"); - commonEventSubscriber0052 = data; - data.getSubscribeInfo().then(() => { - console.info("===============ActsSubscriberTestUnorder_0500_2=========getSubscribeInfo promise"); - Subscriber.subscribe(commonEventSubscriber0052, subscriberCallBack005); - Subscriber.unsubscribe(commonEventSubscriber0051, unsubscriberCallBack); - setTimeout(function () { - console.info( - "==========ActsSubscriberTestUnorder_0500 publish start============" - ); - Subscriber.publish( - "publish_event0500", - commonEventPublishData, - publishCallback - ); - }, 1000); - }); - }); - }); - - /* - * @tc.number : ActsSubscriberTestUnorder_0600 - * @tc.name : verify subscribe and publish : Check whether the current public event is a sticky event - * @tc.desc : isStickyCommonEvent(callback: AsyncCallback): void - */ - it("ActsSubscriberTestUnorder_0600", 0, async function (done) { - console.info("===============ActsSubscriberTestUnorder_0600==========================>"); - let commonEventSubscribeInfo = { - events: ["publish_event0600"], - }; - - let commonEventPublishData = { - isOrdered: false, - isSticky: false, - }; - - function isStickyCallback(err, isSticky) { - console.info("==========================>isStickyCallback"); - expect(isSticky).assertEqual(false); - done(); - } - - function subscriberCallBack006(err, data) { - console.info("==========================>subscriberCallBack006"); - commonEventSubscriber006.isStickyCommonEvent(isStickyCallback); - } - - Subscriber.createSubscriber(commonEventSubscribeInfo).then((data) => { - console.info("===============ActsSubscriberTestUnorder_0600=========createSubscriber promise"); - commonEventSubscriber006 = data; - data.getSubscribeInfo().then(() => { - console.info("===============ActsSubscriberTestUnorder_0600=========getSubscribeInfo promise"); - Subscriber.subscribe(commonEventSubscriber006, subscriberCallBack006); - Subscriber.unsubscribe(commonEventSubscriber006, unsubscriberCallBack); - setTimeout(function () { - console.info("==========ActsSubscriberTestUnorder_0600 publish start============"); - Subscriber.publish("publish_event0600",commonEventPublishData,publishCallback); - }, 1000); - }); - }); - }); - - /* - * @tc.number : ActsSubscriberTestUnorder_0700 - * @tc.name : verify subscribe and publish : Check whether the current public event is a sticky event - * @tc.desc : isStickyCommonEvent(): Promise - */ - it("ActsSubscriberTestUnorder_0700", 0, async function (done) { - console.info("===============ActsSubscriberTestUnorder_0700==========================>"); - let commonEventSubscribeInfo = { - events: ["publish_event0700"], - userId:100 - }; - - let commonEventPublishData = { - isOrdered: false, - isSticky: false, - }; - - function subscriberCallBack007(err, data) { - console.info("subscriberCallBack007"); - commonEventSubscriber007 - .isStickyCommonEvent() - .then((isSticky) => { - console.info("isSticky " + JSON.stringify(isSticky)); - expect(isSticky).assertEqual(false); - done(); - }) - .catch((err) => { - console.info("isSticky failed " + JSON.stringify(err)); - }); - } - - Subscriber.createSubscriber(commonEventSubscribeInfo).then((data) => { - console.info("===============ActsSubscriberTestUnorder_0700=========createSubscriber promise"); - expect(commonEventSubscribeInfo.userId).assertEqual(100) - commonEventSubscriber007 = data; - data.getSubscribeInfo().then(() => { - console.info("===============ActsSubscriberTestUnorder_0700=========getSubscribeInfo promise"); - Subscriber.subscribe(commonEventSubscriber007, subscriberCallBack007); - Subscriber.unsubscribe(commonEventSubscriber007, unsubscriberCallBack); - setTimeout(function () { - console.info("==========ActsSubscriberTestUnorder_0700 publish start============"); - Subscriber.publish("publish_event0700",commonEventPublishData,publishCallback); - }, 1000); - }); - }); - }); -}); + /* + * @tc.number : ActsSubscriberTestUnorder_0100 + * @tc.name : check + * @tc.desc : getSubscribeInfo(callback: AsyncCallback): void + */ + it('ActsSubscriberTestUnorder_0100', 0, async function (done) { + console.info(TAG + 'ActsSubscriberTestUnorder_0100 START ') + let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) + if (CommonEventSubscriber == undefined) { + console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(true).assertTrue() + } + + await CommonEventSubscriber.getSubscribeInfo((err, CommonEventSubscriberInfo) => { + if (err.code) { + console.info(TAG + ': getSubscribeInfo failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': getSubscribeInfo successed! event.Info ===> ' + JSON.stringify(CommonEventSubscriberInfo)) + expect(true).assertTrue() + expect(CommonEventSubscriberInfo.events[0]).assertEqual('event') + expect(CommonEventSubscriberInfo.publisherPermission == '').assertTrue() + expect(CommonEventSubscriberInfo.publisherDeviceId == '').assertTrue() + expect(CommonEventSubscriberInfo.userId).assertEqual(100) + expect(CommonEventSubscriberInfo.priority).assertEqual(1000) + done() + } + }) + }) + + /* + * @tc.number : ActsSubscriberTestUnorder_0200 + * @tc.name : check + * @tc.desc : getSubscribeInfo(): Promise + */ + it('ActsSubscriberTestUnorder_0200', 0, async function (done) { + console.info(TAG + 'ActsSubscriberTestUnorder_0200 START ') + let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) + if (CommonEventSubscriber == undefined) { + console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(true).assertTrue() + } + + await CommonEventSubscriber.getSubscribeInfo().then((CommonEventSubscriberInfo) => { + console.info(TAG + ': getSubscribeInfo promise successed! event.Info ===> ' + JSON.stringify(CommonEventSubscriberInfo)) + expect(true).assertTrue() + expect(CommonEventSubscriberInfo.events[0]).assertEqual('event') + expect(CommonEventSubscriberInfo.publisherPermission == '').assertTrue() + expect(CommonEventSubscriberInfo.publisherDeviceId == '').assertTrue() + expect(CommonEventSubscriberInfo.userId).assertEqual(100) + expect(CommonEventSubscriberInfo.priority).assertEqual(1000) + done() + }).catch((err) => { + console.info(TAG + ': getSubscribeInfo promise failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + }) + + }) + + /* + * @tc.number : ActsgetSubscribeInfoTest_0300 + * @tc.name : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface + * @tc.desc : getSubscribeInfo(callback: AsyncCallback): void + */ + it('ActsgetSubscribeInfoTest_0300', 0, async function (done) { + console.info(TAG + 'ActsgetSubscribeInfoTest_0100 START ') + CommonEventSubscriberInfo.events[0] = '@#¥#3243adsafdf_' + let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) + if (CommonEventSubscriber == undefined) { + console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(true).assertTrue() + } + + await CommonEventSubscriber.getSubscribeInfo((err, CommonEventSubscriberInfo) => { + if (err.code) { + console.info(TAG + ': getSubscribeInfo failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': getSubscribeInfo successed! event.Info ===> ' + JSON.stringify(CommonEventSubscriberInfo)) + expect(true).assertTrue() + expect(CommonEventSubscriberInfo.events[0]).assertEqual('@#¥#3243adsafdf_') + expect(CommonEventSubscriberInfo.publisherPermission == '').assertTrue() + expect(CommonEventSubscriberInfo.publisherDeviceId == '').assertTrue() + expect(CommonEventSubscriberInfo.userId).assertEqual(100) + expect(CommonEventSubscriberInfo.priority).assertEqual(1000) + done() + } + }) + }) + + /* + * @tc.number : ActsgetSubscribeInfoTest_0400 + * @tc.name : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface (by Promise) + * @tc.desc : getSubscribeInfo(callback: AsyncCallback): void + */ + it('ActsSubscriberTestUnorder_0400', 0, async function (done) { + console.info(TAG + 'ActsSubscriberTestUnorder_0400 START ') + CommonEventSubscriberInfo.events[0] = '@#¥#3243adsafdf_' + let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) + if (CommonEventSubscriber == undefined) { + console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(true).assertTrue() + } + + await CommonEventSubscriber.getSubscribeInfo().then((CommonEventSubscriberInfo) => { + console.info(TAG + ': getSubscribeInfo promise successed! event.Info ===> ' + JSON.stringify(CommonEventSubscriberInfo)) + expect(true).assertTrue() + expect(CommonEventSubscriberInfo.events[0]).assertEqual('@#¥#3243adsafdf_') + expect(CommonEventSubscriberInfo.publisherPermission == '').assertTrue() + expect(CommonEventSubscriberInfo.publisherDeviceId == '').assertTrue() + expect(CommonEventSubscriberInfo.userId).assertEqual(100) + expect(CommonEventSubscriberInfo.priority).assertEqual(1000) + done() + }).catch((err) => { + console.info(TAG + ': getSubscribeInfo promise failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + }) + + }) + + /* + * @tc.number : ActsSubscriberTestUnorder_0500 + * @tc.name : check + * @tc.desc : isOrderedCommonEvent(callback: AsyncCallback): void + */ + it('ActsSubscriberTestUnorder_0500', 0, async function (done) { + console.info(TAG + 'ActsSubscriberTestUnorder_0500 START ') + CommonEventSubscriberInfo.events[0] = 'publish_event_0500' + CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0500' + CommonEventSubscriberInfo.priority = 10 + + let CommonEventPublishData = { + code: 0, + data: "initial_data", + isOrdered: true, + } + let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) + if (CommonEventSubscriber == undefined) { + console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(true).assertTrue() + } + + await commonEvent.subscribe(CommonEventSubscriber, (err, CommonEventData) => { + if (err.code) { + console.info(TAG + ': subscribe failed! Err.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': subscribe successed! CommonEventData.Info ===> ' + JSON.stringify(CommonEventData)) + expect(true).assertTrue() + } + }) + + await CommonEventSubscriber.isOrderedCommonEvent((err) => { + if (err.code) { + console.info(TAG + ': isOrderedCommonEvent failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': isOrderedCommonEvent successed!') + expect(true).assertTrue() + expect(CommonEventSubscriberInfo.events[0]).assertEqual('publish_event_0500') + expect(CommonEventSubscriberInfo.publisherPermission == '').assertTrue() + expect(CommonEventSubscriberInfo.publisherDeviceId).assertEqual('PublishDeviceId_0500') + expect(CommonEventSubscriberInfo.userId).assertEqual(100) + expect(CommonEventSubscriberInfo.priority).assertEqual(10) + expect(CommonEventPublishData.code).assertEqual(0) + expect(CommonEventPublishData.data).assertEqual('initial_data') + expect(CommonEventPublishData.isOrdered).assertTrue() + done() + } + }) + + await commonEvent.publish('publish_event_0500', CommonEventPublishData, (err) => { + if (err.code) { + console.info(TAG + ': publish failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': publish successed! event.Info ===> ' + JSON.stringify(CommonEventPublishData)) + expect(true).assertTrue() + done() + } + }) + + await sleep(5000); + }) + + /* + * @tc.number : ActsSubscriberTestUnorder_0600 + * @tc.name : check + * @tc.desc : isOrderedCommonEvent(): Promise + */ + it('ActsSubscriberTestUnorder_0600', 0, async function (done) { + console.info(TAG + 'ActsSubscriberTestUnorder_0600 START ') + CommonEventSubscriberInfo.events[0] = 'publish_event_0600' + CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0600' + CommonEventSubscriberInfo.priority = 10 + + let CommonEventPublishData = { + bundleName: 'com.example.actssubscribertestunorder', + code: 0, + data: "initial_data", + isOrdered: true, + } + let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) + if (CommonEventSubscriber == undefined) { + console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(true).assertTrue() + } + + await commonEvent.subscribe(CommonEventSubscriber, (err, CommonEventData) => { + if (err.code) { + console.info(TAG + ': subscribe failed! Err.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': subscribe successed! CommonEventData.Info ===> ' + JSON.stringify(CommonEventData)) + expect(true).assertTrue() + } + }) + + await CommonEventSubscriber.isOrderedCommonEvent().then(() => { + console.info(TAG + ': isOrderedCommonEvent successed!') + expect(true).assertTrue() + expect(CommonEventSubscriberInfo.events[0]).assertEqual('publish_event_0600') + expect(CommonEventSubscriberInfo.publisherPermission == '').assertTrue() + expect(CommonEventSubscriberInfo.publisherDeviceId).assertEqual('PublishDeviceId_0600') + expect(CommonEventSubscriberInfo.userId).assertEqual(100) + expect(CommonEventSubscriberInfo.priority).assertEqual(10) + expect(CommonEventPublishData.bundleName).assertEqual('com.example.actssubscribertestunorder') + expect(CommonEventPublishData.code).assertEqual(0) + expect(CommonEventPublishData.data).assertEqual('initial_data') + expect(CommonEventPublishData.isOrdered).assertTrue() + done() + }).catch((err) => { + console.info(TAG + ': isOrderedCommonEvent failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + }) + + await commonEvent.publish('publish_event_0600', CommonEventPublishData, (err) => { + if (err.code) { + console.info(TAG + ': publish failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': publish successed! event.Info ===> ' + JSON.stringify(CommonEventPublishData)) + expect(true).assertTrue() + done() + } + }) + + await sleep(500) + + }) + + /* + * @tc.number : ActsSubscriberTestUnorder_0700 + * @tc.name : check + * @tc.desc : iisStickyCommonEvent(callback: AsyncCallback): void + */ + it('ActsSubscriberTestUnorder_0700', 0, async function (done) { + console.info(TAG + 'ActsSubscriberTestUnorder_0700 START ') + CommonEventSubscriberInfo.events[0] = 'publish_event_0700' + CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0700' + CommonEventSubscriberInfo.priority = 10 + + let CommonEventPublishData = { + code: 0, + data: "initial_data", + isSticky: true, + } + let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) + if (CommonEventSubscriber == undefined) { + console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(true).assertTrue() + } + + await commonEvent.subscribe(CommonEventSubscriber, (err, CommonEventData) => { + if (err.code) { + console.info(TAG + ': subscribe failed! Err.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': subscribe successed! CommonEventData.Info ===> ' + JSON.stringify(CommonEventData)) + expect(true).assertTrue() + } + }) + + await CommonEventSubscriber.isStickyCommonEvent((err) => { + if (err.code) { + console.info(TAG + ': isStickyCommonEvent failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': isStickyCommonEvent successed!') + expect(true).assertTrue() + expect(CommonEventSubscriberInfo.events[0]).assertEqual('publish_event_0700') + expect(CommonEventSubscriberInfo.publisherPermission == '').assertTrue() + expect(CommonEventSubscriberInfo.publisherDeviceId).assertEqual('PublishDeviceId_0700') + expect(CommonEventSubscriberInfo.userId).assertEqual(100) + expect(CommonEventSubscriberInfo.priority).assertEqual(10) + expect(CommonEventPublishData.code).assertEqual(0) + expect(CommonEventPublishData.data).assertEqual('initial_data') + expect(CommonEventPublishData.isSticky).assertTrue() + done() + } + }) + + await commonEvent.publish('publish_event_0700', CommonEventPublishData, (err) => { + if (err.code) { + console.info(TAG + ': publish failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': publish successed! event.Info ===> ' + JSON.stringify(CommonEventPublishData)) + expect(true).assertTrue() + done() + } + }) + + await sleep(5000); + }) + + /* + * @tc.number : ActsSubscriberTestUnorder_0800 + * @tc.name : check + * @tc.desc : isStickyCommonEvent(): Promise + */ + it('ActsSubscriberTestUnorder_0800', 0, async function (done) { + console.info(TAG + 'ActsSubscriberTestUnorder_0800 START ') + CommonEventSubscriberInfo.events[0] = 'publish_event_0800' + CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0800' + CommonEventSubscriberInfo.priority = 10 + + let CommonEventPublishData = { + code: 0, + data: "initial_data", + isSticky: true, + } + let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) + if (CommonEventSubscriber == undefined) { + console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) + expect(true).assertTrue() + } + + await commonEvent.subscribe(CommonEventSubscriber, (err, CommonEventData) => { + if (err.code) { + console.info(TAG + ': subscribe failed! Err.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': subscribe successed! CommonEventData.Info ===> ' + JSON.stringify(CommonEventData)) + expect(true).assertTrue() + } + }) + + await CommonEventSubscriber.isStickyCommonEvent().then(() => { + console.info(TAG + ': isStickyCommonEvent successed!') + expect(true).assertTrue() + expect(CommonEventSubscriberInfo.events[0]).assertEqual('publish_event_0800') + expect(CommonEventSubscriberInfo.publisherPermission == '').assertTrue() + expect(CommonEventSubscriberInfo.publisherDeviceId).assertEqual('PublishDeviceId_0800') + expect(CommonEventSubscriberInfo.userId).assertEqual(100) + expect(CommonEventSubscriberInfo.priority).assertEqual(10) + expect(CommonEventPublishData.code).assertEqual(0) + expect(CommonEventPublishData.data).assertEqual('initial_data') + expect(CommonEventPublishData.isSticky).assertTrue() + done() + }).catch((err) => { + console.info(TAG + ': isStickyCommonEvent failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + }) + + await commonEvent.publish('publish_event_0800', CommonEventPublishData, (err) => { + if (err.code) { + console.info(TAG + ': publish failed! event.Info ===> ' + JSON.stringify(err.code)) + expect(false).assertTrue() + done() + } else { + console.info(TAG + ': publish successed! event.Info ===> ' + JSON.stringify(CommonEventPublishData)) + expect(true).assertTrue() + done() + } + }) + + await sleep(500) + }) + }) } diff --git a/request/BUILD.gn b/request/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..6bea708ff4007e8111e1a38567f38e357b6da8e8 --- /dev/null +++ b/request/BUILD.gn @@ -0,0 +1,18 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos_var.gni") +group("request") { + testonly = true + deps = [ "RequestTest_js:ActsMiscservicesRequestJSApiTest" ] +} diff --git a/miscservices/RequestTest_js/BUILD.gn b/request/RequestTest_js/BUILD.gn similarity index 100% rename from miscservices/RequestTest_js/BUILD.gn rename to request/RequestTest_js/BUILD.gn diff --git a/miscservices/RequestTest_js/Test.json b/request/RequestTest_js/Test.json similarity index 100% rename from miscservices/RequestTest_js/Test.json rename to request/RequestTest_js/Test.json diff --git a/miscservices/RequestTest_js/entry/src/main/config.json b/request/RequestTest_js/entry/src/main/config.json similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/config.json rename to request/RequestTest_js/entry/src/main/config.json diff --git a/miscservices/RequestTest_js/entry/src/main/js/Test/List.test.js b/request/RequestTest_js/entry/src/main/js/Test/List.test.js similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/js/Test/List.test.js rename to request/RequestTest_js/entry/src/main/js/Test/List.test.js diff --git a/miscservices/RequestTest_js/entry/src/main/js/Test/Publicfunction.js b/request/RequestTest_js/entry/src/main/js/Test/Publicfunction.js similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/js/Test/Publicfunction.js rename to request/RequestTest_js/entry/src/main/js/Test/Publicfunction.js diff --git a/miscservices/RequestTest_js/entry/src/main/js/Test/UploadCallbackXTSJsunit.test.js b/request/RequestTest_js/entry/src/main/js/Test/UploadCallbackXTSJsunit.test.js similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/js/Test/UploadCallbackXTSJsunit.test.js rename to request/RequestTest_js/entry/src/main/js/Test/UploadCallbackXTSJsunit.test.js diff --git a/miscservices/RequestTest_js/entry/src/main/js/default/app.js b/request/RequestTest_js/entry/src/main/js/default/app.js similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/js/default/app.js rename to request/RequestTest_js/entry/src/main/js/default/app.js diff --git a/miscservices/TimeTest_js/src/main/js/default/i18n/en-US.json b/request/RequestTest_js/entry/src/main/js/default/i18n/en-US.json old mode 100755 new mode 100644 similarity index 100% rename from miscservices/TimeTest_js/src/main/js/default/i18n/en-US.json rename to request/RequestTest_js/entry/src/main/js/default/i18n/en-US.json diff --git a/miscservices/TimeTest_js/src/main/js/default/i18n/zh-CN.json b/request/RequestTest_js/entry/src/main/js/default/i18n/zh-CN.json old mode 100755 new mode 100644 similarity index 100% rename from miscservices/TimeTest_js/src/main/js/default/i18n/zh-CN.json rename to request/RequestTest_js/entry/src/main/js/default/i18n/zh-CN.json diff --git a/miscservices/RequestTest_js/entry/src/main/js/default/pages/index/index.css b/request/RequestTest_js/entry/src/main/js/default/pages/index/index.css similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/js/default/pages/index/index.css rename to request/RequestTest_js/entry/src/main/js/default/pages/index/index.css diff --git a/miscservices/RequestTest_js/entry/src/main/js/default/pages/index/index.hml b/request/RequestTest_js/entry/src/main/js/default/pages/index/index.hml similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/js/default/pages/index/index.hml rename to request/RequestTest_js/entry/src/main/js/default/pages/index/index.hml diff --git a/miscservices/RequestTest_js/entry/src/main/js/default/pages/index/index.js b/request/RequestTest_js/entry/src/main/js/default/pages/index/index.js similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/js/default/pages/index/index.js rename to request/RequestTest_js/entry/src/main/js/default/pages/index/index.js diff --git a/miscservices/RequestTest_js/entry/src/main/resources/base/element/string.json b/request/RequestTest_js/entry/src/main/resources/base/element/string.json similarity index 100% rename from miscservices/RequestTest_js/entry/src/main/resources/base/element/string.json rename to request/RequestTest_js/entry/src/main/resources/base/element/string.json diff --git a/request/RequestTest_js/entry/src/main/resources/base/media/icon.png b/request/RequestTest_js/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/request/RequestTest_js/entry/src/main/resources/base/media/icon.png differ diff --git a/request/RequestTest_js/signature/openharmony_sx.p7b b/request/RequestTest_js/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/request/RequestTest_js/signature/openharmony_sx.p7b differ diff --git a/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/List.test.js b/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/List.test.js index 225e235ce344ab084f3cacd1737e011176334dfa..80d6992ea31485ed1ada212e4b79a5a00a1fa7aa 100644 --- a/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/List.test.js +++ b/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/List.test.js @@ -14,7 +14,9 @@ */ import TransientTaskJsTest from './BackgroundTaskMagrJs.test.js' import ContinuousTaskJsTest from './ContinuousTaskJsunit.test.js' +import ShortTaskMgrApiTest from './ShortTaskMgrJs.test.js' export default function testsuite() { TransientTaskJsTest() ContinuousTaskJsTest() +ShortTaskMgrApiTest() } diff --git a/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/ShortTaskMgrJs.test.js b/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/ShortTaskMgrJs.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dbba3e3965ab9403001bdd1278bbe4c7fe0ae981 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/ShortTaskMgrJs.test.js @@ -0,0 +1,327 @@ +/* + * 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 backgroundTaskManager from '@ohos.backgroundTaskManager' + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' + +export default function ShortTaskMgrApiTest() { +describe("ShortTaskMgrApiTest", function () { + beforeAll(function() { + + /* + * @tc.setup: setup invoked before all testcases + */ + console.info('beforeAll caled') + }) + + afterAll(function() { + + /* + * @tc.teardown: teardown invoked after all testcases + */ + console.info('afterAll caled') + }) + + beforeEach(function() { + + /* + * @tc.setup: setup invoked before each testcases + */ + console.info('beforeEach caled') + }) + + afterEach(function() { + + /* + * @tc.teardown: teardown invoked after each testcases + */ + console.info('afterEach caled') + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_007 + * @tc.name testRequestSuspendDelayFun001 + * @tc.desc test request a suspend daly reason is NumberType. + */ + it("testRequestSuspendDelayFun001", 0, async function (done) { + console.info('----------------------testRequestSuspendDelayFun001---------------------------'); + function callback() {} + let reason = 123; + try{ + let info = backgroundTaskManager.requestSuspendDelay(reason, callback); + if (info.requestId === -1) { + console.info('testRequestSuspendDelayFun001 backgroundTaskManager fail, because of reason is :' + + reason); + expect(info.requestId).assertEqual(-1); + } else { + console.info('testRequestSuspendDelayFun001 backgroundTaskManager success,requestId:' + + info.requestId); + expect(info.requestId).assertLarger(0); + } + }catch(error){ + console.info('testRequestSuspendDelayFun001 backgroundTaskManager fail, because of :' + error); + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_008 + * @tc.name testRequestSuspendDelayFun002 + * @tc.desc test request a suspend daly reason is BooleanType. + */ + it("testRequestSuspendDelayFun002", 0, async function (done) { + console.info('----------------------testRequestSuspendDelayFun002---------------------------'); + function callback() {} + let reason = true; + try{ + let info = backgroundTaskManager.requestSuspendDelay(reason, callback); + if (info.requestId === -1) { + console.info('testRequestSuspendDelayFun002 backgroundTaskManager fail, because of reason is :' + + reason); + expect(info.requestId).assertEqual(-1); + } else { + console.info('testRequestSuspendDelayFun002 backgroundTaskManager success,requestId:' + + info.requestId); + expect(info.requestId).assertLarger(0); + } + }catch(error){ + console.info('testRequestSuspendDelayFun002 backgroundTaskManager fail, because of :' + error); + } + done(); +}) + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_009 + * @tc.name testRequestSuspendDelayFun003 + * @tc.desc test request a suspend daly reason is NullType. + */ +it("testRequestSuspendDelayFun003", 0, async function (done) { + console.info('----------------------testRequestSuspendDelayFun003---------------------------'); + function callback() {} + let reason = null; + try{ + let info = backgroundTaskManager.requestSuspendDelay(reason, callback); + if (info.requestId === -1) { + console.info('testRequestSuspendDelayFun003 backgroundTaskManager fail, because of reason is :' + + reason); + expect(info.requestId).assertEqual(-1); + } else { + console.info('testRequestSuspendDelayFun003 backgroundTaskManager success,requestId:' + + info.requestId); + expect(info.requestId).assertLarger(0); + } + }catch(error){ + console.info('testRequestSuspendDelayFun003 backgroundTaskManager fail, because of :' + error); + } + done(); +}) + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_010 + * @tc.name testRequestSuspendDelayFun004 + * @tc.desc test request a suspend daly reason is EmptyString. + */ + it("testRequestSuspendDelayFun004", 0, async function (done) { + console.info('----------------------testRequestSuspendDelayFun004---------------------------'); + function callback() {} + let reason = ""; + try{ + let info = backgroundTaskManager.requestSuspendDelay(reason, callback); + if (info.requestId === -1) { + console.info('testRequestSuspendDelayFun004 backgroundTaskManager fail, because of reason is :' + + reason); + expect(info.requestId).assertEqual(-1); + } else { + console.info('testRequestSuspendDelayFun004 backgroundTaskManager success,requestId:' + + info.requestId); + expect(info.requestId).assertLarger(0); + } + }catch(error){ + console.info('testRequestSuspendDelayFun004 backgroundTaskManager fail, because of :' + error); + } + done(); + }) + + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_011 + * @tc.name testRequestSuspendDelayFun005 + * @tc.desc test request a suspend daly reason Undefined. + */ + it("testRequestSuspendDelayFun005", 0, async function (done) { + console.info('----------------------testRequestSuspendDelayFun005---------------------------'); + function callback() {} + let reason; + try{ + let info = backgroundTaskManager.requestSuspendDelay(reason, callback); + if (info.requestId === -1) { + console.info('testRequestSuspendDelayFun005 backgroundTaskManager fail, because of reason is :' + + reason); + expect(info.requestId).assertEqual(-1); + } else { + console.info('testRequestSuspendDelayFun005 backgroundTaskManager success,requestId:' + + info.requestId); + expect(info.requestId).assertLarger(0); + } + }catch(error){ + console.info('testRequestSuspendDelayFun005 backgroundTaskManager fail, because of :' + error); + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_012 + * @tc.name testGetRemainingDelayTimeFun001 + * @tc.desc test getRemainingDelayTime Callback ,requestId non-existent. + */ + it("testGetRemainingDelayTimeFun001", 0, async function (done) { + console.info('----------------------testGetRemainingDelayTimeFun001---------------------------'); + function callback() {} + let info = backgroundTaskManager.requestSuspendDelay("test", callback); + if (info.requestId != -1) { + console.info('testGetRemainingDelayTimeFun001 backgroundTaskManager success, requestId:' + + info.requestId); + expect(info.requestId).assertLarger(0); + } else { + expect(info.requestId).assertEqual(-1); + done(); + } + + backgroundTaskManager.getRemainingDelayTime(info.requestId+1, (err, res) => { + if (err) { + console.info('testGetRemainingDelayTimeFun001 backgroundTaskManager error,cause:' + err.code); + expect(err.code).assertLarger(0); + + } else { + console.info('testGetRemainingDelayTimeFun001 backgroundTaskManager success, delaytime:' + res); + expect(res).assertLarger(0); + } + backgroundTaskManager.cancelSuspendDelay(info.requestId) + }); + + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_013 + * @tc.name testGetRemainingDelayTimeFun002 + * @tc.desc test getRemainingDelayTime Promise ,requestId non-existent. + */ + it("testGetRemainingDelayTimeFun002", 0, async function (done) { + console.info('----------------------testGetRemainingDelayTimeFun002---------------------------'); + function callback() {} + let info = backgroundTaskManager.requestSuspendDelay("test", callback); + if (info.requestId != -1) { + console.info('testGetRemainingDelayTimeFun002 backgroundTaskManager success, requestId:' + + info.requestId); + expect(info.requestId).assertLarger(0); + } else { + expect(info.requestId).assertEqual(-1); + done(); + } + + backgroundTaskManager.getRemainingDelayTime(info.requestId+1) + .then(res => { + console.info('testGetRemainingDelayTimeFun002 backgroundTaskManager success, delaytime:' + res); + expect(res).assertLarger(0); + }) + .catch(err =>{ + console.info('testGetRemainingDelayTimeFun002 backgroundTaskManager error,cause:' + err.code); + expect(err.code).assertLarger(0); + }); + backgroundTaskManager.cancelSuspendDelay(info.requestId); + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_014 + * @tc.name testGetRemainingDelayTimeFun003 + * @tc.desc test getRemainingDelayTime Promise ,requestId is null. + */ + it("testGetRemainingDelayTimeFun003", 0, async function (done) { + console.info('----------------------testGetRemainingDelayTimeFun003---------------------------'); + let requestId = null; + try{ + backgroundTaskManager.getRemainingDelayTime(requestId) + .then(res => { + console.info('testGetRemainingDelayTimeFun003 backgroundTaskManager success, delaytime:' + res); + expect(res).assertLarger(0); + }) + .catch(err =>{ + console.info('testGetRemainingDelayTimeFun003 backgroundTaskManager error,cause:' + err.code); + expect(err.code).assertLarger(0); + }); + }catch(error){ + console.info('testGetRemainingDelayTimeFun003 backgroundTaskManager error,' + error); + } + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_015 + * @tc.name testGetRemainingDelayTimeFun004 + * @tc.desc test getRemainingDelayTime Callback ,requestId = -1. + */ + it("testGetRemainingDelayTimeFun004", 0, async function (done) { + console.info('----------------------testGetRemainingDelayTimeFun004---------------------------'); + let requestId = -1; + backgroundTaskManager.getRemainingDelayTime(requestId, (err, res) => { + if (err) { + console.info('testGetRemainingDelayTimeFun001 backgroundTaskManager error,cause:' + err.code); + expect(err.code).assertLarger(0); + + } else { + console.info('testGetRemainingDelayTimeFun001 backgroundTaskManager success, delaytime:' + res); + expect(res).assertLarger(0); + } + }); + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_016 + * @tc.name testGetRemainingDelayTimeFun005 + * @tc.desc test getRemainingDelayTime Promise ,requestId = 0. + */ + it("testGetRemainingDelayTimeFun005", 0, async function (done) { + console.info('----------------------testGetRemainingDelayTimeFun005---------------------------'); + let requestId = 0; + try{ + backgroundTaskManager.getRemainingDelayTime(requestId) + .then(res => { + console.info('testGetRemainingDelayTimeFun005 backgroundTaskManager success, delaytime:' + res); + expect(res).assertLarger(0); + }) + .catch(err =>{ + console.info('testGetRemainingDelayTimeFun005 backgroundTaskManager error,cause:' + err.code); + expect(err.code).assertLarger(0); + }); + }catch(error){ + console.info('testGetRemainingDelayTimeFun005 backgroundTaskManager error,' + error); + } + setTimeout(()=>{ + done(); + }, 500); + }) +}) +} \ No newline at end of file diff --git a/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/List.test.js b/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/List.test.js index b0c42f62021f6e626e7bc27b0375d3c2ff0ab148..aabe3cabe4ab148ec54b0169f29e92df56875b9b 100644 --- a/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/List.test.js +++ b/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/List.test.js @@ -14,7 +14,9 @@ */ import WorkSchedulerJsTest from './WorkScheduler.test.js' import WorkSchedulerPerformanceTest from './WorkSchedulerJs.performance.js' +import WorkSchedulerMgrApiTest from './WorkSchedulerMgrJs.test.js' export default function testsuite() { WorkSchedulerJsTest() WorkSchedulerPerformanceTest() +WorkSchedulerMgrApiTest() } diff --git a/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkSchedulerMgrJs.test.js b/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkSchedulerMgrJs.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0038c7ca26ddc3f79aef48555a8df4edef8c68d4 --- /dev/null +++ b/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkSchedulerMgrJs.test.js @@ -0,0 +1,1943 @@ +/* + * 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 workScheduler from '@ohos.workScheduler' +import workSchedulerCallback from '@ohos.WorkSchedulerExtensionAbility' + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' + +export default function WorkSchedulerMgrApiTest() { + describe("WorkSchedulerMgrApiTest", function () { + beforeAll(function() { + + /* + * @tc.setup: setup invoked before all testcases + */ + console.info('beforeAll caled') + }) + + afterAll(function() { + + /* + * @tc.teardown: teardown invoked after all testcases + */ + console.info('afterAll caled') + }) + + beforeEach(function() { + + /* + * @tc.setup: setup invoked before each testcases + */ + console.info('beforeEach caled') + }) + + afterEach(function() { + + /* + * @tc.teardown: teardown invoked after each testcases + */ + console.info('afterEach caled') + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_072 + * @tc.name testStartWorkFun001 + * @tc.desc test workScheduler workInfo networkType is MOBILE. + */ + it("testStartWorkFun001", 0, async function (done) { + console.info('----------------------testStartWorkFun001---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: workScheduler.NetworkType.NETWORK_TYPE_MOBILE + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun001 workInfo networkType :" + workInfo.networkType); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_073 + * @tc.name testStartWorkFun002 + * @tc.desc test workScheduler workInfo networkType is WIFI. + */ + it("testStartWorkFun002", 0, async function (done) { + console.info('----------------------testStartWorkFun002---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: workScheduler.NetworkType.NETWORK_TYPE_WIFI + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun002 workInfo networkType :" + workInfo.networkType); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_074 + * @tc.name testStartWorkFun003 + * @tc.desc test workScheduler workInfo networkType is BLUETOOTH. + */ + it("testStartWorkFun003", 0, async function (done) { + console.info('----------------------testStartWorkFun003---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: workScheduler.NetworkType.NETWORK_TYPE_BLUETOOTH + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun003 workInfo networkType :" + workInfo.networkType); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_075 + * @tc.name testStartWorkFun004 + * @tc.desc test workScheduler workInfo networkType is WIFI_P2P. + */ + it("testStartWorkFun004", 0, async function (done) { + console.info('----------------------testStartWorkFun004---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: workScheduler.NetworkType.NETWORK_TYPE_WIFI_P2P + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun004 workInfo networkType :" + workInfo.networkType); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_076 + * @tc.name testStartWorkFun005 + * @tc.desc test workScheduler workInfo networkType is ETHERNET. + */ + it("testStartWorkFun005", 0, async function (done) { + console.info('----------------------testStartWorkFun005---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: workScheduler.NetworkType.NETWORK_TYPE_ETHERNET + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun005 workInfo networkType :" + workInfo.networkType); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_077 + * @tc.name testStartWorkFun006 + * @tc.desc test workScheduler workInfo chargerType is ANY. + */ + it("testStartWorkFun006", 0, async function (done) { + console.info('----------------------testStartWorkFun006---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isCharging: true, + chargerType: workScheduler.ChargingType.CHARGING_PLUGGED_ANY + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun006 workInfo ChargingType :" + workInfo.chargerType); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_078 + * @tc.name testStartWorkFun007 + * @tc.desc test workScheduler workInfo chargerType is USB. + */ + it("testStartWorkFun007", 0, async function (done) { + console.info('----------------------testStartWorkFun007---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isCharging: true, + chargerType: workScheduler.ChargingType.CHARGING_PLUGGED_USB + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun007 workInfo ChargingType :" + workInfo.chargerType); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_079 + * @tc.name testStartWorkFun008 + * @tc.desc test workScheduler workInfo chargerType is WIRELESS. + */ + it("testStartWorkFun008", 0, async function (done) { + console.info('----------------------testStartWorkFun008---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isCharging: false, + chargerType: workScheduler.ChargingType.CHARGING_PLUGGED_WIRELESS + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun008 workInfo ChargingType :" + workInfo.chargerType); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_080 + * @tc.name testStartWorkFun009 + * @tc.desc test workScheduler workInfo BatteryStatus OKAY. + */ + it("testStartWorkFun009", 0, async function (done) { + console.info('----------------------testStartWorkFun009---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryStatus: workScheduler.BatteryStatus.BATTERY_STATUS_OKAY + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun009 workInfo BatteryStatus :" + workInfo.batteryStatus); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_081 + * @tc.name testStartWorkFun010 + * @tc.desc test workScheduler workInfo BatteryStatus LOW_OR_OKAY. + */ + it("testStartWorkFun010", 0, async function (done) { + console.info('----------------------testStartWorkFun010---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryStatus: workScheduler.BatteryStatus.BATTERY_STATUS_LOW_OR_OKAY + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun010 workInfo BatteryStatus :" + workInfo.batteryStatus); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_082 + * @tc.name testStartWorkFun011 + * @tc.desc test workScheduler workInfo storageRequest LOW. + */ + it("testStartWorkFun011", 0, async function (done) { + console.info('----------------------testStartWorkFun011---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_LOW + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun011 workInfo StorageRequest :" + workInfo.storageRequest); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_083 + * @tc.name testStartWorkFun012 + * @tc.desc test workScheduler workInfo storageRequest OKAY. + */ + it("testStartWorkFun012", 0, async function (done) { + console.info('----------------------testStartWorkFun012---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_OKAY + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun012 workInfo StorageRequest :" + workInfo.storageRequest); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_084 + * @tc.name testStartWorkFun013 + * @tc.desc test workScheduler workInfo storageRequest LOW_OR_OKAY. + */ + it("testStartWorkFun013", 0, async function (done) { + console.info('----------------------testStartWorkFun013---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_LOW_OR_OKAY + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun013 workInfo StorageRequest :" + workInfo.storageRequest); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_085 + * @tc.name testStartWorkFun014 + * @tc.desc test workScheduler workInfo select all parameter. + */ + it("testStartWorkFun014", 0, async function (done) { + console.info('----------------------testStartWorkFun014---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0, + isCharging: true, + chargerType: 0, + batteryLevel: 20, + batteryStatus: 0, + storageRequest: 0, + isRepeat: true, + repeatCycleTime: 1200000, + repeatCount: 2, + isPersisted: true, + isDeepIdle: true, + idleWaitTime: 3000 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun014 start workScheduler result:" + res); + expect(res).assertEqual(true); + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_086 + * @tc.name testStartWorkFun015 + * @tc.desc test workScheduler workInfo select networkType,batteryLevel,batteryStatus,storageRequest. + */ + it("testStartWorkFun015", 0, async function (done) { + console.info('----------------------testStartWorkFun015---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0, + isCharging: false, + batteryLevel: 50, + batteryStatus: 1, + storageRequest: 1, + isRepeat: false, + isPersisted: false, + isDeepIdle: false + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun015 start workScheduler result:" + res); + expect(res).assertEqual(true); + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_087 + * @tc.name testStartWorkFun016 + * @tc.desc test start workScheduler workId is StringType. + */ + it("testStartWorkFun016", 0, async function (done) { + console.info('----------------------testStartWorkFun016---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: "1", + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun016 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_088 + * @tc.name testStartWorkFun017 + * @tc.desc test start workScheduler workId is NullType. + */ + it("testStartWorkFun017", 0, async function (done) { + console.info('----------------------testStartWorkFun017---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: null, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun017 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_089 + * @tc.name testStartWorkFun018 + * @tc.desc test start workScheduler without workId. + */ + it("testStartWorkFun018", 0, async function (done) { + console.info('----------------------testStartWorkFun018---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun018 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_090 + * @tc.name testStartWorkFun019 + * @tc.desc test start workScheduler bundleName is NumberType. + */ + it("testStartWorkFun019", 0, async function (done) { + console.info('----------------------testStartWorkFun019---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: 123, + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun019 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_091 + * @tc.name testStartWorkFun020 + * @tc.desc test start workScheduler bundleName error. + */ + it("testStartWorkFun020", 0, async function (done) { + console.info('----------------------testStartWorkFun020---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workschedulers.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun020 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_092 + * @tc.name testStartWorkFun021 + * @tc.desc test start workScheduler bundleName is NullType. + */ + it("testStartWorkFun021", 0, async function (done) { + console.info('----------------------testStartWorkFun021---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: null, + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun021 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_093 + * @tc.name testStartWorkFun022 + * @tc.desc test start workScheduler abilityName is NumberType. + */ + it("testStartWorkFun022", 0, async function (done) { + console.info('----------------------testStartWorkFun022---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: 123, + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun022 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_094 + * @tc.name testStartWorkFun023 + * @tc.desc test start workScheduler abilityName is EmptyString. + */ + it("testStartWorkFun023", 0, async function (done) { + console.info('----------------------testStartWorkFun023---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun023 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_095 + * @tc.name testStartWorkFun024 + * @tc.desc test start workScheduler abilityName is a space. + */ + it("testStartWorkFun024", 0, async function (done) { + console.info('----------------------testStartWorkFun024---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: " ", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun024 start workScheduler result:" + res); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_096 + * @tc.name testStartWorkFun025 + * @tc.desc test start workScheduler abilityName is NullType. + */ + it("testStartWorkFun025", 0, async function (done) { + console.info('----------------------testStartWorkFun025---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: null, + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun025 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_097 + * @tc.name testStartWorkFun026 + * @tc.desc test start workScheduler networkType < 0. + */ + it("testStartWorkFun026", 0, async function (done) { + console.info('----------------------testStartWorkFun026---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: -1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun026 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_098 + * @tc.name testStartWorkFun027 + * @tc.desc test start workScheduler networkType > 5. + */ + it("testStartWorkFun027", 0, async function (done) { + console.info('----------------------testStartWorkFun027---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 6 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun027 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_099 + * @tc.name testStartWorkFun028 + * @tc.desc test start workScheduler chargerType < 0. + */ + it("testStartWorkFun028", 0, async function (done) { + console.info('----------------------testStartWorkFun028---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isCharging: true, + chargerType: -1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun028 start workScheduler result:" + res); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_100 + * @tc.name testStartWorkFun029 + * @tc.desc test start workScheduler chargerType > 3. + */ + it("testStartWorkFun029", 0, async function (done) { + console.info('----------------------testStartWorkFun029---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isCharging: false, + chargerType: 4 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun029 start workScheduler result:" + res); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_101 + * @tc.name testStartWorkFun030 + * @tc.desc test start workScheduler isCharging is NumberType. + */ + it("testStartWorkFun030", 0, async function (done) { + console.info('----------------------testStartWorkFun030---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isCharging: 1, + chargerType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun030 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_102 + * @tc.name testStartWorkFun031 + * @tc.desc test start workScheduler isCharging is StringType. + */ + it("testStartWorkFun031", 0, async function (done) { + console.info('----------------------testStartWorkFun031---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isCharging: "true", + chargerType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun031 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_103 + * @tc.name testStartWorkFun032 + * @tc.desc test start workScheduler without isCharging. + */ + it("testStartWorkFun032", 0, async function (done) { + console.info('----------------------testStartWorkFun032---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + chargerType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun032 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_104 + * @tc.name testStartWorkFun033 + * @tc.desc test start workScheduler batteryLevel < 0. + */ + it("testStartWorkFun033", 0, async function (done) { + console.info('----------------------testStartWorkFun033---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryLevel: -1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun033 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_105 + * @tc.name testStartWorkFun034 + * @tc.desc test start workScheduler batteryLevel = 0. + */ + it("testStartWorkFun034", 0, async function (done) { + console.info('----------------------testStartWorkFun034---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryLevel: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun034 start workScheduler result:" + res); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_106 + * @tc.name testStartWorkFun035 + * @tc.desc test start workScheduler batteryLevel = 100. + */ + it("testStartWorkFun035", 0, async function (done) { + console.info('----------------------testStartWorkFun035---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryLevel: 100 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun035 start workScheduler result:" + res); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_107 + * @tc.name testStartWorkFun036 + * @tc.desc test start workScheduler batteryLevel > 100. + */ + it("testStartWorkFun036", 0, async function (done) { + console.info('----------------------testStartWorkFun036---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryLevel: 101 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun036 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_108 + * @tc.name testStartWorkFun037 + * @tc.desc test start workScheduler batteryStatus < 0. + */ + it("testStartWorkFun037", 0, async function (done) { + console.info('----------------------testStartWorkFun037---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryStatus: -1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun037 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_109 + * @tc.name testStartWorkFun038 + * @tc.desc test start workScheduler batteryStatus > 2. + */ + it("testStartWorkFun038", 0, async function (done) { + console.info('----------------------testStartWorkFun038---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryStatus: 3 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun038 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_110 + * @tc.name testStartWorkFun039 + * @tc.desc test start workScheduler storageRequest < 0. + */ + it("testStartWorkFun039", 0, async function (done) { + console.info('----------------------testStartWorkFun039---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: -1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun039 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_111 + * @tc.name testStartWorkFun040 + * @tc.desc test start workScheduler storageRequest > 2. + */ + it("testStartWorkFun040", 0, async function (done) { + console.info('----------------------testStartWorkFun040---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: 3 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun040 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_112 + * @tc.name testStartWorkFun041 + * @tc.desc test start workScheduler repeatCycleTime < 0. + */ + it("testStartWorkFun041", 0, async function (done) { + console.info('----------------------testStartWorkFun041---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isRepeat: true, + repeatCycleTime: -1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun041 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_113 + * @tc.name testStartWorkFun042 + * @tc.desc test start workScheduler repeatCycleTime < 20min. + */ + it("testStartWorkFun042", 0, async function (done) { + console.info('----------------------testStartWorkFun042---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isRepeat: true, + repeatCycleTime: 1140000 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun042 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_114 + * @tc.name testStartWorkFun043 + * @tc.desc test start workScheduler condition only repeatCycleTime. + */ + it("testStartWorkFun043", 0, async function (done) { + console.info('----------------------testStartWorkFun043---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + repeatCycleTime: 1200000 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun043 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_115 + * @tc.name testStartWorkFun044 + * @tc.desc test start workScheduler without repeatCycleTime. + */ + it("testStartWorkFun044", 0, async function (done) { + console.info('----------------------testStartWorkFun044---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isRepeat: true, + repeatCount: 1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun044 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_116 + * @tc.name testStartWorkFun045 + * @tc.desc test start workScheduler isRepeat is StringType. + */ + it("testStartWorkFun045", 0, async function (done) { + console.info('----------------------testStartWorkFun045---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isRepeat: "false", + repeatCycleTime: 1200000 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun045 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_117 + * @tc.name testStartWorkFun046 + * @tc.desc test start workScheduler repeatCount = 0. + */ + it("testStartWorkFun046", 0, async function (done) { + console.info('----------------------testStartWorkFun046---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + repeatCycleTime: 1200000, + repeatCount: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun046 start workScheduler result:" + res); + expect(res).assertEqual(true); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_118 + * @tc.name testStartWorkFun047 + * @tc.desc test start workScheduler repeatCount < 0. + */ + it("testStartWorkFun047", 0, async function (done) { + console.info('----------------------testStartWorkFun047---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + repeatCycleTime: 1200000, + repeatCount: -1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun047 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_119 + * @tc.name testStartWorkFun048 + * @tc.desc test start workScheduler isRepeat = false and repeatCount < 0. + */ + it("testStartWorkFun048", 0, async function (done) { + console.info('----------------------testStartWorkFun048---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isRepeat: false, + repeatCycleTime: 1200000, + repeatCount: -1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun048 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_120 + * @tc.name testStartWorkFun049 + * @tc.desc test start workScheduler condition only repeatCount. + */ + it("testStartWorkFun049", 0, async function (done) { + console.info('----------------------testStartWorkFun049---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + repeatCount: 2 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun049 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_121 + * @tc.name testStartWorkFun050 + * @tc.desc test start workScheduler isPersisted is StringType. + */ + it("testStartWorkFun050", 0, async function (done) { + console.info('----------------------testStartWorkFun050---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isPersisted: "true" + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun050 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_122 + * @tc.name testStartWorkFun051 + * @tc.desc test start workScheduler isPersisted is NumberType. + */ + it("testStartWorkFun051", 0, async function (done) { + console.info('----------------------testStartWorkFun051---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isPersisted: 1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun051 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_123 + * @tc.name testStartWorkFun052 + * @tc.desc test start workScheduler isDeepIdle is StringType. + */ + it("testStartWorkFun052", 0, async function (done) { + console.info('----------------------testStartWorkFun052---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isDeepIdle: "false" + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun052 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_124 + * @tc.name testStartWorkFun053 + * @tc.desc test start workScheduler isDeepIdle is NumberType. + */ + it("testStartWorkFun053", 0, async function (done) { + console.info('----------------------testStartWorkFun053---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isDeepIdle: 1 + } + let res = workScheduler.startWork(workInfo); + console.info("testStartWorkFun053 start workScheduler result:" + res); + expect(res).assertEqual(false); + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_125 + * @tc.name testStopWorkFun001 + * @tc.desc test stop workScheduler needCancel is StringType. + */ + it("testStopWorkFun001", 0, async function (done) { + console.info('----------------------testStopWorkFun001---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + try{ + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo, "true"); + console.info("testStopWorkFun001 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + } + }catch(error){ + console.info("testStopWorkFun001 stop workScheduler fail, " + error); + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_126 + * @tc.name testStopWorkFun002 + * @tc.desc test stop workScheduler needCancel is NumberType. + */ + it("testStopWorkFun002", 0, async function (done) { + console.info('----------------------testStopWorkFun002---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + try{ + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo, 111); + console.info("testStopWorkFun002 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + } + }catch(error){ + console.info("testStopWorkFun002 stop workScheduler fail, " + error); + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_127 + * @tc.name testStopWorkFun003 + * @tc.desc test stop workScheduler needCancel is NullType. + */ + it("testStopWorkFun003", 0, async function (done) { + console.info('----------------------testStopWorkFun003---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + try{ + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo, null); + console.info("testStopWorkFun003 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + } + }catch(error){ + console.info("testStopWorkFun003 stop workScheduler fail, " + error); + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_128 + * @tc.name testStopWorkFun004 + * @tc.desc test stop workScheduler missing parameter needCancel. + */ + it("testStopWorkFun004", 0, async function (done) { + console.info('----------------------testStopWorkFun004---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + try{ + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo); + console.info("testStopWorkFun004 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + } + }catch(error){ + console.info("testStopWorkFun004 stop workScheduler fail, " + error); + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_129 + * @tc.name testStopWorkFun005 + * @tc.desc test stop workScheduler workId error ,needCancel true. + */ + it("testStopWorkFun005", 0, async function (done) { + console.info('----------------------testStopWorkFun005---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let workInfo2 = { + workId: 2, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,true); + console.info("testStopWorkFun005 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_130 + * @tc.name testStopWorkFun006 + * @tc.desc test stop workScheduler workId error ,needCancel false. + */ + it("testStopWorkFun006", 0, async function (done) { + console.info('----------------------testStopWorkFun006---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let workInfo2 = { + workId: 2, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,false); + console.info("testStopWorkFun006 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_131 + * @tc.name testStopWorkFun007 + * @tc.desc test stop workScheduler bundleName error,needCancel true. + */ + it("testStopWorkFun007", 0, async function (done) { + console.info('----------------------testStopWorkFun007---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,true); + console.info("testStopWorkFun007 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_132 + * @tc.name testStopWorkFun008 + * @tc.desc test stop workScheduler bundleName error,needCancel false. + */ + it("testStopWorkFun008", 0, async function (done) { + console.info('----------------------testStopWorkFun008---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,false); + console.info("testStopWorkFun008 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_133 + * @tc.name testStopWorkFun009 + * @tc.desc test stop workScheduler abilityName error,needCancel true. + */ + it("testStopWorkFun009", 0, async function (done) { + console.info('----------------------testStopWorkFun009---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.bundleName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,true); + if(stopRes === false){ + console.info("testStopWorkFun009 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + }else{ + console.info("testStopWorkFun009 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(true) + } + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_134 + * @tc.name testStopWorkFun010 + * @tc.desc test stop workScheduler abilityName error,needCancel false. + */ + it("testStopWorkFun010", 0, async function (done) { + console.info('----------------------testStopWorkFun010---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0 + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.bundleName", + networkType: 0 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,false); + if(stopRes === false){ + console.info("testStopWorkFun010 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(false) + }else{ + console.info("testStopWorkFun010 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(true) + } + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_135 + * @tc.name testStopWorkFun011 + * @tc.desc test stop workScheduler networkType different. + */ + it("testStopWorkFun011", 0, async function (done) { + console.info('----------------------testStopWorkFun011---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 1 + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 2 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,true); + console.info("testStopWorkFun011 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(true) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_136 + * @tc.name testStopWorkFun012 + * @tc.desc test stop workScheduler chargerType different. + */ + it("testStopWorkFun012", 0, async function (done) { + console.info('----------------------testStopWorkFun012---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isCharging: true, + chargerType: 0 + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isCharging: true, + chargerType: 1 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,true); + console.info("testStopWorkFun012 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(true) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_137 + * @tc.name test stopWorkFun013 + * @tc.desc test stop workScheduler batteryStatus different. + */ + it("testStopWorkFun013", 0, async function (done) { + console.info('----------------------testStopWorkFun013---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryStatus: 0 + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + batteryStatus: 1 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,false); + console.info("testStopWorkFun013 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(true) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_138 + * @tc.name test stopWorkFun014 + * @tc.desc test stop workScheduler storageRequest different. + */ + it("testStopWorkFun014", 0, async function (done) { + console.info('----------------------testStopWorkFun014---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: 0 + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: 1 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,false); + console.info("testStopWorkFun014 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(true) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_139 + * @tc.name testStopWorkFun015 + * @tc.desc test stop workScheduler isPersisted different. + */ + it("testStopWorkFun015", 0, async function (done) { + console.info('----------------------testStopWorkFun015---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0, + isPersisted: true + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + networkType: 0, + isPersisted: false + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,true); + console.info("testStopWorkFun015 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(true) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_140 + * @tc.name testStopWorkFun016 + * @tc.desc test stop workScheduler repeatCycleTime different. + */ + it("testStopWorkFun016", 0, async function (done) { + console.info('----------------------testStopWorkFun016---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo1 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isRepeat: true, + repeatCycleTime: 1200000 + } + let workInfo2 = { + workId: 1, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + isRepeat: true, + repeatCycleTime: 1500000 + } + let res = workScheduler.startWork(workInfo1); + console.info("start workScheduler result:" + res); + expect(res).assertEqual(true); + if (res === true) { + let stopRes = workScheduler.stopWork(workInfo2,true); + console.info("testStopWorkFun016 stop workScheduler result:" + stopRes); + expect(stopRes).assertEqual(true) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_141 + * @tc.name testGetWorkStatusFun001 + * @tc.desc test getWorkStatus Callback workId error. + */ + it("testGetWorkStatusFun001", 0, async function (done) { + console.info('----------------------testGetWorkStatusFun001---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 9, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_OKAY + } + let res = workScheduler.startWork(workInfo); + expect(res).assertEqual(true) + workScheduler.getWorkStatus(10, (err, res) => { + if (err) { + console.info('testGetWorkStatusFun001 getWorkStatuscallback fail because:' + err.code); + expect(err.code).assertLarger(0) + } else { + for (let item in res) { + console.info('testGetWorkStatusFun001 getWorkStatuscallback success,' + item + ' is:' + + res[item]); + } + expect(res).assertInstanceOf('Object') + } + }); + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_142 + * @tc.name testGetWorkStatusFun002 + * @tc.desc test getWorkStatus Promise workId error. + */ + it("testGetWorkStatusFun002", 0, async function (done) { + console.info('----------------------testGetWorkStatusFun002---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 9, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_OKAY, + batteryLevel: 15 + } + let res = workScheduler.startWork(workInfo); + expect(res).assertEqual(true) + workScheduler.getWorkStatus(10).then((res) => { + for (let item in res) { + console.info('testGetWorkStatusFun002 getWorkStatuscallback success,' + item + ' is:' + + res[item]); + } + expect(res).assertInstanceOf('Object') + }).catch((err) => { + console.info('testGetWorkStatusFun002 getWorkStatuscallback fail because:' + err.code); + expect(err.code).assertLarger(0) + }) + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_143 + * @tc.name testGetWorkStatusFun003 + * @tc.desc test getWorkStatus Promise parameter undefined. + */ + it("testGetWorkStatusFun003", 0, async function (done) { + console.info('----------------------testGetWorkStatusFun003---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 9, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_OKAY, + batteryLevel: 15 + } + let res = workScheduler.startWork(workInfo); + expect(res).assertEqual(true) + try{ + workScheduler.getWorkStatus(undefined).then((res) => { + for (let item in res) { + console.info('testGetWorkStatusFun003 getWorkStatuspromise success,' + item + ' is:' + + res[item]); + } + expect(res).assertInstanceOf('Object') + }).catch((err) => { + console.info('testGetWorkStatusFun003 getWorkStatuspromise fail because:' + err.code); + expect(err.code).assertLarger(0) + }) + }catch(error){ + console.info('testGetWorkStatusFun003 getWorkStatuspromise fail because:' + error); + } + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_144 + * @tc.name testGetWorkStatusFun004 + * @tc.desc test getWorkStatus Promise parameter StringType. + */ + it("testGetWorkStatusFun004", 0, async function (done) { + console.info('----------------------testGetWorkStatusFun004---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 9, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_OKAY, + batteryLevel: 15 + } + let res = workScheduler.startWork(workInfo); + expect(res).assertEqual(true) + try{ + workScheduler.getWorkStatus('9').then((res) => { + for (let item in res) { + console.info('testGetWorkStatusFun004 getWorkStatuspromise success,' + item + ' is:' + + res[item]); + } + expect(res).assertInstanceOf('Object') + }).catch((err) => { + console.info('testGetWorkStatusFun004 getWorkStatuspromise fail because:' + err.code); + expect(err.code).assertLarger(0) + }) + }catch(error){ + console.info('testGetWorkStatusFun004 getWorkStatuspromise fail because:' + error); + } + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_145 + * @tc.name testObtainAllWorksFun001 + * @tc.desc test obtainAllWorks Callback. + */ + it("testObtainAllWorksFun001", 0, async function (done) { + console.info('----------------------testObtainAllWorksFun001---------------------------'); + workScheduler.stopAndClearWorks(); + let workInfo = { + workId: 145, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_OKAY, + } + let res = workScheduler.startWork(workInfo); + expect(res).assertEqual(true) + workScheduler.obtainAllWorks((err, res) =>{ + if (err) { + console.info('testObtainAllWorksFun001 obtainAllWorks callback fail, because:' + err.code); + expect(err.code).assertLarger(0) + } else { + console.info('testObtainAllWorksFun001 obtainAllWorks callback success, data is:' + + JSON.stringify(res)); + expect(res[0].workId).assertEqual(workInfo.workId) + } + }); + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_146 + * @tc.name testObtainAllWorksFun002 + * @tc.desc test first stop work then obtainAllWorks Promise. + */ + it("testObtainAllWorksFun002", 0, async function (done) { + console.info('----------------------testObtainAllWorksFun002---------------------------'); + let workInfo = { + workId: 146, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_OKAY, + } + let res = workScheduler.startWork(workInfo); + expect(res).assertEqual(true) + workScheduler.stopAndClearWorks(); + workScheduler.obtainAllWorks().then((res) => { + console.info('testObtainAllWorksFun002 obtainAllWorks promise success, data is:' + + JSON.stringify(res)); + }).catch((err) => { + console.info('testObtainAllWorksFun002 obtainAllWorks promise failed, because:' + err.code); + expect(err.code).assertLarger(0) + }) + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_147 + * @tc.name testStopAndClearWorksFun001 + * @tc.desc test repeat stopAndClearWorks. + */ + it("testStopAndClearWorksFun001", 0, async function (done) { + console.info('----------------------testStopAndClearWorksFun001---------------------------'); + let workInfo = { + workId: 147, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName", + storageRequest: workScheduler.StorageRequest.STORAGE_LEVEL_OKAY + } + let res = workScheduler.startWork(workInfo); + expect(res).assertEqual(true) + let stopRes1 = workScheduler.stopAndClearWorks(); + let stopRes2 = workScheduler.stopAndClearWorks(); + if(stopRes1 === true){ + console.info('testStopAndClearWorksFun001 repeat stopAndClearWorks success stopRes2: ' + stopRes2); + expect(stopRes2).assertEqual(true) + } + done(); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_148 + * @tc.name testIsLastWorkTimeOutFun001 + * @tc.desc test isLastWorkTimeOut callback parameter workId < 0. + */ + it("testIsLastWorkTimeOutFun001", 0, async function (done) { + console.info('----------------------testIsLastWorkTimeOutFun001---------------------------'); + workScheduler.isLastWorkTimeOut(-1, (err, res) =>{ + if (err) { + console.info('testIsLastWorkTimeOutFun001 isLastWorkTimeOut callback fail, because:' + err.code); + expect(err.code).assertLarger(0) + } else { + console.info('testIsLastWorkTimeOutFun001 isLastWorkTimeOut callback success, data is:' + res); + expect(res).assertInstanceOf('Boolean') + } + }); + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_150 + * @tc.name testIsLastWorkTimeOutFun003 + * @tc.desc test isLastWorkTimeOut promise parameter workId is StringType. + */ + it("testIsLastWorkTimeOutFun003", 0, async function (done) { + console.info('----------------------testIsLastWorkTimeOutFun003---------------------------'); + try{ + workScheduler.isLastWorkTimeOut('1').then(res => { + console.info('testIsLastWorkTimeOutFun003 isLastWorkTimeOut promise success, data is:' + res); + expect(res).assertInstanceOf('Boolean') + }) + .catch(err => { + console.info('testIsLastWorkTimeOutFun003 isLastWorkTimeOut promise fail, because:' + err.code); + expect(err.code).assertLarger(0) + }); + }catch(error){ + console.info('testIsLastWorkTimeOutFun003 isLastWorkTimeOut promise fail ,' + error); + } + setTimeout(()=>{ + done(); + }, 500); + }) + + /* + * @tc.number SUB_RESOURCESCHEDULE_WORK_SCHEDULE_API_151 + * @tc.name testIsLastWorkTimeOutFun004 + * @tc.desc test isLastWorkTimeOut promise parameter workId is NullType. + */ + it("testIsLastWorkTimeOutFun004", 0, async function (done) { + console.info('----------------------testIsLastWorkTimeOutFun004---------------------------'); + try{ + workScheduler.isLastWorkTimeOut(null).then(res => { + console.info('testIsLastWorkTimeOutFun004 isLastWorkTimeOut promise success, data is:' + res); + expect(res).assertInstanceOf('Boolean') + }) + .catch(err => { + console.info('testIsLastWorkTimeOutFun004 isLastWorkTimeOut promise fail, because:' + err.code); + expect(err.code).assertLarger(0) + }); + }catch(error){ + console.info('testIsLastWorkTimeOutFun004 isLastWorkTimeOut promise fail ,' + error); + } + setTimeout(()=>{ + done(); + }, 500); + }) + }) +} diff --git a/security_lite/deviceauth_basic_deps/deviceauth.gni b/security_lite/deviceauth_basic_deps/deviceauth.gni index 544c1688b7d37ecd71b156192395676759ee9a97..fc07ac837dce969e6934b3b311bb88041f89eeb7 100644 --- a/security_lite/deviceauth_basic_deps/deviceauth.gni +++ b/security_lite/deviceauth_basic_deps/deviceauth.gni @@ -31,7 +31,7 @@ DEVICEAUTH_BASIC_DEPS_SOURCE = [ ] DEVICEAUTH_BASIC_DEPS_INC = [ - "//base/iot_hardware/peripheral/interfaces/kits", + "//base/iothardware/peripheral/interfaces/inner_api", "//utils/native/lite/include", # utils_file.h ohos_types.h # alg test diff --git a/security_lite/huks/liteos_m_adapter/BUILD.gn b/security_lite/huks/liteos_m_adapter/BUILD.gn index 10ecf4ed60d56ab3cdbaf5f48d4fb2373c34022b..f73d2a65f328caa06333f0992f896ca11b3b0e2d 100644 --- a/security_lite/huks/liteos_m_adapter/BUILD.gn +++ b/security_lite/huks/liteos_m_adapter/BUILD.gn @@ -38,7 +38,7 @@ hctest_suite("ActsHuksHalFunctionTest") { ] include_dirs = [ "//base/security/huks/interfaces/innerkits/huks_standard/main/include", - "//base/iot_hardware/peripheral/interfaces/kits", + "//base/iothardware/peripheral/interfaces/inner_api", "../common/include", ] diff --git a/test_packages.gni b/test_packages.gni index 7484d347a77cf39d811ff9d6b560bb495b097552..8ecd65e73fd83450752a595fad199a58de7fea83 100644 --- a/test_packages.gni +++ b/test_packages.gni @@ -14,6 +14,7 @@ import("//test/xts/tools/build/suite.gni") _all_test_packages = [ + "${ACTS_ROOT}/arkXtest:arkXtest", "${ACTS_ROOT}/global:global", "${ACTS_ROOT}/security:security", "${ACTS_ROOT}/useriam:useriam", @@ -23,10 +24,14 @@ _all_test_packages = [ "${ACTS_ROOT}/communication:communication", "${ACTS_ROOT}/notification:notification", "${ACTS_ROOT}/ability:ability", - "${ACTS_ROOT}/miscservices:miscservices", + "${ACTS_ROOT}/time:time", + "${ACTS_ROOT}/theme:theme", + "${ACTS_ROOT}/request:request", + "${ACTS_ROOT}/inputmethod:inputmethod", "${ACTS_ROOT}/powermgr:powermgr", "${ACTS_ROOT}/startup:startup", "${ACTS_ROOT}/sensors:sensor", + "${ACTS_ROOT}/distributeddatamgr:pasteboard", "${ACTS_ROOT}/distributeddatamgr:distributeddatamgr", "${ACTS_ROOT}/graphic:graphic", "${ACTS_ROOT}/arkui:arkui", diff --git a/miscservices/BUILD.gn b/theme/BUILD.gn similarity index 74% rename from miscservices/BUILD.gn rename to theme/BUILD.gn index 0e05ce9deed5713b662f3e7e90de49b4a25346bc..441614e3ab4783a03e6564a3ffa1990b62440c75 100755 --- a/miscservices/BUILD.gn +++ b/theme/BUILD.gn @@ -12,14 +12,9 @@ # limitations under the License. import("//build/ohos_var.gni") -group("miscservices") { +group("theme") { testonly = true deps = [ - "InputMethodTest_ets:ActsInputMethodEtsTest", - "RequestTest_js:ActsMiscservicesRequestJSApiTest", - "TimeTest_js:ActsTimeJSApiTest", - "TimerTest_js:ActsTimerJSApiTest", - "actspasteboardjsapitest:ActsPasteBoardJSApiTest", "screenlock_js:ActsScreenLockJSApiTest", "wallpaper_js:ActsWallpaperJSApiTest", ] diff --git a/miscservices/screenlock_js/BUILD.gn b/theme/screenlock_js/BUILD.gn similarity index 100% rename from miscservices/screenlock_js/BUILD.gn rename to theme/screenlock_js/BUILD.gn diff --git a/miscservices/screenlock_js/Test.json b/theme/screenlock_js/Test.json similarity index 100% rename from miscservices/screenlock_js/Test.json rename to theme/screenlock_js/Test.json diff --git a/theme/screenlock_js/signature/openharmony_sx.p7b b/theme/screenlock_js/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/theme/screenlock_js/signature/openharmony_sx.p7b differ diff --git a/miscservices/screenlock_js/src/main/config.json b/theme/screenlock_js/src/main/config.json similarity index 100% rename from miscservices/screenlock_js/src/main/config.json rename to theme/screenlock_js/src/main/config.json diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/default/app.js b/theme/screenlock_js/src/main/js/default/app.js similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/default/app.js rename to theme/screenlock_js/src/main/js/default/app.js diff --git a/miscservices/screenlock_js/src/main/js/default/common/images/Wallpaper.png b/theme/screenlock_js/src/main/js/default/common/images/Wallpaper.png similarity index 100% rename from miscservices/screenlock_js/src/main/js/default/common/images/Wallpaper.png rename to theme/screenlock_js/src/main/js/default/common/images/Wallpaper.png diff --git a/miscservices/screenlock_js/src/main/js/default/common/images/bg-tv.jpg b/theme/screenlock_js/src/main/js/default/common/images/bg-tv.jpg similarity index 100% rename from miscservices/screenlock_js/src/main/js/default/common/images/bg-tv.jpg rename to theme/screenlock_js/src/main/js/default/common/images/bg-tv.jpg diff --git a/miscservices/TimerTest_js/src/main/js/default/i18n/en-US.json b/theme/screenlock_js/src/main/js/default/i18n/en-US.json similarity index 100% rename from miscservices/TimerTest_js/src/main/js/default/i18n/en-US.json rename to theme/screenlock_js/src/main/js/default/i18n/en-US.json diff --git a/miscservices/TimerTest_js/src/main/js/default/i18n/zh-CN.json b/theme/screenlock_js/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from miscservices/TimerTest_js/src/main/js/default/i18n/zh-CN.json rename to theme/screenlock_js/src/main/js/default/i18n/zh-CN.json diff --git a/miscservices/screenlock_js/src/main/js/default/pages/index/index.css b/theme/screenlock_js/src/main/js/default/pages/index/index.css similarity index 100% rename from miscservices/screenlock_js/src/main/js/default/pages/index/index.css rename to theme/screenlock_js/src/main/js/default/pages/index/index.css diff --git a/miscservices/screenlock_js/src/main/js/default/pages/index/index.hml b/theme/screenlock_js/src/main/js/default/pages/index/index.hml similarity index 100% rename from miscservices/screenlock_js/src/main/js/default/pages/index/index.hml rename to theme/screenlock_js/src/main/js/default/pages/index/index.hml diff --git a/miscservices/screenlock_js/src/main/js/default/pages/index/index.js b/theme/screenlock_js/src/main/js/default/pages/index/index.js similarity index 100% rename from miscservices/screenlock_js/src/main/js/default/pages/index/index.js rename to theme/screenlock_js/src/main/js/default/pages/index/index.js diff --git a/miscservices/screenlock_js/src/main/js/test/List.test.js b/theme/screenlock_js/src/main/js/test/List.test.js similarity index 100% rename from miscservices/screenlock_js/src/main/js/test/List.test.js rename to theme/screenlock_js/src/main/js/test/List.test.js diff --git a/miscservices/screenlock_js/src/main/js/test/screenlock_service_test.js b/theme/screenlock_js/src/main/js/test/screenlock_service_test.js similarity index 100% rename from miscservices/screenlock_js/src/main/js/test/screenlock_service_test.js rename to theme/screenlock_js/src/main/js/test/screenlock_service_test.js diff --git a/miscservices/screenlock_js/src/main/js/test/screenlock_service_test_promise.js b/theme/screenlock_js/src/main/js/test/screenlock_service_test_promise.js similarity index 100% rename from miscservices/screenlock_js/src/main/js/test/screenlock_service_test_promise.js rename to theme/screenlock_js/src/main/js/test/screenlock_service_test_promise.js diff --git a/miscservices/screenlock_js/src/main/resources/base/element/string.json b/theme/screenlock_js/src/main/resources/base/element/string.json similarity index 100% rename from miscservices/screenlock_js/src/main/resources/base/element/string.json rename to theme/screenlock_js/src/main/resources/base/element/string.json diff --git a/theme/screenlock_js/src/main/resources/base/media/icon.png b/theme/screenlock_js/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/theme/screenlock_js/src/main/resources/base/media/icon.png differ diff --git a/miscservices/wallpaper_js/BUILD.gn b/theme/wallpaper_js/BUILD.gn similarity index 100% rename from miscservices/wallpaper_js/BUILD.gn rename to theme/wallpaper_js/BUILD.gn diff --git a/miscservices/wallpaper_js/Test.json b/theme/wallpaper_js/Test.json similarity index 100% rename from miscservices/wallpaper_js/Test.json rename to theme/wallpaper_js/Test.json diff --git a/theme/wallpaper_js/signature/openharmony_sx.p7b b/theme/wallpaper_js/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/theme/wallpaper_js/signature/openharmony_sx.p7b differ diff --git a/miscservices/wallpaper_js/src/main/config.json b/theme/wallpaper_js/src/main/config.json similarity index 100% rename from miscservices/wallpaper_js/src/main/config.json rename to theme/wallpaper_js/src/main/config.json diff --git a/miscservices/wallpaper_js/src/main/js/Test/List.test.js b/theme/wallpaper_js/src/main/js/Test/List.test.js similarity index 100% rename from miscservices/wallpaper_js/src/main/js/Test/List.test.js rename to theme/wallpaper_js/src/main/js/Test/List.test.js diff --git a/miscservices/wallpaper_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js b/theme/wallpaper_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js similarity index 100% rename from miscservices/wallpaper_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js rename to theme/wallpaper_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js diff --git a/miscservices/screenlock_js/src/main/js/default/app.js b/theme/wallpaper_js/src/main/js/default/app.js similarity index 100% rename from miscservices/screenlock_js/src/main/js/default/app.js rename to theme/wallpaper_js/src/main/js/default/app.js diff --git a/miscservices/wallpaper_js/src/main/js/default/common/images/Wallpaper.png b/theme/wallpaper_js/src/main/js/default/common/images/Wallpaper.png similarity index 100% rename from miscservices/wallpaper_js/src/main/js/default/common/images/Wallpaper.png rename to theme/wallpaper_js/src/main/js/default/common/images/Wallpaper.png diff --git a/miscservices/wallpaper_js/src/main/js/default/common/images/bg-tv.jpg b/theme/wallpaper_js/src/main/js/default/common/images/bg-tv.jpg similarity index 100% rename from miscservices/wallpaper_js/src/main/js/default/common/images/bg-tv.jpg rename to theme/wallpaper_js/src/main/js/default/common/images/bg-tv.jpg diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/default/i18n/en-US.json b/theme/wallpaper_js/src/main/js/default/i18n/en-US.json similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/default/i18n/en-US.json rename to theme/wallpaper_js/src/main/js/default/i18n/en-US.json diff --git a/miscservices/actspasteboardjsapitest/entry/src/main/js/default/i18n/zh-CN.json b/theme/wallpaper_js/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from miscservices/actspasteboardjsapitest/entry/src/main/js/default/i18n/zh-CN.json rename to theme/wallpaper_js/src/main/js/default/i18n/zh-CN.json diff --git a/miscservices/wallpaper_js/src/main/js/default/pages/index/index.css b/theme/wallpaper_js/src/main/js/default/pages/index/index.css similarity index 100% rename from miscservices/wallpaper_js/src/main/js/default/pages/index/index.css rename to theme/wallpaper_js/src/main/js/default/pages/index/index.css diff --git a/miscservices/wallpaper_js/src/main/js/default/pages/index/index.hml b/theme/wallpaper_js/src/main/js/default/pages/index/index.hml similarity index 100% rename from miscservices/wallpaper_js/src/main/js/default/pages/index/index.hml rename to theme/wallpaper_js/src/main/js/default/pages/index/index.hml diff --git a/miscservices/wallpaper_js/src/main/js/default/pages/index/index.js b/theme/wallpaper_js/src/main/js/default/pages/index/index.js similarity index 100% rename from miscservices/wallpaper_js/src/main/js/default/pages/index/index.js rename to theme/wallpaper_js/src/main/js/default/pages/index/index.js diff --git a/miscservices/wallpaper_js/src/main/resources/base/element/string.json b/theme/wallpaper_js/src/main/resources/base/element/string.json similarity index 100% rename from miscservices/wallpaper_js/src/main/resources/base/element/string.json rename to theme/wallpaper_js/src/main/resources/base/element/string.json diff --git a/theme/wallpaper_js/src/main/resources/base/media/icon.png b/theme/wallpaper_js/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/theme/wallpaper_js/src/main/resources/base/media/icon.png differ diff --git a/time/BUILD.gn b/time/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..49d9a1c979ba6daf141e980bd9b945e2a01766ac --- /dev/null +++ b/time/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos_var.gni") +group("time") { + testonly = true + deps = [ + "TimeTest_js:ActsTimeJSApiTest", + "TimerTest_js:ActsTimerJSApiTest", + ] +} diff --git a/miscservices/TimeTest_js/BUILD.gn b/time/TimeTest_js/BUILD.gn similarity index 100% rename from miscservices/TimeTest_js/BUILD.gn rename to time/TimeTest_js/BUILD.gn diff --git a/miscservices/TimeTest_js/Test.json b/time/TimeTest_js/Test.json similarity index 100% rename from miscservices/TimeTest_js/Test.json rename to time/TimeTest_js/Test.json diff --git a/time/TimeTest_js/signature/openharmony_sx.p7b b/time/TimeTest_js/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/time/TimeTest_js/signature/openharmony_sx.p7b differ diff --git a/miscservices/TimeTest_js/src/main/config.json b/time/TimeTest_js/src/main/config.json similarity index 100% rename from miscservices/TimeTest_js/src/main/config.json rename to time/TimeTest_js/src/main/config.json diff --git a/miscservices/TimeTest_js/src/main/js/default/app.js b/time/TimeTest_js/src/main/js/default/app.js similarity index 100% rename from miscservices/TimeTest_js/src/main/js/default/app.js rename to time/TimeTest_js/src/main/js/default/app.js diff --git a/miscservices/screenlock_js/src/main/js/default/i18n/en-US.json b/time/TimeTest_js/src/main/js/default/i18n/en-US.json old mode 100644 new mode 100755 similarity index 100% rename from miscservices/screenlock_js/src/main/js/default/i18n/en-US.json rename to time/TimeTest_js/src/main/js/default/i18n/en-US.json diff --git a/miscservices/screenlock_js/src/main/js/default/i18n/zh-CN.json b/time/TimeTest_js/src/main/js/default/i18n/zh-CN.json old mode 100644 new mode 100755 similarity index 100% rename from miscservices/screenlock_js/src/main/js/default/i18n/zh-CN.json rename to time/TimeTest_js/src/main/js/default/i18n/zh-CN.json diff --git a/miscservices/TimeTest_js/src/main/js/default/pages/index/index.css b/time/TimeTest_js/src/main/js/default/pages/index/index.css similarity index 100% rename from miscservices/TimeTest_js/src/main/js/default/pages/index/index.css rename to time/TimeTest_js/src/main/js/default/pages/index/index.css diff --git a/miscservices/TimeTest_js/src/main/js/default/pages/index/index.hml b/time/TimeTest_js/src/main/js/default/pages/index/index.hml similarity index 100% rename from miscservices/TimeTest_js/src/main/js/default/pages/index/index.hml rename to time/TimeTest_js/src/main/js/default/pages/index/index.hml diff --git a/miscservices/TimeTest_js/src/main/js/default/pages/index/index.js b/time/TimeTest_js/src/main/js/default/pages/index/index.js similarity index 95% rename from miscservices/TimeTest_js/src/main/js/default/pages/index/index.js rename to time/TimeTest_js/src/main/js/default/pages/index/index.js index 683d21658fdfe2191a6481e9a35f173b04c6b2f7..b322cafacae644bcb3097d3f61a619e8059c501b 100755 --- a/miscservices/TimeTest_js/src/main/js/default/pages/index/index.js +++ b/time/TimeTest_js/src/main/js/default/pages/index/index.js @@ -14,7 +14,6 @@ */ import app from '@system.app' -//import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' import {Core, ExpectExtend} from 'deccjsunit/index' const injectRef = Object.getPrototypeOf(global) || global diff --git a/miscservices/TimeTest_js/src/main/js/default/test/List.test.js b/time/TimeTest_js/src/main/js/default/test/List.test.js similarity index 100% rename from miscservices/TimeTest_js/src/main/js/default/test/List.test.js rename to time/TimeTest_js/src/main/js/default/test/List.test.js diff --git a/miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js b/time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js similarity index 99% rename from miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js rename to time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js index 97d8bc16abd582698626d4f5a23c7781da3b3a8f..ec0c614cf6d2c878b0282fd7be11ffe09c0d754c 100644 --- a/miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js +++ b/time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js @@ -27,6 +27,7 @@ import { describe("TimeTest", function () { console.log("start################################start"); + /** * @tc.number SUB_systemTime_getRealActiveTime_JS_API_0100 * @tc.name Test systemTime.getRealActiveTime diff --git a/miscservices/TimeTest_js/src/main/js/default/test/Time.test.js b/time/TimeTest_js/src/main/js/default/test/Time.test.js similarity index 100% rename from miscservices/TimeTest_js/src/main/js/default/test/Time.test.js rename to time/TimeTest_js/src/main/js/default/test/Time.test.js diff --git a/miscservices/TimeTest_js/src/main/resources/base/element/string.json b/time/TimeTest_js/src/main/resources/base/element/string.json similarity index 100% rename from miscservices/TimeTest_js/src/main/resources/base/element/string.json rename to time/TimeTest_js/src/main/resources/base/element/string.json diff --git a/time/TimeTest_js/src/main/resources/base/media/icon.png b/time/TimeTest_js/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/time/TimeTest_js/src/main/resources/base/media/icon.png differ diff --git a/miscservices/TimerTest_js/BUILD.gn b/time/TimerTest_js/BUILD.gn similarity index 100% rename from miscservices/TimerTest_js/BUILD.gn rename to time/TimerTest_js/BUILD.gn diff --git a/miscservices/TimerTest_js/Test.json b/time/TimerTest_js/Test.json similarity index 100% rename from miscservices/TimerTest_js/Test.json rename to time/TimerTest_js/Test.json diff --git a/time/TimerTest_js/signature/openharmony_sx.p7b b/time/TimerTest_js/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/time/TimerTest_js/signature/openharmony_sx.p7b differ diff --git a/miscservices/TimerTest_js/src/main/config.json b/time/TimerTest_js/src/main/config.json similarity index 100% rename from miscservices/TimerTest_js/src/main/config.json rename to time/TimerTest_js/src/main/config.json diff --git a/miscservices/TimerTest_js/src/main/js/default/app.js b/time/TimerTest_js/src/main/js/default/app.js similarity index 100% rename from miscservices/TimerTest_js/src/main/js/default/app.js rename to time/TimerTest_js/src/main/js/default/app.js diff --git a/miscservices/wallpaper_js/src/main/js/default/i18n/en-US.json b/time/TimerTest_js/src/main/js/default/i18n/en-US.json similarity index 100% rename from miscservices/wallpaper_js/src/main/js/default/i18n/en-US.json rename to time/TimerTest_js/src/main/js/default/i18n/en-US.json diff --git a/miscservices/wallpaper_js/src/main/js/default/i18n/zh-CN.json b/time/TimerTest_js/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from miscservices/wallpaper_js/src/main/js/default/i18n/zh-CN.json rename to time/TimerTest_js/src/main/js/default/i18n/zh-CN.json diff --git a/miscservices/TimerTest_js/src/main/js/default/pages/index/index.css b/time/TimerTest_js/src/main/js/default/pages/index/index.css similarity index 100% rename from miscservices/TimerTest_js/src/main/js/default/pages/index/index.css rename to time/TimerTest_js/src/main/js/default/pages/index/index.css diff --git a/miscservices/TimerTest_js/src/main/js/default/pages/index/index.hml b/time/TimerTest_js/src/main/js/default/pages/index/index.hml similarity index 100% rename from miscservices/TimerTest_js/src/main/js/default/pages/index/index.hml rename to time/TimerTest_js/src/main/js/default/pages/index/index.hml diff --git a/miscservices/TimerTest_js/src/main/js/default/pages/index/index.js b/time/TimerTest_js/src/main/js/default/pages/index/index.js similarity index 95% rename from miscservices/TimerTest_js/src/main/js/default/pages/index/index.js rename to time/TimerTest_js/src/main/js/default/pages/index/index.js index c41eff97753bb7e8937794076dc8ca97672f66c5..876dee977f2afcf38af5c986e8201f3760232611 100644 --- a/miscservices/TimerTest_js/src/main/js/default/pages/index/index.js +++ b/time/TimerTest_js/src/main/js/default/pages/index/index.js @@ -14,7 +14,6 @@ */ import app from '@system.app' -//import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' import {Core, ExpectExtend} from 'deccjsunit/index' const injectRef = Object.getPrototypeOf(global) || global diff --git a/miscservices/TimerTest_js/src/main/js/default/test/List.test.js b/time/TimerTest_js/src/main/js/default/test/List.test.js similarity index 100% rename from miscservices/TimerTest_js/src/main/js/default/test/List.test.js rename to time/TimerTest_js/src/main/js/default/test/List.test.js diff --git a/miscservices/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js b/time/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js similarity index 100% rename from miscservices/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js rename to time/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js diff --git a/miscservices/TimerTest_js/src/main/resources/base/element/string.json b/time/TimerTest_js/src/main/resources/base/element/string.json similarity index 100% rename from miscservices/TimerTest_js/src/main/resources/base/element/string.json rename to time/TimerTest_js/src/main/resources/base/element/string.json diff --git a/time/TimerTest_js/src/main/resources/base/media/icon.png b/time/TimerTest_js/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/time/TimerTest_js/src/main/resources/base/media/icon.png differ