Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ac82c21b
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看板
提交
ac82c21b
编写于
3月 11, 2023
作者:
C
chengxingzhen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xts-API覆盖
Signed-off-by:
N
chengxingzhen
<
chengxingzhen@huawei.com
>
上级
3f171887
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
921 addition
and
10 deletion
+921
-10
ability/ability_runtime/BUILD.gn
ability/ability_runtime/BUILD.gn
+1
-0
ability/ability_runtime/actsrequestdialogtest/BUILD.gn
ability/ability_runtime/actsrequestdialogtest/BUILD.gn
+23
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/AppScope/app.json
...actsrequestdialogtest/actsrequestdialog/AppScope/app.json
+21
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/AppScope/resources/base/element/string.json
...requestdialog/AppScope/resources/base/element/string.json
+8
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/AppScope/resources/base/media/app_icon.png
...srequestdialog/AppScope/resources/base/media/app_icon.png
+0
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/BUILD.gn
..._runtime/actsrequestdialogtest/actsrequestdialog/BUILD.gn
+44
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/Test.json
...runtime/actsrequestdialogtest/actsrequestdialog/Test.json
+39
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/Application/AbilityStage.ts
...uestdialog/entry/src/main/ets/Application/AbilityStage.ts
+22
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility/MainAbility.ts
...questdialog/entry/src/main/ets/MainAbility/MainAbility.ts
+64
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility/pages/index/index.ets
...alog/entry/src/main/ets/MainAbility/pages/index/index.ets
+58
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility/pages/second/second.ets
...og/entry/src/main/ets/MainAbility/pages/second/second.ets
+43
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility2/MainAbility2.ts
...estdialog/entry/src/main/ets/MainAbility2/MainAbility2.ts
+100
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/TestAbility/TestAbility.ts
...questdialog/entry/src/main/ets/TestAbility/TestAbility.ts
+50
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/TestAbility/pages/index.ets
...uestdialog/entry/src/main/ets/TestAbility/pages/index.ets
+48
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...og/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/test/Ability.test.ets
...ctsrequestdialog/entry/src/main/ets/test/Ability.test.ets
+95
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/test/List.test.ets
...t/actsrequestdialog/entry/src/main/ets/test/List.test.ets
+22
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/module.json
...stdialogtest/actsrequestdialog/entry/src/main/module.json
+48
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/resources/base/element/string.json
...tdialog/entry/src/main/resources/base/element/string.json
+32
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/resources/base/media/icon.png
...equestdialog/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/resources/base/profile/main_pages.json
...log/entry/src/main/resources/base/profile/main_pages.json
+6
-0
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/signature/openharmony_sx.p7b
...dialogtest/actsrequestdialog/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
...rhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
+116
-10
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/WantAgentCover.test.ets
...erhaptest/entry/src/main/ets/test/WantAgentCover.test.ets
+3
-0
未找到文件。
ability/ability_runtime/BUILD.gn
浏览文件 @
ac82c21b
...
...
@@ -30,6 +30,7 @@ group("ability_runtime") {
"actsdataabilityaccessdatasharetest:dataabilityaccessdatashare",
"actsfwkdataaccessortest:dataability",
"actsqueryfunctiontest:actsqueryfunctiontest",
"actsrequestdialogtest:actsrequestdialogtest",
"actsserviceabilityclienttest:serviceability",
"actsshellcommandfunctionalitytest:actsshellcommandfunctionalitytest",
"actsstartrunnertest:ActsStartRunnerTest",
...
...
ability/ability_runtime/actsrequestdialogtest/BUILD.gn
0 → 100644
浏览文件 @
ac82c21b
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES 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("actsrequestdialogtest") {
testonly = true
if (is_standard_system) {
deps = [
"actsrequestdialog:ActsRequestDialog",
]
}
}
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/AppScope/app.json
0 → 100644
浏览文件 @
ac82c21b
{
"app"
:{
"bundleName"
:
"com.acts.example.requestdialog"
,
"vendor"
:
"huawei"
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"debug"
:
false
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:app_name"
,
"description"
:
"$string:description_application"
,
"distributedNotificationEnabled"
:
true
,
"keepAlive"
:
true
,
"singleUser"
:
true
,
"minAPIVersion"
:
9
,
"targetAPIVersion"
:
9
,
"car"
:{
"apiCompatibleVersion"
:
9
,
"singleUser"
:
false
}
}
}
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
ac82c21b
{
"string"
:[
{
"name"
:
"app_name"
,
"value"
:
"ohosProject"
}
]
}
\ No newline at end of file
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
ac82c21b
15.1 KB
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/BUILD.gn
0 → 100644
浏览文件 @
ac82c21b
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES 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("ActsRequestDialog") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsrequestdialog_js_assets",
":actsrequestrecent_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsRequestDialog"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsrequestdialog_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsrequestdialog_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsrequestrecent_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsrequestdialog_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/Test.json
0 → 100644
浏览文件 @
ac82c21b
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"180000"
,
"bundle-name"
:
"com.acts.example.requestdialog"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
70000
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsRequestDialog.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"remount"
,
"mkdir /data/test"
]
},
{
"type"
:
"PushKit"
,
"push"
:
[
"ActsRequestDialog.hap->/data/test/ActsRequestDialog.hap"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"chmod 644 /data/test/*.hap"
]
}
]
}
\ No newline at end of file
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/Application/AbilityStage.ts
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
AbilityStage
from
"
@ohos.app.ability.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
MyAbilityStage onCreate
"
);
globalThis
.
stageContext
=
this
.
context
;
}
}
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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.app.ability.UIAbility
'
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
){
// Ability is creating, initialize resources for this ability
console
.
log
(
"
MainAbility onCreate
"
);
globalThis
.
abilityWant
=
want
;
globalThis
.
abilityContext
=
this
.
context
;
globalThis
.
applicationContext
=
this
.
context
.
getApplicationContext
();
globalThis
.
requestDialogSuccess
=
false
;
globalThis
.
validRequestInfo
=
false
;
globalThis
.
validRequestCallback
=
false
;
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
MainAbility onDestroy
"
);
globalThis
.
applicationContext
.
killAllProcesses
().
then
((
data
)
=>
{
console
.
log
(
`MainAbility getRunningProcessInformation data
${
JSON
.
stringify
(
data
)}
`
);
}).
catch
((
err
)
=>
{
console
.
log
(
`MainAbility getRunningProcessInformation err
${
JSON
.
stringify
(
err
)}
`
);
})
globalThis
.
applicationContext
.
killAllProcesses
((
err
,
data
)
=>
{
console
.
log
(
`MainAbility getRunningProcessInformation data
${
JSON
.
stringify
(
data
)}
err:
${
JSON
.
stringify
(
err
)}
`
);
})
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
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
"
);
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
MainAbility onForeground
"
);
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
MainAbility onBackground
"
);
}
};
\ No newline at end of file
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility/pages/index/index.ets
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
var testTime = 0;
@Entry
@Component
struct Index {
aboutToAppear(){
console.info("start run testcase!!!!")
if(testTime++==0){
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
}
build() {
Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility/pages/second/second.ets
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/MainAbility2/MainAbility2.ts
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.app.ability.UIAbility
'
import
commonEvent
from
'
@ohos.commonEvent
'
import
dialogRequest
from
'
@ohos.app.ability.dialogRequest
'
async
function
publishEvent
()
{
var
event
=
'
ACTS_REQUEST_DIALOG_EVENT1
'
;
var
commonEventPublishData
=
{
parameters
:
{
instanceCount
:
1
,
}
};
commonEvent
.
publish
(
event
,
commonEventPublishData
,
()
=>
{
console
.
log
(
'
============>publish event success.==========>>
'
)
});
}
export
default
class
MainAbility2
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
// Ability is creating, initialize resources for this ability
console
.
log
(
"
MainAbility2 onCreate
"
);
globalThis
.
abilityWant2
=
want
;
globalThis
.
requestDialogSuccess
=
true
;
try
{
let
requestInfo
=
dialogRequest
.
getRequestInfo
(
want
);
if
(
requestInfo
)
{
globalThis
.
validRequestInfo
=
true
;
console
.
log
(
"
MainAbility2 requestInfo is valid
"
);
}
else
{
console
.
log
(
"
MainAbility2 requestInfo is invalid
"
);
}
let
requestCallback
=
dialogRequest
.
getRequestCallback
(
want
);
if
(
requestCallback
)
{
console
.
log
(
"
MainAbility2 requestCallback is valid
"
);
globalThis
.
validRequestCallback
=
true
;
let
resultCode
=
{
result
:
dialogRequest
.
ResultCode
.
RESULT_CANCEL
,
};
let
resultCode2
=
{
result
:
dialogRequest
.
ResultCode
.
RESULT_OK
,
};
console
.
log
(
`resultCjode2 is
${
JSON
.
stringify
(
resultCode2
)}
`
);
requestCallback
.
setRequestResult
(
resultCode
);
}
else
{
console
.
log
(
"
MainAbility2 requestCallback is invalid
"
);
}
publishEvent
();
}
catch
{
console
.
log
(
"
MainAbility2 testRequest fail
"
);
}
console
.
log
(
"
AbilityMultiInstanceAppA abilityWant =
"
+
JSON
.
stringify
(
globalThis
.
abilityWant2
));
}
onDestroy
()
{
// Ability is destroying, release resources for this ability
console
.
log
(
"
MainAbility2 onDestroy
"
);
}
onWindowStageCreate
(
windowStage
)
{
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility2 onWindowStageCreate
"
)
globalThis
.
abilityContext2
=
this
.
context
;
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/pages/second/second
"
,
null
);
}
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
console
.
log
(
"
MainAbility onWindowStageDestroy
"
);
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
MainAbility onForeground
"
);
}
onBackground
()
{
// Ability has back to background
console
.
log
(
"
MainAbility onBackground
"
);
}
};
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/TestAbility/TestAbility.ts
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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.app.ability.UIAbility
'
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/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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.example.requestdialog.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/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/test/Ability.test.ets
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
"@ohos/hypium"
import
commonEvent
from
'@ohos.commonEvent'
var
subscriberInfo
=
{
events
:
[
"ACTS_REQUEST_DIALOG_EVENT1"
,
"ACTS_REQUEST_DIALOG_EVENT2"
]
};
const
CASE_TIMEOUT
=
3000
;
console
.
info
(
"====>in Ability.test====>"
);
export
default
function
abilityTest
()
{
describe
(
'ActsRequestDialogTest'
,
function
()
{
console
.
info
(
"====>in ActsRequestDialogTest====>"
);
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
));
}
/*
* @tc.number: ACTS_requestDialog_0100
* @tc.name: Start Recent Ability with no permission.
* @tc.desc: reguest dialog service
*/
it
(
'ACTS_requestDialog_0100'
,
0
,
async
function
(
done
)
{
console
.
log
(
'ACTS_requestDialog_0100====<begin'
);
var
subscriber
;
let
id
;
let
resultCode
;
async
function
subscribeCallBack
(
err
,
data
)
{
console
.
info
(
"====>ACTS_requestDialog_0100 Subscribe CallBack data:====>"
+
JSON
.
stringify
(
data
));
async
function
processInfoCheck
(
data
)
{
console
.
info
(
'====> ACTS_requestDialog_0100 processInfoCheck=====>'
);
expect
(
globalThis
.
requestDialogSuccess
)
.
assertTrue
();
expect
(
globalThis
.
validRequestInfo
)
.
assertTrue
();
expect
(
globalThis
.
validRequestCallback
)
.
assertTrue
();
commonEvent
.
unsubscribe
(
subscriber
,
unSubscribeCallback
);
done
();
}
if
(
data
.
event
==
"ACTS_REQUEST_DIALOG_EVENT1"
)
{
console
.
info
(
'====> ACTS_startRecent_0100 ACTS_StartAbility_CommonEvent1 success=====>'
);
await
sleep
(
500
);
processInfoCheck
(
data
);
}
}
commonEvent
.
createSubscriber
(
subscriberInfo
)
.
then
(
async
(
data
)
=>
{
console
.
info
(
"====>ACTS_requestDialog_0100 Create Subscriber====>"
);
subscriber
=
data
;
commonEvent
.
subscribe
(
subscriber
,
subscribeCallBack
);
try
{
await
globalThis
.
abilityContext
.
requestDialogService
(
{
bundleName
:
'com.acts.example.requestdialog'
,
abilityName
:
'com.acts.example.requestdialog.MainAbility2'
,
})
.
then
((
data
)
=>
{
console
.
info
(
"====>ACTS_requestDialog_0100 request end + data:"
+
JSON
.
stringify
(
data
));
resultCode
=
data
.
result
;
})
}
catch
(
paramError
)
{
console
.
info
(
"====>ACTS_requestDialog_0100 requestDialogSerivce paramError====>"
);
}
})
function
unSubscribeCallback
()
{
console
.
info
(
"====>UnSubscribe0100 CallBack====>"
);
}
function
timeout
()
{
console
.
log
(
'ACTS_requestDialog_0100 timeout.'
);
done
();
}
id
=
setTimeout
(
timeout
,
CASE_TIMEOUT
);
console
.
log
(
'Start ACTS_requestDialog_0100 timer id : '
+
id
);
})
})
}
\ No newline at end of file
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
ac82c21b
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import abilityTest from './Ability.test.ets'
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/module.json
0 → 100644
浏览文件 @
ac82c21b
{
"module"
:
{
"name"
:
"phone"
,
"type"
:
"entry"
,
"srcEntrance"
:
"./ets/Application/AbilityStage.ts"
,
"description"
:
"$string:phone_entry_dsc"
,
"mainElement"
:
"MainAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"uiSyntax"
:
"ets"
,
"pages"
:
"$profile:main_pages"
,
"abilities"
:
[
{
"name"
:
"com.acts.example.requestdialog.MainAbility"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:phone_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"orientation"
:
"portrait"
,
"skills"
:
[
{
"actions"
:
[
"action.system.home"
],
"entities"
:
[
"entity.system.home"
]
}
]
},
{
"name"
:
"com.acts.example.requestdialog.MainAbility2"
,
"srcEntrance"
:
"./ets/MainAbility2/MainAbility2.ts"
,
"description"
:
"$string:phone_entry_main"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:entry_label"
,
"visible"
:
true
,
"launchType"
:
"standard"
,
"orientation"
:
"portrait"
}
]
}
}
\ No newline at end of file
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
ac82c21b
{
"string"
:
[
{
"name"
:
"phone_entry_dsc"
,
"value"
:
"i am an entry for phone"
},
{
"name"
:
"phone_entry_main"
,
"value"
:
"the phone entry ability"
},
{
"name"
:
"entry_label"
,
"value"
:
"ActsContextTest"
},
{
"name"
:
"form_description"
,
"value"
:
"my form"
},
{
"name"
:
"serviceability_description"
,
"value"
:
"my whether"
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
},
{
"name"
:
"app_name"
,
"value"
:
"Demo"
}
]
}
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
ac82c21b
15.1 KB
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
ac82c21b
{
"src"
:
[
"MainAbility/pages/index/index"
,
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
ability/ability_runtime/actsrequestdialogtest/actsrequestdialog/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
ac82c21b
文件已添加
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
浏览文件 @
ac82c21b
...
...
@@ -12,16 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'@ohos/hypium'
import
{
describe
,
afterEach
,
it
,
expect
}
from
'@ohos/hypium'
import
formProvider
from
'@ohos.application.formProvider'
;
import
FormInfo
from
'@ohos.application.formInfo'
;
import
formInfoNew
from
'@ohos.app.form.formInfo'
;
import
formError
from
'@ohos.application.formError'
;
import
formHost
from
'@ohos.application.formHost'
;
import
errorManager
from
'@ohos.app.ability.errorManager'
;
import
abilityConstant
from
'@ohos.app.ability.AbilityConstant'
import
appManager
from
'@ohos.application.appManager'
import
appManagerNew
from
'@ohos.app.ability.appManager'
import
commonEvent
from
'@ohos.commonEvent'
;
import
ability
from
'@ohos.ability.ability'
;
...
...
@@ -29,12 +26,11 @@ import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry
import
common
from
'@ohos.app.ability.common'
;
import
contextConstant
from
"@ohos.app.ability.contextConstant"
var
EXTENSION_INFO_ERR
=
16000001
var
INNER_ERROR
=
16000050
var
CROSS_USER_DENY
=
201
var
INVALID_PARAM
=
401
var
trueInfo
;
var
array
=
new
Array
();
let
EXTENSION_INFO_ERR
=
16000001
;
let
INNER_ERROR
=
16000050
;
let
CROSS_USER_DENY
=
201
;
let
array
=
new
Array
();
let
TAG
=
''
;
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
));
}
...
...
@@ -661,5 +657,115 @@ export default function ApiCoverTest() {
done
()
})
})
/*
* @tc.number SUB_AA_AbilityAppManager_0100
* @tc.name The form of a promise getRunningProcessInformation
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AbilityAppManager_0100'
,
0
,
async
function
(
done
)
{
TAG
=
'SUB_AA_AbilityAppManager_0100'
;
await
appManagerNew
.
getRunningProcessInformation
()
.
then
((
data
)
=>
{
console
.
log
(
`${TAG} getRunningProcessInformation data ${JSON.stringify(data.length)}`
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
log
(
`${TAG} getRunningProcessInformation${i} : JSON.stringify(data[i])`
);
expect
(
typeof
(
data
[
i
]
.
pid
))
.
assertEqual
(
"number"
);
expect
(
data
[
i
]
.
pid
)
.
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
]
.
uid
))
.
assertEqual
(
"number"
);
expect
(
data
[
i
]
.
uid
)
.
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
]
.
processName
))
.
assertEqual
(
"string"
);
expect
(
data
[
i
]
.
processName
.
length
)
.
assertLarger
(
0
);
expect
(
Array
.
isArray
(
data
[
i
]
.
bundleNames
))
.
assertEqual
(
true
);
expect
(
data
[
i
]
.
bundleNames
.
length
)
.
assertLarger
(
0
);
}
done
();
})
.
catch
((
err
)
=>
{
console
.
log
(
`${TAG} getRunningProcessInformation err ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
})
})
/*
* @tc.number SUB_AA_AbilityAppManager_0200
* @tc.name The form of a callback getRunningProcessInformation
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_AbilityAppManager_0200'
,
0
,
async
function
(
done
)
{
TAG
=
'SUB_AA_AbilityAppManager_0100'
;
appManagerNew
.
getRunningProcessInformation
((
err
,
data
)
=>
{
console
.
log
(
`${TAG} getRunningProcessInformation data ${JSON.stringify(data.length)}
err: ${JSON.stringify(err)}`
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
log
(
`${TAG} getRunningProcessInformation${i} : JSON.stringify(data[i])`
);
expect
(
typeof
(
data
[
i
]
.
pid
))
.
assertEqual
(
"number"
);
expect
(
data
[
i
]
.
pid
)
.
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
]
.
uid
))
.
assertEqual
(
"number"
);
expect
(
data
[
i
]
.
uid
)
.
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
]
.
processName
))
.
assertEqual
(
"string"
);
expect
(
data
[
i
]
.
processName
.
length
)
.
assertLarger
(
0
);
expect
(
Array
.
isArray
(
data
[
i
]
.
bundleNames
))
.
assertEqual
(
true
);
expect
(
data
[
i
]
.
bundleNames
.
length
)
.
assertLarger
(
0
);
}
done
();
})
})
/*
* @tc.number SUB_AA_ApplicationContext_0100
* @tc.name The form of a promise getRunningProcessInformation
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_ApplicationContext_0100'
,
0
,
async
function
(
done
)
{
TAG
=
'SUB_AA_ApplicationContext_0100'
;
await
globalThis
.
applicationContext
.
getRunningProcessInformation
()
.
then
((
data
)
=>
{
console
.
log
(
`${TAG} getRunningProcessInformation data ${JSON.stringify(data.length)}`
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
log
(
`${TAG} getRunningProcessInformation${i} : JSON.stringify(data[i])`
);
expect
(
typeof
(
data
[
i
]
.
pid
))
.
assertEqual
(
"number"
);
expect
(
data
[
i
]
.
pid
)
.
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
]
.
uid
))
.
assertEqual
(
"number"
);
expect
(
data
[
i
]
.
uid
)
.
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
]
.
processName
))
.
assertEqual
(
"string"
);
expect
(
data
[
i
]
.
processName
.
length
)
.
assertLarger
(
0
);
expect
(
Array
.
isArray
(
data
[
i
]
.
bundleNames
))
.
assertEqual
(
true
);
expect
(
data
[
i
]
.
bundleNames
.
length
)
.
assertLarger
(
0
);
}
done
();
})
.
catch
((
err
)
=>
{
console
.
log
(
`${TAG} getRunningProcessInformation err ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
})
})
/*
* @tc.number SUB_AA_ApplicationContext_0200
* @tc.name The form of a callback getRunningProcessInformation
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_ApplicationContext_0200'
,
0
,
async
function
(
done
)
{
TAG
=
'SUB_AA_ApplicationContext_0200'
;
globalThis
.
applicationContext
.
getRunningProcessInformation
((
err
,
data
)
=>
{
console
.
log
(
`${TAG} getRunningProcessInformation data ${JSON.stringify(data.length)}
err: ${JSON.stringify(err)}`
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
console
.
log
(
`${TAG} getRunningProcessInformation${i} : JSON.stringify(data[i])`
);
expect
(
typeof
(
data
[
i
]
.
pid
))
.
assertEqual
(
"number"
);
expect
(
data
[
i
]
.
pid
)
.
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
]
.
uid
))
.
assertEqual
(
"number"
);
expect
(
data
[
i
]
.
uid
)
.
assertLarger
(
0
);
expect
(
typeof
(
data
[
i
]
.
processName
))
.
assertEqual
(
"string"
);
expect
(
data
[
i
]
.
processName
.
length
)
.
assertLarger
(
0
);
expect
(
Array
.
isArray
(
data
[
i
]
.
bundleNames
))
.
assertEqual
(
true
);
expect
(
data
[
i
]
.
bundleNames
.
length
)
.
assertLarger
(
0
);
}
done
();
})
})
})
}
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/WantAgentCover.test.ets
浏览文件 @
ac82c21b
...
...
@@ -14,6 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import wantAgent from '@ohos.app.ability.wantAgent';
import wantConstant from '@ohos.app.ability.wantConstant'
var TAG
export default function wantAgentCoverTest() {
...
...
@@ -60,6 +61,8 @@ export default function wantAgentCoverTest() {
});
setTimeout(() => {
expect(wantConstant.Params.ABILITY_BACK_TO_OTHER_MISSION_STACK)
.assertEqual('ability.params.backToOtherMissionStack');
expect(status).assertTrue();
expect(code1).assertEqual(2);
done()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录