Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
dad6650f
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看板
未验证
提交
dad6650f
编写于
8月 01, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4734 Adapt to the new framework
Merge pull request !4734 from jiyong/local-20220801-0001
上级
f050e16a
5928ecd8
变更
23
显示空白变更内容
内联
并排
Showing
23 changed file
with
450 addition
and
114 deletion
+450
-114
ability/ability_runtime/apicover/apicoverhaptest/Test.json
ability/ability_runtime/apicover/apicoverhaptest/Test.json
+5
-3
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/MainAbility/MainAbility.ts
...overhaptest/entry/src/main/ets/MainAbility/MainAbility.ts
+1
-1
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/MainAbility/pages/MainAbility_pages.ets
...ntry/src/main/ets/MainAbility/pages/MainAbility_pages.ets
+10
-20
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/TestAbility/TestAbility.ts
...overhaptest/entry/src/main/ets/TestAbility/TestAbility.ts
+50
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/TestAbility/pages/index.ets
...verhaptest/entry/src/main/ets/TestAbility/pages/index.ets
+48
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
...rhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
+24
-24
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ContextEnvironmentTest.test.ets
...t/entry/src/main/ets/test/ContextEnvironmentTest.test.ets
+1
-1
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/List.test.ets
...ver/apicoverhaptest/entry/src/main/ets/test/List.test.ets
+4
-4
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/VerificationTest.ets
...coverhaptest/entry/src/main/ets/test/VerificationTest.ets
+12
-12
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/WantAgentCover.test.ets
...erhaptest/entry/src/main/ets/test/WantAgentCover.test.ets
+3
-3
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+1
-1
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/Test.json
...ssmultiinstance/actsamsprocessmultiinstancetest/Test.json
+6
-4
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts
...nstancetest/entry/src/main/ets/MainAbility/MainAbility.ts
+1
-1
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/index/index.ets
...test/entry/src/main/ets/MainAbility/pages/index/index.ets
+10
-20
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/second/second.ets
...st/entry/src/main/ets/MainAbility/pages/second/second.ets
+0
-0
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/TestAbility/TestAbility.ts
...nstancetest/entry/src/main/ets/TestAbility/TestAbility.ts
+50
-0
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/TestAbility/pages/index.ets
...stancetest/entry/src/main/ets/TestAbility/pages/index.ets
+48
-0
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets
...ultiinstancetest/entry/src/main/ets/test/Ability.test.ets
+15
-15
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/List.test.ets
...ssmultiinstancetest/entry/src/main/ets/test/List.test.ets
+2
-2
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/profile/main_pages.json
...est/entry/src/main/resources/base/profile/main_pages.json
+2
-2
barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/TestAbility.ts
...ilityconfig/entry/src/main/ets/TestAbility/TestAbility.ts
+1
-1
未找到文件。
ability/ability_runtime/apicover/apicoverhaptest/Test.json
浏览文件 @
dad6650f
{
{
"description"
:
"Configuration for hjunit demo Tests"
,
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"
OH
JSUnitTest"
,
"test-timeout"
:
"180000"
,
"test-timeout"
:
"180000"
,
"package"
:
"com.example.apicoverhaptest"
,
"bundle-name"
:
"com.example.apicoverhaptest"
,
"shell-timeout"
:
"600000"
"module-name"
:
"phone"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
70000
},
},
"kits"
:
[
"kits"
:
[
{
{
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
dad6650f
...
@@ -30,7 +30,7 @@ export default class MainAbility extends Ability {
...
@@ -30,7 +30,7 @@ export default class MainAbility extends Ability {
// Main window is created, set main page for this ability
// Main window is created, set main page for this ability
console
.
log
(
"
[Demo] MainAbility onWindowStageCreate
"
)
console
.
log
(
"
[Demo] MainAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
;
globalThis
.
abilityContext
=
this
.
context
;
windowStage
.
setUIContent
(
this
.
context
,
"
pages/MainAbility_pages
"
,
null
)
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/
pages/MainAbility_pages
"
,
null
)
}
}
onWindowStageDestroy
()
{
onWindowStageDestroy
()
{
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/pages/MainAbility_pages.ets
→
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/
MainAbility/
pages/MainAbility_pages.ets
浏览文件 @
dad6650f
...
@@ -13,9 +13,10 @@
...
@@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import file from '@system.file';
import router from '@ohos.router';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import list from '../test/ListTest'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../test/List.test'
@Entry
@Entry
@Component
@Component
...
@@ -24,23 +25,12 @@ struct Index {
...
@@ -24,23 +25,12 @@ struct Index {
aboutToAppear() {
aboutToAppear() {
console.info("start run testcase!!!!")
console.info("start run testcase!!!!")
const core = Core.getInstance()
var abilityDelegator: any
const expectExtend = new ExpectExtend({
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
'id': 'extend'
var abilityDelegatorArguments: any
})
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
core.addService('expect', expectExtend)
console.info('start run testcase!!!')
const reportExtend = new ReportExtend(file)
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
core.addService('report', reportExtend)
core.init()
globalThis.abilityWant.parameters.timeout = 20000;
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
configService.setConfig(globalThis.abilityWant.parameters)
console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters))
list(globalThis.abilityContext)
core.execute()
}
}
build() {
build() {
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/TestAbility/TestAbility.ts
0 → 100644
浏览文件 @
dad6650f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
}
onDestroy
()
{
console
.
log
(
'
TestAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
TestAbility onWindowStageCreate
'
)
windowStage
.
loadContent
(
"
TestAbility/pages/index
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
))
});
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
console
.
log
(
'
TestAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
TestAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
TestAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
dad6650f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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/apicover/apicoverhaptest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
dad6650f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s it
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
=
`
${
targetParams
}
${
key
}
${
parameters
[
key
]}
`
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
}
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a com.example.apicoverhaptest.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/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
浏览文件 @
dad6650f
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import formProvider from '@ohos.application.formProvider';
import formProvider from '@ohos.application.formProvider';
import FormInfo from '@ohos.application.formInfo';
import FormInfo from '@ohos.application.formInfo';
...
@@ -24,7 +24,7 @@ var array = new Array();
...
@@ -24,7 +24,7 @@ var array = new Array();
function sleep(time) {
function sleep(time) {
return new Promise((resolve)=>setTimeout(resolve,time));
return new Promise((resolve)=>setTimeout(resolve,time));
}
}
export default function ApiCoverTest(
abilityContext
) {
export default function ApiCoverTest() {
describe('ApiCoverTestTest', function () {
describe('ApiCoverTestTest', function () {
/*
/*
...
@@ -39,7 +39,7 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -39,7 +39,7 @@ export default function ApiCoverTest(abilityContext) {
bundleName: "com.example.extensionapitest",
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension1"
abilityName: "FirstExtension1"
};
};
await abilityContext.startServiceExtensionAbility(want).then((data) => {
await
globalThis.
abilityContext.startServiceExtensionAbility(want).then((data) => {
console.log('Ability: startServiceExtensionAbility success:' + JSON.stringify(data));
console.log('Ability: startServiceExtensionAbility success:' + JSON.stringify(data));
expect("case execute failed").assertEqual(data);
expect("case execute failed").assertEqual(data);
}).catch((error) => {
}).catch((error) => {
...
@@ -61,7 +61,7 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -61,7 +61,7 @@ export default function ApiCoverTest(abilityContext) {
bundleName: "com.example.extensionapitest1",
bundleName: "com.example.extensionapitest1",
abilityName: "FirstExtension"
abilityName: "FirstExtension"
};
};
await abilityContext.stopServiceExtensionAbility(want).then((data) => {
await
globalThis.
abilityContext.stopServiceExtensionAbility(want).then((data) => {
console.log(`Ability: stopServiceExtensionAbility success: ${JSON.stringify(data)}`);
console.log(`Ability: stopServiceExtensionAbility success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
expect("case execute failed").assertEqual(data);
}).catch((error) => {
}).catch((error) => {
...
@@ -83,7 +83,7 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -83,7 +83,7 @@ export default function ApiCoverTest(abilityContext) {
bundleName: "com.example.extensionapitest",
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension"
abilityName: "FirstExtension"
};
};
await abilityContext.startServiceExtensionAbilityWithAccount(want, 999).then((data) => {
await
globalThis.
abilityContext.startServiceExtensionAbilityWithAccount(want, 999).then((data) => {
console.log(`Ability: startServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
console.log(`Ability: startServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual("data");
expect("case execute failed").assertEqual("data");
}).catch((error) => {
}).catch((error) => {
...
@@ -105,7 +105,7 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -105,7 +105,7 @@ export default function ApiCoverTest(abilityContext) {
bundleName: "com.example.extensionapitest",
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension"
abilityName: "FirstExtension"
};
};
await abilityContext.stopServiceExtensionAbilityWithAccount(want, 999).then((data) => {
await
globalThis.
abilityContext.stopServiceExtensionAbilityWithAccount(want, 999).then((data) => {
console.log(`Ability: stopServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
console.log(`Ability: stopServiceExtensionAbilityWithAccount success: ${JSON.stringify(data)}`);
expect("case execute failed").assertEqual(data);
expect("case execute failed").assertEqual(data);
}).catch((error) => {
}).catch((error) => {
...
@@ -127,7 +127,7 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -127,7 +127,7 @@ export default function ApiCoverTest(abilityContext) {
bundleName: "com.example.extensionapitest",
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension1"
abilityName: "FirstExtension1"
}
}
await abilityContext.startServiceExtensionAbility(want, (err, data) => {
await
globalThis.
abilityContext.startServiceExtensionAbility(want, (err, data) => {
if (err.code) {
if (err.code) {
console.error(`Ability: startServiceExtensionAbility failed: ${JSON.stringify(err)}`);
console.error(`Ability: startServiceExtensionAbility failed: ${JSON.stringify(err)}`);
expect(EXTENSION_INFO_ERR).assertEqual(err.code);
expect(EXTENSION_INFO_ERR).assertEqual(err.code);
...
@@ -151,7 +151,7 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -151,7 +151,7 @@ export default function ApiCoverTest(abilityContext) {
bundleName: "com.example.extensionapitest1",
bundleName: "com.example.extensionapitest1",
abilityName: "FirstExtension"
abilityName: "FirstExtension"
};
};
await abilityContext.stopServiceExtensionAbility(want, (err, data) => {
await
globalThis.
abilityContext.stopServiceExtensionAbility(want, (err, data) => {
if (err.code) {
if (err.code) {
console.error(`Ability: stopServiceExtensionAbility failed: ${JSON.stringify(err)}`);
console.error(`Ability: stopServiceExtensionAbility failed: ${JSON.stringify(err)}`);
expect(EXTENSION_INFO_ERR).assertEqual(err.code);
expect(EXTENSION_INFO_ERR).assertEqual(err.code);
...
@@ -176,7 +176,7 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -176,7 +176,7 @@ export default function ApiCoverTest(abilityContext) {
bundleName: "com.example.extensionapitest",
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension"
abilityName: "FirstExtension"
};
};
await abilityContext.startServiceExtensionAbilityWithAccount(want, 999, (err, data) => {
await
globalThis.
abilityContext.startServiceExtensionAbilityWithAccount(want, 999, (err, data) => {
if (err.code) {
if (err.code) {
console.error(`Ability: startServiceExtensionAbilityWithAccount failed: ${JSON.stringify(err)}`);
console.error(`Ability: startServiceExtensionAbilityWithAccount failed: ${JSON.stringify(err)}`);
expect(USERID_ERR).assertEqual(err.code);
expect(USERID_ERR).assertEqual(err.code);
...
@@ -200,7 +200,7 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -200,7 +200,7 @@ export default function ApiCoverTest(abilityContext) {
bundleName: "com.example.extensionapitest",
bundleName: "com.example.extensionapitest",
abilityName: "FirstExtension"
abilityName: "FirstExtension"
};
};
abilityContext.stopServiceExtensionAbilityWithAccount(want, 999, (err, data) => {
globalThis.
abilityContext.stopServiceExtensionAbilityWithAccount(want, 999, (err, data) => {
if (err.code) {
if (err.code) {
console.error(`Ability: stopServiceExtensionAbilityWithAccount failed: ${JSON.stringify(err)}`);
console.error(`Ability: stopServiceExtensionAbilityWithAccount failed: ${JSON.stringify(err)}`);
expect(USERID_ERR).assertEqual(err.code);
expect(USERID_ERR).assertEqual(err.code);
...
@@ -219,17 +219,17 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -219,17 +219,17 @@ export default function ApiCoverTest(abilityContext) {
* @tc.level 3
* @tc.level 3
*/
*/
it('SUB_AA_AMS_Context_0100', 0, async function (done) {
it('SUB_AA_AMS_Context_0100', 0, async function (done) {
expect("/data/storage/el2/base/haps/phone/cache").assertEqual(abilityContext.cacheDir)
expect("/data/storage/el2/base/haps/phone/cache").assertEqual(
globalThis.
abilityContext.cacheDir)
expect("/data/storage/el2/base/haps/phone/temp").assertEqual(abilityContext.tempDir)
expect("/data/storage/el2/base/haps/phone/temp").assertEqual(
globalThis.
abilityContext.tempDir)
expect("/data/storage/el2/base/haps/phone/files").assertEqual(abilityContext.filesDir)
expect("/data/storage/el2/base/haps/phone/files").assertEqual(
globalThis.
abilityContext.filesDir)
expect("/data/storage/el2/database/phone").assertEqual(abilityContext.databaseDir)
expect("/data/storage/el2/database/phone").assertEqual(
globalThis.
abilityContext.databaseDir)
expect("/data/storage/el2/base/haps/phone/preferences").assertEqual(abilityContext.preferencesDir)
expect("/data/storage/el2/base/haps/phone/preferences").assertEqual(
globalThis.
abilityContext.preferencesDir)
expect("/data/storage/el1/bundle").assertEqual(abilityContext.bundleCodeDir)
expect("/data/storage/el1/bundle").assertEqual(
globalThis.
abilityContext.bundleCodeDir)
expect("/data/storage/el2/distributedfiles").assertEqual(abilityContext.distributedFilesDir)
expect("/data/storage/el2/distributedfiles").assertEqual(
globalThis.
abilityContext.distributedFilesDir)
expect(1).assertEqual(abilityContext.area)
expect(1).assertEqual(
globalThis.
abilityContext.area)
let moduleContext = abilityContext.createModuleContext("module1")
let moduleContext =
globalThis.
abilityContext.createModuleContext("module1")
expect("/data/storage/el2/base/cache").assertEqual(moduleContext.cacheDir)
expect("/data/storage/el2/base/cache").assertEqual(moduleContext.cacheDir)
abilityContext.resourceManager.getConfiguration((err, data) => {
globalThis.
abilityContext.resourceManager.getConfiguration((err, data) => {
if(err == undefined){
if(err == undefined){
console.log(`Ability: getConfiguration success: ${JSON.stringify(data)}`);
console.log(`Ability: getConfiguration success: ${JSON.stringify(data)}`);
console.log(`Ability: getConfiguration success: JSON.stringify(data.direction)`);
console.log(`Ability: getConfiguration success: JSON.stringify(data.direction)`);
...
@@ -249,14 +249,14 @@ export default function ApiCoverTest(abilityContext) {
...
@@ -249,14 +249,14 @@ export default function ApiCoverTest(abilityContext) {
* @tc.level 3
* @tc.level 3
*/
*/
it('SUB_AA_AMS_Context_0200', 0, async function (done) {
it('SUB_AA_AMS_Context_0200', 0, async function (done) {
await abilityContext.eventHub.on("contextEvent", func1)
await
globalThis.
abilityContext.eventHub.on("contextEvent", func1)
abilityContext.eventHub.emit("contextEvent", "aa", "bb")
globalThis.
abilityContext.eventHub.emit("contextEvent", "aa", "bb")
await sleep(500)
await sleep(500)
expect("aa").assertEqual(array[0])
expect("aa").assertEqual(array[0])
expect("bb").assertEqual(array[1])
expect("bb").assertEqual(array[1])
array = []
array = []
await abilityContext.eventHub.off("contextEvent", func1)
await
globalThis.
abilityContext.eventHub.off("contextEvent", func1)
abilityContext.eventHub.emit("contextEvent", "cc", "dd")
globalThis.
abilityContext.eventHub.emit("contextEvent", "cc", "dd")
await sleep(500)
await sleep(500)
expect(array.length).assertEqual(0)
expect(array.length).assertEqual(0)
array = [];
array = [];
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ContextEnvironmentTest.test.ets
浏览文件 @
dad6650f
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
var TAG: string = ''
var TAG: string = ''
export default function ContextEnvironmentTest(applicationContext) {
export default function ContextEnvironmentTest(applicationContext) {
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/List
T
est.ets
→
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/List
.t
est.ets
浏览文件 @
dad6650f
...
@@ -18,10 +18,10 @@ import verificationTest from './VerificationTest'
...
@@ -18,10 +18,10 @@ import verificationTest from './VerificationTest'
import wantAgentCover from './WantAgentCover.test'
import wantAgentCover from './WantAgentCover.test'
import contextEnvironmentTest from './ContextEnvironmentTest.test';
import contextEnvironmentTest from './ContextEnvironmentTest.test';
export default function List(
context
) {
export default function List() {
apiCoverAbility(
context
)
apiCoverAbility()
verificationTest(
context
)
verificationTest()
wantAgentCover(
context
)
wantAgentCover()
contextEnvironmentTest(globalThis.applicationContext)
contextEnvironmentTest(globalThis.applicationContext)
}
}
\ No newline at end of file
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/VerificationTest.ets
浏览文件 @
dad6650f
...
@@ -12,14 +12,14 @@
...
@@ -12,14 +12,14 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import commonEvent from '@ohos.commonEvent';
import commonEvent from '@ohos.commonEvent';
import AbilityConstant from "@ohos.application.AbilityConstant";
import AbilityConstant from "@ohos.application.AbilityConstant";
import appManager from "@ohos.application.appManager";
import appManager from "@ohos.application.appManager";
import wantConstant from '@ohos.ability.wantConstant';
import wantConstant from '@ohos.ability.wantConstant';
var TAG
var TAG
export default function verificationTest(
abilityContext
){
export default function verificationTest(){
describe('VerificationTestTest', function() {
describe('VerificationTestTest', function() {
...
@@ -62,7 +62,7 @@ export default function verificationTest(abilityContext){
...
@@ -62,7 +62,7 @@ export default function verificationTest(abilityContext){
bundleName: 'ohos.acts.aafwk.test.fasupplement',
bundleName: 'ohos.acts.aafwk.test.fasupplement',
abilityName: 'ohos.acts.aafwk.test.fasupplement.MainAbility'
abilityName: 'ohos.acts.aafwk.test.fasupplement.MainAbility'
}
}
abilityContext.startAbility(wantNum).then((data) => {
globalThis.
abilityContext.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
console.info(TAG + "startAbility err = " + JSON.stringify(err));
...
@@ -125,7 +125,7 @@ export default function verificationTest(abilityContext){
...
@@ -125,7 +125,7 @@ export default function verificationTest(abilityContext){
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
abilityName: 'MainAbility3'
abilityName: 'MainAbility3'
}
}
abilityContext.startAbility(wantNum).then((data) => {
globalThis.
abilityContext.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
console.info(TAG + "startAbility err = " + JSON.stringify(err));
...
@@ -202,7 +202,7 @@ export default function verificationTest(abilityContext){
...
@@ -202,7 +202,7 @@ export default function verificationTest(abilityContext){
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
abilityName: 'MainAbility4'
abilityName: 'MainAbility4'
}
}
abilityContext.startAbility(wantNum).then((data) => {
globalThis.
abilityContext.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
console.info(TAG + "startAbility err = " + JSON.stringify(err));
...
@@ -258,7 +258,7 @@ export default function verificationTest(abilityContext){
...
@@ -258,7 +258,7 @@ export default function verificationTest(abilityContext){
bundleName: 'ohos.acts.aafwk.test.fasupplement',
bundleName: 'ohos.acts.aafwk.test.fasupplement',
abilityName: 'ohos.acts.aafwk.test.fasupplement.MainAbility2'
abilityName: 'ohos.acts.aafwk.test.fasupplement.MainAbility2'
}
}
abilityContext.startAbility(wantNum).then((data) => {
globalThis.
abilityContext.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
console.info(TAG + "startAbility err = " + JSON.stringify(err));
...
@@ -285,14 +285,14 @@ export default function verificationTest(abilityContext){
...
@@ -285,14 +285,14 @@ export default function verificationTest(abilityContext){
let label = undefined
let label = undefined
let code1 = 0
let code1 = 0
let code2 = 0
let code2 = 0
abilityContext.setMissionLabel(label).then((data) => {
globalThis.
abilityContext.setMissionLabel(label).then((data) => {
console.info(TAG + "setMissionLabel data = " + JSON.stringify(data));
console.info(TAG + "setMissionLabel data = " + JSON.stringify(data));
}).catch((err) => {
}).catch((err) => {
code1 = err.code
code1 = err.code
console.info(TAG + "setMissionLabel err = " + JSON.stringify(err));
console.info(TAG + "setMissionLabel err = " + JSON.stringify(err));
});
});
abilityContext.setMissionLabel(label, (err, data) => {
globalThis.
abilityContext.setMissionLabel(label, (err, data) => {
code2 = err.code
code2 = err.code
console.info(TAG + "setMissionLabel err = " + JSON.stringify(err));
console.info(TAG + "setMissionLabel err = " + JSON.stringify(err));
console.info(TAG + "setMissionLabel data = " + JSON.stringify(data));
console.info(TAG + "setMissionLabel data = " + JSON.stringify(data));
...
@@ -352,7 +352,7 @@ export default function verificationTest(abilityContext){
...
@@ -352,7 +352,7 @@ export default function verificationTest(abilityContext){
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
abilityName: 'MainAbility5'
abilityName: 'MainAbility5'
}
}
abilityContext.startAbility(wantNum).then((data) => {
globalThis.
abilityContext.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
console.info(TAG + "startAbility err = " + JSON.stringify(err));
...
@@ -415,8 +415,8 @@ export default function verificationTest(abilityContext){
...
@@ -415,8 +415,8 @@ export default function verificationTest(abilityContext){
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
abilityName: 'MainAbility9'
abilityName: 'MainAbility9'
}
}
abilityContext.startAbility(wantNum).then((data) => {
globalThis.
abilityContext.startAbility(wantNum).then((data) => {
value = abilityContext.restoreWindowStage(undefined);
value =
globalThis.
abilityContext.restoreWindowStage(undefined);
console.info(TAG + "startAbility data = " + JSON.stringify(data) + ";" + JSON.stringify(data));
console.info(TAG + "startAbility data = " + JSON.stringify(data) + ";" + JSON.stringify(data));
}).catch((err) => {
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
console.info(TAG + "startAbility err = " + JSON.stringify(err));
...
@@ -475,7 +475,7 @@ export default function verificationTest(abilityContext){
...
@@ -475,7 +475,7 @@ export default function verificationTest(abilityContext){
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
bundleName: 'ohos.acts.aafwk.test.stagesupplement',
abilityName: 'MainAbility10'
abilityName: 'MainAbility10'
}
}
abilityContext.startAbility(wantNum).then((data) => {
globalThis.
abilityContext.startAbility(wantNum).then((data) => {
console.info(TAG + "startAbility data = " + JSON.stringify(data));
console.info(TAG + "startAbility data = " + JSON.stringify(data));
}).catch((err) => {
}).catch((err) => {
console.info(TAG + "startAbility err = " + JSON.stringify(err));
console.info(TAG + "startAbility err = " + JSON.stringify(err));
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/WantAgentCover.test.ets
浏览文件 @
dad6650f
...
@@ -12,11 +12,11 @@
...
@@ -12,11 +12,11 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import {
describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import wantAgent from '@ohos.wantAgent';
import wantAgent from '@ohos.wantAgent';
var TAG
var TAG
export default function wantAgentCoverTest(
abilityContext
) {
export default function wantAgentCoverTest() {
describe('WantAgentTest', function () {
describe('WantAgentTest', function () {
/*
/*
...
@@ -29,7 +29,7 @@ export default function wantAgentCoverTest(abilityContext) {
...
@@ -29,7 +29,7 @@ export default function wantAgentCoverTest(abilityContext) {
TAG = 'SUB_AA_OpenHarmony_WantAgentCover_0100 ==>';
TAG = 'SUB_AA_OpenHarmony_WantAgentCover_0100 ==>';
try {
try {
let status:any = abilityContext.stageMode
let status:any =
globalThis.
abilityContext.stageMode
let code1 = undefined
let code1 = undefined
var wantAgentInfo = {
var wantAgentInfo = {
wants: [
wants: [
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
dad6650f
{
{
"src"
:
[
"src"
:
[
"pages/MainAbility_pages"
"
MainAbility/
pages/MainAbility_pages"
]
]
}
}
\ No newline at end of file
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/Test.json
浏览文件 @
dad6650f
{
{
"description"
:
"Configuration for hjunit demo Tests"
,
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"120000"
,
"test-timeout"
:
"180000"
,
"package"
:
"com.example.processmultiinstance"
,
"bundle-name"
:
"com.example.processmultiinstance"
,
"shell-timeout"
:
"300000"
"module-name"
:
"phone"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
70000
},
},
"kits"
:
[
"kits"
:
[
{
{
...
...
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
dad6650f
...
@@ -30,7 +30,7 @@ export default class MainAbility extends Ability {
...
@@ -30,7 +30,7 @@ export default class MainAbility extends Ability {
// Main window is created, set main page for this ability
// Main window is created, set main page for this ability
console
.
log
(
"
MainAbility onWindowStageCreate
"
)
console
.
log
(
"
MainAbility onWindowStageCreate
"
)
globalThis
.
abilityContext
=
this
.
context
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
)
windowStage
.
setUIContent
(
this
.
context
,
"
MainAbility/
pages/index/index
"
,
null
)
}
}
onWindowStageDestroy
()
{
onWindowStageDestroy
()
{
...
...
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/index/index.ets
→
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/
MainAbility/
pages/index/index.ets
浏览文件 @
dad6650f
...
@@ -12,10 +12,10 @@
...
@@ -12,10 +12,10 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import
file from '@system.file
';
import
router from '@ohos.router
';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import {
Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import {
Hypium } from '@ohos/hypium'
import testsuite from
"../../test/List.test.ets"
import testsuite from
'../../../test/List.test'
@Entry
@Entry
...
@@ -24,22 +24,12 @@ struct Index {
...
@@ -24,22 +24,12 @@ struct Index {
aboutToAppear(){
aboutToAppear(){
console.info("start run testcase!!!!")
console.info("start run testcase!!!!")
const core = Core.getInstance()
var abilityDelegator: any
const expectExtend = new ExpectExtend({
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
'id': 'extend'
var abilityDelegatorArguments: any
})
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
core.addService('expect', expectExtend)
console.info('start run testcase!!!')
const reportExtend = new ReportExtend(file)
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
core.addService('report', reportExtend)
core.init()
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters))
globalThis.abilityWant.parameters.timeout = 70000;
configService.setConfig(globalThis.abilityWant.parameters)
testsuite(globalThis.abilityContext)
core.execute()
}
}
build() {
build() {
...
...
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/pages/second/second.ets
→
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/
MainAbility/
pages/second/second.ets
浏览文件 @
dad6650f
文件已移动
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/TestAbility/TestAbility.ts
0 → 100644
浏览文件 @
dad6650f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
Ability
from
'
@ohos.application.Ability
'
export
default
class
TestAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
'
TestAbility onCreate
'
)
}
onDestroy
()
{
console
.
log
(
'
TestAbility onDestroy
'
)
}
onWindowStageCreate
(
windowStage
)
{
console
.
log
(
'
TestAbility onWindowStageCreate
'
)
windowStage
.
loadContent
(
"
TestAbility/pages/index
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
Succeeded in loading the content. Data:
'
+
JSON
.
stringify
(
data
))
});
globalThis
.
abilityContext
=
this
.
context
;
}
onWindowStageDestroy
()
{
console
.
log
(
'
TestAbility onWindowStageDestroy
'
)
}
onForeground
()
{
console
.
log
(
'
TestAbility onForeground
'
)
}
onBackground
()
{
console
.
log
(
'
TestAbility onBackground
'
)
}
};
\ No newline at end of file
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
dad6650f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
dad6650f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s it
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
=
`
${
targetParams
}
${
key
}
${
parameters
[
key
]}
`
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
}
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a com.example.processmultiinstance.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/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
dad6650f
...
@@ -35,7 +35,7 @@ var processNameA = "com.example.multiinstancehapa";
...
@@ -35,7 +35,7 @@ var processNameA = "com.example.multiinstancehapa";
var
processNameB
=
"com.example.multiinstancehapb"
;
var
processNameB
=
"com.example.multiinstancehapb"
;
var
processNameC
=
"com.example.multiinstancehapc"
;
var
processNameC
=
"com.example.multiinstancehapc"
;
export
default
function
abilityTest
(
abilityContext
)
{
export
default
function
abilityTest
()
{
describe
(
'ActsProcessMultiInstanceTest'
,
function
()
{
describe
(
'ActsProcessMultiInstanceTest'
,
function
()
{
afterEach
(
async
(
done
)
=>
{
afterEach
(
async
(
done
)
=>
{
...
@@ -138,14 +138,14 @@ export default function abilityTest(abilityContext) {
...
@@ -138,14 +138,14 @@ export default function abilityTest(abilityContext) {
done
();
done
();
}
}
}
}
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapba.MainAbility"
,
abilityName
:
"com.example.multiinstancehapba.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
console
.
log
(
'ACTS_Process_MultiInstance_0100 - startAbilityhapba: '
console
.
log
(
'ACTS_Process_MultiInstance_0100 - startAbilityhapba: '
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
})
})
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapbb.MainAbility"
,
abilityName
:
"com.example.multiinstancehapbb.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
...
@@ -247,14 +247,14 @@ export default function abilityTest(abilityContext) {
...
@@ -247,14 +247,14 @@ export default function abilityTest(abilityContext) {
done
();
done
();
}
}
}
}
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapbc.MainAbility"
,
abilityName
:
"com.example.multiinstancehapbc.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
console
.
log
(
'ACTS_Process_MultiInstance_0200 - startAbilityhapbc: '
console
.
log
(
'ACTS_Process_MultiInstance_0200 - startAbilityhapbc: '
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
})
})
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapbd.MainAbility"
,
abilityName
:
"com.example.multiinstancehapbd.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
...
@@ -361,14 +361,14 @@ export default function abilityTest(abilityContext) {
...
@@ -361,14 +361,14 @@ export default function abilityTest(abilityContext) {
done
();
done
();
}
}
}
}
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapbd.MainAbility"
,
abilityName
:
"com.example.multiinstancehapbd.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
console
.
log
(
'ACTS_Process_MultiInstance_0300 - startAbilityhapbd: '
console
.
log
(
'ACTS_Process_MultiInstance_0300 - startAbilityhapbd: '
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
})
})
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapbe.MainAbility"
,
abilityName
:
"com.example.multiinstancehapbe.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
...
@@ -472,14 +472,14 @@ export default function abilityTest(abilityContext) {
...
@@ -472,14 +472,14 @@ export default function abilityTest(abilityContext) {
done
();
done
();
}
}
}
}
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapba.MainAbility"
,
abilityName
:
"com.example.multiinstancehapba.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
console
.
log
(
'ACTS_Process_MultiInstance_0400 - startAbilityhapba: '
console
.
log
(
'ACTS_Process_MultiInstance_0400 - startAbilityhapba: '
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
})
})
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapbf.MainAbility"
,
abilityName
:
"com.example.multiinstancehapbf.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
...
@@ -583,14 +583,14 @@ export default function abilityTest(abilityContext) {
...
@@ -583,14 +583,14 @@ export default function abilityTest(abilityContext) {
done
();
done
();
}
}
}
}
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapa"
,
bundleName
:
"com.example.multiinstancehapa"
,
abilityName
:
"com.example.multiinstancehapaa.MainAbility"
,
abilityName
:
"com.example.multiinstancehapaa.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
console
.
log
(
'ACTS_Process_MultiInstance_0500 - startAbilityhapaa: '
console
.
log
(
'ACTS_Process_MultiInstance_0500 - startAbilityhapaa: '
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
})
})
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapbe.MainAbility"
,
abilityName
:
"com.example.multiinstancehapbe.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
...
@@ -697,14 +697,14 @@ export default function abilityTest(abilityContext) {
...
@@ -697,14 +697,14 @@ export default function abilityTest(abilityContext) {
done
();
done
();
}
}
}
}
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapa"
,
bundleName
:
"com.example.multiinstancehapa"
,
abilityName
:
"com.example.multiinstancehapaa.MainAbility"
,
abilityName
:
"com.example.multiinstancehapaa.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
console
.
log
(
'ACTS_Process_MultiInstance_0600 - startAbilityhapaa: '
console
.
log
(
'ACTS_Process_MultiInstance_0600 - startAbilityhapaa: '
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
})
})
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapbf.MainAbility"
,
abilityName
:
"com.example.multiinstancehapbf.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
...
@@ -810,14 +810,14 @@ export default function abilityTest(abilityContext) {
...
@@ -810,14 +810,14 @@ export default function abilityTest(abilityContext) {
done
();
done
();
}
}
}
}
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapa"
,
bundleName
:
"com.example.multiinstancehapa"
,
abilityName
:
"com.example.multiinstancehapab.MainAbility"
,
abilityName
:
"com.example.multiinstancehapab.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
console
.
log
(
'ACTS_Process_MultiInstance_0700 - startAbilityhapab: '
console
.
log
(
'ACTS_Process_MultiInstance_0700 - startAbilityhapab: '
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
+
JSON
.
stringify
(
err
)
+
", "
+
JSON
.
stringify
(
data
))
})
})
abilityContext
.
startAbility
({
globalThis
.
abilityContext
.
startAbility
({
bundleName
:
"com.example.multiinstancehapb"
,
bundleName
:
"com.example.multiinstancehapb"
,
abilityName
:
"com.example.multiinstancehapbc.MainAbility"
,
abilityName
:
"com.example.multiinstancehapbc.MainAbility"
,
},
(
err
,
data
)
=>
{
},
(
err
,
data
)
=>
{
...
...
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/List.test.ets
浏览文件 @
dad6650f
...
@@ -15,8 +15,8 @@
...
@@ -15,8 +15,8 @@
import abilityTest from './Ability.test.ets'
import abilityTest from './Ability.test.ets'
export default function testsuite(
context
) {
export default function testsuite() {
abilityTest(
context
)
abilityTest()
}
}
\ No newline at end of file
ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
dad6650f
{
{
"src"
:
[
"src"
:
[
"pages/index/index"
,
"
MainAbility/
pages/index/index"
,
"pages/second/second"
"
MainAbility/
pages/second/second"
]
]
}
}
\ No newline at end of file
barrierfree/accessibilityconfig/entry/src/main/ets/TestAbility/TestAbility.ts
浏览文件 @
dad6650f
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*/
*/
import
Ability
from
'
@ohos.application.Ability
'
import
Ability
from
'
@ohos.application.Ability
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
hypium/index
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
import
testsuite
from
'
../test/List.test
'
export
default
class
TestAbility
extends
Ability
{
export
default
class
TestAbility
extends
Ability
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录