Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
61870610
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
61870610
编写于
4月 17, 2023
作者:
C
chengxingzhen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xts-ams支持release版本调试调优
Signed-off-by:
N
chengxingzhen
<
chengxingzhen@huawei.com
>
上级
c0fe43fc
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
1824 addition
and
0 deletion
+1824
-0
ability/ability_runtime/stage/BUILD.gn
ability/ability_runtime/stage/BUILD.gn
+1
-0
ability/ability_runtime/stage/actsdebuggabletest/BUILD.gn
ability/ability_runtime/stage/actsdebuggabletest/BUILD.gn
+24
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/AppScope/app.json
...e/actsdebuggabletest/actsdebuggabletest/AppScope/app.json
+19
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/AppScope/resources/base/element/string.json
...ebuggabletest/AppScope/resources/base/element/string.json
+8
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/AppScope/resources/base/media/app_icon.png
...debuggabletest/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/BUILD.gn
...time/stage/actsdebuggabletest/actsdebuggabletest/BUILD.gn
+43
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/Test.json
...ime/stage/actsdebuggabletest/actsdebuggabletest/Test.json
+33
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+86
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/entryability/EntryAbility.ts
...gabletest/entry/src/main/ets/entryability/EntryAbility.ts
+66
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/pages/Index.ets
...est/actsdebuggabletest/entry/src/main/ets/pages/Index.ets
+35
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/test/ActsDebuggableAaProcessTest.test.ets
...ry/src/main/ets/test/ActsDebuggableAaProcessTest.test.ets
+664
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/test/ActsDebuggableAaStartTest.test.ets
...ntry/src/main/ets/test/ActsDebuggableAaStartTest.test.ets
+300
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/test/List.test.ets
.../actsdebuggabletest/entry/src/main/ets/test/List.test.ets
+22
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/testability/TestAbility.ets
...ggabletest/entry/src/main/ets/testability/TestAbility.ets
+72
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/testability/pages/Index.ets
...ggabletest/entry/src/main/ets/testability/pages/Index.ets
+50
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/module.json
...uggabletest/actsdebuggabletest/entry/src/main/module.json
+47
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/base/element/color.json
...abletest/entry/src/main/resources/base/element/color.json
+8
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/base/element/string.json
...bletest/entry/src/main/resources/base/element/string.json
+24
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/base/media/icon.png
...buggabletest/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+5
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/en_US/element/string.json
...letest/entry/src/main/resources/en_US/element/string.json
+24
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/zh_CN/element/string.json
...letest/entry/src/main/resources/zh_CN/element/string.json
+24
-0
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/signature/openharmony_sx.p7b
...gabletest/actsdebuggabletest/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/AppScope/app.json
...untime/stage/actsdebuggabletest/timeout/AppScope/app.json
+19
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/AppScope/resources/base/element/string.json
...etest/timeout/AppScope/resources/base/element/string.json
+8
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/AppScope/resources/base/media/app_icon.png
...letest/timeout/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/BUILD.gn
...ability_runtime/stage/actsdebuggabletest/timeout/BUILD.gn
+46
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/ets/entryability/EntryAbility.ts
...t/timeout/entry/src/main/ets/entryability/EntryAbility.ts
+66
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/ets/pages/Index.ets
...debuggabletest/timeout/entry/src/main/ets/pages/Index.ets
+32
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/module.json
...age/actsdebuggabletest/timeout/entry/src/main/module.json
+37
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/base/element/color.json
.../timeout/entry/src/main/resources/base/element/color.json
+8
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/base/element/string.json
...timeout/entry/src/main/resources/base/element/string.json
+16
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/base/media/icon.png
...test/timeout/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/base/profile/main_pages.json
...out/entry/src/main/resources/base/profile/main_pages.json
+5
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/en_US/element/string.json
...imeout/entry/src/main/resources/en_US/element/string.json
+16
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/zh_CN/element/string.json
...imeout/entry/src/main/resources/zh_CN/element/string.json
+16
-0
ability/ability_runtime/stage/actsdebuggabletest/timeout/signature/openharmony_sx.p7b
...e/actsdebuggabletest/timeout/signature/openharmony_sx.p7b
+0
-0
未找到文件。
ability/ability_runtime/stage/BUILD.gn
浏览文件 @
61870610
...
...
@@ -17,6 +17,7 @@ group("stage") {
testonly = true
if (is_standard_system) {
deps = [
"actsdebuggabletest:actsdebuggabletest",
"actslifecyclemultihap2:ActsLifecycleMultiHap2",
"actslifecyclemultihap3:ActsLifecycleMultiHap3",
"actslifecyclemultihaptest:ActsLifecycleMultiHapTest",
...
...
ability/ability_runtime/stage/actsdebuggabletest/BUILD.gn
0 → 100644
浏览文件 @
61870610
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
group("actsdebuggabletest") {
testonly = true
if (is_standard_system) {
deps = [
"actsdebuggabletest:ActsDebuggableTest",
"timeout:ActsDebuggableTimeout",
]
}
}
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/AppScope/app.json
0 → 100644
浏览文件 @
61870610
{
"app"
:
{
"bundleName"
:
"com.example.debuggable"
,
"vendor"
:
"example"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"icon"
:
"$media:app_icon"
,
"label"
:
"$string:app_name"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
9
,
"targetAPIVersion"
:
9
,
"car"
:
{
"apiCompatibleVersion"
:
9
,
"singleUser"
:
false
}
}
}
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
61870610
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"Debuggable"
}
]
}
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
61870610
6.6 KB
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/BUILD.gn
0 → 100644
浏览文件 @
61870610
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsDebuggableTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsdebuggabletest_js_assets",
":actsdebuggabletest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsDebuggableTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsdebuggabletest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsdebuggabletest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsdebuggabletest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsdebuggabletest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/Test.json
0 → 100644
浏览文件 @
61870610
{
"description"
:
"Configuration for debuggable demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"180000"
,
"bundle-name"
:
"com.example.debuggable"
,
"module-name"
:
"entry"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
15000
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsDebuggableTest.hap"
,
"ActsDebuggableTimeout.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"power-shell wakeup"
,
"power-shell setmode 602"
,
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
,
"hilog -b D"
,
"hilog -Q pidoff"
,
"hilog -Q domainoff"
,
"hilog -G 2M"
]
}
]
}
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
hilog
from
'
@ohos.hilog
'
;
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.app.ability.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
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
onAbilityCreateCallback
'
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
addAbilityMonitorCallback : %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
OpenHarmonyTestRunner OnPrepare
'
);
}
async
onRun
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
OpenHarmonyTestRunner onRun run
'
);
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.TestAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a TestAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
'
-D
'
]
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
cmd : %{public}s
'
,
cmd
);
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
executeShellCommand : err : %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
executeShellCommand : data : %{public}s
'
,
d
.
stdResult
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
executeShellCommand : data : %{public}s
'
,
d
.
exitCode
??
''
);
})
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
OpenHarmonyTestRunner onRun end
'
);
}
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/entryability/EntryAbility.ts
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
;
import
Window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onCreate
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
want param:
'
+
JSON
.
stringify
(
want
)
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
launchParam:
'
+
JSON
.
stringify
(
launchParam
)
??
''
);
}
onDestroy
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onDestroy
'
);
}
onWindowStageCreate
(
windowStage
:
Window
.
WindowStage
)
{
// Main window is created, set main page for this ability
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageCreate
'
);
windowStage
.
loadContent
(
'
pages/Index
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
ERROR
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
Failed to load the content. Cause: %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
return
;
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
Succeeded in loading the content. Data: %{public}s
'
,
JSON
.
stringify
(
data
)
??
''
);
});
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageDestroy
'
);
}
onForeground
()
{
// Ability has brought to foreground
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onForeground
'
);
}
onBackground
()
{
// Ability has back to background
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onBackground
'
);
}
}
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/pages/Index.ets
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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'
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/test/ActsDebuggableAaProcessTest.test.ets
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
hilog
from
'@ohos.hilog'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'@ohos/hypium'
;
import
AbilityDelegatorRegistry
from
'@ohos.app.ability.abilityDelegatorRegistry'
;
import
backgroundTaskManager
from
'@ohos.resourceschedule.backgroundTaskManager'
;
let
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
async
function
requestSuspendDelay
()
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'requestSuspendDelay start '
);
let
myReason
=
'test ActsDebuggableAaProcessTest'
;
let
delayInfo
=
backgroundTaskManager
.
requestSuspendDelay
(
myReason
,
()
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'requestSuspendDelay delay will timeout. '
);
});
globalThis
.
delayId
=
delayInfo
.
requestId
;
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'requestSuspendDelay delayId is '
+
globalThis
.
delayId
);
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'requestSuspendDelay actualDelayTime is '
+
delayInfo
.
actualDelayTime
);
}
function
sleep
(
time
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
(
null
);
},
time
)
});
}
export
default
function
actsDebuggableAaProcessTest
()
{
describe
(
'ActsDebuggableAaProcessTest'
,
function
()
{
beforeAll
(
async
function
()
{
await
abilityDelegator
.
executeShellCommand
(
'aa start -b com.example.timeout -a EntryAbility'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'beforeAll aa start data is: '
+
data
.
stdResult
);
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'beforeAll err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
2000
);
await
requestSuspendDelay
();
})
beforeEach
(
async
function
()
{
await
abilityDelegator
.
executeShellCommand
(
'hilog -r'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'beforeEach ActsDebuggableAaProcessTest hilog -r data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'beforeEach ActsDebuggableAaProcessTest hilog -r err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
2000
);
})
afterEach
(
function
()
{
})
afterAll
(
async
function
()
{
await
abilityDelegator
.
executeShellCommand
(
'aa force-stop com.example.timeout'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'afterAll force-stop data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'afterAll force-stop err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
1000
);
})
/*
* @tc.number SUB_AA_AMS_Debuggable_0800
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -p 'sleep 100' -S
* @tc.desc Function test
* @tc.level 1
*/
it
(
'SUB_AA_AMS_Debuggable_0800'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -p \'sleep 100\' -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0800 data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0800 err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
500
);
let
res
=
undefined
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0800 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0800 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe perfCmd:sleep 100'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe sandbox: true'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_0900
* @tc.name aa process -b com.example.timeout -a EntryAbility -p 'sleep 100' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_0900'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -p \'sleep 100\' -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0900 data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0900 err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
500
);
let
res
=
undefined
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0900 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0900 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe perfCmd:sleep 100'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe sandbox: true'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1000
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -p 'sleep 100'
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1000'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -p \'sleep 100\''
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1000 data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1000 err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
500
);
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1000 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1000 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe perfCmd:sleep 100'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
expect
(
res
.
indexOf
(
'debuggablePipe sandbox: true'
)
>
0
)
.
assertFalse
();
done
()
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1100
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1100'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -S'
)
.
then
(
data
=>
{
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1100 err is: '
+
JSON
.
stringify
(
err
));
})
expect
(
res
)
.
assertContain
(
'usage: aa process <options>'
);
await
sleep
(
500
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1100 SUB_AA_AMS_Debuggable_1100 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1100 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe aa process must contains -p or -D and param length must be less than 1024.'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1200
* @tc.name aa process -b com.ohos.test -a EntryAbility -m entry -p 'sleep 100' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1200'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.ohos.test -a EntryAbility -m entry -p \'sleep 100\' -S'
)
.
then
(
data
=>
{
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1200 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'error: failed to start native process.'
);
await
sleep
(
500
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1200 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1200 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.ohos.test'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe fail to start native process'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1300
* @tc.name aa process -b com.example.timeout -a test -m entry -p 'sleep 100' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1300'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a test -m entry -p \'sleep 100\' -S'
)
.
then
(
data
=>
{
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1300 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'error: failed to start native process.'
);
await
sleep
(
500
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1300 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1300 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:test'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe fail to start native process'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1400
* @tc.name aa process -b com.example.timeout -a EntryAbility -m test -p 'sleep 100' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1400'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m test -p \'sleep 100\' -S'
)
.
then
(
data
=>
{
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1400 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'error: failed to start native process.'
);
await
sleep
(
500
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1400 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1400 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:test'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe fail to start native process'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1500
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -p 'value length large than 1024' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1500'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
let
cmd
=
'aa process -b com.example.timeout -a EntryAbility -m entry -p '
+
'\'qwertyuiopasdfghjklzxcvbnm123456qwert'
+
'yuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghj'
+
'klzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123'
+
'456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuio'
+
'pasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzx'
+
'cvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456q'
+
'wertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasd'
+
'fghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbn'
+
'm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwert'
+
'yuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghj'
+
'klzxcvbnm123456\' -S'
;
await
abilityDelegator
.
executeShellCommand
(
cmd
)
.
then
(
data
=>
{
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1500 aa process err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'usage: aa process <options>'
);
await
sleep
(
500
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1500 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1500 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe aa process must contains -p or -D and param length must be less than 1024.'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1600
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -p sleep 100 -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1600'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -p sleep 100 -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1600 aa process data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1600 aa process err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
500
);
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1600 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1600 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe perfCmd:sleep'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe sandbox: true'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1700
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -S -p
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1700'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -S -p'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1700 aa process data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1700 aa process err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'error: option requires a value.'
);
expect
(
res
)
.
assertContain
(
'usage: aa process <options>'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1800
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -D 'sleep 100'
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1800'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -D \'sleep 100\''
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1800 data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1800 err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
500
);
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1800 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1800 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe debugCmd:sleep 100'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
expect
(
res
.
indexOf
(
'debuggablePipe sandbox: true'
)
>
0
)
.
assertFalse
();
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_1900
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -D 'sleep 100' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_1900'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -D \'sleep 100\' -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1900 data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1900 err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
500
);
let
res
=
undefined
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1900 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_1900 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe debugCmd:sleep 100'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe sandbox: true'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_2000
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -D sleep 100 -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_2000'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -D sleep 100 -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2000 aa process data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2000 aa process err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
500
);
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2000 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2000 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe debugCmd:sleep'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe sandbox: true'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
expect
(
res
.
indexOf
(
'debuggablePipe debugCmd:sleep 100'
)
>
0
)
.
assertFalse
();
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_2100
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -p 'sleep 100' -D 'sleep 100' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_2100'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -p \'sleep 100\' -D \'sleep 100\' -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2100 data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2100 err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
500
);
let
res
=
undefined
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2100 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2100 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe perfCmd:sleep 100'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe sandbox: true'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_2200
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -D 'sleep 100' -p 'sleep 100' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_2200'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -D \'sleep 100\' -p \'sleep 100\' -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2200 data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2200 err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
500
);
let
res
=
undefined
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2200 data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2200 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe perfCmd:sleep 100'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe sandbox: true'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe abilityName:EntryAbility'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe moduleName:entry'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe bundleName:com.example.timeout'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_2300
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -D 'value length large than 1024' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_2300'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
let
cmd
=
'aa process -b com.example.timeout -a EntryAbility -m entry -D '
+
'\'qwertyuiopasdfghjklzxcvbnm123456qwert'
+
'yuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghj'
+
'klzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123'
+
'456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuio'
+
'pasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzx'
+
'cvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456q'
+
'wertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasd'
+
'fghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbn'
+
'm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwert'
+
'yuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghj'
+
'klzxcvbnm123456\' -S'
;
await
abilityDelegator
.
executeShellCommand
(
cmd
)
.
then
(
data
=>
{
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2300 aa process err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'usage: aa process <options>'
);
await
sleep
(
500
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2300 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2300 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe aa process must contains -p or -D and param length must be less than 1024.'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_2400
* @tc.name aa process -b com.example.timeout -a EntryAbility -m entry -S -D
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_2400'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa process -b com.example.timeout -a EntryAbility -m entry -S -D'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2400 aa process data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2400 aa process err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'error: option requires a value.'
);
expect
(
res
)
.
assertContain
(
'usage: aa process <options>'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_2500
* @tc.name aa process -h
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_2500'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa process -h'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2500 aa process data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2500 aa process err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'usage: aa process <options>'
);
expect
(
res
)
.
assertContain
(
'-h, --help'
);
expect
(
res
)
.
assertContain
(
'list available commands'
);
expect
(
res
)
.
assertContain
(
'-a <ability-name> -b <bundle-name> [-m <module-name>]'
);
expect
(
res
)
.
assertContain
(
'-p <perf-cmd>'
);
expect
(
res
)
.
assertContain
(
'performance optimization command. Either -p or -D must be selected, -p takes precedence.'
);
expect
(
res
)
.
assertContain
(
'debug command. Either -p or -D must be selected, -p takes precedence.'
);
expect
(
res
)
.
assertContain
(
'-D <debug-cmd>'
);
expect
(
res
)
.
assertContain
(
'[-S]'
);
expect
(
res
)
.
assertContain
(
'debug ability with an element name'
);
done
();
})
})
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/test/ActsDebuggableAaStartTest.test.ets
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
hilog
from
'@ohos.hilog'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'@ohos/hypium'
;
import
AbilityDelegatorRegistry
from
'@ohos.app.ability.abilityDelegatorRegistry'
;
import
backgroundTaskManager
from
'@ohos.resourceschedule.backgroundTaskManager'
;
let
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
async
function
cancelSuspendDelay
()
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'cancelSuspendDelay delayId '
+
globalThis
.
delayId
);
backgroundTaskManager
.
cancelSuspendDelay
(
globalThis
.
delayId
);
}
function
sleep
(
time
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
(
null
);
},
time
)
});
}
export
default
function
actsDebuggableAaStartTest
()
{
describe
(
'ActsDebuggableAaStartTest'
,
function
()
{
beforeAll
(
async
function
()
{
})
beforeEach
(
async
function
()
{
await
abilityDelegator
.
executeShellCommand
(
'aa force-stop com.example.timeout'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'beforeEach ActsDebuggableAaStartTest force-stop data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'beforeEach ActsDebuggableAaStartTest force-stop err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
1000
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -r'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'beforeEach ActsDebuggableAaStartTest hilog -r data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'beforeEach ActsDebuggableAaStartTest hilog -r err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
2000
);
})
afterEach
(
function
()
{
})
afterAll
(
async
function
()
{
await
cancelSuspendDelay
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_0100
* @tc.name aa start -b com.example.timeout -a EntryAbility -p 'sleep 100' -S
* @tc.desc Function test
* @tc.level 1
*/
it
(
'SUB_AA_AMS_Debuggable_0100'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa start -b com.example.timeout -a EntryAbility -p \'sleep 100\' -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0100 data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0100 err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
800
);
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0100 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0100 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe perfCmd:sleep 100'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe sandbox: true'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_0200
* @tc.name aa start -b com.example.timeout -a EntryAbility -p 'sleep 100'
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_0200'
,
1
,
async
function
(
done
)
{
await
abilityDelegator
.
executeShellCommand
(
'aa start -b com.example.timeout -a EntryAbility -p \'sleep 100\''
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0200 data is: '
+
JSON
.
stringify
(
data
));
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0200 err is: '
+
JSON
.
stringify
(
err
));
});
await
sleep
(
800
);
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0200 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0200 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe perfCmd:sleep 100'
);
expect
(
res
.
indexOf
(
'debuggablePipe sandbox: true'
)
>
0
)
.
assertFalse
();
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_0300
* @tc.name aa start -b com.example.timeout -a EntryAbility
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_0300'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa start -b com.example.timeout -a EntryAbility'
)
.
then
(
data
=>
{
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0300 err is: '
+
JSON
.
stringify
(
err
));
})
expect
(
res
)
.
assertContain
(
'start ability successfully.'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_0400
* @tc.name aa start -b com.example.timeout -a EntryAbility -S -p
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_0400'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa start -b com.example.timeout -a EntryAbility -S -p'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0400 data is: '
+
JSON
.
stringify
(
data
));
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0400 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'error: option requires a value.'
);
expect
(
res
)
.
assertContain
(
'usage: aa start <options>'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_0500
* @tc.name aa start -b com.example.timeout -a EntryAbility -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_0500'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa start -b com.example.timeout -a EntryAbility -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0500 data is: '
+
JSON
.
stringify
(
data
));
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0500 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'start ability successfully.'
);
await
sleep
(
800
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0500 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0500 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
.
indexOf
(
'debuggablePipe perfCmd'
)
>
0
)
.
assertFalse
();
expect
(
res
.
indexOf
(
'debuggablePipe sandbox'
)
>
0
)
.
assertFalse
();
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_0600
* @tc.name aa start -b com.example.timeout -a EntryAbility -p sleep 100 -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_0600'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa start -b com.example.timeout -a EntryAbility -p sleep 100 -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0600 data is: '
+
JSON
.
stringify
(
data
));
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0600 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'start ability successfully.'
);
await
sleep
(
800
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0600 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0600 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe perfCmd:sleep'
);
expect
(
res
)
.
assertContain
(
'debuggablePipe sandbox: true'
);
expect
(
res
.
indexOf
(
'debuggablePipe perfCmd:sleep 100'
)
>
0
)
.
assertFalse
();
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_0700
* @tc.name aa start -b com.example.timeout -a EntryAbility -p 'value length large than 1024' -S
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_0700'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa start -b com.example.timeout -a EntryAbility -p \'qwertyuiopas'
+
'dfghjklzxcvbnm123456qwert'
+
'yuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghj'
+
'klzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123'
+
'456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuio'
+
'pasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzx'
+
'cvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456q'
+
'wertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasd'
+
'fghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbn'
+
'm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwert'
+
'yuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghjklzxcvbnm123456qwertyuiopasdfghj'
+
'klzxcvbnm123456\' -S'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0700 data is: '
+
JSON
.
stringify
(
data
));
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0700 err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'usage: aa start <options>'
);
await
sleep
(
800
);
await
abilityDelegator
.
executeShellCommand
(
'hilog -x | grep debuggablePipe'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0700 hilog data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_0700 hilog err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'debuggablePipe aa start -p param length must be less than 1024.'
);
done
();
})
/*
* @tc.number SUB_AA_AMS_Debuggable_2600
* @tc.name aa start -h
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AMS_Debuggable_2600'
,
1
,
async
function
(
done
)
{
let
res
=
undefined
;
await
abilityDelegator
.
executeShellCommand
(
'aa start -h'
)
.
then
(
data
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2600 aa process data is: '
+
data
.
stdResult
);
res
=
data
.
stdResult
;
})
.
catch
(
err
=>
{
hilog
.
info
(
0x0000
,
'debuggabletest'
,
'%{public}s'
,
'SUB_AA_AMS_Debuggable_2600 aa process err is: '
+
JSON
.
stringify
(
err
));
});
expect
(
res
)
.
assertContain
(
'usage: aa start <options>'
);
expect
(
res
)
.
assertContain
(
'[-p <perf-cmd>]'
);
expect
(
res
)
.
assertContain
(
'[-S]'
);
done
();
})
})
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import aastartTest from './ActsDebuggableAaStartTest.test';
import aaprocessTest from './ActsDebuggableAaProcessTest.test';
export default function testsuite() {
aaprocessTest();
aastartTest();
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/testability/TestAbility.ets
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
import Window from '@ohos.window';
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('testability/pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/ets/testability/pages/Index.ets
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
@Entry
@Component
struct Index {
aboutToAppear() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
}
@State message: string = 'Hello Debuggable'
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/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/module.json
0 → 100644
浏览文件 @
61870610
{
"module"
:
{
"name"
:
"entry"
,
"type"
:
"entry"
,
"description"
:
"$string:module_desc"
,
"mainElement"
:
"EntryAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"pages"
:
"$profile:main_pages"
,
"abilities"
:
[
{
"name"
:
"EntryAbility"
,
"srcEntrance"
:
"./ets/entryability/EntryAbility.ts"
,
"description"
:
"$string:EntryAbility_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:EntryAbility_label"
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:start_window_background"
,
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
]
},
{
"name"
:
"TestAbility"
,
"srcEntrance"
:
"./ets/testability/TestAbility.ets"
,
"description"
:
"$string:TestAbility_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:TestAbility_label"
,
"visible"
:
true
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:start_window_background"
}
]
}
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
61870610
{
"color"
:
[
{
"name"
:
"start_window_background"
,
"value"
:
"#FFFFFF"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
61870610
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"the test ability"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"test label"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
61870610
6.6 KB
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
61870610
{
"src"
:
[
"pages/Index"
]
}
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/en_US/element/string.json
0 → 100644
浏览文件 @
61870610
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"the test ability"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"test label"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/entry/src/main/resources/zh_CN/element/string.json
0 → 100644
浏览文件 @
61870610
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"模块描述"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"the test ability"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"test label"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/actsdebuggabletest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
61870610
文件已添加
ability/ability_runtime/stage/actsdebuggabletest/timeout/AppScope/app.json
0 → 100644
浏览文件 @
61870610
{
"app"
:
{
"bundleName"
:
"com.example.timeout"
,
"vendor"
:
"example"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"icon"
:
"$media:app_icon"
,
"label"
:
"$string:app_name"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
9
,
"targetAPIVersion"
:
9
,
"car"
:
{
"apiCompatibleVersion"
:
9
,
"singleUser"
:
false
}
}
}
ability/ability_runtime/stage/actsdebuggabletest/timeout/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
61870610
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"Timeout"
}
]
}
ability/ability_runtime/stage/actsdebuggabletest/timeout/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
61870610
6.6 KB
ability/ability_runtime/stage/actsdebuggabletest/timeout/BUILD.gn
0 → 100644
浏览文件 @
61870610
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsDebuggableTimeout") {
hap_name = "ActsDebuggableTimeout"
js_build_mode = "debug"
testonly = true
hap_profile = "entry/src/main/module.json"
deps = [
":actsdebuggabletimeout_js_assets",
":actsdebuggabletimeout_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsdebuggabletimeout_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsdebuggabletimeout_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsdebuggabletimeout_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsdebuggabletimeout_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/ets/entryability/EntryAbility.ts
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.app.ability.UIAbility
'
;
import
Window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onCreate
'
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
want param:
'
+
JSON
.
stringify
(
want
)
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
launchParam:
'
+
JSON
.
stringify
(
launchParam
)
??
''
);
}
onDestroy
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onDestroy
'
);
}
onWindowStageCreate
(
windowStage
:
Window
.
WindowStage
)
{
// Main window is created, set main page for this ability
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageCreate
'
);
windowStage
.
loadContent
(
'
pages/Index
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
ERROR
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
Failed to load the content. Cause: %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
return
;
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
Succeeded in loading the content. Data: %{public}s
'
,
JSON
.
stringify
(
data
)
??
''
);
});
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageDestroy
'
);
}
onForeground
()
{
// Ability has brought to foreground
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onForeground
'
);
}
onBackground
()
{
// Ability has back to background
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onBackground
'
);
}
}
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/ets/pages/Index.ets
0 → 100644
浏览文件 @
61870610
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/module.json
0 → 100644
浏览文件 @
61870610
{
"module"
:
{
"name"
:
"entry"
,
"type"
:
"entry"
,
"description"
:
"$string:module_desc"
,
"mainElement"
:
"EntryAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"pages"
:
"$profile:main_pages"
,
"abilities"
:
[
{
"name"
:
"EntryAbility"
,
"srcEntrance"
:
"./ets/entryability/EntryAbility.ts"
,
"description"
:
"$string:EntryAbility_desc"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:EntryAbility_label"
,
"startWindowIcon"
:
"$media:icon"
,
"startWindowBackground"
:
"$color:start_window_background"
,
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
61870610
{
"color"
:
[
{
"name"
:
"start_window_background"
,
"value"
:
"#FFFFFF"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
61870610
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
61870610
6.6 KB
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
61870610
{
"src"
:
[
"pages/Index"
]
}
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/en_US/element/string.json
0 → 100644
浏览文件 @
61870610
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/timeout/entry/src/main/resources/zh_CN/element/string.json
0 → 100644
浏览文件 @
61870610
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"模块描述"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/stage/actsdebuggabletest/timeout/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
61870610
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录