Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5e62a8e0
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5e62a8e0
编写于
9月 06, 2022
作者:
X
xuchenghua09
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
Signed-off-by:
N
xuchenghua09
<
xuchenghua09@huawei.com
>
上级
c275cd86
变更
66
展开全部
显示空白变更内容
内联
并排
Showing
66 changed file
with
1689 addition
and
461 deletion
+1689
-461
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn
...untime/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn
+6
-4
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/Test.json
...ntime/actsusers/ActsAmsUsersExtensionSystemTest/Test.json
+9
-3
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts
...nSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts
+20
-16
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/index/index.ets
...Test/entry/src/main/ets/MainAbility/pages/index/index.ets
+31
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/second/second.ets
...st/entry/src/main/ets/MainAbility/pages/second/second.ets
+43
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts
...ystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts
+3
-3
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
...mTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
+21
-9
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets
...ensionSystemTest/entry/src/main/ets/test/Ability.test.ets
+160
-170
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets
...ExtensionSystemTest/entry/src/main/ets/test/List.test.ets
+2
-2
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+2
-2
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/signature/openharmony_sx.p7b
...sAmsUsersExtensionSystemTest/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/BUILD.gn
...runtime/actsusers/ActsAmsUsersExtensionThirdTest/BUILD.gn
+2
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/Test.json
...untime/actsusers/ActsAmsUsersExtensionThirdTest/Test.json
+16
-3
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility/MainAbility.ts
...onThirdTest/entry/src/main/ets/MainAbility/MainAbility.ts
+32
-29
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility/pages/index/index.ets
...Test/entry/src/main/ets/MainAbility/pages/index/index.ets
+31
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility/pages/second/second.ets
...st/entry/src/main/ets/MainAbility/pages/second/second.ets
+44
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts
...ThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts
+3
-3
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
...dTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
+16
-11
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts
...onThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts
+51
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/pages/index.ets
...nThirdTest/entry/src/main/ets/TestAbility/pages/index.ets
+48
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/Ability.test.ets
...tensionThirdTest/entry/src/main/ets/test/Ability.test.ets
+27
-36
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/List.test.ets
...sExtensionThirdTest/entry/src/main/ets/test/List.test.ets
+2
-2
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/element/string.json
...irdTest/entry/src/main/resources/base/element/string.json
+1
-1
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+2
-2
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/signature/openharmony_sx.p7b
...tsAmsUsersExtensionThirdTest/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/Test.json
...bility_runtime/actsusers/ActsAmsUsersSystemTest/Test.json
+1
-1
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/BUILD.gn
.../ability_runtime/actsusers/ActsAmsUsersThirdTest/BUILD.gn
+2
-0
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/Test.json
...ability_runtime/actsusers/ActsAmsUsersThirdTest/Test.json
+6
-3
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility/MainAbility.ts
...rsThirdTest/entry/src/main/ets/MainAbility/MainAbility.ts
+1
-1
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility/pages/index/index.ets
...Test/entry/src/main/ets/MainAbility/pages/index/index.ets
+42
-0
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility/pages/second/second.ets
...st/entry/src/main/ets/MainAbility/pages/second/second.ets
+43
-0
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts
...ThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts
+2
-2
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility3/MainAbility3.ts
...ThirdTest/entry/src/main/ets/MainAbility3/MainAbility3.ts
+3
-3
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts
...rsThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts
+51
-0
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/pages/index.ets
...sThirdTest/entry/src/main/ets/TestAbility/pages/index.ets
+48
-0
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/Ability.test.ets
...msUsersThirdTest/entry/src/main/ets/test/Ability.test.ets
+32
-30
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/List.test.ets
...tsAmsUsersThirdTest/entry/src/main/ets/test/List.test.ets
+2
-2
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+2
-2
ability/ability_runtime/actsusers/BUILD.gn
ability/ability_runtime/actsusers/BUILD.gn
+1
-1
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn
...me/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn
+2
-0
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/Test.json
...e/actsusers/actsconnectabilitysystemabilitytest/Test.json
+7
-4
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts
...abilitytest/entry/src/main/ets/MainAbility/MainAbility.ts
+23
-28
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/index/index.ets
...test/entry/src/main/ets/MainAbility/pages/index/index.ets
+42
-0
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/second/second.ets
...st/entry/src/main/ets/MainAbility/pages/second/second.ets
+43
-0
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts
...abilitytest/entry/src/main/ets/TestAbility/TestAbility.ts
+51
-0
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/pages/index.ets
...bilitytest/entry/src/main/ets/TestAbility/pages/index.ets
+48
-0
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets
...tysystemabilitytest/entry/src/main/ets/test/List.test.ets
+2
-2
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets
...est/entry/src/main/ets/test/manyusersabilitytest.test.ets
+36
-36
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+2
-2
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/signature/openharmony_sx.p7b
...nectabilitysystemabilitytest/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/BUILD.gn
...y_runtime/actsusers/actsmanyuserthirdabilitytest/BUILD.gn
+3
-1
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/Test.json
..._runtime/actsusers/actsmanyuserthirdabilitytest/Test.json
+6
-4
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts
...abilitytest/entry/src/main/ets/MainAbility/MainAbility.ts
+2
-3
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/pages/index/index.ets
...test/entry/src/main/ets/MainAbility/pages/index/index.ets
+42
-0
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/pages/second/second.ets
...st/entry/src/main/ets/MainAbility/pages/second/second.ets
+43
-0
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts
...abilitytest/entry/src/main/ets/TestAbility/TestAbility.ts
+51
-0
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/pages/index.ets
...bilitytest/entry/src/main/ets/TestAbility/pages/index.ets
+48
-0
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/List.test.ets
...serthirdabilitytest/entry/src/main/ets/test/List.test.ets
+2
-2
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets
...est/entry/src/main/ets/test/manyusersabilitytest.test.ets
+36
-36
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+2
-2
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/signature/openharmony_sx.p7b
...actsmanyuserthirdabilitytest/signature/openharmony_sx.p7b
+0
-0
未找到文件。
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/BUILD.gn
浏览文件 @
5e62a8e0
...
...
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsUsersExtensionSystemTest") {
hap_profile = "entry/src/main/module.json"
hap_profile = "
./
entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsamsusersextensionsystemtest_js_assets",
...
...
@@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsAmsUsersExtensionSystemTest") {
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsUsersExtensionSystemTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsamsusersextensionsystemtest_app_profile") {
...
...
@@ -31,11 +33,11 @@ ohos_app_scope("actsamsusersextensionsystemtest_app_profile") {
}
ohos_js_assets("actsamsusersextensionsystemtest_js_assets") {
source_dir = "entry/src/main/ets"
source_dir = "
./
entry/src/main/ets"
}
ohos_resources("actsamsusersextensionsystemtest_resources") {
sources = [ "entry/src/main/resources" ]
sources = [ "
./
entry/src/main/resources" ]
deps = [ ":actsamsusersextensionsystemtest_app_profile" ]
hap_profile = "entry/src/main/module.json"
hap_profile = "
./
entry/src/main/module.json"
}
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/Test.json
浏览文件 @
5e62a8e0
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"
OH
JSUnitTest"
,
"test-timeout"
:
"300000"
,
"package"
:
"com.acts.actsinterfacemultiusersextensiontest"
,
"shell-timeout"
:
"300000"
"bundle-name"
:
"com.acts.actsinterfacemultiusersextensiontest"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"300000"
,
"testcase-timeout"
:
"30000"
},
"kits"
:
[
{
...
...
@@ -12,6 +14,10 @@
"run-command"
:
[
"acm create -n user101 -t normal"
,
"acm switch -i 101"
],
"teardown-command"
:
[
"acm switch -i 100"
,
"acm delete -i 101"
]
},
{
...
...
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
5e62a8e0
...
...
@@ -13,38 +13,42 @@
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
){
// Ability is creating, initialize resources for this ability
console
.
log
(
"
MainAbility onCreate
"
)
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
MainAbility onCreate
'
)
globalThis
.
abilityWant
=
want
;
globalThis
.
abilityContext
=
this
.
context
;
var
abilityDelegator
:
any
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
:
any
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
MainAbility onDestroy
"
)
console
.
log
(
'
MainAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
)
console
.
log
(
'
MainAbility onWindowStageCreate
'
)
windowStage
.
setUIContent
(
this
.
context
,
'
MainAbility/pages/index/index
'
,
null
)
}
onWindowStageDestroy
()
{
//Main window is destroyed, release UI related resources
console
.
log
(
"
MainAbility onWindowStageDestroy
"
)
console
.
log
(
'
MainAbility onWindowStageDestroy
'
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
MainAbility onForeground
"
)
console
.
log
(
'
MainAbility onForeground
'
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
MainAbility onBackground
"
)
console
.
log
(
'
MainAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/index/index.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'ActsAmsUsersExtensionSystemTest'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility/pages/second/second.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/MainAbility2/MainAbility2.ts
浏览文件 @
5e62a8e0
...
...
@@ -19,7 +19,7 @@ export default class MainAbility2 extends Ability {
onCreate
(
want
,
launchParam
)
{
console
.
log
(
"
MainAbility2 onCreate
"
);
globalThis
.
abilityContext
=
this
.
context
globalThis
.
abilityContext
2
=
this
.
context
}
onDestroy
()
{
...
...
@@ -28,10 +28,10 @@ export default class MainAbility2 extends Ability {
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
"
MainAbility2 onWindowStageCreate
"
);
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/second
"
,
null
);
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/
pages/index/second
"
,
null
);
commonEvent
.
publish
(
"
ACTS_InterfaceMultiUsersExtension_CommonEvent
"
,
()
=>
{
console
.
log
(
"
publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback
"
)
globalThis
.
abilityContext
.
terminateSelf
().
then
(()
=>
{
globalThis
.
abilityContext
2
.
terminateSelf
().
then
(()
=>
{
commonEvent
.
publish
(
"
ACTS_TerminateSelf_CommonEvent
"
,
()
=>
{
console
.
log
(
'
terminateSelf promise
'
);
});
...
...
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
浏览文件 @
5e62a8e0
...
...
@@ -79,6 +79,8 @@ export default class ServiceAbility extends ServiceExtensionAbility {
},{
windowMode
:
0
},(
err
,
data
)
=>
{
console
.
debug
(
"
==== err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
==== errCode is====>
"
+
JSON
.
stringify
(
err
.
code
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub7
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensiontest.MainAbility
"
);
...
...
@@ -92,7 +94,9 @@ export default class ServiceAbility extends ServiceExtensionAbility {
abilityName
:
'
com.acts.error.MainAbility2
'
},{
windowMode
:
0
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
==== err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
==== errCode is====>
"
+
JSON
.
stringify
(
err
.
code
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub2
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensiontest.MainAbility
"
);
...
...
@@ -126,7 +130,9 @@ export default class ServiceAbility extends ServiceExtensionAbility {
{
bundleName
:
'
com.acts.actsinterfacemultiusersextensiontest
'
,
abilityName
:
'
com.acts.actsinterfacemultiusersextensiontest.ServiceAbility2
'
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
==== err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
==== errCode is====>
"
+
JSON
.
stringify
(
err
.
code
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub8
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensiontest.MainAbility
"
);
...
...
@@ -138,7 +144,9 @@ export default class ServiceAbility extends ServiceExtensionAbility {
{
bundleName
:
'
com.acts.error
'
,
abilityName
:
'
com.acts.error.ServiceAbility2
'
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
==== err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
==== errCode is====>
"
+
JSON
.
stringify
(
err
.
code
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub4
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensiontest.MainAbility
"
);
...
...
@@ -186,7 +194,9 @@ export default class ServiceAbility extends ServiceExtensionAbility {
{
bundleName
:
'
com.acts.error
'
,
abilityName
:
'
com.acts.error.ServiceAbility2
'
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
==== err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
==== errCode is====>
"
+
JSON
.
stringify
(
err
.
code
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub6
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensiontest.MainAbility
"
);
...
...
@@ -210,7 +220,9 @@ export default class ServiceAbility extends ServiceExtensionAbility {
{
bundleName
:
'
com.example.userservicesystemapi7
'
,
abilityName
:
'
com.example.userservicesystemapi7.ServiceAbility
'
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
==== err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
==== errCode is====>
"
+
JSON
.
stringify
(
err
.
code
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub10
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensiontest.MainAbility
"
);
...
...
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s it
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
=
`
${
targetParams
}
${
key
}
${
parameters
[
key
]}
`
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
}
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a com.acts.actsinterfacemultiusersextensiontest.MainAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
5e62a8e0
此差异已折叠。
点击以展开。
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/ets/test/List.test.ets
浏览文件 @
5e62a8e0
...
...
@@ -14,7 +14,7 @@
*/
import abilityTest from './Ability.test.ets'
export default function testsuite(
context
) {
export default function testsuite() {
console.debug("====>in list.test====>");
abilityTest(
context
)
abilityTest()
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
5e62a8e0
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
"
MainAbility/
pages/index/index"
,
"
MainAbility/
pages/second/second"
]
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionSystemTest/signature/openharmony_sx.p7b
浏览文件 @
5e62a8e0
无法预览此类型文件
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/BUILD.gn
浏览文件 @
5e62a8e0
...
...
@@ -22,6 +22,8 @@ ohos_js_hap_suite("ActsAmsUsersExtensionThirdTest") {
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsUsersExtensionThirdTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsamsusersextensionthirdtest_app_profile") {
...
...
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/Test.json
浏览文件 @
5e62a8e0
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"
OH
JSUnitTest"
,
"test-timeout"
:
"300000"
,
"package"
:
"com.acts.actsinterfacemultiusersextensionthirdtest"
,
"shell-timeout"
:
"300000"
"bundle-name"
:
"com.acts.actsinterfacemultiusersextensionthirdtest"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"300000"
,
"testcase-timeout"
:
"30000"
},
"kits"
:
[
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"acm create -n user101 -t normal"
,
"acm switch -i 101"
],
"teardown-command"
:
[
"acm switch -i 100"
,
"acm delete -i 101"
]
},
{
"test-file-name"
:
[
"ActsAmsUsersExtensionThirdTest.hap"
...
...
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
5e62a8e0
...
...
@@ -13,39 +13,42 @@
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
// Ability is creating, initialize resources for this ability
console
.
log
(
"
MainAbility onCreate
"
);
console
.
log
(
'
MainAbility onCreate
'
)
globalThis
.
abilityWant
=
want
;
globalThis
.
abilityContext
=
this
.
context
globalThis
.
abilityContext
=
this
.
context
;
var
abilityDelegator
:
any
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
:
any
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
MainAbility onDestroy
"
);
console
.
log
(
'
MainAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility onWindowStageCreate
"
);
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
);
console
.
log
(
'
MainAbility onWindowStageCreate
'
)
windowStage
.
setUIContent
(
this
.
context
,
'
MainAbility/pages/index/index
'
,
null
)
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
console
.
log
(
"
MainAbility onWindowStageDestroy
"
);
console
.
log
(
'
MainAbility onWindowStageDestroy
'
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
MainAbility onForeground
"
);
console
.
log
(
'
MainAbility onForeground
'
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
MainAbility onBackground
"
);
console
.
log
(
'
MainAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility/pages/index/index.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'ActsAmsUsersExtensionSystemTest'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility/pages/second/second.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts
浏览文件 @
5e62a8e0
...
...
@@ -19,7 +19,7 @@ export default class MainAbility2 extends Ability {
onCreate
(
want
,
launchParam
)
{
console
.
log
(
"
MainAbility2 onCreate
"
);
globalThis
.
abilityContext
=
this
.
context
globalThis
.
abilityContext
2
=
this
.
context
}
onDestroy
()
{
...
...
@@ -28,10 +28,10 @@ export default class MainAbility2 extends Ability {
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
"
MainAbility2 onWindowStageCreate
"
);
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/second
"
,
null
);
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/
pages/index/second
"
,
null
);
commonEvent
.
publish
(
"
ACTS_InterfaceMultiUsersExtension_CommonEvent
"
,
()
=>
{
console
.
log
(
"
publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback
"
)
globalThis
.
abilityContext
.
terminateSelf
().
then
(()
=>
{
globalThis
.
abilityContext
2
.
terminateSelf
().
then
(()
=>
{
commonEvent
.
publish
(
"
ACTS_TerminateSelf_CommonEvent
"
,
()
=>
{
console
.
log
(
'
terminateSelf promise
'
);
});
...
...
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts
浏览文件 @
5e62a8e0
...
...
@@ -76,7 +76,8 @@ export default class ServiceAbility extends ServiceExtensionAbility {
abilityName
:
'
com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility2
'
},{
windowMode
:
0
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
====>err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub7
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility
"
);
...
...
@@ -90,7 +91,8 @@ export default class ServiceAbility extends ServiceExtensionAbility {
abilityName
:
'
com.acts.error.MainAbility2
'
},{
windowMode
:
0
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
====>err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub2
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility
"
);
...
...
@@ -124,7 +126,8 @@ export default class ServiceAbility extends ServiceExtensionAbility {
{
bundleName
:
'
com.acts.actsinterfacemultiusersextensionthirdtest
'
,
abilityName
:
'
com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility2
'
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
====>err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub8
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility
"
);
...
...
@@ -136,7 +139,8 @@ export default class ServiceAbility extends ServiceExtensionAbility {
{
bundleName
:
'
com.acts.error
'
,
abilityName
:
'
com.acts.error.ServiceAbility2
'
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
====>err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub4
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility
"
);
...
...
@@ -178,7 +182,8 @@ export default class ServiceAbility extends ServiceExtensionAbility {
{
bundleName
:
'
com.acts.error
'
,
abilityName
:
'
com.acts.error.ServiceAbility2
'
},()
=>
{
},(
err
,
data
)
=>
{
console
.
debug
(
"
====>err is====>
"
+
JSON
.
stringify
(
err
));
console
.
debug
(
"
====>startAbility end====>
"
);
})
var
myStub6
=
new
Stub
(
"
com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility
"
);
...
...
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
}
onDestroy
()
{
console
.
log
(
'
TestAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
TestAbility onWindowStageCreate
'
)
windowStage
.
loadContent
(
"
TestAbility/pages/index
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
))
});
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
console
.
log
(
'
TestAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
TestAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
TestAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s it
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
=
`
${
targetParams
}
${
key
}
${
parameters
[
key
]}
`
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
}
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a com.acts.actsinterfacemultiusersextensionthirdtest.MainAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
5e62a8e0
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
deccjsunit/index
"
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
@ohos/hypium
"
import commonEvent from '@ohos.commonEvent'
import osaccount from '@ohos.account.osAccount'
...
...
@@ -26,20 +26,11 @@ var osAccountManager
const START_ABILITY_TIMEOUT = 6000;
globalThis.number = 0;
console.debug("====>in Ability.test====>");
export default function abilityTest(
abilityContext
) {
export default function abilityTest() {
console.debug("====>in function abilityTest====>");
describe('ActsInterfaceMultiUsersExtensionThirdTest', function () {
afterAll(function() {
osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
osAccountManager.activateOsAccount(100, (err)=>{
console.debug("====>activateOsAccount localId: 100 err:" + JSON.stringify(err));
osAccountManager.removeOsAccount(101, (err)=>{
console.debug("====>remove localId: 101" + " err:" + JSON.stringify(err));
})
})
})
console.debug("====>in ACTS_InterfaceMultiUsers====>");
/*
* @tc.number : ACTS_ThirdPartyExtensionStartAbility_0100
* @tc.name : start new ability
...
...
@@ -57,7 +48,7 @@ export default function abilityTest(abilityContext) {
if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){
startresult = true
}
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -70,7 +61,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0100start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -124,7 +115,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>UnSubscribeCallback====>");
flag = false
expect(startresult).assertEqual(false);
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -158,7 +149,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0200start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -189,7 +180,7 @@ export default function abilityTest(abilityContext) {
if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){
startresult = true
}
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -202,7 +193,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0300start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -256,7 +247,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>UnSubscribeCallback====>");
flag = false
expect(startresult).assertEqual(false);
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -290,7 +281,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0400start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -322,7 +313,7 @@ export default function abilityTest(abilityContext) {
if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){
startresult = true
}
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -335,7 +326,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0500start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -389,7 +380,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>UnSubscribeCallback====>");
flag = false
expect(startresult).assertEqual(false);
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -423,7 +414,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0600start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -454,7 +445,7 @@ export default function abilityTest(abilityContext) {
if(data.event == "ACTS_InterfaceMultiUsersExtension_CommonEvent"){
startresult = true
}
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -467,7 +458,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0700start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -522,7 +513,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>UnSubscribeCallback====>");
flag = false
expect(startresult).assertEqual(false);
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -556,7 +547,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0800start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -586,7 +577,7 @@ export default function abilityTest(abilityContext) {
if(data.event == "ACTS_TerminateSelf_CommonEvent"){
startresult = true
}
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -599,7 +590,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0100start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -652,7 +643,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>UnSubscribeCallback====>");
flag = false
expect(startresult).assertEqual(false);
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -686,7 +677,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0200start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -717,7 +708,7 @@ export default function abilityTest(abilityContext) {
if(data.event == "ACTS_TerminateSelf_CommonEvent"){
startresult = true
}
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -730,7 +721,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0300start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
@@ -784,7 +775,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>UnSubscribeCallback====>");
flag = false
expect(startresult).assertEqual(false);
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
globalThis.
abilityContext.disconnectAbility(globalThis.number).then((data)=>{
console.debug("====>data is====>" + JSON.stringify(data));
})
console.log('====>disconnectAbility finish');
...
...
@@ -820,7 +811,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>0400start connectAbility====>");
globalThis.number = await abilityContext.connectAbility(
globalThis.number = await
globalThis.
abilityContext.connectAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensionthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersextensionthirdtest.ServiceAbility'
...
...
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/ets/test/List.test.ets
浏览文件 @
5e62a8e0
...
...
@@ -14,7 +14,7 @@
*/
import abilityTest from './Ability.test.ets'
export default function testsuite(
context
) {
export default function testsuite() {
console.debug("====>in list.test====>");
abilityTest(
context
)
abilityTest()
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/element/string.json
浏览文件 @
5e62a8e0
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
5e62a8e0
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
"
MainAbility/
pages/index/index"
,
"
MainAbility/
pages/second/second"
]
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersExtensionThirdTest/signature/openharmony_sx.p7b
浏览文件 @
5e62a8e0
无法预览此类型文件
ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/Test.json
浏览文件 @
5e62a8e0
...
...
@@ -6,7 +6,7 @@
"bundle-name"
:
"com.acts.actsinterfacemultiuserstest"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"300000"
,
"testcase-timeout"
:
300000
"testcase-timeout"
:
"30000"
},
"kits"
:
[
{
...
...
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/BUILD.gn
浏览文件 @
5e62a8e0
...
...
@@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsAmsUsersThirdTest") {
ets2abc = true
certificate_profile = "signature/openharmony_sx_thirdparty.p7b"
hap_name = "ActsAmsUsersThirdTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsamsusersthirdtest_app_profile") {
...
...
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/Test.json
浏览文件 @
5e62a8e0
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"
OH
JSUnitTest"
,
"test-timeout"
:
"300000"
,
"package"
:
"com.acts.actsinterfacemultiusersthirdtest"
,
"shell-timeout"
:
"300000"
"bundle-name"
:
"com.acts.actsinterfacemultiusersthirdtest"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"300000"
,
"testcase-timeout"
:
"30000"
},
"kits"
:
[
{
...
...
@@ -14,6 +16,7 @@
"acm switch -i 101"
],
"teardown-command"
:[
"acm switch -i 100"
,
"acm delete -i 101"
]
},
...
...
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
5e62a8e0
...
...
@@ -28,7 +28,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
"
MainAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
)
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/
pages/index/index
"
,
null
)
}
onWindowStageDestroy
()
{
...
...
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility/pages/index/index.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
import router from '@ohos.router'
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("start run testcase!!!!")
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('MainAbility')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility/pages/second/second.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility2/MainAbility2.ts
浏览文件 @
5e62a8e0
...
...
@@ -16,7 +16,7 @@ import Ability from '@ohos.application.Ability'
import
commonEvent
from
'
@ohos.commonEvent
'
function
PublishCallBackOne
()
{
console
.
debug
(
"
====>Publish CallBack ACTS_StartAbility_0100_CommonEvent====>
"
);
globalThis
.
abilityContext
.
terminateSelf
();
globalThis
.
abilityContext
2
.
terminateSelf
();
console
.
debug
(
"
====>terminateSelf succese====>
"
)
commonEvent
.
publish
(
"
ACTS_TerminateSelf_CommonEvent
"
,
()
=>
{
console
.
debug
(
"
====>publish ACTS_TerminateSelf_CommonEvent====>
"
)
...
...
@@ -34,7 +34,7 @@ export default class MainAbility extends Ability {
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
"
MainAbility2 onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
globalThis
.
abilityContext
2
=
this
.
context
commonEvent
.
publish
(
"
ACTS_InterfaceMultiUsers_0100_Start_CommonEvent
"
,
PublishCallBackOne
);
}
...
...
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/MainAbility3/MainAbility3.ts
浏览文件 @
5e62a8e0
...
...
@@ -26,9 +26,9 @@ export default class MainAbility extends Ability {
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
"
MainAbility3 onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
globalThis
.
abilityContext
3
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/second
"
,
null
)
globalThis
.
abilityContext
.
terminateSelfWithResult
(
globalThis
.
abilityContext
3
.
terminateSelfWithResult
(
{
resultCode
:
1
,
want
:{
...
...
@@ -46,7 +46,7 @@ export default class MainAbility extends Ability {
onForeground
()
{
console
.
log
(
"
MainAbility3 onForeground
"
)
globalThis
.
abilityContext
.
terminateSelfWithResult
({
globalThis
.
abilityContext
3
.
terminateSelfWithResult
({
resultCode
:
1
})
}
...
...
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/TestAbility.ts
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
}
onDestroy
()
{
console
.
log
(
'
TestAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
TestAbility onWindowStageCreate
'
)
windowStage
.
loadContent
(
"
TestAbility/pages/index
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
))
});
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
console
.
log
(
'
TestAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
TestAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
TestAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s it
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
=
`
${
targetParams
}
${
key
}
${
parameters
[
key
]}
`
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
}
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a com.acts.actsinterfacemultiusersthirdtest.MainAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
5e62a8e0
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
deccjsunit/index
"
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
@ohos/hypium
"
import commonEvent from '@ohos.commonEvent'
import osaccount from '@ohos.account.osAccount'
...
...
@@ -22,7 +22,7 @@ var subscriberInfo_MainAbility = {
var osAccountManager
const START_ABILITY_TIMEOUT = 6000;
console.debug("====>in Ability.test====>");
export default function abilityTest(
abilityContext
) {
export default function abilityTest() {
console.debug("====>in function abilityTest====>");
describe('ActsInterfaceMultiUsersThirdTest', function () {
...
...
@@ -50,7 +50,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
await
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2'
...
...
@@ -101,7 +101,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
await
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
...
...
@@ -151,13 +151,14 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
abilityContext.startAbility(
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2'
}, {
windowMode:0
},() => {
},(err,data) => {
console.debug("====>startAbility err:====>" + JSON.stringify(err));
console.debug("====>startAbility end====>" );
})
})
...
...
@@ -203,7 +204,7 @@ export default function abilityTest(abilityContext) {
commonEvent.subscribe(Subscriber, SubscribeCallBack);
})
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
await
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
...
...
@@ -252,7 +253,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
await
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2'
...
...
@@ -301,7 +302,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
await
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
...
...
@@ -349,11 +350,12 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
abilityContext.startAbility(
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2'
},() => {
},(err,data) => {
console.debug("====>startAbility err:====>" + JSON.stringify(err));
console.debug("====>startAbility end====>" );
})
})
...
...
@@ -399,7 +401,7 @@ export default function abilityTest(abilityContext) {
commonEvent.subscribe(Subscriber, SubscribeCallBack);
})
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
await
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
...
...
@@ -438,7 +440,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3',
...
...
@@ -466,7 +468,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
...
...
@@ -497,7 +499,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3',
...
...
@@ -524,7 +526,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
...
...
@@ -555,7 +557,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3',
...
...
@@ -581,7 +583,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
...
...
@@ -610,7 +612,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3',
...
...
@@ -635,7 +637,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
...
...
@@ -673,7 +675,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
await
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2'
...
...
@@ -722,7 +724,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
await
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
...
...
@@ -772,7 +774,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
abilityContext.startAbility(
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility2'
...
...
@@ -821,7 +823,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
await
globalThis.
abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
...
...
@@ -862,7 +864,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3',
...
...
@@ -889,7 +891,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
...
...
@@ -919,7 +921,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.actsinterfacemultiusersthirdtest',
abilityName: 'com.acts.actsinterfacemultiusersthirdtest.MainAbility3',
...
...
@@ -945,7 +947,7 @@ export default function abilityTest(abilityContext) {
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
await
globalThis.
abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
...
...
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/ets/test/List.test.ets
浏览文件 @
5e62a8e0
...
...
@@ -14,7 +14,7 @@
*/
import abilityTest from './Ability.test.ets'
export default function testsuite(
context
) {
export default function testsuite() {
console.debug("====>in list.test====>");
abilityTest(
context
)
abilityTest()
}
\ No newline at end of file
ability/ability_runtime/actsusers/ActsAmsUsersThirdTest/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
5e62a8e0
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
"
MainAbility/
pages/index/index"
,
"
MainAbility/
pages/second/second"
]
}
\ No newline at end of file
ability/ability_runtime/actsusers/BUILD.gn
浏览文件 @
5e62a8e0
...
...
@@ -13,7 +13,7 @@
import("//build/ohos_var.gni")
group("actsusers") {
group("actsusers
900
") {
testonly = true
if (is_standard_system) {
deps = [
...
...
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/BUILD.gn
浏览文件 @
5e62a8e0
...
...
@@ -22,6 +22,8 @@ ohos_js_hap_suite("ActsConnectAbilitySystemAbilityTest") {
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsConnectAbilitySystemAbilityTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsconnectabilitysystemabilitytest_app_profile") {
...
...
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/Test.json
浏览文件 @
5e62a8e0
...
...
@@ -2,10 +2,12 @@
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"120000"
,
"package"
:
"com.example.actsconnectabilitysystemabilitytest"
,
"shell-timeout"
:
"60000"
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"300000"
,
"bundle-name"
:
"com.example.actsconnectabilitysystemabilitytest"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"300000"
,
"testcase-timeout"
:
"30000"
},
"kits"
:
[
{
...
...
@@ -15,6 +17,7 @@
"acm switch -i 101"
],
"teardown-command"
:[
"acm switch -i 101"
,
"acm delete -i 101"
]
},
...
...
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
onCreate
(
want
,
launchParam
){
// Ability is creating, initialize resources for this ability
console
.
log
(
"
AbilityMultiInstanceTest
onCreate
"
)
console
.
log
(
"
MainAbility
onCreate
"
)
globalThis
.
abilityWant
=
want
;
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
AbilityMultiInstanceTest
onDestroy
"
)
console
.
log
(
"
MainAbility
onDestroy
"
)
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
AbilityMultiInstanceTest
onWindowStageCreate
"
)
console
.
log
(
"
MainAbility
onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
)
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/
pages/index/index
"
,
null
)
}
onWindowStageDestroy
()
{
//
Main window is destroyed, release UI related resources
console
.
log
(
"
AbilityMultiInstanceTest
onWindowStageDestroy
"
)
//Main window is destroyed, release UI related resources
console
.
log
(
"
MainAbility
onWindowStageDestroy
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
AbilityMultiInstanceTest
onForeground
"
)
console
.
log
(
"
MainAbility
onForeground
"
)
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
AbilityMultiInstanceTest
onBackground
"
)
console
.
log
(
"
MainAbility
onBackground
"
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/index/index.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
import router from '@ohos.router'
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("start run testcase!!!!")
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('MainAbility')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/MainAbility/pages/second/second.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
}
onDestroy
()
{
console
.
log
(
'
TestAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
TestAbility onWindowStageCreate
'
)
windowStage
.
loadContent
(
"
TestAbility/pages/index
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
))
});
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
console
.
log
(
'
TestAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
TestAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
TestAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s it
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
=
`
${
targetParams
}
${
key
}
${
parameters
[
key
]}
`
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
}
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a com.example.actsconnectabilitysystemabilitytest.MainAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/List.test.ets
浏览文件 @
5e62a8e0
...
...
@@ -13,6 +13,6 @@
* limitations under the License.
*/
import abilityTest from './manyusersabilitytest.test.ets'
export default function testsuite(
context
) {
abilityTest(
context
)
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets
浏览文件 @
5e62a8e0
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "
deccjsunit/index
"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "
@ohos/hypium
"
import commonEvent from '@ohos.commonEvent'
...
...
@@ -66,7 +66,7 @@ var unsubscriberInfoStartAbility_0200 = {
const START_ABILITY_TIMEOUT = 1000;
globalThis.number = 0;
export default function abilityTest(
abilityContext
) {
export default function abilityTest() {
describe('ActssystemabilityTest', function () {
/*
...
...
@@ -87,7 +87,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent");
console.debug("====>ACTS_ConnectAbility_0100 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -114,7 +114,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('AMS_ConnectAbility_0100 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -139,7 +139,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ConnectAbility_0100 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -189,7 +189,7 @@ export default function abilityTest(abilityContext) {
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbilityone",
...
...
@@ -217,7 +217,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_DisconnectAbility_0100 5 CallBack data:====>" + JSON.stringify(data));
clearTimeout(id);
console.debug("====>ACTS_DisconnectAbility_0100 6====>");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -241,7 +241,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('AMS_DonnectAbility_0300 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -249,7 +249,7 @@ export default function abilityTest(abilityContext) {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_DisconnectAbility_0100 3====>");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -283,7 +283,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_DisconnectAbility_0200 1111 connectAbility2====>");
console.debug("====>ACTS_DisconnectAbility_0200 66 Subscriber====>");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
999,
(error, data) => {
console.log('ACTS_DisconnectAbility_0200 5 DisconnectAbility result errCode : '
...
...
@@ -309,7 +309,7 @@ export default function abilityTest(abilityContext) {
console.debug('unsubscribe subscriberdisconnect');
commonEvent.unsubscribe(subscriber, () => {
console.debug('unsubscribe subscriber')
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('ACTS_DisconnectAbility_0200 9 DisconnectAbility result errCode : '
...
...
@@ -326,7 +326,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_DisconnectAbility_0200 10 Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack)
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -358,7 +358,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_DisconnectAbility_0300 4 CallBack data:====>" + JSON.stringify(data));
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0500_commonEvent");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('ACTS_DisconnectAbility_0300 5 DisconnectAbility result errCode : '
...
...
@@ -382,7 +382,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('AMS_ConnectAbility_0500 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('ACTS_DisconnectAbility_0300 7 DisconnectAbility result errCode : '
...
...
@@ -391,7 +391,7 @@ export default function abilityTest(abilityContext) {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_DisconnectAbility_0300 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -425,7 +425,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_DisconnectAbility_0400 1111 connectAbility2====>");
console.debug("====>ACTS_DisconnectAbility_0400 66 Subscriber====>");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
999,
(error, data) => {
console.log('ACTS_DisconnectAbility_0400 5 DisconnectAbility result errCode : '
...
...
@@ -451,7 +451,7 @@ export default function abilityTest(abilityContext) {
console.debug('unsubscribe subscriberdisconnect');
commonEvent.unsubscribe(subscriber, () => {
console.debug('unsubscribe subscriber')
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('ACTS_DisconnectAbility_0400 9 DisconnectAbility result errCode : '
...
...
@@ -468,7 +468,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_DisconnectAbility_0400 10 Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack)
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -501,7 +501,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0700_commonEvent");
console.debug("====>ACTS_ExtensionConnectAbility_0100 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -525,7 +525,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('ACTS_ExtensionConnectAbility_0100 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -533,7 +533,7 @@ export default function abilityTest(abilityContext) {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ExtensionConnectAbility_0100 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -560,7 +560,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0800_commonEvent");
console.debug("====>ACTS_ExtensionConnectAbility_0200 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -583,7 +583,7 @@ export default function abilityTest(abilityContext) {
function timeout() {
console.debug('ACTS_ExtensionConnectAbility_0200 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -591,7 +591,7 @@ export default function abilityTest(abilityContext) {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ExtensionConnectAbility_0200 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -618,7 +618,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0900_commonEvent");
console.debug("====>ACTS_ExtensionDisconnectAbility_0100 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -642,7 +642,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('ACTS_ExtensionDisconnectAbility_0100 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -650,7 +650,7 @@ export default function abilityTest(abilityContext) {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ExtensionDisconnectAbility_0100 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -677,7 +677,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_1000_commonEvent");
console.debug("====>ACTS_ExtensionDisconnectAbility_0200 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -701,7 +701,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('ACTS_ExtensionDisconnectAbility_0200 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -709,7 +709,7 @@ export default function abilityTest(abilityContext) {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ExtensionDisconnectAbility_0200 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -736,7 +736,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_1100_commonEvent");
console.debug("====>ACTS_ExtensionDisconnectAbility_0300 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -759,7 +759,7 @@ export default function abilityTest(abilityContext) {
function timeout() {
console.debug('ACTS_ExtensionDisconnectAbility_0300 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -767,7 +767,7 @@ export default function abilityTest(abilityContext) {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ExtensionDisconnectAbility_0300 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
@@ -795,7 +795,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_1200_commonEvent");
console.debug("====>ACTS_ExtensionDisconnectAbility_0400 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -818,7 +818,7 @@ export default function abilityTest(abilityContext) {
function timeout() {
console.debug('ACTS_ExtensionDisconnectAbility_0400 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -826,7 +826,7 @@ export default function abilityTest(abilityContext) {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ExtensionDisconnectAbility_0400 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsconnectabilitysystemabilitytest",
abilityName: "com.example.actsconnectabilitysystemabilitytest.ServiceAbility",
...
...
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
5e62a8e0
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
"
MainAbility/
pages/index/index"
,
"
MainAbility/
pages/second/second"
]
}
\ No newline at end of file
ability/ability_runtime/actsusers/actsconnectabilitysystemabilitytest/signature/openharmony_sx.p7b
浏览文件 @
5e62a8e0
无法预览此类型文件
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/BUILD.gn
浏览文件 @
5e62a8e0
...
...
@@ -21,8 +21,10 @@ ohos_js_hap_suite("ActsManyUsersAbilityTest") {
":actsmanyusersabilitytest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx
_thirdparty
.p7b"
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsManyUsersAbilityTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsmanyusersabilitytest_app_profile") {
...
...
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/Test.json
浏览文件 @
5e62a8e0
...
...
@@ -2,10 +2,12 @@
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"120000"
,
"package"
:
"com.example.actsmanyusersabilitytest"
,
"shell-timeout"
:
"60000"
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"300000"
,
"bundle-name"
:
"com.example.actsmanyusersabilitytest"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"300000"
,
"testcase-timeout"
:
"30000"
},
"kits"
:
[
{
...
...
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
5e62a8e0
...
...
@@ -20,7 +20,6 @@ export default class MainAbility extends Ability {
// Ability is creating, initialize resources for this ability
console
.
log
(
"
MainAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
globalThis
.
abilityContext
=
this
.
context
}
onDestroy
()
{
...
...
@@ -31,8 +30,8 @@ export default class MainAbility extends Ability {
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility onWindowStageCreate
"
)
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
)
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/
pages/index/index
"
,
null
)
}
onWindowStageDestroy
()
{
...
...
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/pages/index/index.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
import router from '@ohos.router'
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("start run testcase!!!!")
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('MainAbility')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/MainAbility/pages/second/second.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/TestAbility.ts
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
}
onDestroy
()
{
console
.
log
(
'
TestAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
TestAbility onWindowStageCreate
'
)
windowStage
.
loadContent
(
"
TestAbility/pages/index
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
))
});
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
console
.
log
(
'
TestAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
TestAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
TestAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
5e62a8e0
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s it
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
=
`
${
targetParams
}
${
key
}
${
parameters
[
key
]}
`
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
}
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a com.example.actsmanyusersabilitytest.MainAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/List.test.ets
浏览文件 @
5e62a8e0
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import abilityTest from './manyusersabilitytest.test.ets'
export default function testsuite(
context
) {
export default function testsuite() {
abilityTest(
context
)
abilityTest()
}
\ No newline at end of file
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/ets/test/manyusersabilitytest.test.ets
浏览文件 @
5e62a8e0
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "
deccjsunit/index
"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "
@ohos/hypium
"
import commonEvent from '@ohos.commonEvent'
...
...
@@ -87,7 +87,7 @@ function onFailedCallback(code) {
console.log('ACTS_ConnectAbility onFailedCallback====> code=' + JSON.stringify(code))
}
export default function abilityTest(
abilityContext
) {
export default function abilityTest() {
describe('manyuserability', function () {
function onFailedCallBack(code) {
...
...
@@ -111,7 +111,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0100_commonEvent");
console.debug("====>ACTS_ThirdPartyConnectAbility_0100 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -136,7 +136,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('ACTS_ThirdPartyConnectAbility_0100 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -145,7 +145,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ThirdPartyConnectAbility_0100 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -197,7 +197,7 @@ export default function abilityTest(abilityContext) {
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbilityone",
...
...
@@ -221,7 +221,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0100 5 CallBack data:====>" + JSON.stringify(data));
clearTimeout(id);
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0100 6====>");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -250,7 +250,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('AMS_DonnectAbility_0300 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -259,7 +259,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0100 3====>");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -292,7 +292,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0200 1111 connectAbility2====>");
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0200 66 Subscriber====>");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
999,
(error, data) => {
console.log('ACTS_ThirdPartyDisconnectAbility_0200 5 DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -320,7 +320,7 @@ export default function abilityTest(abilityContext) {
console.debug('unsubscribe subscriberdisconnect');
commonEvent.unsubscribe(subscriber, () => {
console.debug('unsubscribe subscriber')
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('ACTS_ThirdPartyDisconnectAbility_0200 9 DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -339,7 +339,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0200 10 Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack)
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -374,7 +374,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0300 4 CallBack data:====>" + JSON.stringify(data));
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0500_commonEvent");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('ACTS_ThirdPartyDisconnectAbility_0300 5 DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -402,7 +402,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('ACTS_ThirdPartyDisconnectAbility_0300 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('ACTS_ThirdPartyDisconnectAbility_0300 7 DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -411,7 +411,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0300 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -443,7 +443,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0400 1111 connectAbility2====>");
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0400 66 Subscriber====>");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
999,
(error, data) => {
console.log('ACTS_ThirdPartyDisconnectAbility_0400 5 DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -471,7 +471,7 @@ export default function abilityTest(abilityContext) {
console.debug('unsubscribe subscriberdisconnect');
commonEvent.unsubscribe(subscriber, () => {
console.debug('unsubscribe subscriber')
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('ACTS_ThirdPartyDisconnectAbility_0400 9 DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -490,7 +490,7 @@ export default function abilityTest(abilityContext) {
console.debug("====>ACTS_ThirdPartyDisconnectAbility_0400 10 Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack)
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -525,7 +525,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0700_commonEvent");
console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0100 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -554,7 +554,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('ACTS_ExtensionConnectAbility_0100 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -563,7 +563,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0100 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -591,7 +591,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0800_commonEvent");
console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0200 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -619,7 +619,7 @@ export default function abilityTest(abilityContext) {
function timeout() {
console.debug('ACTS_ThirdPartyExtensionConnectAbility_0200 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -628,7 +628,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ThirdPartyExtensionConnectAbility_0200 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -655,7 +655,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_0900_commonEvent");
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0100 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -684,7 +684,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('ACTS_ThirdPartyExtensionDisconnectAbility_0100 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -693,7 +693,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0100 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -721,7 +721,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_1000_commonEvent");
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0200 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -750,7 +750,7 @@ export default function abilityTest(abilityContext) {
expect().assertFail();
console.debug('ACTS_ThirdPartyExtensionDisconnectAbility_0200 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -759,7 +759,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0200 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -787,7 +787,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_1100_commonEvent");
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0200 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -815,7 +815,7 @@ export default function abilityTest(abilityContext) {
function timeout() {
console.debug('ACTS_ThirdPartyExtensionDisconnectAbility_0300 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -824,7 +824,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0300 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
@@ -852,7 +852,7 @@ export default function abilityTest(abilityContext) {
clearTimeout(id);
expect(data.event).assertEqual("AMS_ConnectAbility_1200_commonEvent");
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0400 5 ");
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -880,7 +880,7 @@ export default function abilityTest(abilityContext) {
function timeout() {
console.debug('ACTS_ThirdPartyExtensionDisconnectAbility_0400 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
abilityContext.disconnectAbility(
globalThis.
abilityContext.disconnectAbility(
connId,
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
...
...
@@ -889,7 +889,7 @@ export default function abilityTest(abilityContext) {
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>ACTS_ThirdPartyExtensionDisconnectAbility_0400 3 ");
connId = await abilityContext.connectAbility(
connId = await
globalThis.
abilityContext.connectAbility(
{
bundleName: "com.example.actsmanyusersabilitytest",
abilityName: "com.example.actsmanyusersabilitytest.ServiceAbility",
...
...
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
5e62a8e0
{
"src"
:
[
"pages/index/index"
,
"pages/second/second"
"
MainAbility/
pages/index/index"
,
"
MainAbility/
pages/second/second"
]
}
\ No newline at end of file
ability/ability_runtime/actsusers/actsmanyuserthirdabilitytest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
5e62a8e0
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录